Setup
- EVM
- Solana
A same-chain swap on Arbitrum: 100 USDC → WETH.
Steps
- EVM
- Solana
1
Quote
Ask for the best route. The response is keyed by pair: read
recommendedSource, then pull that route out of quoteRates.Provider allow/deny lists,
filter, and quote-timing knobs are optional. See advanced quote fields.2
Approve
Give the router an allowance for the source token.
AutoPermit picks EIP-2612 or Permit2 automatically, so most tokens need no on-chain approval at all.Permit2 vs EIP-2612 vs plain approvals, and gasless permit signing, are in Check allowance and Approval mechanisms.
3
Build & send
trade() builds the transaction from the request, then signs and sends it in one call.trade() builds and sends in one call. Call buildTradeTxn first only to preview the transaction or reuse it via txnData. Full field list, gasless variant, and the TRY_ANOTHER_ROUTE retry are in Execute trade.4
Status
Confirm settlement.
chainId is a number, and the terminal states are uppercase.Same-chain swaps settle in one block. For the full response shape and multi-tx polling, see Track trade status.
End-to-end
- EVM
- Solana
API usage
The same flow over REST. Non-EVM chains build a chain-specific transaction you sign locally, then submit via Broadcast.- EVM
- Solana
What can go wrong
- No route returned, the pair is thin or unsupported. Try a different amount or token, or widen
slippage. - Approval fails, make sure the wallet holds gas (ETH on Arbitrum).
TRY_ANOTHER_ROUTEon the trade response, retry withpair.bestReturnSource. See Execute trade.