Skip to content
LogoLogo

token.getMetadata

Gets the metadata for a TIP-20 token, including name, symbol, decimals, currency, and total supply.

Usage

import {  } from './viem.config'
 
const  = await .token.getMetadata({
  : '0x20c0000000000000000000000000000000000000',
})
 
.('Currency:', .currency)
Currency: USD
.('Decimals:', .decimals)
Decimals: 18
.('Name:', .name)
Name: United States Dollar
.('Symbol:', .symbol)
Symbol: USD
.('Total Supply:', .totalSupply)
Total Supply: 1000000000000000000000n

Return Type

type ReturnType = {
  currency: string
  decimals: number
  name: string
  paused?: boolean
  quoteToken?: Address
  supplyCap?: bigint
  symbol: string
  totalSupply: bigint
  transferPolicyId?: bigint
}

Parameters

token

  • Type: Address | bigint

Address or ID of the TIP-20 token.

blockNumber (optional)

  • Type: bigint

Block number to read the state from.

blockOverrides (optional)

  • Type: BlockOverrides

Block overrides to apply to the state.

blockTag (optional)

  • Type: BlockTag

Block tag to read the state from.

stateOverride (optional)

  • Type: StateOverride

State override to apply.