Get a route

We recommend getting a new route or quote every 20 seconds to refresh prices.

// Set up parameters for swapping tokens and depositing into Radiant lending pool
const params = {
  fromAddress: signer.address,
  fromChain: arbitrumId,
  fromToken: usdcArbitrumAddress,
  fromAmount: amount,
  toChain: polygonId,
  toToken: nativeToken,
  toAddress: signer.address,
  slippage: 1,
  quoteOnly: false,

// Get the swap route using Squid SDK
const { route, requestId } = await squid!.getRoute(params);

You can then explore the route response. This includes all the information on your quote route.estimate and all the data needed to generate a transaction route.transactionRequest.

Last updated