Get a route

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

A route is our term for a complete response from our API, including an estimate(quote) and transactionRequest (payload, calldata and gas settings). The route is our core product, which we use in every other Squid product.

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": "1000000000000000000",
      "sendAmount": "22073181",
      "toAmount": "17755520049246481683",
      "toAmountMin": "17639489984069697216",
      "fromAmountUSD": "22.24",
      "route": {
        "fromChain": [
          {
            "type": "SWAP",
            "dex": {
              "chainName": "Avalanche",
              "dexName": "Pangolin",
              "swapRouter": "0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106",
              "factory": "0xefa94DE7a4656D787667C749f7E1223D71E9FD88",
              "isStable": false
            },
            "target": "0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106",
            "path": [
              "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
              "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"
            ],
            "squidCallType": 2,
            "fromToken": {
              "chainId": 43114,
              "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
              "name": "Avalanche",
              "symbol": "AVAX",
              "decimals": 18,
              "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
              "coingeckoId": "avalanche-2",
              "commonKey": "wavax-wei"
            },
            "toToken": {
              "chainId": 43114,
              "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
              "decimals": 6,
              "name": "USD Coin",
              "symbol": "USDC",
              "logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/3408.png",
              "coingeckoId": "usd-coin-avalanche-bridged-usdc-e"
            },
            "fromAmount": "1000000000000000000",
            "toAmount": "22102730",
            "toAmountMin": "21958291",
            "exchangeRate": "22.1",
            "priceImpact": "-0.01",
            "dynamicSlippage": 0.6534872808848458
          },
          {
            "type": "SWAP",
            "dex": {
              "chainName": "Avalanche",
              "dexName": "Curve_v2",
              "swapRouter": "0x890f4e345B1dAED0367A877a1612f86A1f86985f",
              "isStable": true
            },
            "target": "0xd7bb79aee866672419999a0496d99c54741d67b5",
            "path": [
              "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
              "0xfaB550568C688d5D8A52C7d794cb93Edc26eC0eC"
            ],
            "squidCallType": 1,
            "fromToken": {
              "chainId": 43114,
              "address": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
              "decimals": 6,
              "name": "USD Coin",
              "symbol": "USDC",
              "logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/3408.png",
              "coingeckoId": "usd-coin-avalanche-bridged-usdc-e"
            },
            "toToken": {
              "chainId": 43114,
              "address": "0xfaB550568C688d5D8A52C7d794cb93Edc26eC0eC",
              "name": "Axelar USDC",
              "symbol": "axlUSDC",
              "decimals": 6,
              "logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/21420.png",
              "coingeckoId": "axlusdc",
              "commonKey": "uusdc"
            },
            "fromAmount": "22102730",
            "toAmount": "22073181",
            "toAmountMin": "22051108",
            "exchangeRate": "0.99866",
            "priceImpact": "0.0",
            "dynamicSlippage": 0.1
          }
        ],
        "toChain": [
          {
            "type": "SWAP",
            "dex": {
              "chainName": "Polygon",
              "dexName": "Quickswap_v3",
              "swapRouter": "0xf5b509bb0909a69b1c207e495f687a596c168e12",
              "deployer": "0x2D98E2FA9da15aa6dC9581AB097Ced7af697CB92",
              "quoter": "0xa15F0D7377B2A0C0c10db057f641beD21028FC89",
              "isStable": true
            },
            "target": "0xf5b509bb0909a69b1c207e495f687a596c168e12",
            "path": [
              "0x750e4C4984a9e0f12978eA6742Bc1c5D248f40ed",
              "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
            ],
            "squidCallType": 1,
            "fromToken": {
              "chainId": 137,
              "address": "0x750e4C4984a9e0f12978eA6742Bc1c5D248f40ed",
              "name": "axlUSDC",
              "symbol": "axlUSDC",
              "decimals": 6,
              "logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/21420.png",
              "coingeckoId": "axlusdc",
              "commonKey": "uusdc"
            },
            "toToken": {
              "name": "USD Coin",
              "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
              "symbol": "USDC",
              "decimals": 6,
              "chainId": 137,
              "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
              "coingeckoId": "usd-coin"
            },
            "fromAmount": "22073181",
            "toAmount": "22062358",
            "toAmountMin": "22040296",
            "exchangeRate": "0.99951",
            "priceImpact": "0.0",
            "dynamicSlippage": 0.1
          },
          {
            "type": "SWAP",
            "dex": {
              "chainName": "Polygon",
              "dexName": "Quickswap",
              "swapRouter": "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
              "factory": "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
              "isStable": false
            },
            "target": "0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff",
            "path": [
              "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
              "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"
            ],
            "squidCallType": 1,
            "fromToken": {
              "name": "USD Coin",
              "address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
              "symbol": "USDC",
              "decimals": 6,
              "chainId": 137,
              "logoURI": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
              "coingeckoId": "usd-coin"
            },
            "toToken": {
              "chainId": 137,
              "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
              "name": "MATIC",
              "symbol": "MATIC",
              "decimals": 18,
              "logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/3890.png",
              "coingeckoId": "matic-network",
              "commonKey": "wmatic-wei"
            },
            "fromAmount": "22062358",
            "toAmount": "17755520049246481683",
            "toAmountMin": "17639489984069697216",
            "exchangeRate": "0.80479681197103",
            "priceImpact": "0.0",
            "dynamicSlippage": 0.6534872808848458
          }
        ]
      },
      "feeCosts": [
        {
          "name": "Gas Receiver Fee",
          "description": "Estimated Gas Receiver fee",
          "percentage": "0",
          "token": {
            "chainId": 43114,
            "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
            "name": "Avalanche",
            "symbol": "AVAX",
            "decimals": 18,
            "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
            "coingeckoId": "avalanche-2",
            "commonKey": "wavax-wei"
          },
          "amount": "12121304853374451",
          "amountUSD": "0.2685"
        }
      ],
      "gasCosts": [
        {
          "type": "executeCall",
          "token": {
            "chainId": 43114,
            "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
            "name": "Avalanche",
            "symbol": "AVAX",
            "decimals": 18,
            "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
            "coingeckoId": "avalanche-2",
            "commonKey": "wavax-wei"
          },
          "amount": "20670000000000000",
          "amountUSD": "0.4578",
          "gasPrice": "25000000000",
          "maxFeePerGas": "51500000000",
          "maxPriorityFeePerGas": "1500000000",
          "estimate": "780000",
          "limit": "780000"
        }
      ],
      "estimatedRouteDuration": 90,
      "exchangeRate": "17.755520049246481683",
      "aggregatePriceImpact": "-0.01",
      "toAmountUSD": "22.0168"
    },
    "params": {
      "enableForecall": false,
      "slippage": 1.5,
      "quoteOnly": false,
      "toAddress": "0xAD3A87a43489C44f0a8A33113B2745338ae71A9D",
      "fromAmount": "1000000000000000000",
      "toToken": {
        "chainId": 137,
        "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
        "name": "MATIC",
        "symbol": "MATIC",
        "decimals": 18,
        "logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/3890.png",
        "coingeckoId": "matic-network",
        "commonKey": "wmatic-wei"
      },
      "fromToken": {
        "chainId": 43114,
        "address": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
        "name": "Avalanche",
        "symbol": "AVAX",
        "decimals": 18,
        "logoURI": "https://axelarscan.io/logos/chains/avalanche.svg",
        "coingeckoId": "avalanche-2",
        "commonKey": "wavax-wei"
      },
      "toChain": "137",
      "fromChain": "43114"
    },
    "transactionRequest": {
      "routeType": "CALL_BRIDGE_CALL",
      "targetAddress": "0xce16F69375520ab01377ce7B88f5BA8C48F8D666",
      "data": "0x8ca3bf6800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000740000000000000000000000000ad3a87a43489c44f0a8a33113b2745338ae71a9d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007506f6c79676f6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000761786c555344430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000e54ca86531e17ef3616d22ca28b0d458b6c89106000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000e4a2a1623d00000000000000000000000000000000000000000000000000000000014f0e9300000000000000000000000000000000000000000000000000000000000000800000000000000000000000004fd39c9e151e50580779bd04b1f7ecc310079fd30000000000000000000000000000000000000000000000000000018610b81f0f0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000d7bb79aee866672419999a0496d99c54741d67b50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d7bb79aee866672419999a0496d99c54741d67b5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000a4ddc1f59d0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015142ca0000000000000000000000000000000000000000000000000000000001507924000000000000000000000000ce16f69375520ab01377ce7b88f5ba8c48f8d666000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000b97ef9ef8734c71904d8002f8b6bc66dd9c48a6e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000054000000000000000000000000000000000000000000000000000000000000006c000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000750e4c4984a9e0f12978ea6742bc1c5d248f40ed0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000750e4c4984a9e0f12978ea6742bc1c5d248f40ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000f5b509bb0909a69b1c207e495f687a596c168e120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000750e4c4984a9e0f12978ea6742bc1c5d248f40ed00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f5b509bb0909a69b1c207e495f687a596c168e12000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000e4bc651188000000000000000000000000750e4c4984a9e0f12978ea6742bc1c5d248f40ed0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000004fd39c9e151e50580779bd04b1f7ecc310079fd30000000000000000000000000000000000000000000000000000018610b81f14000000000000000000000000000000000000000000000000000000000150cf5d0000000000000000000000000000000000000000000000000000000001504ee80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000750e4c4984a9e0f12978ea6742bc1c5d248f40ed000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000010000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000044095ea7b3000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000010418cbafe5000000000000000000000000000000000000000000000000000000000150a516000000000000000000000000000000000000000000000000f4cc0eaeb788fec000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000ad3a87a43489c44f0a8a33113b2745338ae71a9d0000000000000000000000000000000000000000000000000000018610b81f1500000000000000000000000000000000000000000000000000000000000000020000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000000000000",
      "value": "1012121304853374451",
      "gasLimit": "780000",
      "gasPrice": "25000000000",
      "maxFeePerGas": "51500000000",
      "maxPriorityFeePerGas": "1500000000"
    }
  },
  "requestId": "340c79f3-4f63-4d72-a6e6-3b70edfd3fe7",
  "integratorId": "squid-swap-widget"
}

Last updated