> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# How to Get a Token Mint

> Learn how to retrieve Solana token mint information, including supply, authority, decimals, and metadata.

In order to get the current supply, authority, or decimals a token has, you will
need to get the account info for the token mint.

<Note>
  These examples read the PYUSD mint and the USDC metadata account, which exist
  only on mainnet. Run them against a Surfpool local network that forks mainnet
  (`surfpool start --network mainnet` fetches the accounts on demand), or point
  the RPC URL at a mainnet endpoint.
</Note>

## Fetch Mint Account

<Tabs>
<Tab title="Kit">
<div className="sol-tab-label">Kit</div>

```ts highlight={7}
import { type Address, createSolanaRpc } from "@solana/kit";
import { fetchMint } from "@solana-program/token-2022";

const rpc = createSolanaRpc("http://localhost:8899");
const address = "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo" as Address;

const mint = await fetchMint(rpc, address);
console.log(mint);
```

<div className="sol-run" data-run="cookbook/tokens/get-token-mint/fetch" data-tab="Kit">
<div className="sol-run-bar"><button type="button" className="sol-run-btn">Run</button><span className="sol-run-note">Output from a local Surfpool network</span></div>
<div className="sol-run-out">

```text Output
{
  executable: false,
  lamports: 2078412093n,
  programAddress: 'TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb',
  space: 866n,
  address: '2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo',
  data: {
    mintAuthority: {
      __option: 'Some',
      value: '8Jornc27vtAYPkwDzsZVgLQchAYyC8nD7aCNPCDV8Qk2'
    },
    supply: 670662348088952n,
    decimals: 6,
    isInitialized: true,
    freezeAuthority: {
      __option: 'Some',
      value: '2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk'
    },
    extensions: { __option: 'Some', value: [Array] }
  },
  exists: true
}
```

</div>
</div>

</Tab>
<Tab title="Web3.js v3">
<div className="sol-tab-label">Web3.js v3</div>

```ts highlight={10-14}
import { Connection, PublicKey } from "@solana/web3.js";
import { getMintDecoder } from "@solana-program/token-2022";

const connection = new Connection("http://localhost:8899", "confirmed");

const mintAddress = new PublicKey(
  "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
);

const mintAccountInfo = await connection.getAccountInfo(
  mintAddress,
  "confirmed",
);
const mintAccount = getMintDecoder().decode(mintAccountInfo!.data);

console.log(mintAccount);
```

<div className="sol-run" data-run="cookbook/tokens/get-token-mint/fetch" data-tab="Web3.js v3">
<div className="sol-run-bar"><button type="button" className="sol-run-btn">Run</button><span className="sol-run-note">Output from a local Surfpool network</span></div>
<div className="sol-run-out">

```text Output
{
  mintAuthority: {
    __option: 'Some',
    value: 'AxJkHRY3puoofyj7Pn512M1SGBgWroXMkEdNPQypkzbu'
  },
  supply: 689767591884463n,
  decimals: 6,
  isInitialized: true,
  freezeAuthority: {
    __option: 'Some',
    value: '2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk'
  },
  extensions: {
    __option: 'Some',
    value: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object]
    ]
  }
}
```

</div>
</div>

</Tab>
<Tab title="Rust">
<div className="sol-tab-label">Rust</div>

```rust
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
use solana_sdk::pubkey;
use spl_token_2022_interface::{
    extension::{
        confidential_transfer::ConfidentialTransferMint,
        confidential_transfer_fee::ConfidentialTransferFeeConfig,
        metadata_pointer::MetadataPointer, mint_close_authority::MintCloseAuthority,
        permanent_delegate::PermanentDelegate, transfer_fee::TransferFeeConfig,
        transfer_hook::TransferHook, BaseStateWithExtensions, ExtensionType, StateWithExtensions,
    },
    state::Mint,
};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("http://localhost:8899"),
        CommitmentConfig::confirmed(),
    );

    let mint_address = pubkey!("2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo");
    let mint_data = client.get_account_data(&mint_address).await?;
    let mint = StateWithExtensions::<Mint>::unpack(&mint_data)?;

    println!("Mint address: {:#?}", mint_address);
    println!("{:#?}\n", mint.base);

    let extension_types = mint.get_extension_types()?;
    println!("Extensions enabled: {:#?}\n", extension_types);

    extension_types
        .iter()
        .for_each(|extension_type| match extension_type {
            ExtensionType::TransferFeeConfig => {
                if let Ok(ext) = mint.get_extension::<TransferFeeConfig>() {
                    println!("{:#?}\n", ext);
                }
            }
            ExtensionType::MintCloseAuthority => {
                if let Ok(ext) = mint.get_extension::<MintCloseAuthority>() {
                    println!("{:#?}\n", ext);
                }
            }
            ExtensionType::PermanentDelegate => {
                if let Ok(ext) = mint.get_extension::<PermanentDelegate>() {
                    println!("{:#?}\n", ext);
                }
            }
            ExtensionType::ConfidentialTransferMint => {
                if let Ok(ext) = mint.get_extension::<ConfidentialTransferMint>() {
                    println!("{:#?}\n", ext);
                }
            }
            ExtensionType::ConfidentialTransferFeeConfig => {
                if let Ok(ext) = mint.get_extension::<ConfidentialTransferFeeConfig>() {
                    println!("{:#?}\n", ext);
                }
            }
            ExtensionType::TransferHook => {
                if let Ok(ext) = mint.get_extension::<TransferHook>() {
                    println!("{:#?}\n", ext);
                }
            }
            ExtensionType::MetadataPointer => {
                if let Ok(ext) = mint.get_extension::<MetadataPointer>() {
                    println!("{:#?}\n", ext);
                }
            }
            _ => {
                println!("{:?}: (not handled)\n", extension_type);
            }
        });

    Ok(())
}
```

