Skip to main content
Retrieves the best quote (lowest total fee) from all supported bridge protocols. Parameters:
  • tokenIn (required): Input token address
  • tokenOut (required): Output token address
  • sourceChain (required): Source blockchain
  • destinationChain (required): Destination blockchain
  • amount (required): Amount in token units
  • amountSymbol (optional): The denomination of the amount (e.g., USDC, DAI, ETH).
  • excludeBridges (optional): Comma-separated bridges to exclude
  • recipient (optional): Recipient address
The amountSymbol parameter is used to specify the denomination of the amount you want to send. For quotes in USD, you need to set amountSymbol to USDC (or leave empty).You can quote in a different denomination than the token you want to send. For example, you can set amountSymbol to USDC, while sending ETH as tokenIn
import { crapi, Chainrails } from "@chainrails/sdk"

Chainrails.config({
  api_key: "your_api_key_here"
})

const bestQuote = await crapi.quotes.getBestAcrossBridges({
  tokenIn: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  tokenOut: "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4",
  sourceChain: "BASE_MAINNET",
  destinationChain: "ARBITRUM_MAINNET",
  amount: "10000000",
  amountSymbol: "USDC",
  excludeBridges: "GATEWAY",
  recipient: "0x742d35Cc6635C0532925a3b8D62A7fe7B58123D1"
})

console.log("Best quote:", bestQuote)