Skip to content

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

index.ts
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

chainId
nullable CAIP2

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.

chainIds
nullable CAIP2[]

A list of CAIP-2 chain IDs to list currencies for. Alternative to chainId.

all
nullable boolean

When set to true, all supported currencies are returned. Defaults to false.

Return Type

Returns an array of currency objects:

id*
string

The unique identifier of the currency.

name*
string

The name of the currency. Ex. "USD Coin".

symbol*
string

The symbol of the currency. Ex. "USDC".

decimals*
number

The number of decimals of the currency.

logoUrl*
string

The URL of the currency's logo.

tier*
'tier1' | 'tier2' | 'tier3'

The tier of the currency. Stablecoins are tier1, major tokens are tier2, and volatile tokens are tier3.

on*
(chain: Chain) => CAIP19

Returns the CAIP-19 ID of the currency on the given chain. Throws a CurrencyNotSupportedError if the currency is not supported on that chain.

contractAddressOn
nullable (chain: Chain) => string

Returns the token's contract address on the given chain. Only present for tokens with a contract address (i.e., not native currencies).