services
Get a key

library / How to use Solana

SPL tokens

SPL tokens in the Carbium Library: 12 working Solana examples, among them Token name and symbol lookup and Large-wallet token account listing.

  • Token name and symbol lookup HS0133

    Read a token's name, symbol and decimals from its mint and Metaplex metadata accounts with getAccountInfo on Carbium RPC, in one TypeScript file.

  • Large-wallet token account listing HS0132

    List a large wallet's token accounts with getTokenAccountsByOwner, using a mint filter and a deadline so a slow reply ends in a clear error.

  • Raw to UI amount conversion HS0131

    Convert a raw SPL token amount to exact UI text with the mint's decimals from getTokenSupply on Carbium RPC, using BigInt.

  • Missing token account detection HS0129

    Check whether a wallet's associated token account exists before a transfer, using two read-only getMultipleAccounts lookups on Carbium RPC.

  • Largest token holders HS0048

    Rank the top 5 holders of a Solana mint by owner from a candidate set, since getTokenLargestAccounts answers -32601 on Carbium.

  • Transfer vs TransferChecked decoder HS0047

    Tell SPL Token Transfer from TransferChecked in real transactions and decode amount, decimals and accounts from the raw instruction bytes.

  • Wrapped SOL account reader HS0023

    The wSOL mint address, plus a read-only TypeScript file that lists a wallet's wrapped SOL accounts with lamports, amount and rent reserve.

  • Associated token address lookup HS0022

    Derive a wallet's associated token account address for any mint with @solana/kit, then confirm it on chain with two read calls.

  • Token account layout decoder HS0021

    Read the holder wallet, mint and amount from a Solana token account's raw bytes with getAccountInfo, in one read-only TypeScript file on Carbium RPC.

  • Token accounts by owner HS0017

    List every SPL token a wallet holds, with amounts, using getTokenAccountsByOwner on the Token and Token-2022 programs in one TypeScript file.

  • Token mint supply and authorities HS0005

    Read an SPL token's supply, decimals, mint authority and freeze authority with one getAccountInfo call in a read-only TypeScript file on Carbium RPC.

  • SPL token balance HS0001

    Read a wallet's SPL token balance, such as USDC, with getTokenAccountBalance in one read-only TypeScript file on Carbium RPC.