Skip to main content
Install the agent skill:
See the AI tools guide for dedicated skills.

Create an RPC connection

Helius exposes Solana and Photon RPC endpoints through a single URL. It’s a thin wrapper extending Solana’s Connection class that allows you to query cold Light Token balances.
Light
SPL
The Light Token SDK calls RPC methods internally via interface functions like transferInterface and getAtaInterface. Call them directly for custom indexing, block explorers, or debugging. See JSON RPC Methods.
Fetch the parsed state of a light token account, including hot and cold balances.
Guide | Example
SPL
Fetch merged and deduplicated transaction history across on-chain and compressed transactions.
Guide | Example
SPL

Client

Both @lightprotocol/compressed-token (TypeScript) and light_token_client (Rust) match the SPL Token API.

Create mint

Create a mint account with optional token metadata.
Guide | Example (TS) | Example (Rust)

Add rent-free mint with token metadata

Open in Cursor

Create associated token account

Associated light token accounts can hold balances of light, SPL, or Token 2022 mints.
Guide | Example (TS) | Example (Rust)

Create rent-free associated token account

Open in Cursor

Mint tokens

Mint Light, SPL and Token 2022 tokens to a destination account. The SDK auto-detects the token program based on the mint address you pass. When no programId is passed, all three token programs are queried in parallel and returns the first successful result. The priority order is SPL Token → Token 2022 → Light Token.
Guide | Example (TS) | Example (Rust)

Mint tokens to Light Token account

Open in Cursor

Transfer tokens with Transferinterface

The interface detects account types and invokes the right programs.
Light Token -> Light Token Account
  • Transfers tokens between Light Token accounts
SPL token -> Light Token Account
  • Transfers SPL tokens to Light Token accounts
  • SPL tokens are locked in interface PDA
  • Tokens are minted to Light Token account
Light Token -> SPL Account
  • Releases SPL tokens from interface PDA to SPL account
  • Burns tokens in source Light Token account
Guide | Example (TS) | Example (Rust)
For payment flows, createTransferInterfaceInstructions returns TransactionInstruction[][] — handles loading cold state and transferring in one call:
Guide | Example (instruction) | Example (action)
Your app logic may require you to create a single sign request for your user:
While almost always you will have only one transfer transaction, you can optimize sending in the rare cases where you have multiple transactions. Parallelize the loads, confirm them, and then send the transfer instruction after.
Load creates the ATA if needed and loads any compressed state into it. Light Token accounts auto-compress inactive accounts. Before any action, the SDK detects cold balances and adds instructions to load them.
Guide | Example | Source

Transfer tokens between Light Token and SPL accounts

Open in Cursor

Wrap and unwrap

Wrap moves tokens from an SPL/Token 2022 account to a Light Token associated token account (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)

Wrap and unwrap SPL tokens to Light Token

Open in Cursor

Approve delegate

Approve a delegate to spend tokens up to a specified amount.
Guide | Example (TS) | Example (Rust)
SPL

Approve and revoke token delegates

Open in Cursor

Revoke delegate

Remove all delegate permissions.
Guide | Example (TS) | Example (Rust)
SPL

Approve and revoke token delegates

Open in Cursor

Create token account

Guide | Example
SPL

Create Light Token account

Open in Cursor

Burn

Permanently destroy tokens and reduce mint supply.
Guide | Example
SPL

Burn Light Tokens

Open in Cursor

Freeze and thaw

Freeze prevents all transfers, burns, or closes. Only the freeze authority can freeze or thaw.
Guide | Example (freeze) | Example (thaw)
SPL

Freeze and thaw Light Token accounts

Open in Cursor

Close token account

Close an empty token account and reclaim lamports.
Guide | Example
SPL

Close Light Token account

Open in Cursor

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
SPL

Add create-mint CPI to an Anchor program

Open in Cursor

CreateAssociatedAccountCpi

Create a rent-free associated token account via CPI.
Guide | Example | Source
SPL

Add create-ATA CPI to an Anchor program

Open in Cursor

CreateTokenAccountCpi

Create a rent-free token account via CPI.
Guide | Example | Source
SPL

Add create-token-account CPI to an Anchor program

Open in Cursor

MintToCpi

Mint tokens to a destination account via CPI.
Guide | Example | Source
SPL

Add mint-to CPI to an Anchor program

Open in Cursor

Transfer

Transfer with decimal validation via CPI.
Guide | Example | Source
SPL

Add transfer-checked CPI to an Anchor program

Open in Cursor

TransferInterfaceCpi

Transfer tokens across SPL, Token 2022, and Light Token accounts via CPI. The interface auto-detects the token type and routes to the correct program.
Guide | Example | Source
Light
SPL

Add transfer-interface CPI to an Anchor program

Open in Cursor

BurnCpi

Burn tokens via CPI.
Guide | Example | Source
SPL

Add burn CPI to an Anchor program

Open in Cursor

FreezeCpi and ThawCpi

Freeze or thaw a token account via CPI.
Guide | Example (freeze) | Example (thaw) | Source
SPL

Add freeze and thaw CPI to an Anchor program

Open in Cursor

ApproveCpi and RevokeCpi

Approve a delegate or revoke permissions via CPI.
Guide | Example (approve) | Example (revoke) | Source
SPL

Add approve and revoke CPI to an Anchor program

Open in Cursor

CloseAccountCpi

Close a token account and reclaim lamports via CPI.
Guide | Example | Source
SPL

Add close-account CPI to an Anchor program

Open in Cursor

Anchor macros

#[light_account(...)] replaces #[account(...)] for rent-free account initialization. Add #[light_program] above #[program] to enable compression.

Create mint

Guide | Example | Source
Anchor

Create a rent-free mint with Anchor macros

Open in Cursor

Create mint with metadata

Metadata fields are declared inline instead of requiring a separate CPI.
Guide | Example | Source
Anchor

Create a rent-free mint with Anchor macros

Open in Cursor

Create associated token account

Guide | Example | Source
Anchor

Create a rent-free ATA with Anchor macros

Open in Cursor

Create token account (vault)

Guide | Example | Source
Anchor

Create a rent-free token account with Anchor macros

Open in Cursor

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
Anchor

Add rent-free PDAs to an Anchor program

Open in Cursor