RPC
The Light Token SDK calls Photon RPC methods internally via interface functions liketransferInterface and getAtaInterface. Call them directly for custom indexing, block explorers, or debugging.
API reference
Create an RPC connection
- TypeScript
- Rust
Light Token
Solana
Get balance
Fetch the parsed state of a light token account, including hot and cold balances.Guide | Example
Light Token
SPL
Transaction history
Fetch merged and deduplicated transaction history across on-chain and compressed transactions.Guide | Example
Light Token
SPL
TypeScript client
@lightprotocol/compressed-token interface functions match the @solana/spl-token API. Use rpc (from createRpc) instead of connection.
Instruction API return types
Some instruction builders return a single instruction, others return a 2D array (TransactionInstruction[][]) where each inner array is one transaction. The 2D shape handles cases where cold balances need loading in a separate preceding transaction.
| Return type | APIs |
|---|---|
TransactionInstruction | createAssociatedTokenAccountInterfaceInstruction, createMintToInterfaceInstruction, createLightTokenTransferInstruction, createWrapInstruction |
TransactionInstruction[][] | createTransferInterfaceInstructions, createLoadAtaInstructions, createUnwrapInstructions |
Create mint
Create a mint account with optional token metadata. The light token program sponsors rent-exemption.Guide | Example | Source
Light Token
SPL
Create associated token account
Create an associated token account. Light-ATAs hold balances of light, SPL, or Token 2022 mints.Guide | Example | Source
Light Token
SPL
Mint tokens
Mint tokens to a destination account. Auto-detects the token program.Guide | Example | Source
Light Token
SPL
Transfer tokens
Transfer tokens between accounts. Handles loading cold state, creating the recipient ATA, and transferring in one call. Supports Light-to-Light, SPL-to-Light, and Light-to-SPL transfers.Guide | Example | Source
Light Token
SPL
Unify fragmented token balances
Unify fragmented token balances
Load ATA
Load ATA
Wrap and unwrap
Wrap and unwrap
Wrap moves tokens from an SPL/Token 2022 account to a Light Token ATA (hot balance). Unwrap moves tokens back to SPL — use this to compose with applications that do not yet support light-token.
Guide | Example (wrap) | Example (unwrap)
Approve delegate
Approve a delegate to spend tokens up to a specified amount.Guide | Example
Light Token
SPL
Revoke delegate
Remove all delegate permissions.Guide | Example
Light Token
SPL
Rust client
light_token_client uses builder structs with .instruction() or .execute(). All instructions map 1:1 to spl_token::instruction::*.
Create mint
Guide | Example | Source
Light Token
SPL
Create associated token account
Guide | Example | Source
Light Token
SPL
Create token account
Guide | Example | Source
Light Token
SPL
Mint tokens
Guide | Example | Source
Light Token
SPL
Transfer (interface)
Unified interface that routes across Light Token, SPL, and Token 2022 accounts.Guide | Example | Source
Light Token
SPL
Transfer (checked)
Transfer with decimal validation.Guide | Example | Source
Light Token
SPL
Burn
Permanently destroy tokens and reduce mint supply.Guide | Example | Source
Light Token
SPL
Freeze and thaw
Freeze prevents all transfers, burns, or closes. Only the freeze authority can freeze or thaw.Guide | Example (freeze) | Example (thaw) | Source
Light Token
SPL
Approve and revoke
Approve a delegate or remove all delegate permissions.Guide | Example (approve) | Example (revoke) | Source
Light Token
SPL
Close token account
Close an empty token account and reclaim lamports.Guide | Example | Source
Light Token
SPL
Wrap and unwrap
Move tokens between SPL/Token 2022 and Light Token accounts.Guide | Example (wrap) | Example (unwrap) | Source
Light Token (no SPL equivalent)
Program CPI
light_token::instruction::*Cpi structs map 1:1 to spl_token::instruction::*. Use .invoke() for external signers or .invoke_signed() for PDA signers. Add .rent_free() to sponsor rent-exemption on account creation.
CreateMintCpi
Create a rent-free mint account via CPI.Guide | Example | Source
Light Token
SPL
CreateAssociatedAccountCpi
Create a rent-free associated token account via CPI.Guide | Example | Source
Light Token
SPL
CreateTokenAccountCpi
Create a rent-free token account via CPI.Guide | Example | Source
Light Token
SPL
MintToCpi
Mint tokens to a destination account via CPI.Guide | Example | Source
Light Token
SPL
TransferCheckedCpi
Transfer with decimal validation via CPI.Guide | Example | Source
Light Token
SPL
BurnCpi
Burn tokens via CPI.Guide | Example | Source
Light Token
SPL
FreezeCpi and ThawCpi
Freeze or thaw a token account via CPI.Guide | Example (freeze) | Example (thaw) | Source
Light Token
SPL
ApproveCpi and RevokeCpi
Approve a delegate or revoke permissions via CPI.Guide | Example (approve) | Example (revoke) | Source
Light Token
SPL
CloseAccountCpi
Close a token account and reclaim lamports via CPI.Guide | Example | Source
Light Token
SPL
Anchor macros
#[light_account(...)] replaces #[account(...)] for rent-free account initialization. Add #[light_program] above #[program] to enable compression.
Create mint
Guide | Example | Source
Light Token
Anchor
Create mint with metadata
Metadata fields are declared inline instead of requiring a separate CPI.Guide | Example | Source
Light Token
Anchor + Token 2022
Create associated token account
Guide | Example | Source
Light Token
Anchor
Create token account (vault)
Guide | Example | Source
Light Token
Anchor
Light-PDA init
Add#[light_program] above #[program], derive LightAccount on state structs with a compression_info field, and derive LightAccounts on the accounts struct.
Guide | Example | Source