Skip to content

Tokens and balances

Look up ERC-20 token identity, metadata, and wallet balances.

TokenModule covers a token as an asset in its own right: sdk.tokens.getToken reads its name, symbol, and decimals straight from the ERC-20 contract, getMetadata attaches a logo when the asset repo has one, and getAccountBalance reads a wallet’s holding of it in the token’s smallest units.

This is wallet balance only — what an account holds regardless of the protocol. Collateral already deposited into the vault is a separate figure, covered in Vaults and collateral; the exchange rate between two tokens is in Pricing and oracles.

Each read also exists as a standalone function taking the SDK context explicitly, listed with this group in the sidebar.

A wallet’s WETH balance, scaled to a human-readable amount:

const weth = await sdk.tokens.getToken({ address: WETH });
if (!weth) return undefined;
const balance = await sdk.tokens.getAccountBalance({
tokenAddress: WETH,
accountAddress,
});
// Balances come back in the token's smallest units; scale by its decimals
// for a human-readable amount.
const wholeWeth = Number(balance) / 10 ** weth.decimals;

Primary APIs

Interfaces

  • TokenModule — Token operations: metadata, balances, and lookups.

Supporting types and functions in this group are not listed here; each has its own page, listed with the group in the sidebar.