Set your transfer parameters
Before you can send tokens or messages, you'll need to set your parameters.
Now you're ready to set the parameters of your trade request.
Example: Swap 0.05 WETH from Goerli and receive aUSDC on the Avalanche Fuji Tesntet
Due to low liquidity on testnet, we ask that you limit your trade size in most cases to less than 0.1 of the native gas token (e.g. <0.1 ETH, or AVAX).
Note that the same token types (i.e. USDC) often has a different address on each chain. Make sure you've checked the address is right for the chain you are sending from/to.
Params are structured as a#getroute object. A GetRoute
object describes a desired any-to-any transfer. It is defined by the following interface:
Request Params:
Property | Description |
---|---|
fromChain | Source Chain ID |
fromToken | Address of the sending tokens |
fromAmount | Amount of tokens to be sent in WEI |
toChain | Destination Chain ID |
toToken | Address of the receiving tokens |
fromAddress | Transaction sender address. Will be also used as a fallback address for the source chain |
toAddress | The expected output address that will receive the destination tokens |
slippage | Max slippage across route, (0.3-99.99) 1 = 1% slippage. |
enableForecall (optional) | Instant execution on the destination chain when set to |
quoteOnly (optional) | If |
prefer (optional) | When set, the route response will prefer routes from the DEX corresponding to the string. See possible strings here. |
Sending/receiving native tokens
If you want to send or receive native tokens (i.e ETH), the sourceTokenAddress
or destinationTokenAddress
arguments must be set to 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
Once you have configured the params object, the next step is to get a route
Last updated