zerox-swap
0x swap
Return a quote comparison or an exact unsigned 0x swap plan. Choose an allowance flow deliberately; do not treat the transaction target as the token spender.
Read the exact swap
Collect chain ID, sell/buy token addresses and decimals, raw sell amount, public taker, recipient and the user's slippage/cost limit. Use the API v2 AllowanceHolder price and quote endpoints in reads. Existing API credentials stay in private environment settings. API access and paid CLI requests are different spending choices; do not enable a payment gateway merely to make a diagnostic pass.
Use /price for exploration. A firm /quote requires the correct taker and fresh balance/allowance state. Inspect liquidity availability, issues.balance, issues.allowance, simulationIncomplete, route, fee fields, expected buyAmount and minBuyAmount. Missing liquidity, unsupported token behavior or incomplete simulation is a concrete gap, not a successful quote.
Bind allowance and transaction
For AllowanceHolder resolve the returned allowance spender against current official deployment records. For Permit2 inspect typed data, amount, nonce, spender, domain and deadline independently. Never approve Settler. Verify transaction.to, data, native value and chain against the quoted intent. In the AllowanceHolder flow the spender and transaction.to are both AllowanceHolder; in the Permit2 flow the spender is Permit2 and transaction.to is Settler.
Return finite allowance needs and an unsigned handoff with exact minimum output, costs, recipient and quote age. After any changed amount, token, chain or approval state, refresh the quote; signatures and calldata are bound to the reviewed terms. Do not inject affiliate fees or a surplus recipient.
Resolve the result
A quote, successful simulation or send response is not a fill. For a submitted swap inspect the original receipt and sell/buy token deltas at the correct recipient, including actual native gas. On timeout retain the original hash and inspect it before any retry. On 401/403 report missing access; on rate limits respect retry-after rather than changing auth or payment scope.