80trust / 100

Base Swap Quote

by AllTheBot Base swap quote in Onchain & crypto

x402 APIPassing, checked 1 h ago

Swap quote and best DEX price on Base: live quotes from Uniswap v3 (all fee tiers) and Aerodrome (stable/volatile) for any ERC-20 pair, ranked best first, with a low-liquidity flag. ETH, USDC, cbBTC, DAI or any token address. Read-only, no swap executed.

GET https://api.zkrobotics.fr/x402/base/swap-quote

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
65 ms typical, 172 ms slowest 5%
Last check
1 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X GET "https://api.zkrobotics.fr/x402/base/swap-quote?amount_in=1&token_in=ETH&token_out=USDC"
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.zkrobotics.fr%2Fx402%2Fbase%2Fswap-quote
const res = await pay("https://api.zkrobotics.fr/x402/base/swap-quote?amount_in=1&token_in=ETH&token_out=USDC");
console.log(await res.json());

Example input

{
  "amount_in": "1",
  "token_in": "ETH",
  "token_out": "USDC"
}

Example output

{
  "amount_in": "1",
  "best": {
    "amount_out": "2528.473174",
    "amount_out_raw": "2528473174",
    "low_liquidity": false,
    "pool_fee_pct": 0.05,
    "venue": "Uniswap v3"
  },
  "network": "base",
  "quotes": [
    {
      "amount_out": "2528.473174",
      "amount_out_raw": "2528473174",
      "low_liquidity": false,
      "pool_fee_pct": 0.05,
      "venue": "Uniswap v3"
    },
    {
      "amount_out": "2526.948041",
      "amount_out_raw": "2526948041",
      "low_liquidity": false,
      "pool": "volatile",
      "venue": "Aerodrome"
    }
  ],
  "token_in": "0x4200000000000000000000000000000000000006",
  "token_out": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
1 h agoPassed402176 ms$0.0025
5 h agoPassed40257 ms$0.0025
8 h agoPassed402172 ms$0.0025
13 h agoPassed40265 ms$0.0025