getTokenSupply
The getTokenSupply method returns the total supply of an SPL Token. This method provides the current circulating supply for any token by querying the token's mint account, which tracks all minting and burning operations.
Every SPL Token has a mint account that serves as the source of truth for that token's total supply. The mint account tracks how many tokens have been minted and how many have been burned, with the difference representing the current supply. This method queries the mint account to return the authoritative supply figure, including proper decimal formatting for display.
This method is essential for token dashboards, market data providers calculating market capitalization, DeFi protocols implementing supply-dependent logic, and analytics platforms tracking token metrics. It's particularly important for dynamic supply tokens where minting and burning occur regularly, as opposed to fixed-supply tokens. The method provides both raw and formatted supply values.
Parameters
parameter | type | description |
|---|---|---|
tokenMintPubkey | string | Base-58 encoded public key of the token mint account |
config | object | Optional configuration object |
config.commitment | string | Level of commitment: 'processed', 'confirmed', or 'finalized' (default: 'finalized') |
Return Object
field | type | description |
|---|---|---|
context | object | RPC response context with slot information |
context.slot | number | The slot at which this supply was retrieved |
value | object | Token supply information object |
value.amount | string | Raw total supply as a string (no decimals applied), in smallest units |
value.decimals | number | Number of decimal places for this token |
value.uiAmount | number|null | Total supply as a float with decimals applied (deprecated, may be null for large amounts) |
value.uiAmountString | string | Total supply as a string with decimals applied, safe for all amounts |
Request Example
Response Example
Tip: Use uiAmountString for display to avoid precision issues with large numbers. The supply reflects all minted tokens minus burned tokens. For wrapped SOL (wSOL), the mint is So11111111111111111111111111111111111111112. NFTs typically have a supply of 1 with 0 decimals.