tradeQuote
Prices a swap between sell and buy across the indexed venues and stores it under a quoteId.
Cost: 0.01 USDC per call over x402: the first call gets a 402 with payment requirements in the
PAYMENT-REQUIREDheader (base64 JSON); sign them and retry with aPAYMENT-SIGNATUREheader carrying the payment payload.sell/buy: two different assets (native and ERC-20 USDC count as the same asset; either side may be USDC). Resolve a ticker with POST /trade/v1/search first.Response shape: when one side is USDC,
best.typeisdirect/two_hop/splitandbest.legslists one leg per path actually used;routes[]lists every discovery candidate. When neither side is USDC, or when a USDC-side allocation can't be expressed as legs,best.typeisgraph,best.legsis empty, and the execution plan is inbest.graph. Both shapes supportside: exactInandexactOut, and both execute the same way through POST /trade/v1/swap.amount: a human-readable decimal string in the token's own units, e.g. "1.5" for 1.5 USDC, not base units. It is thesellamount forside: exactInand thebuyamount forside: exactOut.Optional:
side(exactIn/exactOut),slippageBps, split and hop limits,venues/excludeVenues(ids from GET /trade/v1/venues),taker,ttlSec.Executability: POST /trade/v1/swap executes every quote through ArcgateRouter.
best.executableisfalse, with warninggraph_execution_unavailable, when no ArcgateRouter is configured (or, for an Aerodrome edge, no Aerodrome router), or when the operator has disabled a selected path's venue - even with both routers configured. In that last case, POST /trade/v1/swap may still fall back to an executable candidate the quote already priced instead of failing outright.Readiness: name the wallet that will trade in
takerand the answer carriesreadiness, read at the quote's block: whether that wallet holds the input (balance), which approval or Permit2 signature POST /trade/v1/swap will need (approvalfor the default permit2,approveforapproval: "approve"), enough native USDC for gas (gas), and whether this call's x402 payer can pay the swap fee (fees).totalCostUsdcis the swap fee plus gas: what finishing costs. Whenreadyis false,nextisstop. Withouttakerthere is noreadiness.Lifetime: the
quoteIdis good forttlSecseconds (default and max 120).Next: POST /trade/v1/swap with the returned
quoteId. Costs 10000 base units (0.01 USDC) per call. Payment goes in params._meta["x402/payment"]; use an x402-aware MCP client (see https://docs.arcgate.dev/#arcgate/description/mcp-for-agents).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buy | Yes | ||
| sell | Yes | ||
| side | No | exactIn | |
| taker | No | ||
| amount | Yes | ||
| ttlSec | No | How long the stored quote (and this response's expiresAt) stays live, in seconds (1-120, default 120). A caller may shorten it to re-quote sooner; it can never lengthen past 120s. Safe to shorten or leave at default: POST /trade/v1/swap always re-quotes and re-simulates at the current block and 409s quote_stale below the stored minAmountOut, so this bounds staleness risk, not price risk. The on-chain execution deadline is a separate parameter (deadlineSec, POST /trade/v1/swap). | |
| venues | No | ||
| maxHops | No | ||
| sources | No | ||
| maxSplits | No | ||
| allowSplits | No | ||
| slippageBps | No | ||
| excludeVenues | No |