getTokenSupply
Learn getTokenSupply use cases, code examples, request parameters, response structure, and tips.
The getTokenSupply RPC method in CoinVera retrieves the total supply of a specific SPL token mint. This method is essential for understanding the overall quantity of tokens created and is especially useful for token dashboards, explorers, and tokenomics tracking.
✅ Common Use Cases
Displaying Token Information Show the total token supply in wallets, token explorers, or DeFi dashboards.
Tokenomics Analysis Understand how many tokens exist and how that relates to market cap or distribution.
Supply Verification Validate supply directly from the on-chain mint account for auditing or compliance.
Monitoring Supply Changes Detect increases or decreases in supply for mintable tokens (e.g., stablecoins or utility tokens with active minting authority).
🧾 Request Parameters
[
mintAddress: string, // Required – Base-58 token mint address
options?: {
commitment?: string // Optional – "processed", "confirmed", or "finalized"
}
]mintAddress: The public key of the SPL token mint.
commitment (optional): The network state to query against. Defaults to the node's standard (typically
finalized).
📦 Response Structure
The value field contains detailed supply information:
amount: Total supply in raw units (not adjusted for decimals).
decimals: Number of decimal places defined for this token.
uiAmount: Total supply as a float (may be null or imprecise).
uiAmountString: Total supply as a string (accurate and display-friendly).
🧪 Example
Query the Supply of a Specific Token Mint
Code Examples
Example Response
💡 Developer Tips
Decimals Matter Always use the
decimalsfield to properly convertamountinto a human-readable value.Immutable by Default Most SPL tokens have a fixed supply unless governed by a mint authority. Track
getMintto see if further minting is possible.Prefer
uiAmountStringfor Display For accurate and consistent formatting, useuiAmountStringinstead ofuiAmount.Data Source Is Direct This method reads data directly from the mint account—not from token accounts—ensuring reliable totals.
Burns Don’t Change Mint Supply Burning typically occurs at the token account level and does not reduce the mint’s recorded total unless explicitly programmed.
The getTokenSupply method is a vital part of working with SPL tokens, enabling reliable supply visibility for audits, analytics, and user interfaces built on CoinVera.
Last updated