Skip to main content
The Token Program is the standard fungible-asset program on Thru. From a developer perspective, it owns mint accounts and token accounts, emits lifecycle and balance-change events, and expects clients to derive deterministic account addresses before building instruction payloads.

Use This When

  • you need a fungible-token mint and token account model on Thru
  • you need to transfer, mint, burn, freeze, or thaw token balances
  • you need to parse mint or token account state from chain data

Quickstart

Fetch the ABI, generate TypeScript builders, then build instruction bytes and send the transaction.
thru-cli abi account get --include-data --out ./token-program.abi.yaml <ABI_ACCOUNT_ADDRESS>

thru-cli abi codegen \
  --files ./token-program.abi.yaml \
  --language typescript \
  --output ./generated
import { decodeAddress } from "@thru/helpers";
import {
  TokenInstruction,
  TransferInstruction,
} from "./generated/thru/program/token/types";

const instructionData = TokenInstruction.builder()
  .payload()
  .select("transfer")
  .writePayload(
    TransferInstruction.builder()
      .set_source_account_index(2)
      .set_dest_account_index(3)
      .set_amount(1_000_000)
  )
  .finish()
  .build();

const tx = await thru.transactions.build({
  feePayer: { publicKey: decodeAddress(feePayerAddress) },
  program: "taAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKqq",
  accounts: {
    readWrite: [sourceTokenAccount, destinationTokenAccount],
    readOnly: [],
  },
  instructionData,
});

const signedWire = await signTransaction(tx.toWireForSigning());
const signature = await thru.transactions.send(signedWire);

How It Works

The program has two main account types:
  • mint accounts define token-wide metadata and authorities
  • token accounts hold balances for a specific owner and mint
In typical client flows:
  1. derive the mint or token account address
  2. create the account with a state proof for the new address
  3. submit lifecycle or balance-changing instructions against those accounts
  4. read account state or emitted events to verify the new balances and authorities
The Web SDK package mirrors this structure closely: it gives you address derivation helpers, instruction builders, and account parsers for the same program surface.

Account Model

AccountWhat it storesNotes
TokenMintAccountdecimals, supply, creator, mint_authority, freeze_authority, has_freeze_authority, tickerThe mint defines token-wide configuration and supply.
TokenAccountmint, owner, amount, is_frozenEach token account is tied to one mint and one owner.
TokenProgramAccountSize-discriminated envelope over mint and token accountsThe ABI distinguishes mint_account and token_account by expected size.

Address Derivation

Common client flows derive addresses deterministically:
  • mint address: from mintAuthority + seed, then PDA-derived under the Token Program
  • token account address: from owner + mint + seed, then PDA-derived under the Token Program

Required Accounts

Token instructions refer to transaction accounts by index:
  • lifecycle instructions include the mint, token account, authority, and sometimes owner account indices
  • creation flows also include a state proof for the new address
  • the same mint or authority may appear across multiple instructions in one transaction, so the final account list must stay stable
If you are using the Web package, the generated builders and helpers keep the instruction payload aligned with the ABI field names and account-index model.

Events

EventWhat it means
initialize_mintA new mint was created and configured.
initialize_accountA new token account was created for a mint and owner.
transferTokens moved between two token accounts.
mint_toNew supply was minted into a destination token account.
burnSupply was burned from a token account.
close_accountA token account was closed and cleaned up.
freeze_accountA token account was frozen by the freeze authority.
thaw_accountA previously frozen token account was thawed.

Instructions

InstructionUse it whenNotes
initialize_mintCreate a new fungible token mintIncludes ticker, decimals, authorities, seed, and state proof.
initialize_accountCreate a token account for an owner and mintIncludes the new account seed and state proof.
transferMove tokens between token accountsThe common balance-changing path for user transfers.
mint_toIncrease supply and credit a token accountRequires the mint authority.
burnDecrease supply and remove tokens from an accountRequires the account authority.
close_accountClose a token account and reclaim its balanceOften used for cleanup once a balance is empty.
freeze_accountFreeze a token accountRequires the freeze authority on the mint.
thaw_accountUnfreeze a token accountAlso requires the freeze authority.