Skip to main content

Quoting Routes

Quoting calculates available swap routes without executing anything on-chain. Use quotes to show users their options before they confirm a transaction.

Common request parameters

All quote methods accept these base fields:
FieldTypeDescription
srcTokenBlockchainBlockchainNameSource blockchain (e.g. 'ETH', 'BSC', 'POLYGON')
srcTokenAddressstringToken address on the source chain. Use 0xEeee...EEeE for native tokens
srcTokenAmountstringAmount to swap in token units (not wei)
dstTokenBlockchainBlockchainNameDestination blockchain
dstTokenAddressstringToken address on the destination chain
fromAddressstring(optional) Sender wallet address. Required by some providers for accurate quotes
receiverstring(optional) Recipient address on the destination chain
slippagenumber(optional) Max slippage in percent (e.g. 1 = 1%)
integratorAddressstring(optional) Overrides the SDK-level integrator address for this request
preferredProviderstring(optional) Force a specific provider
enableChecksboolean(optional) Enable balance/gas checks. Default: true
showFailedRoutesboolean(optional) Include failed routes in quoteAll response. Default: false

quoteBest

Returns the single route with the highest expected output.
const quote = await sdk.quoteBest(params: QuoteRequestInterface): Promise<QuoteResponseInterface>

Example

const quote = await sdk.quoteBest({
    srcTokenBlockchain: 'ETH',
    srcTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
    srcTokenAmount: '1',
    dstTokenBlockchain: 'BSC',
    dstTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
});

console.log(quote.id);                                    // → 'uuid-...'
console.log(quote.providerType);                          // → 'across'
console.log(quote.swapType);                              // → 'cross-chain'
console.log(quote.estimate.destinationTokenAmount);       // → '0.412'
console.log(quote.estimate.destinationTokenMinAmount);    // → '0.408'
console.log(quote.estimate.durationInMinutes);            // → 3
console.log(quote.estimate.slippage);                     // → 1

Response: QuoteResponseInterface

FieldTypeDescription
idstringTrade identifier — pass this to swap()
providerTypestringBridge or DEX used (e.g. 'across', 'uniswap-v3')
swapType'cross-chain' | 'on-chain'Type of the swap
tokens.fromTokenInterfaceSource token info + amount
tokens.toTokenInterfaceDestination token info + expected amount
estimate.destinationTokenAmountstringExpected output in token units
estimate.destinationTokenMinAmountstringMinimum output after slippage
estimate.durationInMinutesnumberEstimated completion time
estimate.priceImpactnumber | nullPrice impact in percent
fees.gasTokenFeesobjectGas fee breakdown
fees.percentFeesobjectProtocol and integrator fee breakdown
routingRoutingInterface[]Step-by-step route path
warningsErrorInterface[]Non-fatal provider warnings
useRubicContractbooleanWhether the swap goes through Rubic proxy contracts

quoteAll

Returns all available routes, sorted by expected output (best first).
const result = await sdk.quoteAll(params: QuoteRequestInterface): Promise<QuoteAllInterface>

Example

const result = await sdk.quoteAll({
    srcTokenBlockchain: 'ETH',
    srcTokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC
    srcTokenAmount: '1000',
    dstTokenBlockchain: 'POLYGON',
    dstTokenAddress: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC
    showFailedRoutes: true,
});

// Best route
const best = result.routes[0];
console.log(best.providerType, best.estimate.destinationTokenAmount);

// All routes
result.routes.forEach(route => {
    console.log(route.providerType, '→', route.estimate.destinationTokenAmount);
});

// Failed routes (when showFailedRoutes: true)
result.failed?.forEach(fail => {
    console.log(fail.providerType, 'failed:', fail.data.reason);
});

Response: QuoteAllInterface

FieldTypeDescription
quoteQuoteRequestInterfaceEcho of the original request
routesQuoteResponseInterface[]Successful routes, sorted best-first
failedFailedQuoteInterface[]Failed routes (only if showFailedRoutes: true)

quoteDepositTrades

Returns routes where the user sends funds directly to a deposit address — no on-chain transaction is required from the source wallet. Useful for CEXes, hardware wallets, or any scenario where the user can’t sign a transaction.
const result = await sdk.quoteDepositTrades(params): Promise<QuoteAllInterface>
The request is the same as quoteAll but fromAddress is optional and the response only contains deposit-based providers (e.g. ChangeNOW, Exolix, SimpleSwap).

Example

const result = await sdk.quoteDepositTrades({
    srcTokenBlockchain: 'BTC',
    srcTokenAddress: '0x0000000000000000000000000000000000000000',
    srcTokenAmount: '0.1',
    dstTokenBlockchain: 'ETH',
    dstTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
    receiver: '0xYourEthereumAddress',
});

const route = result.routes[0];
console.log('Provider:', route.providerType);
console.log('You receive:', route.estimate.destinationTokenAmount, 'ETH');

Comparing providers

const result = await sdk.quoteAll({ /* params */ });

const comparison = result.routes.map(r => ({
    provider: r.providerType,
    receive: r.estimate.destinationTokenAmount,
    minReceive: r.estimate.destinationTokenMinAmount,
    estimatedTime: r.estimate.durationInMinutes + ' min',
    priceImpact: r.estimate.priceImpact + '%',
}));

console.table(comparison);

Next step

Once you have a quote and its id, pass it to sdk.swap() to get transaction data.