Swing Points Program is Live 🚀 Learn More →

Find Available Routes

Swing searches across all available routes across blockchains before initiating a token transfer. Use the instructions below to request all possible routes from our API.

Set transfer parameters

These are the parameters you'll need to set for your transfer.

import type { TransferParams } from '@swing.xyz/sdk';
 
const transferParams: TransferParams = {
  fromChain: 'ethereum', // Source chain
  fromToken: 'USDC', // Source token
  fromUserAddress: '0x0000', // Source chain wallet address
 
  amount: '100', // Amount to transfer in token decimals
 
  toChain: 'polygon', // Destination chain
  toToken: 'USDC', // Destination token
  toUserAddress: '0x0000', // Ending chain wallet address
 
  maxSlippage: 0.01, //An optional percentage value passed as a decimal between 0 and 1. (i.e 0.02 = 2%). Otherwise, slippage defaults to 3%.
};

Get a transfer quote

Finds a quote for each available route for your transfer.

const quote = await swingSDK.getQuote(transferParams);

Choose a transfer route

The best route will always be listed first, but feel free to choose any available bridge or exchange.

const transferRoute = quote.routes[0];