Skip to Content
DocumentationTokensGet Token Metadata

Get Token Metadata

The getTokenMetadata function retrieves token metadata using metadata pointer extensions. It supports both metadata stored directly in mint accounts and in separate metadata accounts, and works with Token-Extension mints that have metadata pointer extension enabled.

Usage

const metadata = await connection.getTokenMetadata(mintAddress);

Parameters

  • mintAddress: Address - The mint address of the token
  • commitment: Commitment (optional) - The commitment level for the RPC call (default: “confirmed”)

Returns

Returns a Promise<TokenMetadata> containing:

  • updateAuthority: Address - The update authority for the metadata
  • mint: Address - The mint address
  • name: string - The token name
  • symbol: string - The token symbol
  • uri: string - The URI pointing to additional metadata (usually an IPFS or HTTP URL)
  • additionalMetadata: Record<string, string> - Additional metadata key-value pairs

Example

import { connect } from "solana-kite"; const connection = await connect("mainnet"); // Get metadata for a token with metadata pointer extension const mintAddress = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" as Address; // USDC try { const metadata = await connection.getTokenMetadata(mintAddress); console.log("Token Name:", metadata.name); console.log("Token Symbol:", metadata.symbol); console.log("Token URI:", metadata.uri); console.log("Update Authority:", metadata.updateAuthority); console.log("Additional Metadata:", metadata.additionalMetadata); } catch (error) { console.error("Failed to get token metadata:", error.message); }

Requirements

This function requires the token to have:

  1. Metadata Pointer Extension: The mint must have a metadata pointer extension enabled
  2. Token Extensions Program: The mint must be created using the Token Extensions program (Token-2022), not the classic Token program

Error Handling

The function will throw an error if:

  • The mint address is not found
  • The mint uses the classic Token program (which doesn’t support metadata extensions)
  • No metadata pointer extension is found
  • The metadata account is not found (when metadata is stored separately)

Token Extensions

This function is specifically designed to work with Token Extensions, which provide enhanced functionality for tokens on Solana. Token Extensions allow for:

  • Metadata pointer extensions
  • Transfer hooks
  • Transfer fees
  • And many other advanced features

For more information about Token Extensions, see the Solana Token Extensions documentation .

Last updated on