Tokens
getTokenSupply
Returns the total supply of a token mint
Parameters
Public key of the token mint (base-58 encoded)
Configuration object containing:
Commitment level (processed, confirmed, finalized)
Response
Object containing:
Code Examples
Basic Request
Using web3.js
Notes
- Returns the total supply of a token mint
- The supply includes all tokens in circulation
- The response is immediate as it reads from the current state
- The supply can change with token minting and burning
- The mint must be a valid token mint
Best Practices
- Use appropriate commitment level based on your needs
- Cache results when appropriate to reduce RPC load
- Monitor for changes in token supply
- Consider using websocket subscription for real-time updates
- Handle network errors and retry when appropriate
Common Errors
Code | Message | Solution |
---|---|---|
-32601 | Method not found | Verify you’re connected to a Solana RPC node |
-32602 | Invalid params | Check mint public key and configuration |
-32007 | Mint not found | Verify the mint exists |
Use Cases
-
Token Supply Analysis
-
Token Supply Monitoring
-
Token Supply Planning