List supported currencies
Lists the currencies supported by Glide on one or more chains. Useful for building currency pickers in deposit and withdrawal UIs.
Import
import { listSupportedCurrencies } from "@paywithglide/glide-js";Usage
import { listSupportedCurrencies } from "@paywithglide/glide-js";
import { base } from "@paywithglide/glide-js/chains";
import { config } from "./config";
const currencies = await listSupportedCurrencies(config, {
chainId: base.id,
});
// Get the CAIP-19 ID of a currency on a chain
const usdcOnBase = currencies
.find((currency) => currency.symbol === "USDC")!
.on(base);
// "eip155:8453/erc20:0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"Parameters
The CAIP-2 chain ID to list currencies for (e.g., eip155:8453 for Base). Use the id field of a chain imported from @paywithglide/glide-js/chains.
A list of CAIP-2 chain IDs to list currencies for. Alternative to chainId.
When set to true, all supported currencies are returned. Defaults to false.
Return Type
Returns an array of currency objects:
The unique identifier of the currency.
The name of the currency. Ex. "USD Coin".
The symbol of the currency. Ex. "USDC".
The number of decimals of the currency.
The URL of the currency's logo.
The tier of the currency. Stablecoins are tier1, major tokens are tier2, and volatile tokens are tier3.
Returns the CAIP-19 ID of the currency on the given chain. Throws a CurrencyNotSupportedError if the currency is not supported on that chain.
Returns the token's contract address on the given chain. Only present for tokens with a contract address (i.e., not native currencies).