tradeSwapTx
Finishes a tradeSwap call that asked for a Permit2 signature: it takes the signed permit and returns the transactions ready to send.
Cost: free.
tradeSwapalready paid for this round, and it can be used once.Inputs: the same
quoteId,takerandrecipientas thetradeSwapcall,deadlineSec, and the requiredpermit:messagefromsignatures[0].typedDataand yoursignatureover it. Call it while the quote is live.Returns: the swap with the permit embedded, as
transactionsto send in order. Read what you sign.nextissend.Errors:
400
invalid_request:permithas an extra field, or its spender, token or amount does not match. Fix the request.409
no_pending_swap: no open round for thisquoteId,takerandrecipient. It was never paid, named another wallet, or was already used. CalltradeSwapfirst.409
quote_staleor 410quote_expired: the price moved or the quote ran out. There is no fresh quote here: calltradeQuote.422
swap_reverts: the nonce is stale, a deadline passed or the signature is invalid. Stop.429
swap_attempts_exhausted: this permit round has used its 5 failed calls. Quote again.
Next:
tradeReceipt: confirm the fill once you have sent the transactions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| taker | Yes | The wallet that signs and sends the transactions. It holds the input token. | |
| permit | Yes | The `PermitSingle` from `signatures[0].typedData` (`message`) and the taker's EIP-712 signature over it (`signature`). Only those two fields are accepted. arcgate rebuilds the Permit2 domain itself and checks the signer, spender, token, amount, nonce and both deadlines. | |
| quoteId | Yes | The quoteId from tradeQuote. A quote lives for its `ttlSec`, at most 120 seconds. | |
| recipient | No | The address that receives the output. Defaults to `taker`. | |
| deadlineSec | No | Seconds from now until the swap transaction expires on chain, 10-600 (default 60). |