The THORSwap Pathfinder, is a cutting-edge discovery and routing API, at the core of the THORSwap Aggregator. Its job is to identify the best route for your trade and build the transaction for you. While developers can use the API directly, we encourage third parties to use the Cross-Chain SDK to abstract some functions.
Thorchain: AVAX, BCH, BNB, BTC, ETH, DOGE, LTC, ATOM and some ERC20 tokens
Ethereum: 1inch, 0x, UniswapV2, UniswapV3, SushiSwap, KyberNetwork Avalanche: Pangolin, TraderJoe, 1inch, KyberNetwork
By default all providers are queried to return the best quote for the user.
Note: 0x does not support sending to a custom recipient and is automatically excluded for erc20-erc20 transactions when the senderAddress and the recipientAddress are different in a /quote request.
Smart contract addresses
We do not recommend sending to smart contracts, your funds will likely be lost. This is because it may consume more than 2300 gas. There is no way to recover your funds.
From the THORChain Documentation
The V3 Router uses solidity .Send() to transfer ETH assets outbound. When an outbound ETH tx is sent to a contract, it must complete execution with only 2300 Gas. If the recipient runs out of Gas, the network still considers the payment sent. Developers of THORChain UI's should check recipient ETH addresses for the presence of code and warn users who may have complex fallback functions that their payment may not succeed, and they could lose funds. Geth eth.getCode("0xaddress") may be useful.
By default we will make a eth_getCode call to check if the recipient address is a smart contract. If it is, we will throw an error to prevent any loss. If you want to override this behavior, you can set the
allowSmartContractRecipient flag to
true in the quote query. This is at your own risk, we do not recommend this, your funds will likely be lost. No recovery is possible.
Below is a dummy request showing a swapIn from 1000 $APE tokens into Bitcoin Cash. For details on request parameters, please refer to the API section.
In order to quickly understand how to make an exchange using the protocol, we suggest you take a quick course: Quick start