getTokenLargestAccounts – Solana

The getTokenLargestAccounts JSON-RPC method retrieves the 20 largest accounts for a specified SPL Token type.

This information helps developers analyze token distribution patterns and track high-value accounts using the Core API.

The response includes account addresses, raw balances, and formatted balances with decimals applied, which can be displayed in user-friendly interfaces.

Supported Networks

This method is available on the following API endpoints:

  • Mainnet

Parameters

Required Parameters

  • string (required): The Pubkey of the token Mint to query, provided as a base-58 encoded string.

Optional Parameters

  • object (optional): A configuration object containing:

    • commitment (string): Defines the level of finality for the request.

Result

The response returns an RpcResponse object containing:

  • context (object): Provides contextual information about the slot.

    • slot (u64): The slot number when the largest token accounts were retrieved.

  • value (array): An array of JSON objects representing the largest token accounts.

    • Each object includes:

      • address (string): The Pubkey of the token account.

      • amount (string): The raw token balance (without decimals).

      • decimals (u8): The number of decimal places for the token balance.

      • uiAmount (number|null): The token balance with decimals applied. (Deprecated)

      • uiAmountString (string): The token balance as a string with decimals applied.

Request Example

API Endpoints

cURL Example

Response

A successful request returns the largest token accounts with their balances.

Example Response

In this response:

  • address: The Pubkey of each token account.

  • amount: The raw balance in lamports.

  • decimals: The number of decimal places.

  • uiAmountString: The formatted balance as a string.

Error Handling

Common getTokenLargestAccounts error scenarios:

  • Invalid Mint Pubkey: If the provided Pubkey is invalid.

  • Network issues: Connectivity problems with the Solana JSON-RPC API endpoints.

  • Invalid request parameters: Incorrect parameter structure or data types.

Example Error Response

Use Cases

The Solana getTokenLargestAccounts method is useful for:

  • Token distribution analysis: Identifying whale accounts holding significant token amounts;

  • DeFi applications: Tracking liquidity pool balances;

  • Web3 analytics tools: Displaying token holder rankings;

  • Wallet applications: Providing users insights into major token holders.

Code getTokenLargestAccounts Example – Web3 Integration

Integration with Web3

By integrating Web3 getTokenLargestAccounts into Solana’s Core API, developers can efficiently analyze token distributions, monitor account balances, and provide insights into transaction activity. This JSON-RPC method is a key tool for applications dealing with token analytics and blockchain monitoring.

Last updated

Was this helpful?