Skip to content
LogoLogo

token.getMetadata

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

Usage

import { client } from './viem.config'
 
const metadata = await client.token.getMetadata({
  token: '0x20c0000000000000000000000000000000000000',
})
 
console.log('Currency:', metadata.currency)
Currency: USD
console.log('Decimals:', metadata.decimals)
Decimals: 18
console.log('Name:', metadata.name)
Name: United States Dollar
console.log('Logo URI:', metadata.logoURI)
Logo URI: https://example.com/token.svg
console.log('Symbol:', metadata.symbol)
Symbol: USD
console.log('Total Supply:', metadata.totalSupply)
Total Supply: 1000000000000000000000n

Return Type

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

Parameters

token

  • Type: string

Token to operate on: a chain-declared token name (resolving its address and metadata), a TIP-20 token id, or a token address. Metadata declared on the chain's tokens config is used when present; otherwise it is read from the contract.

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.