Skip to main content

Executing Swaps

Swap methods return transaction data that you send via your wallet or web3 library. No transaction is broadcast by the SDK — it only builds the calldata.

swap

Builds transaction data for a route that was previously calculated with quoteBest or selected from quoteAll.

Request parameters

Extends all quote parameters, plus:

Example

Response: SwapResponseInterface


swapBest

Combines quoteBest + swap into a single API call. Use when you don’t need to show the user a quote preview.
Same parameters as swap, but without id — the API finds the best route internally.

Example


swapDepositTrade

Returns a deposit address instead of calldata. The user manually sends funds to that address — no wallet signing of a smart contract call required. Used with deposit-based providers (ChangeNOW, Exolix, SimpleSwap, etc.).
fromAddress is optional. receiver is required — it’s the destination address where tokens will arrive.

Example


Token approvals

ERC-20 swaps may require a token approval before the swap transaction. Use checkApprove to determine whether approval is needed, then send the approval transaction first.

Full example with approval check