<div className="sol-run" data-run="cookbook/tokens/get-token-mint/fetch" data-tab="Rust">
<div className="sol-run-bar"><button type="button" className="sol-run-btn">Run</button><span className="sol-run-note">Output from a local Surfpool network</span></div>
<div className="sol-run-out">

```text Output
Mint address: 2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo
Mint {
    mint_authority: Some(
        8Jornc27vtAYPkwDzsZVgLQchAYyC8nD7aCNPCDV8Qk2,
    ),
    supply: 670662348088952,
    decimals: 6,
    is_initialized: true,
    freeze_authority: Some(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
}

Extensions enabled: [
    MintCloseAuthority,
    PermanentDelegate,
    TransferFeeConfig,
    ConfidentialTransferMint,
    ConfidentialTransferFeeConfig,
    TransferHook,
    MetadataPointer,
    TokenMetadata,
]

MintCloseAuthority {
    close_authority: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
}

PermanentDelegate {
    delegate: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
}

TransferFeeConfig {
    transfer_fee_config_authority: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
    withdraw_withheld_authority: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
    withheld_amount: PodU64(
        [
            0,
            0,
            0,
            0,
            0,
            0,
            0,
            0,
        ],
    ),
    older_transfer_fee: TransferFee {
        epoch: PodU64(
            [
                93,
                2,
                0,
                0,
                0,
                0,
                0,
                0,
            ],
        ),
        maximum_fee: PodU64(
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
            ],
        ),
        transfer_fee_basis_points: PodU16(
            [
                0,
                0,
            ],
        ),
    },
    newer_transfer_fee: TransferFee {
        epoch: PodU64(
            [
                93,
                2,
                0,
                0,
                0,
                0,
                0,
                0,
            ],
        ),
        maximum_fee: PodU64(
            [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
            ],
        ),
        transfer_fee_basis_points: PodU16(
            [
                0,
                0,
            ],
        ),
    },
}

ConfidentialTransferMint {
    authority: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
    auto_approve_new_accounts: PodBool(
        0,
    ),
    auditor_elgamal_pubkey: OptionalNonZeroElGamalPubkey(
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ),
}

ConfidentialTransferFeeConfig {
    authority: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
    withdraw_withheld_authority_elgamal_pubkey: [28, 55, 230, 67, 59, 115, 4, 221, 130, 115, 122, 228, 13, 155, 139, 243, 196, 159, 91, 14, 108, 73, 168, 213, 51, 40, 179, 229, 6, 144, 28, 87],
    harvest_to_mint_enabled: PodBool(
        1,
    ),
    withheld_amount: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
}

TransferHook {
    authority: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
    program_id: OptionalNonZeroPubkey(
        11111111111111111111111111111111,
    ),
}

MetadataPointer {
    authority: OptionalNonZeroPubkey(
        2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk,
    ),
    metadata_address: OptionalNonZeroPubkey(
        2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo,
    ),
}

TokenMetadata: (not handled)
```

</div>
</div>

</Tab>
<Tab title="Python">
<div className="sol-tab-label">Python</div>

```py
import asyncio
import json

from solana.rpc.async_api import AsyncClient
from solders.pubkey import Pubkey


async def main():
    async with AsyncClient("http://localhost:8899") as client:
        address = Pubkey.from_string("2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo")

        mint = await client.get_account_info_json_parsed(address)
        print(json.dumps(json.loads(mint.value.to_json()), indent=2))


asyncio.run(main())
```

