Skip to main content

Get quote for a swap

Get a quote to swap between Native Coin - ERC20 - Avax ERC20

Query Parameters
sellAsset string REQUIRED

Asset to sell. (e.g. ETH.UNI-0x1f9840a85d5af5bf1d1762f925bdaddc4201f984)

buyAsset string REQUIRED

Asset to buy. (e.g. BTC.BTC)

sellAmount number REQUIRED

Amount of sellAsset to sell in assetAmount. (e.g. 100 for 100 UNI)

slippage number

Slippage tolerance as a percentage. (e.g. 3 means 3% max slippage)

limit number

The maximum number of trades routes to return. (e.g. 5)

senderAddress string

The senderAddress to be used to build calldata. (e.g. 0x2A1Af1d52641b9B595dbafFe36452d325E6cA103)

recipientAddress string

The recipientAddress may be used to build the tcMemo. If you don't provide a recipientAddress, your calldata may be invalid and you may need to replace {recipientAddress} in the memo field. (e.g. 0x2A1Af1d52641b9B595dbafFe36452d325E6cA103)

providers string[]

Possible values: [THORCHAIN, UNISWAPV2, UNISWAPV3, THORCHAIN, ZEROX, ONEINCH, SUSHISWAP]

Restrict liquidity sources. THORCHAIN provider must be set for cross-chain quotes

subProviders string[]

Restrict sources of the providers.

preferredProvider string

Possible values: [UNISWAPV2, UNISWAPV3, THORCHAIN, ZEROX, ONEINCH, SUSHISWAP]

Optionally specify the provider the swap should use.

affiliateAddress string

The affiliate thorname to receive the affiliate fee. Must be 10 chars or less, the shorter the better. (e.g. partner1)

affiliateBasisPoints string

Basis point to take from the trade (e.g. 50 for 0.5%)

isAffiliateFeeFlat boolean

If set to true, the API will adjust the memo so that the total affiliate fees, including smart contract, are as close as possible to the provided affiliateBasisPoints

allowSmartContractRecipient boolean

If set to true, we will not perform any safety checks on the recipient address on an EVM chain. This is risky, and funds will likely be lost. For more information https://docs.thorswap.net/aggregation-api/pathfinder#smart-contract-addresses

Responses
200

A complete quote response with calldata

Schema
routes object[]

An array of the different swap options available for this trade

path string

The full path that this swap will take

providers string[]

The list of providers the aggregation protocol should look to for a quote. If left empty, the full list of providers will be used.

subProviders string[]

The list of sub-providers the aggregation protocol should look to for a quote. If left empty, the full list of sub-providers will be used.

swaps object[]

The list of invidivual swaps (or steps) that make up this route

path string

The path of this step

provider string

The provider used to perform this step

from string

The source asset identifier

to string

The destination asset identifier

order number

The order of this step within the main trade, starting from 0.

expectedOutput string

The expected asset amount out of this trade.

expectedOutputMaxSlippage string

The expected asset amount out of this trade if the entire slippage amount, provided in the quote, is incurred.

optimal boolean

A flag to indicate if this suggested route returns the best price

complete boolean

A flag to indicate if the response data has been fully formed.

calldata object

The response object of a quote, that is to be passed into the swap contract of the THORSwap aggregation protocol

tcRouter string REQUIRED

The THORChain router responsible for this trade.

tcVault string REQUIRED

The current THORChain vault for this trade, this should be an active vault. We take good measures to make sure it is an active vault, but we encourage you to take precautions on the client-side.

tcMemo string REQUIRED

memo to be passed to THORChain

token string REQUIRED
amount string REQUIRED
amountOutMin string REQUIRED
deadline string REQUIRED
contract string

The address of the contract router responsible for this trade.

contractInfo string

Details of the swap to be completed. Currently either TC-TC, ETH-TC, TC-ETH or ETH-ETH.

inboundAddress string

The inbound address for the sell asset.

targetAddress string

The target address for the trade.

400

Error

Schema
name string

name of the error

message string

details about this error

500

Error

Schema
message string

Internal Server Error