Squid Dev Documentation
  • Getting Started
    • Overview
    • Get an Integrator ID
    • Integrator Quickstart
  • Widget Integration
    • Add A Widget
      • Swap widget
        • Getting Started
        • Installing the Widget
        • React Installation
        • NextJS Installation
        • Vite Installation
        • Iframe Installation
        • Customization Guide
          • Default User Settings
          • Configuring Content
          • Default Chains and Tokens
          • Configuration Types
          • Collect Fees
        • Information for Integrators
        • Set default chains and tokens via URL
        • Errors
    • Upgrade Your Widget
  • API & SDK Integration
    • API
      • Swap & Bridge Example
      • Staking Example
      • Cross-chain NFT Purchase Example
      • Get Route Status
    • SDK
      • Cross-chain Swap Example
      • Staking Example
      • Cross-chain NFT Purchase Example
      • Get Route Status
    • Key Concepts
      • Route Request Parameters
      • Get a route
      • Execute the route
      • 🪝Hooks
        • How do hooks work
        • Build a preHook
        • Build a postHook
        • Using the full ERC20 or Native balance in a call
        • ❗Transfer the remainder to the user
        • Get a route and execute as normal
      • Express
      • Track status
      • Types
      • Collect Fees
      • Get supported tokens and chains
    • Coral: Intent Swaps
      • Integrating Coral
    • NEW: Bitcoin and Solana
  • Adding Tokens
    • Whitelist a Token
    • Interchain Token(ITS) Listings
      • How To List
    • Circle's EURC Integration Guide
  • Migration
    • Squid v2 vs Squid v1
    • v1 -> v2 Migration
  • Additional Resources
    • Contracts
    • Squid v1 Docs
      • SDK
        • Installing our SDK
        • Get supported tokens and chains
          • Example chains response
          • Example tokens response
        • Set your transfer parameters
        • Get a route
          • Understanding the route response
        • Execute your swap or call
        • Get Route Status
        • Contract calls
          • Code example
          • Creating a ContractCall object
          • Contract call types
          • Approving ERC20s in our multicall
          • Transferring the remainder to a user
        • Collect Fees
          • Fee collector contract addresses
        • Working example!
      • API
        • integratorId
        • API playground
        • Base URLs
        • Get supported tokens and chains
        • Get a route
        • Checking the status of a transaction
        • Error codes
          • V2 API
      • Cosmos
        • Installing our SDK
        • Get supported tokens and chains
          • Example chains response
          • Example tokens response
        • Set your transfer parameters
        • Get a route
          • Cosmos route response
        • Execute your swap or call on Cosmos
        • Get Route Status
        • Cosmos custom calls
        • Working cosmos example!
        • Fallback Addresses
    • Additional Dev Resources
      • Choose How To Integrate Squid
      • Squid x Tenderly
      • Testnet or Mainnet?
      • Understanding Gas Payments
      • Supported Chains and Tokens
      • Request a new supported token
      • Liquidity Sources
        • axlASSET Liquidity
      • Integrator type specific docs
        • DEXs
        • Aggregators
        • NFTs
      • Setting up an EVM signer
      • Setting up Cosmos signer
      • Contract addresses
      • SDK easter eggs
        • Setting toAmount
        • getAllBalances
        • Advanced set up
        • Manually approve a route
        • Manually approve an ERC20
      • Whitelist a token
      • Security & Audits
        • Security
        • Audits
        • Axelar
      • Get an integrator-id
    • Architecture
      • FAQ
      • Liquidity model
      • Architecture
      • General message passing (GMP)
      • Transaction times and fees
      • Fallback behaviour on failed transactions
      • Axelar
    • Brand Assets
      • "Powered by Squid" Policy
    • Audits & Security
    • Contact
  • Changelog
    • SDK
      • v1.3
      • v1.2
    • API
      • v1.9
      • v1.8
      • v1.7
      • v1.6
  • Old v2 Documentation (Deprecated)
    • Whitelist a Token
    • Interchain Token(ITS) Listings
      • How To List
    • Add A Widget
      • Swap widget
        • Getting Started
        • Installing the Widget
        • React Installation
        • NextJS Installation
        • Iframe Installation
        • Customization Guide
          • Default User Settings
          • Theme Customization
          • Configuring Content
          • Default Chains and Tokens
          • Configuration Types
          • Collect fees
        • Information for Integrators
        • Set default chains and tokens via URL
        • Errors
      • Stake widget
        • Installing the Widget
        • Configuration
        • Importing The widget
    • Quick Start
    • API
      • Swap & Bridge Example
      • Staking Example
      • Cross-chain NFT Purchase Example
    • SDK
      • Cross-chain Swap Example
      • Staking Example
      • Cross-chain NFT Purchase Example
    • Key Concepts
      • Route Request Parameters
      • Get a route
      • Execute the route
      • 🪝Hooks
        • How do hooks work
        • Build a preHook
        • Build a postHook
        • Using the full ERC20 or Native balance in a call
        • ❗Transfer the remainder to the user
        • Add your hooks to a route request, or widget
        • Get a route and execute as normal
      • Boost
      • Track status
      • Types
      • Collect Fees
      • Get supported tokens and chains
Powered by GitBook
On this page
  • Example: Returned route object
  • Understanding route response
  1. Additional Resources
  2. Squid v1 Docs
  3. Cosmos

Get a route

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

PreviousSet your transfer parametersNextCosmos route response

Last updated 1 year ago

Once you've , you can now call getRoute()

Types:

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

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"

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 depending on what the route will require.

type of fee
set your parameters
#getroute
#routeresponse