<div className="sol-run" data-run="cookbook/tokens/get-token-mint/fetch" data-tab="Python">
<div className="sol-run-bar"><button type="button" className="sol-run-btn">Run</button><span className="sol-run-note">Output from a local Surfpool network</span></div>
<div className="sol-run-out">

```text Output
{
  "lamports": 2078412093,
  "data": {
    "program": "spl-token-2022",
    "parsed": {
      "info": {
        "decimals": 6,
        "extensions": [
          {
            "extension": "mintCloseAuthority",
            "state": {
              "closeAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk"
            }
          },
          {
            "extension": "permanentDelegate",
            "state": {
              "delegate": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk"
            }
          },
          {
            "extension": "transferFeeConfig",
            "state": {
              "newerTransferFee": {
                "epoch": 605,
                "maximumFee": 0,
                "transferFeeBasisPoints": 0
              },
              "olderTransferFee": {
                "epoch": 605,
                "maximumFee": 0,
                "transferFeeBasisPoints": 0
              },
              "transferFeeConfigAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
              "withdrawWithheldAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
              "withheldAmount": 0
            }
          },
          {
            "extension": "confidentialTransferMint",
            "state": {
              "auditorElgamalPubkey": null,
              "authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
              "autoApproveNewAccounts": false
            }
          },
          {
            "extension": "confidentialTransferFeeConfig",
            "state": {
              "authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
              "harvestToMintEnabled": true,
              "withdrawWithheldAuthorityElgamalPubkey": "HDfmQztzBN2Cc3rkDZuL88SfWw5sSajVMyiz5QaQHFc=",
              "withheldAmount": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
            }
          },
          {
            "extension": "transferHook",
            "state": {
              "authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
              "programId": null
            }
          },
          {
            "extension": "metadataPointer",
            "state": {
              "authority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
              "metadataAddress": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo"
            }
          },
          {
            "extension": "tokenMetadata",
            "state": {
              "additionalMetadata": [],
              "mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
              "name": "PayPal USD",
              "symbol": "PYUSD",
              "updateAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
              "uri": "https://token-metadata.paxos.com/pyusd_metadata/prod/solana/pyusd_metadata.json"
            }
          }
        ],
        "freezeAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
        "isInitialized": true,
        "mintAuthority": "AxJkHRY3puoofyj7Pn512M1SGBgWroXMkEdNPQypkzbu",
        "supply": "691374793439163"
      },
      "type": "mint"
    },
    "space": 866
  },
  "owner": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",
  "executable": false,
  "rentEpoch": 18446744073709551615
}
```

</div>
</div>

</Tab>
<Tab title="Go">
<div className="sol-tab-label">Go</div>

```go
package main

import (
	"context"
	"encoding/json"
	"fmt"

	"github.com/solana-foundation/solana-go/v2"
	token2022 "github.com/solana-foundation/solana-go/v2/programs/token-2022"
	"github.com/solana-foundation/solana-go/v2/rpc"
)

func main() {
	client := rpc.New("http://localhost:8899")
	address := solana.MustPublicKeyFromBase58("2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo")

	info, err := client.GetAccountInfo(context.Background(), address)
	if err != nil {
		panic(err)
	}
	mint, _, err := token2022.ParseMintWithExtensions(info.Value.Data.GetBinary())
	if err != nil {
		panic(err)
	}

	out, _ := json.MarshalIndent(mint, "", "  ")
	fmt.Println(string(out))
}
```

<div className="sol-run" data-run="cookbook/tokens/get-token-mint/fetch" data-tab="Go">
<div className="sol-run-bar"><button type="button" className="sol-run-btn">Run</button><span className="sol-run-note">Output from a local Surfpool network</span></div>
<div className="sol-run-out">

```text Output
{
  "MintAuthority": "AxJkHRY3puoofyj7Pn512M1SGBgWroXMkEdNPQypkzbu",
  "Supply": 691374793439163,
  "Decimals": 6,
  "IsInitialized": true,
  "FreezeAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk"
}
```

</div>
</div>

</Tab>
<Tab title="Web3.js (legacy)">
<div className="sol-tab-label">Web3.js (legacy)</div>

