Get a route

getRoute SDK method that retrieves the cost of token transfer and encoded calldata for the execution of the route

Once you've set your parameters, you can now call getRoute()

Types:#getroute #routeresponse

const { route, requestId, integratorId  } = await squid.getRoute(params)

This will return a quote for a token transfer and everything you need to submit it on chain.

Example: Returned route object

{
    "route": {
        "estimate": {
            "fromAmount": "100000000000000000",
            "sendAmount": "2568175",
            "toAmount": "933438",
            "toAmountMin": "914769",
            "fromAmountUSD": "1.336",
            "route": {
                "fromChain": [
                    {
                        "type": "SWAP",
                        "dex": {
                            "chainName": "Avalanche",
                            "dexName": "Pangolin",
                            "swapRouter": "0x2D99ABD9008Dc933ff5c0CD271B88309593aB921",
                            "factory": "0xE4A575550C2b460d2307b82dCd7aFe84AD1484dd",
                            "isCrypto": true
                        },
                        "target": "0x2D99ABD9008Dc933ff5c0CD271B88309593aB921",
                        "path": [
                            "0xd00ae08403B9bbb9124bB305C09058E32C39A48c",
                            "0x57f1c63497aee0be305b8852b354cec793da43bb"
                        ],
                        "swapType": "crypto",
                        "squidCallType": 2,
                        "fromToken": {
                            "chainId": 43113,
                            "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
                            "name": "Avalanche",
                            "symbol": "AVAX",
                            "decimals": 18,
                            "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
                            "coingeckoId": "avalanche-2",
                            "commonKey": "wavax-wei"
                        },
                        "toToken": {
                            "chainId": 43113,
                            "address": "0x57f1c63497aee0be305b8852b354cec793da43bb",
                            "name": "Axelar USDC",
                            "symbol": "aUSDC",
                            "decimals": 6,
                            "logoURI": "https://raw.githubusercontent.com/axelarnetwork/axelar-docs/main/public/images/assets/usdc.svg",
                            "coingeckoId": "axlusdc",
                            "commonKey": "uausdc"
                        },
                        "fromAmount": "100000000000000000",
                        "toAmount": "2568175",
                        "toAmountMin": "2542493",
                        "exchangeRate": "25.82",
                        "priceImpact": "0.54",
                        "isFrom": true,
                        "dynamicSlippage": 1
                    }
                ],
                "toChain": [
                    {
                        "type": "Transfer",
                        "fromChain": "axelar-testnet-lisbon-3",
                        "toChain": "osmo-test-5",
                        "fromToken": {
                            "chainId": "axelar-testnet-lisbon-3",
                            "address": "uausdc",
                            "name": "Axelar USD Coin",
                            "symbol": "aUSDC",
                            "decimals": 6,
                            "logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/21420.png",
                            "coingeckoId": "axlusdc",
                            "commonKey": "uausdc",
                            "bridgeOnly": false,
                            "pathKey": "axlusdc_axelar"
                        },
                        "toToken": {
                            "chainId": "osmo-test-5",
                            "address": "ibc/6F34E1BD664C36CE49ACC28E60D62559A5F96C4F9A6CCE4FC5A67B2852E24CFE",
                            "name": "Axelar USD Coin",
                            "symbol": "aUSDC",
                            "decimals": 6,
                            "logoURI": "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png?1547042389",
                            "coingeckoId": "usd-coin",
                            "bridgeOnly": false,
                            "commonKey": "uausdc",
                            "pathKey": "axlusdc_osmosis"
                        },
                        "fromChannel": "channel-227",
                        "toChannel": "channel-3"
                    },
                    {
                        "type": "Swap",
                        "chainId": "osmo-test-5",
                        "dex": "Osmosis",
                        "poolId": "46",
                        "fromToken": {
                            "chainId": "osmo-test-5",
                            "address": "ibc/6F34E1BD664C36CE49ACC28E60D62559A5F96C4F9A6CCE4FC5A67B2852E24CFE",
                            "name": "Axelar USD Coin",
                            "symbol": "aUSDC",
                            "decimals": 6,
                            "logoURI": "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png?1547042389",
                            "coingeckoId": "usd-coin",
                            "bridgeOnly": false,
                            "commonKey": "uausdc",
                            "pathKey": "axlusdc_osmosis"
                        },
                        "toToken": {
                            "chainId": "osmo-test-5",
                            "address": "ibc/40F1B2458AEDA66431F9D44F48413240B8D28C072463E2BF53655728683583E3",
                            "name": "USD Coin",
                            "symbol": "USDC",
                            "decimals": 6,
                            "logoURI": "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png?1547042389",
                            "coingeckoId": "usd-coin",
                            "bridgeOnly": false,
                            "pathKey": "nusdc_osmosis"
                        },
                        "toAmount": "933438",
                        "priceImpact": "0.03",
                        "toAmountMin": "914769"
                    }
                ]
            },
            "feeCosts": [
                {
                    "name": "Gas Receiver Fee",
                    "description": "Estimated Gas Receiver fee",
                    "percentage": "0",
                    "token": {
                        "chainId": 43113,
                        "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
                        "name": "Avalanche",
                        "symbol": "AVAX",
                        "decimals": 18,
                        "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
                        "coingeckoId": "avalanche-2",
                        "commonKey": "wavax-wei"
                    },
                    "amount": "13547442404191574",
                    "amountUSD": "0.1810"
                }
            ],
            "gasCosts": [
                {
                    "type": "executeCall",
                    "token": {
                        "chainId": 43113,
                        "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
                        "name": "Avalanche",
                        "symbol": "AVAX",
                        "decimals": 18,
                        "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
                        "coingeckoId": "avalanche-2",
                        "commonKey": "wavax-wei"
                    },
                    "amount": "12773000000000000",
                    "amountUSD": "0.1706",
                    "gasPrice": "25000000000",
                    "maxFeePerGas": "51500000000",
                    "maxPriorityFeePerGas": "1500000000",
                    "estimate": "482000",
                    "limit": "482000"
                }
            ],
            "estimatedRouteDuration": 90,
            "isExpressSupported": false,
            "exchangeRate": "9.33438",
            "aggregatePriceImpact": "0.57",
            "toAmountUSD": "0.9334"
        },
        "params": {
            "evmFallbackAddress": "0x31D46E425fEEcd6d6751cE079c8fce6EEe8c50e5",
            "customCosmosContractCall": {},
            "slippage": 1,
            "toAddress": "osmo16xz3ujtdszrqzzjqpx79wuxya3w27jn9khnumm",
            "fromAmount": "100000000000000000",
            "toToken": {
                "chainId": "osmo-test-5",
                "address": "ibc/40F1B2458AEDA66431F9D44F48413240B8D28C072463E2BF53655728683583E3",
                "name": "USD Coin",
                "symbol": "USDC",
                "decimals": 6,
                "logoURI": "https://assets.coingecko.com/coins/images/6319/small/USD_Coin_icon.png?1547042389",
                "coingeckoId": "usd-coin",
                "bridgeOnly": false,
                "pathKey": "nusdc_osmosis"
            },
            "fromToken": {
                "chainId": 43113,
                "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
                "name": "Avalanche",
                "symbol": "AVAX",
                "decimals": 18,
                "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
                "coingeckoId": "avalanche-2",
                "commonKey": "wavax-wei"
            },
            "toChain": "osmo-test-5",
            "fromChain": "43113"
        },
        "transactionRequest": {
            "routeType": "CALL_BRIDGE_CALL",
            "targetAddress": "0x481A2AAE41cd34832dDCF5A79404538bb2c02bC8",
            "data": "0x846a1bc6000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000002d99abd9008dc933ff5c0cd271b88309593ab921000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000e4a2a1623d000000000000000000000000000000000000000000000000000000000026cb9d0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000481a2aae41cd34832ddcf5a79404538bb2c02bc80000000000000000000000000000000000000000000000000000018945c2e9300000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d00ae08403b9bbb9124bb305c09058e32c39a48c00000000000000000000000057f1c63497aee0be305b8852b354cec793da43bb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005615553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096f736d6f7369732d360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003f6f736d6f317a6c397a746d77653277636476763973746438786e30366d64617161716d3738397275746d617a6668337a3836397a636178347376306374717700000000000000000000000000000000000000000000000000000000000000015e000000027b22737761705f776974685f616374696f6e223a7b22737761705f6d7367223a7b22746f6b656e5f6f75745f6d696e5f616d6f756e74223a22393134373639222c2270617468223a5b7b22706f6f6c5f6964223a223436222c22746f6b656e5f6f75745f64656e6f6d223a226962632f34304631423234353841454441363634333146394434344634383431333234304238443238433037323436334532424635333635353732383638333538334533227d5d7d2c2261667465725f737761705f616374696f6e223a7b2262616e6b5f73656e64223a7b227265636569766572223a226f736d6f3136787a33756a7464737a72717a7a6a71707837397775787961337732376a6e396b686e756d6d227d7d2c226c6f63616c5f66616c6c6261636b5f61646472657373223a226f736d6f3136787a33756a7464737a72717a7a6a71707837397775787961337732376a6e396b686e756d6d227d7d0000",
            "value": "113547442404191574",
            "gasLimit": "482000",
            "gasPrice": "25000000000",
            "maxFeePerGas": "51500000000",
            "maxPriorityFeePerGas": "1500000000"
        }
    }
}

Understanding route response

aggregatePriceImpact

This is the total price impact of all trades across a route.

feeCosts

We return an object containing a description of the fees which the Axelar network charges for making the cross chain transactions possible. We return the relevant type of fee depending on what the route will require.

route.estimate.route

There will be objects fromChain and toChain, each of which contain an array of calls which will be executed by the Squid Multicall contract on each chain. These calls can be type as "SWAP", "BRIDGE" or "CUSTOM". Squid's backend will generate a combination of the three to get tokens from A to B. If a user has requested a customContractCall in their request, they should see their call appear in toChain at the end of the array, with "type" = "CUSTOM"

Last updated