> For the complete documentation index, see [llms.txt](https://docs.triton.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.triton.one/solana/rpc-methods/readme/gettokenlargestaccounts.md).

# getTokenLargestAccounts

Returns the 20 largest token accounts for an SPL Token mint, with address, amount, decimals and uiAmountString for each.

{% hint style="info" %}
On most Triton endpoints, this method is served by the DAS index. It accepts only `confirmed` or `finalized` commitment, and both return the index's latest state. If you pass a config, it must set `commitment`. The response `context` carries `slot` only. An unknown mint returns an empty list. `uiAmount` and `uiAmountString` come from a floating-point value and don't apply Token-2022 UI-amount extensions, so use `amount` for exact values.
{% endhint %}

## Request

{% tabs %}
{% tab title="cURL" %}

```bash
curl "https://<your-endpoint>.mainnet.rpcpool.com/<your-token>" -s -X POST \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenLargestAccounts",
  "params": [
    "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    {
      "commitment": "finalized"
    }
  ]
}'
```

{% endtab %}

{% tab title="Kit" %}

```typescript
import { address, createSolanaRpc } from "@solana/kit";

const rpc_url = "https://<your-endpoint>.mainnet.rpcpool.com/<your-token>";
const rpc = createSolanaRpc(rpc_url);

let mint = address("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

let largestHolders = await rpc.getTokenLargestAccounts(mint).send();

console.log(largestHolders);
```

{% endtab %}

{% tab title="web3.js" %}

```typescript
import { Connection, PublicKey } from "@solana/web3.js";

const connection = new Connection("https://<your-endpoint>.mainnet.rpcpool.com/<your-token>", "confirmed");

let mint = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

let largestHolders = await connection.getTokenLargestAccounts(mint);

console.log(largestHolders);
```

{% endtab %}

{% tab title="Rust" %}

```rust
// Cargo.toml: anyhow = "1", solana-client = "~4.4", solana-commitment-config = "3",
// solana-sdk = "5", tokio = { version = "1", features = ["full"] }. solana-client 4.4 takes
// solana-sdk 5.x types. Requires Rust 1.98.1 or newer (solana-client 4.4).
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::pubkey;

#[tokio::main]
async fn main() -> Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("https://<your-endpoint>.mainnet.rpcpool.com/<your-token>"),
        CommitmentConfig::confirmed(),
    );

    let mint = pubkey!("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

    let largest_holders = client.get_token_largest_accounts(&mint).await?;

    println!("{:#?}", largest_holders);

    Ok(())
}
```

{% endtab %}
{% endtabs %}

## Parameters

**`pubkey`** · string · required

Pubkey of the token Mint to query, as base-58 encoded string

**`config`** · object

Configuration object containing the following fields:

**`commitment`** · string · default `finalized`

Values: `processed`, `confirmed`, `finalized`. Triton accepts only `confirmed` or `finalized` for this method.

Solana RPC uses the following commitment levels:

| Value       | Description                                                                                                                                                                        |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `processed` | Return data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks. |
| `confirmed` | Return data from the highest slot the cluster has finalized. On Alpenglow, `confirmed` and `finalized` are the same level.                                                         |
| `finalized` | Return data from the highest slot that the cluster has finalized. On Alpenglow there are no vote towers or lockouts: a slot is finalized by certificates of aggregated votes.      |

## Response

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 464671878 },
    "value": [
      {
        "address": "HLmqeL62xR1QoZ1HKKbXRrdN1p3phKpxRMb2VVopvBBz",
        "amount": "9036593316313",
        "decimals": 6,
        "uiAmount": 9036593.316313,
        "uiAmountString": "9036593.316313"
      },
      {
        "address": "7dQmths1cyCQ4xaC5KcVfXz4BvVWtnHc3hcgnfnE1PBx",
        "amount": "1981312319692",
        "decimals": 6,
        "uiAmount": 1981312.319692,
        "uiAmountString": "1981312.319692"
      }
    ]
  },
  "id": 1
}
```

## Result

RpcResponse object containing:

**`context`** · object

Slot the node used to answer this request. On Triton, the context carries `slot` only.

| Field  | Type  | Description                                    |
| ------ | ----- | ---------------------------------------------- |
| `slot` | `u64` | Slot at which the node evaluated this request. |

**`value`** · array

Array of up to 20 token-balance objects with the following fields:

Each element combines a token-account address with the same amount fields documented for `uiTokenAmount` in [Token Balances](https://solana.com/docs/rpc/json-structures#token-balances).

| Field            | Type             | Description                                                                                       |
| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------- |
| `address`        | `string`         | Token-account address, as a base-58 encoded string.                                               |
| `amount`         | `string`         | Raw token balance, as a base-10 integer string with no decimal point.                             |
| `decimals`       | `u8`             | Number of decimal places configured on the mint.                                                  |
| `uiAmount`       | `number \| null` | Decimal-scaled token balance as a floating-point number. Deprecated in favor of `uiAmountString`. |
| `uiAmountString` | `string`         | Decimal-scaled token balance as a string.                                                         |

***

*Adapted from the* [*Solana `getTokenLargestAccounts` reference*](https://solana.com/docs/rpc/http/gettokenlargestaccounts)*, maintained by the Solana Foundation.*

***

<i class="fa-life-ring">:life-ring:</i> Contact support by clicking the chat icon in your [customer dashboard](https://customers.triton.one)\ <i class="fa-briefcase">:briefcase:</i> Sales questions? [Contact us](https://triton.one/contact)\ <i class="fa-sparkles">:sparkles:</i> AI agent? Read [llms.txt](https://docs.triton.one/llms.txt)\ <i class="fa-rss">:rss:</i> Follow updates: [Blog](https://blog.triton.one) · [X](https://x.com/triton_one) · [YouTube](https://www.youtube.com/@triton_one_ltd) · [Telegram](https://t.me/tritonone) · [GitHub](https://github.com/rpcpool)
