tokens

Retrieves supported Universal Bridge tokens based on the provided filters.

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

Example

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

Returned tokens might look something like:

[
{
chainId: 1,
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
decimals: 18,
symbol: "ETH",
name: "Ethereum",
iconUri: "https://assets.relay.link/icons/1/light.png",
priceUsd: 2000.5,
},
{
chainId: 1,
address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
decimals: 6,
symbol: "USDC",
name: "USD Coin",
iconUri:
"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
priceUsd: 1.0,
},
];

You can filter for specific chains or tokens:

import { Bridge } from "thirdweb";
// Get all tokens on Ethereum mainnet
const ethTokens = await Bridge.tokens({
chainId: 1,
client: thirdwebClient,
});

You can search for tokens by symbol or name:

import { Bridge } from "thirdweb";
// Search for USDC tokens
const usdcTokens = await Bridge.tokens({
symbol: "USDC",
client: thirdwebClient,
});
// Search for tokens by name
const ethereumTokens = await Bridge.tokens({
name: "Ethereum",
client: thirdwebClient,
});

You can filter by a specific token address:

import { Bridge } from "thirdweb";
// Get a specific token
const token = await Bridge.tokens({
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
client: thirdwebClient,
});

The returned tokens 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 50 tokens
const tokens = await Bridge.tokens({
limit: 50,
offset: 0,
client: thirdwebClient,
});
// Get the next 50 tokens
const nextTokens = await Bridge.tokens({
limit: 50,
offset: 50,
client: thirdwebClient,
});
function tokens(options: Options): Promise<Result>;

Parameters

The options for retrieving tokens.

Type

let options: Options;

Returns

let returnType: Promise<Result>;

A promise that resolves to an array of tokens.