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 { 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
};

Get a transfer quote

Finds a quote for each available route for your transfer.

const quote = await sdk.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].route;