Sell.quote

Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected destinationAmount that will be received in exchange for the specified originAmount, which is specified with the sellAmountWei option.

Example

import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb";
const quote = await Bridge.Sell.quote({
originChainId: 1,
originTokenAddress: NATIVE_TOKEN_ADDRESS,
destinationChainId: 10,
destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
amount: toWei("0.01"),
client: thirdwebClient,
});

This will return a quote that might look like:

{
originAmount: 1000000000000000000n,
destinationAmount: 9999979011973735n,
blockNumber: 22026509n,
timestamp: 1741730936680,
estimatedExecutionTimeMs: 1000
steps: [
{
originToken: {
chainId: 1,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
symbol: "ETH",
name: "Ethereum",
decimals: 18,
priceUsd: 2000,
iconUri: "https://..."
},
destinationToken: {
chainId: 10,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
symbol: "ETH",
name: "Ethereum",
decimals: 18,
priceUsd: 2000,
iconUri: "https://..."
},
originAmount: 1000000000000000000n,
destinationAmount: 99999979011973735n,
estimatedExecutionTimeMs: 1000
}
],
intent: {
originChainId: 1,
originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
destinationChainId: 10,
destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
amount: 1000000000000000000n
}
}

The quote is an estimate for how much you would expect to receive for a specific sell. This quote is not guaranteed and you should use Sell.prepare to get a finalized quote with transaction data ready for execution. So why use quote? The quote function is sometimes slightly faster than prepare, and can be used before the user connects their wallet.

You can access this functions input and output types with Sell.quote.Options and Sell.quote.Result, respectively.

To limit quotes to routes that have a certain number of steps involved, use the maxSteps option.

const quote = await Bridge.Sell.quote({
originChainId: 1,
originTokenAddress: NATIVE_TOKEN_ADDRESS,
destinationChainId: 10,
destinationTokenAddress: NATIVE_TOKEN_ADDRESS,
amount: toWei("0.01"),
maxSteps: 2, // Will only return a quote for routes with 2 or fewer steps
client: thirdwebClient,
});
function quote(options: Options): Promise<Result>;

Parameters

The options for the quote.

Type

let options: Options;

Returns

let returnType: Promise<Result>;

A promise that resolves to a non-finalized quote for the requested sell.