81trust / 100

Dex Quote

by Uniswap V3 spot quote in Onchain & crypto

x402 APIPassing, checked 5 h ago

Spot quote for swapping through a Uniswap V3 pool at the current tick. amountIn is in human units (not wei). zeroForOne=true sends token0 → token1; false sends token1 → token0. Returns amountOut net of the pool's fee tier. NOTE: this is a single-tick spot quote - slippage from depleting concentrated liquidity is NOT modeled. Use for indicative pricing; for production swaps quote against the Uniswap SDK.

POST https://agent402.tools/api/dex-quote

Last 30 days

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

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/dex-quote" \
  -H "content-type: application/json" \
  -d '{"amountIn":1,"network":"base","poolAddress":"0xd0b53d9277642d899df5c87a3966a349a798f224","zeroForOne":true}'
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%2Fagent402.tools%2Fapi%2Fdex-quote
const res = await pay("https://agent402.tools/api/dex-quote", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"amountIn":1,"network":"base","poolAddress":"0xd0b53d9277642d899df5c87a3966a349a798f224","zeroForOne":true}),
});
console.log(await res.json());

Example input

{
  "amountIn": 1,
  "network": "base",
  "poolAddress": "0xd0b53d9277642d899df5c87a3966a349a798f224",
  "zeroForOne": true
}

Example output

{
  "amountIn": 1,
  "amountOut": 3498.3,
  "fee": 500,
  "network": "base",
  "note": "spot quote at current tick - no multi-tick swap simulation",
  "poolAddress": "0xd0b53d9277642d899df5c87a3966a349a798f224",
  "spotPrice_1per0": 3500.05,
  "zeroForOne": true
}

Security scan

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

Recent checks

WhenResultHTTPTimePrice
5 h agoPassed402187 ms$0.002