tradeSwapTx
The free Permit2 second round: finishes a POST /trade/v1/swap call whose signatures asked the taker to sign a Permit2 PermitSingle.
Cost: free, never x402-gated - a payment header, if one is sent anyway, is ignored and nobody is charged. Only reachable once, right after the paid call that opened it.
Key inputs: the SAME
quoteId,takerandrecipient(defaults totaker) as the paid POST /trade/v1/swap call, plusdeadlineSecand the requiredpermit: { message: signatures[0].typedData.message, signature }(signtypedDatawith the taker's key, EIP-712, e.g. viem'ssignTypedData).permitaccepts onlymessageandsignature, end to end - any other field, at any level, is 400invalid_requestat parse. The service rebuilds the Permit2 domain itself and checks the signer, spender, token, amount, nonce and both deadlines: a mismatched spender or token, or an amount belowamountIn(a larger amount is accepted), is 400invalid_request; a stale nonce, an expiredsigDeadline/expiration, or an invalid signature (verified via ERC-1271 on chain for a contract taker) is 422swap_reverts. A contract taker can swap, but POST /trade/v1/receipt only reads transactions the taker sends itself, so it answersinvalid_requestfor a Safe, ERC-4337 or batching EIP-7702 wallet: check your own transaction receipt instead.No pending round: 409
no_pending_swapwhen thisquoteId/taker/recipientnever paid, named a different taker or recipient, or already used its one free call - call POST /trade/v1/swap first, which is paid and returns the permit this call takes.Freshness: re-quotes and re-simulates exactly like POST /trade/v1/swap, and can answer the SAME 410
quote_expired/409quote_staleit would - but never with a freshquote(issue #124's free re-quote is /trade/v1/swap's own paid-quote courtesy, not this free route's).Attempts: a permit round (
quoteId,taker,recipient) gets at most 5 failed calls; the next one is 429swap_attempts_exhausted(next: "requote"), answered without running the swap pipeline. A failed call is a 400 from the permit checks above, a 409, 422, 500 or 503, or an undelivered 200; a delivered 200, a 400 at parse, a 404, a 410 orno_pending_swapuses none. Failed POST /trade/v1/swap calls don't count here. A new POST /trade/v1/swap permit response resets this round's attempts only once delivered (after settlement when paid).Next: sign and send
transactionsin order, then confirm the fill with POST /trade/v1/receipt (free). This is the last call in search -> quote -> swap -> swap/tx.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| taker | Yes | ||
| permit | Yes | ||
| quoteId | Yes | ||
| recipient | No | ||
| deadlineSec | No |