routes

Retrieves supported Universal Bridge routes based on the provided filters.

When multiple filters are specified, a route must satisfy all filters to be included (it acts as an AND operator).

Example

import { Bridge } from "thirdweb";
const routes = await Bridge.routes({
client: thirdwebClient,
});

Returned routes might look something like:

[
{
destinationToken: {
address: "0x12c88a3C30A7AaBC1dd7f2c08a97145F5DCcD830",
chainId: 1,
decimals: 18,
iconUri:
"https://assets.coingecko.com/coins/images/37207/standard/G.jpg",
name: "G7",
symbol: "G7",
},
originToken: {
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
chainId: 480,
decimals: 18,
iconUri: "https://assets.relay.link/icons/1/light.png",
name: "Ether",
symbol: "ETH",
},
},
{
destinationToken: {
address: "0x4d224452801ACEd8B2F0aebE155379bb5D594381",
chainId: 1,
decimals: 18,
iconUri:
"https://coin-images.coingecko.com/coins/images/24383/large/apecoin.jpg?1696523566",
name: "ApeCoin",
symbol: "APE",
},
originToken: {
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
chainId: 480,
decimals: 18,
iconUri: "https://assets.relay.link/icons/1/light.png",
name: "Ether",
symbol: "ETH",
},
},
];

You can filter for specific chains or tokens:

import { Bridge } from "thirdweb";
// Get all routes starting from mainnet ETH
const routes = await Bridge.routes({
originChainId: 1,
originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
client: thirdwebClient,
});

The returned routes will be limited based on the API. You can paginate through the results using the limit and offset parameters:

import { Bridge } from "thirdweb";
// Get the first 10 routes starting from mainnet ETH
const routes = await Bridge.routes({
originChainId: 1,
originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
limit: 10,
offset: 0,
client: thirdwebClient,
});
function routes(options: Options): Promise<Result>;

Parameters

The options for the quote.

Type

let options: Options;

Returns

let returnType: Promise<Result>;

A promise that resolves to an array of routes.