Get Token Mint Information
The getMint
function retrieves information about a token mint, including its decimals, authority, and supply.
Usage
const mint = await connection.getMint(mintAddress, commitment);
Parameters
mintAddress
:Address
- Address of the token mint to get information forcommitment
:Commitment
(optional) - Desired confirmation level (default: “confirmed”)
Returns
Returns a Promise<Mint | null>
containing the mint information:
decimals
: Number of decimal places for the tokenmintAuthority
: Public key of the account allowed to mint new tokenssupply
: Current total supply of the token- Other metadata if the token uses Token Extensions
Example
// Get information about the USDC mint
const usdcMint = await connection.getMint("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
console.log(`Decimals: ${usdcMint.data.decimals}`);
console.log(`Mint authority: ${usdcMint.data.mintAuthority}`);
console.log(`Supply: ${usdcMint.data.supply}`);
Last updated on