@thru/token-program is the root package for building and reading Thru token-program data.
Use it when you need to create token instructions, derive token addresses, parse mint or token account state, or format token amounts for display.
Install
Root export
The package exposes a single root entrypoint. Import everything you need from@thru/token-program.
When to use it
Use@thru/token-program when you are working at the token-program layer. If you need the full RPC client and transaction workflows around tokens, use @thru/thru-sdk. If you only need generated request/response types, use @thru/proto.
Main entrypoints
Instruction builders
These helpers return an asyncInstructionData function that accepts an AccountLookupContext and resolves to serialized instruction bytes.
createInitializeMintInstructioncreateInitializeAccountInstructioncreateMintToInstructioncreateTransferInstructionbuildTokenInstructionBytes
createInitializeMintInstruction and createInitializeAccountInstruction when you are setting up a new mint or token account. Use createMintToInstruction and createTransferInstruction when you are moving balances after accounts already exist.
Address derivation
deriveMintAddressderiveTokenAccountAddressderiveWalletSeed
deriveMintAddress expects a 32-byte hex seed, and deriveTokenAccountAddress defaults to a 32-byte zero seed.
Account parsing
parseMintAccountDataparseTokenAccountDataisAccountNotFoundError
Account from @thru/thru-sdk and want typed mint or token account details back. The parsers return MintAccountInfo and TokenAccountInfo.
Formatting and helpers
formatRawAmountbytesToHexhexToBytesPUBKEY_LENGTHTICKER_MAX_LENGTHZERO_PUBKEY
Common flow
For a mint setup flow, the package typically looks like this:- Derive the mint or token account address.
- Build the initialization instruction.
- Serialize the instruction bytes with
AccountLookupContext. - Parse the resulting account data later with the account helpers.
createTransferInstruction.