<Warning>
  **`@solana/web3.js` 1.x is no longer actively maintained**

  It receives critical fixes only. Use [Kit](/developers/docs/clients/official/javascript#solana-kit) for new code. To migrate existing code, follow the [Kit upgrade guide](https://www.solanakit.com/docs/upgrade-guide), or the [web3.js v3 migration guide](https://github.com/solana-foundation/solana-web3.js/blob/main/docs/web3js-v1-to-v3-migration.md) to keep the class-based API.

  To run this code, install 1.x with `npm install @solana/web3.js@1`. A plain `npm install @solana/web3.js` installs v3, which this code doesn't run on.
</Warning>

```ts highlight={10-15}
import { Connection, PublicKey } from "@solana/web3.js";
import { getMint, TOKEN_2022_PROGRAM_ID } from "@solana/spl-token";

const connection = new Connection("http://localhost:8899", "confirmed");

const mintAddress = new PublicKey(
  "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
);

const mintAccount = await getMint(
  connection,
  mintAddress,
  undefined,
  TOKEN_2022_PROGRAM_ID,
);

console.log(
  JSON.stringify(
    {
      ...mintAccount,
      supply: mintAccount.supply.toString(),
    },
    null,
    2,
  ),
);
```

<div className="sol-run" data-run="cookbook/tokens/get-token-mint/fetch" data-tab="Web3.js (legacy)">
<div className="sol-run-bar"><button type="button" className="sol-run-btn">Run</button><span className="sol-run-note">Output from a local Surfpool network</span></div>
<div className="sol-run-out">

```text Output
{
  "address": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
  "mintAuthority": "8Jornc27vtAYPkwDzsZVgLQchAYyC8nD7aCNPCDV8Qk2",
  "supply": "681206899588952",
  "decimals": 6,
  "isInitialized": true,
  "freezeAuthority": "2apBGMsS6ti9RyF5TwQTDswXBWskiJP2LD4cUEDqYJjk",
  "tlvData": {
    "type": "Buffer",
    "data": [
      3,
      0,
      32,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      12,
      0,
      32,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      1,
      0,
      108,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      93,
      2,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      93,
      2,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      4,
      0,
      65,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      16,
      0,
      129,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      28,
      55,
      230,
      67,
      59,
      115,
      4,
      221,
      130,
      115,
      122,
      228,
      13,
      155,
      139,
      243,
      196,
      159,
      91,
      14,
      108,
      73,
      168,
      213,
      51,
      40,
      179,
      229,
      6,
      144,
      28,
      87,
      1,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      14,
      0,
      64,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      18,
      0,
      64,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      23,
      146,
      72,
      59,
      108,
      138,
      42,
      135,
      183,
      71,
      29,
      129,
      79,
      149,
      145,
      249,
      57,
      92,
      132,
      10,
      156,
      227,
      217,
      244,
      213,
      186,
      125,
      58,
      75,
      138,
      116,
      158,
      19,
      0,
      174,
      0,
      23,
      133,
      50,
      97,
      239,
      106,
      184,
      83,
      42,
      103,
      240,
      83,
      134,
      90,
      173,
      49,
      41,
      63,
      207,
      7,
      207,
      18,
      10,
      181,
      185,
      161,
      87,
      6,
      84,
      141,
      192,
      43,
      23,
      146,
      72,
      59,
      108,
      138,
      42,
      135,
      183,
      71,
      29,
      129,
      79,
      149,
      145,
      249,
      57,
      92,
      132,
      10,
      156,
      227,
      217,
      244,
      213,
      186,
      125,
      58,
      75,
      138,
      116,
      158,
      10,
      0,
      0,
      0,
      80,
      97,
      121,
      80,
      97,
      108,
      32,
      85,
      83,
      68,
      5,
      0,
      0,
      0,
      80,
      89,
      85,
      83,
      68,
      79,
      0,
      0,
      0,
      104,
      116,
      116,
      112,
      115,
      58,
      47,
      47,
      116,
      111,
      107,
      101,
      110,
      45,
      109,
      101,
      116,
      97,
      100,
      97,
      116,
      97,
      46,
      112,
      97,
      120,
      111,
      115,
      46,
      99,
      111,
      109,
      47,
      112,
      121,
      117,
      115,
      100,
      95,
      109,
      101,
      116,
      97,
      100,
      97,
      116,
      97,
      47,
      112,
      114,
      111,
      100,
      47,
      115,
      111,
      108,
      97,
      110,
      97,
      47,
      112,
      121,
      117,
      115,
      100,
      95,
      109,
      101,
      116,
      97,
      100,
      97,
      116,
      97,
      46,
      106,
      115,
      111,
      110,
      0,
      0,
      0,
      0
    ]
  }
}
```

</div>
</div>

</Tab>
</Tabs>

## Fetch Metaplex Token Metadata

For tokens using the
[Metaplex Token Metadata Program](https://developers.metaplex.com/token-metadata),
you can fetch the metadata account to get the token's name, symbol, and URI.

The Kit examples use the Metaplex Token Metadata client. Install it together
with `@solana-program/token`, which the client loads but doesn't declare as a
dependency:

```shell
npm install @solana/kit @metaplex-foundation/mpl-token-metadata-kit @solana-program/token
```

<Note>
  `@metaplex-foundation/mpl-token-metadata-kit` 0.0.3 is built on Kit 6. It
  runs with Kit 8, but TypeScript reports the RPC types as incompatible until
  you resolve it onto your Kit version in `package.json`, then delete
  `node_modules` and `package-lock.json` and run `npm install` again:

  ```json
  "overrides": {
    "@metaplex-foundation/mpl-token-metadata-kit": {
      "@solana/kit": "$@solana/kit",
      "@solana/program-client-core": "^8.6.0"
    }
  }
  ```
</Note>

<CodeGroup>

```ts Kit highlight={9-10}
import { address, createSolanaRpc } from "@solana/kit";
import { fetchMetadataFromSeeds } from "@metaplex-foundation/mpl-token-metadata-kit";

const rpc = createSolanaRpc("http://localhost:8899");

// Example: USDC mint address
const mintAddress = address("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

// Fetch metadata directly using the mint address
const metadata = await fetchMetadataFromSeeds(rpc, { mint: mintAddress });

console.log("Token Name:", metadata.data.name);
console.log("Token Symbol:", metadata.data.symbol);
console.log("Metadata URI:", metadata.data.uri);
console.log("Update Authority:", metadata.data.updateAuthority);
```

```py Python
import asyncio
import struct

from solana.rpc.async_api import AsyncClient
from solders.pubkey import Pubkey

METADATA_PROGRAM_ID = Pubkey.from_string("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s")


async def main():
    async with AsyncClient("http://localhost:8899") as client:
        # Example: USDC mint address
        mint = Pubkey.from_string("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")

        # The metadata account is a PDA derived from the mint address
        metadata_address, _ = Pubkey.find_program_address(
            [b"metadata", bytes(METADATA_PROGRAM_ID), bytes(mint)], METADATA_PROGRAM_ID
        )
        data = (await client.get_account_info(metadata_address)).value.data

    # Layout: key (1 byte), update authority (32), mint (32), then name, symbol, uri
    update_authority = Pubkey.from_bytes(data[1:33])
    fields, offset = [], 65
    for _ in range(3):
        (length,) = struct.unpack_from("<I", data, offset)
        fields.append(data[offset + 4 : offset + 4 + length].decode().rstrip("\x00"))
        offset += 4 + length
    name, symbol, uri = fields

    print("Token Name:", name)
    print("Token Symbol:", symbol)
    print("Metadata URI:", uri)
    print("Update Authority:", update_authority)


asyncio.run(main())
```

```go Go
package main

import (
	"context"
	"fmt"
	"strings"

	bin "github.com/gagliardetto/binary"
	"github.com/solana-foundation/solana-go/v2"
	"github.com/solana-foundation/solana-go/v2/rpc"
)

func main() {
	client := rpc.New("http://localhost:8899")

	// Example: USDC mint address
	mint := solana.MustPublicKeyFromBase58("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v")

	// The metadata account is a PDA derived from the mint address
	metadataAddress, _, err := solana.FindTokenMetadataAddress(mint)
	if err != nil {
		panic(err)
	}
	account, err := client.GetAccountInfo(context.Background(), metadataAddress)
	if err != nil {
		panic(err)
	}

	// The first fields of the Metaplex Metadata account
	var metadata struct {
		Key             uint8
		UpdateAuthority solana.PublicKey
		Mint            solana.PublicKey
		Name            string
		Symbol          string
		Uri             string
	}
	if err := bin.NewBorshDecoder(account.GetBinary()).Decode(&metadata); err != nil {
		panic(err)
	}

	fmt.Println("Token Name:", strings.TrimRight(metadata.Name, "\x00"))
	fmt.Println("Token Symbol:", strings.TrimRight(metadata.Symbol, "\x00"))
	fmt.Println("Metadata URI:", strings.TrimRight(metadata.Uri, "\x00"))
	fmt.Println("Update Authority:", metadata.UpdateAuthority)
}
```

</CodeGroup>

<Info>
  Not all tokens have Metaplex metadata. Tokens created with Token Extensions
  (Token-2022) may use the different functionality instead. See [Token
  Extensions Metadata](/developers/docs/tokens/extensions/metadata) for more information.
</Info>
