81trust / 100

Base Quote

by base-quote in Onchain & crypto

x402 APIPassing, checked 3 h ago

Slippage estimate, swap quote, and best DEX price on Base - compares Uniswap v2, Uniswap v3, and Aerodrome on-chain via Multicall3, returns amount received, chosen path, and price impact.

POST https://x402.agentindex.world/base/quote

Last 30 days

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

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://x402.agentindex.world/base/quote" \
  -H "content-type: application/json" \
  -d '{"amount_in":1000000,"token_in":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","token_out":"0x4200000000000000000000000000000000000006"}'
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.03:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fx402.agentindex.world%2Fbase%2Fquote
const res = await pay("https://x402.agentindex.world/base/quote", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"amount_in":1000000,"token_in":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","token_out":"0x4200000000000000000000000000000000000006"}),
});
console.log(await res.json());

Example input

{
  "amount_in": 1000000,
  "token_in": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "token_out": "0x4200000000000000000000000000000000000006"
}

Example output

{
  "aerodrome": {
    "amount_out": 0.000368869375130808,
    "amount_out_raw": "368869375130808",
    "available": true,
    "detail": "volatile pool"
  },
  "amount_in": "1000000",
  "best_amount_out": 0.000370394821572273,
  "best_amount_out_raw": "370394821572273",
  "best_dex": "uniswap_v3",
  "decimals_in": 6,
  "decimals_out": 18,
  "price_impact_pct": 0.01,
  "token_in": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "token_out": "0x4200000000000000000000000000000000000006",
  "uniswap_v2": {
    "amount_out": 0.000369235162467701,
    "amount_out_raw": "369235162467701",
    "available": true,
    "detail": null
  },
  "uniswap_v3": {
    "amount_out": 0.000370394821572273,
    "amount_out_raw": "370394821572273",
    "available": true,
    "detail": "0.05% fee tier"
  }
}

Security scan

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

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed402133 ms$0.003