
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@thru/token-program
Advanced tools
TypeScript bindings for the Thru on-chain token program. Provides instruction builders, account parsers, address derivation, and formatting utilities for creating and managing tokens on the Thru network.
TypeScript bindings for the Thru on-chain token program. Provides instruction builders, account parsers, address derivation, and formatting utilities for creating and managing tokens on the Thru network.
pnpm add @thru/token-program
Peer dependencies: @thru/helpers, @thru/thru-sdk.
import {
createInitializeMintInstruction,
deriveMintAddress,
} from '@thru/token-program';
const { address, bytes, derivedSeed } = deriveMintAddress(
mintAuthorityAddress,
seedHex,
tokenProgramAddress
);
const instruction = createInitializeMintInstruction({
mintAccountBytes: bytes,
decimals: 6,
mintAuthorityBytes: authorityBytes,
ticker: 'MYTOKEN',
seedHex,
stateProof,
});
import {
createInitializeAccountInstruction,
deriveTokenAccountAddress,
} from '@thru/token-program';
const { bytes: tokenAccountBytes, derivedSeed } = deriveTokenAccountAddress(
ownerAddress,
mintAddress,
tokenProgramAddress
);
const instruction = createInitializeAccountInstruction({
tokenAccountBytes,
mintAccountBytes,
ownerAccountBytes,
seedBytes: derivedSeed,
stateProof,
});
import { createTransferInstruction } from '@thru/token-program';
const instruction = createTransferInstruction({
sourceAccountBytes,
destinationAccountBytes,
amount: 1_000_000n,
});
import { parseMintAccountData, parseTokenAccountData } from '@thru/token-program';
const mintInfo = parseMintAccountData(account);
// { decimals, supply, creator, mintAuthority, freezeAuthority, ticker, ... }
const tokenInfo = parseTokenAccountData(account);
// { mint, owner, amount, isFrozen }
import { formatRawAmount } from '@thru/token-program';
formatRawAmount(1_500_000n, 6); // "1.5"
formatRawAmount(1_000_000n, 6); // "1"
createInitializeMintInstruction, createInitializeAccountInstruction, createMintToInstruction, createTransferInstructionderiveMintAddress, deriveTokenAccountAddress, deriveWalletSeedparseMintAccountData, parseTokenAccountData decode raw on-chain data into typed objectsformatRawAmount, bytesToHex, hexToBytesEach instruction builder returns an InstructionData function that accepts an AccountLookupContext and resolves to the serialized instruction bytes.
| Function | Description |
|---|---|
createInitializeMintInstruction(args) | Create a new token mint with ticker, decimals, and authorities |
createInitializeAccountInstruction(args) | Create a token account for a given owner and mint |
createMintToInstruction(args) | Mint new tokens to a destination account |
createTransferInstruction(args) | Transfer tokens between accounts |
buildTokenInstructionBytes(variant, payload) | Low-level helper to wrap a payload in a token instruction envelope |
| Function | Description |
|---|---|
deriveMintAddress(authority, seed, programAddress) | Derive the deterministic address for a token mint |
deriveTokenAccountAddress(owner, mint, programAddress, seed?) | Derive the deterministic address for a token account |
deriveWalletSeed(walletAddress, extraSeeds?) | Derive a seed from a wallet address |
| Function | Description |
|---|---|
parseMintAccountData(account) | Parse raw account data into MintAccountInfo |
parseTokenAccountData(account) | Parse raw account data into TokenAccountInfo |
isAccountNotFoundError(err) | Check if an error represents a missing account (code 5) |
interface MintAccountInfo {
decimals: number;
supply: bigint;
creator: string;
mintAuthority: string;
freezeAuthority: string | null;
hasFreezeAuthority: boolean;
ticker: string;
}
interface TokenAccountInfo {
mint: string;
owner: string;
amount: bigint;
isFrozen: boolean;
}
| Constant | Value | Description |
|---|---|---|
PUBKEY_LENGTH | 32 | Length of a public key in bytes |
TICKER_MAX_LENGTH | 8 | Maximum ticker string length |
ZERO_PUBKEY | Uint8Array(32) | 32 zero bytes, used as a null public key |
pnpm build # Build with tsup (CJS + ESM + .d.ts)
pnpm dev # Watch mode
pnpm clean # Remove dist/
FAQs
TypeScript bindings for the Thru on-chain token program. Provides instruction builders, account parsers, address derivation, and formatting utilities for creating and managing tokens on the Thru network.
We found that @thru/token-program demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.