Tokens
getTokenLargestAccounts
Returns the largest token accounts for a given mint
Parameters
Public key of the token mint (base-58 encoded)
Response
Object containing:
Array of token account objects containing:
Public key of the token account (base-58 encoded)
Raw amount of tokens as a string
Number of decimals configured for token’s mint
Token amount as a float, accounting for decimals
Token amount as a string, accounting for decimals
Code Examples
Basic Request
Using web3.js
Notes
- Returns the largest token accounts for a given mint
- Accounts are sorted by balance in descending order
- The response is immediate as it reads from the current state
- The accounts can change with token transfers and other operations
- 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 largest accounts
- 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 |
-32008 | Invalid limit | Ensure limit is a positive number |
Use Cases
-
Token Distribution Analysis
-
Token Holder Monitoring
-
Token Supply Planning