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
  1. Additional Resources
  2. Squid v1 Docs
  3. Cosmos

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 1: [EVM -> Cosmos] Swap 0.1 Native AVAX from Avalanche Fuji Tesntet and receive Noble USDC on the Osmosis Testnet

const params = {
        fromChain: 43113, // Avalanche Fuji Tesntet
        fromToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // AVAX on Avalanche
        fromAddress: "0x6A32651F7D6131A0cAB2c649190F3B256f1A959D" // address of the sender
        fromAmount: "100000000000000000", // 0.1 AVAX
        toChain: "osmo-test-5", // Osmosis Testnet
        toToken: "ibc/DE6792CF9E521F6AD6E9A4BDF6225C9571A3B74ACC0A529F92BC5122A39D2E58", // nUSDC on Osmosis
        toAddress: "osmo16xz3ujtdszrqzzjqpx79wuxya3w27jn9khnumm", // the recipient of the tokens on Osmosis
        slippage: 1.00, // 1.00 = 1% max slippage across the entire route
        fromAddress: "0x747A6e3824FAB0d1266306C3b492fcB941C5dd93", // Fallback address for the EVM Side
        quoteOnly: false // optional, defaults to false, if true there are less params required by the api, but no tx object is returned
    };

Example 2: [Cosmos -> EVM] Swap 1 nUSDC from Osmosis Testnet and receive Native AVAX Avalanche Fuji Tesntet

const params = {
    fromChain: "osmo-test-5", // Osmosis Testnet
    fromToken: "ibc/DE6792CF9E521F6AD6E9A4BDF6225C9571A3B74ACC0A529F92BC5122A39D2E58", // nUSDC on Osmosis
    fromAmount: "1000000", // 1 nUSDC
    toChain: 43113, // Avalanche Fuji Tesntet
    toToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // AVAX on Avalanche
    toAddress: "0x747A6e3824FAB0d1266306C3b492fcB941C5dd93", // the recipient of the trade on Avalanche
    slippage: 1.00, // 1.00 = 1% max slippage across the entire route
    fromAddress: "osmo1eaztm3pqrkw2xgt0lxppahtx5v5pndmjg6yfrh", // Cosmos Sender address
    quoteOnly: false // optional, defaults to false
};

Example 3: [Cosmos -> Cosmos] Swap 1 uosmo from Osmosis Testnet and receive nUSDC on Omosis Testnet

 const params = {
   fromChain: "osmo-test-5", // Osmosis Testnet
   fromToken: "uosmo", // OSMO on Osmosis
   fromAmount: "1000000", // 1uosmo
   fromAddress: "osmo1eaztm3pqrkw2xgt0lxppahtx5v5pndmjg6yfrh", // Cosmos Sender address
   toChain: "osmo-test-5", // Omosis Testnet
   toToken: "ibc/DE6792CF9E521F6AD6E9A4BDF6225C9571A3B74ACC0A529F92BC5122A39D2E58", // nUSDC on Osmosis
   toAddress: "osmo1eaztm3pqrkw2xgt0lxppahtx5v5pndmjg6yfrh", // the recipient of the trade
   slippage: 3.0, // slippage option
};

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.

Request Params:

Property
Description

fromChain

fromToken

fromAmount

Amount of tokens to be sent (in EVM wei or "u" Cosmos micro units)

toChain

toToken

fromAddress

Fallback address for the EVM or Cosmos part of the trade. Must be set when executing swaps from EVM to/from Cosmos

toAddress

The recipient address to receive the tokens

slippage

Max slippage across route, (0.3-99.99) 1 = 1% slippage.

quoteOnly (optional)

If true, returns only a quote for the route. Omits transaction data needed for execution. Defaults to false

prefer (optional)

collectFees

Integrators can pass in a wallet address and a fee percentage - see fees section

Sending/receiving native tokens (EVM chains only)

If you want to send or receive native tokens (i.e ETH), the sourceTokenAddress or destinationTokenAddress arguments must be set to 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

PreviousExample tokens responseNextGet a route

Last updated 1 year ago

Params are structured as a object. A GetRoute object describes a desired any-to-any transfer. It is defined by the following interface:

When set, the route response will prefer routes from the DEX corresponding to the string. See possible strings . EVM chains only supported.

Once you have configured the params object, the next step is to

get a route
Source Chain ID
Address of the sending tokens
Destination Chain ID
Address of the receiving tokens
here
#getroute