Skip to main content
Install the agent skill:
npx skills add https://zkcompression.com
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
import { createRpc, Rpc } from '@lightprotocol/stateless.js';

const RPC_ENDPOINT = 'https://mainnet.helius-rpc.com?api-key=YOUR_KEY';
const connection: Rpc = createRpc(RPC_ENDPOINT, RPC_ENDPOINT);
SPL
import { Connection } from "@solana/web3.js";

const connection = new Connection(RPC_ENDPOINT);
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
import {
  getAssociatedTokenAddressInterface,
  getAtaInterface,
} from "@lightprotocol/compressed-token/unified";

const ata = getAssociatedTokenAddressInterface(mint, owner);
const account = await getAtaInterface(rpc, ata, owner, mint);

console.log(account.parsed.amount);
SPL
import { getAccount } from "@solana/spl-token";

const account = await getAccount(connection, ata);

console.log(account.amount);
Fetch merged and deduplicated transaction history across on-chain and compressed transactions.
Guide | Example
const result = await rpc.getSignaturesForOwnerInterface(owner);

console.log(result.signatures); // Merged + deduplicated
console.log(result.solana);     // On-chain txs only
console.log(result.compressed); // Compressed txs only
SPL
const signatures = await connection.getSignaturesForAddress(ata);

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)
import { createMintInterface } from "@lightprotocol/compressed-token";

const { mint } = await createMintInterface(
  rpc,
  payer,
  mintAuthority,
  freezeAuthority,
  decimals,
  mintKeypair
);
import { createMint } from "@solana/spl-token";

const mint = await createMint(
  connection,
  payer,
  mintAuthority,
  freezeAuthority,
  decimals
);

Add rent-free mint with token metadata

CursorOpen in Cursor
---
description: Add rent-free mint with token metadata
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add rent-free mint with token metadata

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-mint
- Skills and resources index: https://zkcompression.com/skill.md
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js

SPL equivalent: createMint() → Light Token: createMintInterface()

### 1. Index project
- Grep `@solana/spl-token|Connection|Keypair|createMint` across src/
- Glob `**/*.ts` for project structure
- Identify: RPC setup, existing mint logic, entry point for mint creation
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the TypeScript Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have mint operations to extend, or is this greenfield?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing connection/signer setup is compatible with the cookbook prerequisites
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `npm install @lightprotocol/compressed-token @lightprotocol/stateless.js`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `tsc --noEmit`
- Bash run existing test suite if present
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Create associated token account

Associated light token accounts can hold balances of light, SPL, or Token 2022 mints.
Guide | Example (TS) | Example (Rust)
import { createAtaInterface } from "@lightprotocol/compressed-token";

const ata = await createAtaInterface(
  rpc,
  payer,
  mint,
  owner
);
import { getOrCreateAssociatedTokenAccount } from "@solana/spl-token";

const ata = await getOrCreateAssociatedTokenAccount(
  connection,
  payer,
  mint,
  owner
);

Create rent-free associated token account

CursorOpen in Cursor
---
description: Create rent-free associated token account
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Create rent-free associated token account

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-ata
- Skills and resources index: https://zkcompression.com/skill.md
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js

SPL equivalent: createAssociatedTokenAccount() → Light Token: createAtaInterface()

### 1. Index project
- Grep `@solana/spl-token|Connection|Keypair|createAssociatedTokenAccount|createAtaInterface` across src/
- Glob `**/*.ts` for project structure
- Identify: RPC setup, existing ATA logic, entry point for ATA creation
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the TypeScript Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have ATA operations to extend, or is this greenfield?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing connection/signer setup is compatible with the cookbook prerequisites
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `npm install @lightprotocol/compressed-token @lightprotocol/stateless.js`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `tsc --noEmit`
- Bash run existing test suite if present
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

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)
import { mintToInterface } from "@lightprotocol/compressed-token";

const tx = await mintToInterface(
  rpc,
  payer,
  mint,
  destination,
  mintAuthority,
  amount
);
import { mintTo } from "@solana/spl-token";

const tx = await mintTo(
  connection,
  payer,
  mint,
  destination,
  mintAuthority,
  amount
);

Mint tokens to Light Token account

CursorOpen in Cursor
---
description: Mint tokens to Light Token account
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Mint tokens to Light Token account

Context:
- Guide: https://zkcompression.com/light-token/cookbook/mint-to
- Skills and resources index: https://zkcompression.com/skill.md
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js

SPL equivalent: mintTo() → Light Token: mintToInterface()

### 1. Index project
- Grep `@solana/spl-token|Connection|Keypair|mintTo|mintToInterface` across src/
- Glob `**/*.ts` for project structure
- Identify: RPC setup, existing mint logic, entry point for minting
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the TypeScript Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have mint operations to extend, or is this greenfield?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing connection/signer setup is compatible with the cookbook prerequisites
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `npm install @lightprotocol/compressed-token @lightprotocol/stateless.js`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `tsc --noEmit`
- Bash run existing test suite if present
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

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)
import { transferInterface } from "@lightprotocol/compressed-token/unified";

const tx = await transferInterface(
  rpc,
  payer,
  sourceAta,
  mint,
  recipient,
  owner,
  amount
);
import { transfer } from "@solana/spl-token";

const tx = await transfer(
  connection,
  payer,
  sourceAta,
  destinationAta,
  owner,
  amount
);
For payment flows, createTransferInterfaceInstructions returns TransactionInstruction[][] — handles loading cold state and transferring in one call:
Guide | Example (instruction) | Example (action)
import { Transaction } from "@solana/web3.js";
import { createTransferInterfaceInstructions } from "@lightprotocol/compressed-token/unified";

// Returns TransactionInstruction[][].
// Each inner array is one transaction.
// Almost always returns just one.
const instructions = await createTransferInterfaceInstructions(
  rpc,
  payer.publicKey,
  mint,
  amount,
  owner.publicKey,
  recipient
);

for (const ixs of instructions) {
  const tx = new Transaction().add(...ixs);

  // sign and send ...
}
Your app logic may require you to create a single sign request for your user:
const transactions = instructions.map((ixs) => new Transaction().add(...ixs));

// One approval for all
const signed = await wallet.signAllTransactions(transactions);

for (const tx of signed) {
  // send...
  await sendAndConfirmTransaction(rpc, tx);
}
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.
import {
  createTransferInterfaceInstructions,
  sliceLast,
} from "@lightprotocol/compressed-token/unified";

const instructions = await createTransferInterfaceInstructions(
  rpc,
  payer.publicKey,
  mint,
  amount,
  owner.publicKey,
  recipient
);
const { rest: loadInstructions, last: transferInstructions } = sliceLast(instructions);
// empty = nothing to load, will no-op.
await Promise.all(
  loadInstructions.map((ixs) => {
    const tx = new Transaction().add(...ixs);
    tx.sign(payer, owner);
    return sendAndConfirmTransaction(rpc, tx);
  })
);

const transferTx = new Transaction().add(...transferInstructions);
transferTx.sign(payer, owner);
await sendAndConfirmTransaction(rpc, transferTx);
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
import {
  loadAta,
  getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token/unified";

const ata = getAssociatedTokenAddressInterface(mint, recipient);

const sig = await loadAta(rpc, ata, recipient, mint, payer);

Transfer tokens between Light Token and SPL accounts

CursorOpen in Cursor
---
description: Transfer tokens between Light Token and SPL accounts
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Transfer tokens between Light Token and SPL accounts

Context:
- Guide: https://zkcompression.com/light-token/cookbook/transfer-interface
- Skills and resources index: https://zkcompression.com/skill.md
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js

transferInterface() transfers tokens between token accounts (SPL, Token 2022, or Light Token) in a single call.
- Light Token → Light Token: transfers between Light Token accounts
- SPL → Light Token: locks SPL tokens in interface PDA, mints to Light Token account
- Light Token → SPL: burns Light Token balance, releases SPL tokens from interface PDA

### 1. Index project
- Grep `@solana/spl-token|Connection|Keypair|transfer|transferInterface` across src/
- Glob `**/*.ts` for project structure
- Identify: RPC setup, existing transfer logic, entry point for transfers
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the TypeScript Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have transfer operations to extend, or is this greenfield?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing connection/signer setup is compatible with the cookbook prerequisites
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `npm install @lightprotocol/compressed-token @lightprotocol/stateless.js`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `tsc --noEmit`
- Bash run existing test suite if present
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

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)
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
import {
  wrap,
  unwrap,
  getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token/unified";

const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey);
const tokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey);

// Wrap: SPL → Light
await wrap(rpc, payer, splAta, tokenAta, owner, mint, amount);

// Unwrap: Light → SPL
await unwrap(rpc, payer, splAta, owner, mint, amount);

Wrap and unwrap SPL tokens to Light Token

CursorOpen in Cursor
---
description: Wrap and unwrap SPL tokens to Light Token
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Wrap and unwrap SPL tokens to Light Token

Context:
- Guide: https://zkcompression.com/light-token/cookbook/wrap-unwrap
- Skills and resources index: https://zkcompression.com/skill.md
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js

- Wrap: Move tokens from SPL or Token 2022 account → Light Token associated token account (hot balance)
- Unwrap: Move tokens from Light Token associated token account (hot balance) → SPL or Token 2022 account

### 1. Index project
- Grep `@solana/spl-token|Connection|Keypair|wrap|unwrap|WrapTokens|UnwrapTokens` across src/
- Glob `**/*.ts` for project structure
- Identify: RPC setup, existing wrap/unwrap logic, entry point for wrap/unwrap
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the TypeScript Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have wrap/unwrap operations to extend, or is this greenfield?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing connection/signer setup is compatible with the cookbook prerequisites
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `npm install @lightprotocol/compressed-token @lightprotocol/stateless.js`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `tsc --noEmit`
- Bash run existing test suite if present
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Approve delegate

Approve a delegate to spend tokens up to a specified amount.
Guide | Example (TS) | Example (Rust)
import { approve } from "@lightprotocol/compressed-token";

const tx = await approve(
  rpc,
  payer,
  mint,
  amount,
  owner,
  delegate
);
SPL
import { approve } from "@solana/spl-token";

const tx = await approve(
  connection,
  payer,
  source,
  delegate,
  owner,
  amount
);

Approve and revoke token delegates

CursorOpen in Cursor
---
description: Approve and revoke token delegates
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Approve and revoke token delegates

Context:
- Guide: https://zkcompression.com/light-token/cookbook/approve-revoke
- Skills and resources index: https://zkcompression.com/skill.md
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js

SPL equivalent: approve() / revoke() → Light Token: approve() / revoke()

### 1. Index project
- Grep `@solana/spl-token|Connection|Keypair|approve|revoke|delegate` across src/
- Glob `**/*.ts` for project structure
- Identify: RPC setup, existing delegation logic, entry point for delegation
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the TypeScript Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have delegate operations to extend, or is this greenfield?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing connection/signer setup is compatible with the cookbook prerequisites
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `npm install @lightprotocol/compressed-token @lightprotocol/stateless.js`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `tsc --noEmit`
- Bash run existing test suite if present
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Revoke delegate

Remove all delegate permissions.
Guide | Example (TS) | Example (Rust)
import { revoke } from "@lightprotocol/compressed-token";

const tx = await revoke(
  rpc,
  payer,
  delegatedAccounts,
  owner
);
SPL
import { revoke } from "@solana/spl-token";

const tx = await revoke(
  connection,
  payer,
  source,
  owner
);

Approve and revoke token delegates

CursorOpen in Cursor
---
description: Approve and revoke token delegates
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Approve and revoke token delegates

Context:
- Guide: https://zkcompression.com/light-token/cookbook/approve-revoke
- Skills and resources index: https://zkcompression.com/skill.md
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js

SPL equivalent: approve() / revoke() → Light Token: approve() / revoke()

### 1. Index project
- Grep `@solana/spl-token|Connection|Keypair|approve|revoke|delegate` across src/
- Glob `**/*.ts` for project structure
- Identify: RPC setup, existing delegation logic, entry point for delegation
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the TypeScript Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have delegate operations to extend, or is this greenfield?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing connection/signer setup is compatible with the cookbook prerequisites
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `npm install @lightprotocol/compressed-token @lightprotocol/stateless.js`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `tsc --noEmit`
- Bash run existing test suite if present
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Create token account

Guide | Example
use light_token::instruction::CreateTokenAccount;

let ix = CreateTokenAccount::new(
    payer.pubkey(),
    account.pubkey(),
    mint,
    owner,
)
.instruction()?;
SPL
use spl_token::instruction::initialize_account;

let ix = initialize_account(
    &spl_token::id(),
    &account,
    &mint,
    &owner,
)?;

Create Light Token account

CursorOpen in Cursor
---
description: Create Light Token account
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Create Light Token account

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-token-account
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)

SPL equivalent: spl_token::instruction::initialize_account → Light Token: CreateTokenAccount

### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|CreateTokenAccount|initialize_account` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for token account creation
- Check Cargo.toml for existing light-* dependencies and solana-sdk version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the Rust Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have token account operations to extend, or is this greenfield?
- AskUserQuestion: action-level API (high-level, fewer lines) or instruction-level API (low-level, full control)?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing Rpc/signer setup is compatible with the cookbook prerequisites (light_client::rpc::Rpc, solana_sdk::signature::Keypair)
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token-client light-token light-client --features light-client/v2`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `cargo check`
- Bash `cargo test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Burn

Permanently destroy tokens and reduce mint supply.
Guide | Example
use light_token::instruction::Burn;

let ix = Burn {
    source,
    mint,
    amount,
    authority: payer.pubkey(),
    max_top_up: None,
    fee_payer: None,
}
.instruction()?;
SPL
use spl_token::instruction::burn;

let ix = burn(
    &spl_token::id(),
    &source,
    &mint,
    &authority,
    &[],
    amount,
)?;

Burn Light Tokens

CursorOpen in Cursor
---
description: Burn Light Tokens
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Burn Light Tokens

Context:
- Guide: https://zkcompression.com/light-token/cookbook/burn
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)

SPL equivalent: spl_token::instruction::burn → Light Token: Burn

### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|Burn|burn` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for burn
- Check Cargo.toml for existing light-* dependencies and solana-sdk version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the Rust Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have burn operations to extend, or is this greenfield?
- AskUserQuestion: action-level API (high-level, fewer lines) or instruction-level API (low-level, full control)?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing Rpc/signer setup is compatible with the cookbook prerequisites (light_client::rpc::Rpc, solana_sdk::signature::Keypair)
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token-client light-token light-client --features light-client/v2`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `cargo check`
- Bash `cargo test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Freeze and thaw

Freeze prevents all transfers, burns, or closes. Only the freeze authority can freeze or thaw.
Guide | Example (freeze) | Example (thaw)
use light_token::instruction::Freeze;

let ix = Freeze {
    token_account: ata,
    mint,
    freeze_authority: payer.pubkey(),
}
.instruction()?;
use light_token::instruction::Thaw;

let ix = Thaw {
    token_account: ata,
    mint,
    freeze_authority: payer.pubkey(),
}
.instruction()?;
SPL
use spl_token::instruction::{freeze_account, thaw_account};

let ix = freeze_account(
    &spl_token::id(),
    &account,
    &mint,
    &freeze_authority,
    &[],
)?;

let ix = thaw_account(
    &spl_token::id(),
    &account,
    &mint,
    &freeze_authority,
    &[],
)?;

Freeze and thaw Light Token accounts

CursorOpen in Cursor
---
description: Freeze and thaw Light Token accounts
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Freeze and thaw Light Token accounts

Context:
- Guide: https://zkcompression.com/light-token/cookbook/freeze-thaw
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)

- Freeze: prevents all transfers or token burns from a specific Light Token account
- Thaw: re-enables transfers on a frozen Light Token account
- Only the freeze authority (set at mint creation) can freeze or thaw accounts

SPL equivalent: spl_token::instruction::freeze_account / thaw_account → Light Token: Freeze / Thaw

### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|Freeze|Thaw|freeze_account|thaw_account` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for freeze/thaw
- Check Cargo.toml for existing light-* dependencies and solana-sdk version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the Rust Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have freeze/thaw operations to extend, or is this greenfield?
- AskUserQuestion: action-level API (high-level, fewer lines) or instruction-level API (low-level, full control)?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing Rpc/signer setup is compatible with the cookbook prerequisites (light_client::rpc::Rpc, solana_sdk::signature::Keypair)
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token-client light-token light-client --features light-client/v2`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `cargo check`
- Bash `cargo test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Close token account

Close an empty token account and reclaim lamports.
Guide | Example
use light_token::instruction::{CloseAccount, LIGHT_TOKEN_PROGRAM_ID};

let ix = CloseAccount::new(
    LIGHT_TOKEN_PROGRAM_ID,
    account,
    destination,
    owner,
)
.instruction()?;
SPL
use spl_token::instruction::close_account;

let ix = close_account(
    &spl_token::id(),
    &account,
    &destination,
    &owner,
    &[],
)?;

Close Light Token account

CursorOpen in Cursor
---
description: Close Light Token account
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Close Light Token account

Context:
- Guide: https://zkcompression.com/light-token/cookbook/close-token-account
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)

SPL equivalent: spl_token::instruction::close_account → Light Token: CloseAccount

### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|CloseAccount|close_account` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for close account
- Check Cargo.toml for existing light-* dependencies and solana-sdk version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — follow the Rust Client tab
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new feature, migrate existing SPL code, add alongside existing)
- AskUserQuestion: does the project already have close operations to extend, or is this greenfield?
- AskUserQuestion: action-level API (high-level, fewer lines) or instruction-level API (low-level, full control)?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Verify existing Rpc/signer setup is compatible with the cookbook prerequisites (light_client::rpc::Rpc, solana_sdk::signature::Keypair)
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token-client light-token light-client --features light-client/v2`
- Follow the cookbook guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `cargo check`
- Bash `cargo test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

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
use light_token::instruction::CreateMintCpi;

CreateMintCpi {
    mint_seed: mint_seed.clone(),
    authority: authority.clone(),
    payer: payer.clone(),
    address_tree: address_tree.clone(),
    output_queue: output_queue.clone(),
    compressible_config: compressible_config.clone(),
    mint: mint.clone(),
    rent_sponsor: rent_sponsor.clone(),
    system_accounts,
    cpi_context: None,
    cpi_context_account: None,
    params,
}
.invoke()?
SPL
use spl_token::instruction::initialize_mint;

let ix = initialize_mint(
    &spl_token::id(),
    &mint.pubkey(),
    &mint_authority,
    Some(&freeze_authority),
    decimals,
)?;

invoke(&ix, &[mint, rent_sysvar])?;

Add create-mint CPI to an Anchor program

CursorOpen in Cursor
---
description: Add create-mint CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add create-mint CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-mint
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (CreateMintCpi, CreateMintParams, SystemAccountInfos)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/create-mint

Key CPI struct: `light_token::instruction::CreateMintCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|mint|decimals|authority|metadata` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, mint seeds
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the CPI tab under Program: token metadata config, mint params, system accounts, invoke patterns
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add create-mint to existing program, new program from scratch, migrate from SPL create_mint)
- AskUserQuestion: should the mint seed be an external keypair or a PDA? (determines invoke vs invoke_signed)
- AskUserQuestion: do you need token metadata (name, symbol, uri)?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Configure Token Metadata → Configure Mint Params → System Accounts → Build CPI and invoke
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

CreateAssociatedAccountCpi

Create a rent-free associated token account via CPI.
Guide | Example | Source
use light_token::instruction::CreateAssociatedAccountCpi;

CreateAssociatedAccountCpi {
    payer: payer.clone(),
    owner: owner.clone(),
    mint: mint.clone(),
    ata: associated_token_account.clone(),
    bump,
}
.rent_free(
    compressible_config.clone(),
    rent_sponsor.clone(),
    system_program.clone(),
)
.invoke()?
SPL
use spl_associated_token_account::instruction::create_associated_token_account;

let ix = create_associated_token_account(
    &payer.pubkey(),
    &owner.pubkey(),
    &mint,
    &spl_token::id(),
);

invoke(&ix, &[payer, owner, mint])?;

Add create-ATA CPI to an Anchor program

CursorOpen in Cursor
---
description: Add create-ATA CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add create-ATA CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-ata
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (CreateAssociatedAccountCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/create-associated-token-account

Key CPI struct: `light_token::instruction::CreateAssociatedAccountCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|ata|associated|owner|mint` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, ATA derivation
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the CPI tab under Program: ATA creation with .rent_free() chain
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add create-ATA to existing program, new program from scratch, migrate from SPL create_associated_token_account)
- AskUserQuestion: should the payer be an external signer or a PDA? (determines invoke vs invoke_signed)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build CreateAssociatedAccountCpi → .rent_free() → .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

CreateTokenAccountCpi

Create a rent-free token account via CPI.
Guide | Example | Source
use light_token::instruction::CreateTokenAccountCpi;

CreateTokenAccountCpi {
    payer: payer.clone(),
    account: account.clone(),
    mint: mint.clone(),
    owner,
}
.rent_free(
    compressible_config.clone(),
    rent_sponsor.clone(),
    system_program.clone(),
    token_program.key,
)
.invoke()?
SPL
use spl_token::instruction::initialize_account;

let ix = initialize_account(
    &spl_token::id(),
    &account,
    &mint,
    &owner,
)?;

invoke(&ix, &[account, mint, owner])?;

Add create-token-account CPI to an Anchor program

CursorOpen in Cursor
---
description: Add create-token-account CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add create-token-account CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-token-account
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (CreateTokenAccountCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/create-token-account

Key CPI struct: `light_token::instruction::CreateTokenAccountCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|token_account|vault|owner|mint` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, vault/token account patterns
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the CPI tab under Program: token account creation with .rent_free() chain
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add create-token-account to existing program, new program from scratch, migrate from SPL token account init)
- AskUserQuestion: should the payer be an external signer or a PDA? (determines invoke vs invoke_signed)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build CreateTokenAccountCpi → .rent_free() → .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

MintToCpi

Mint tokens to a destination account via CPI.
Guide | Example | Source
use light_token::instruction::MintToCpi;

MintToCpi {
    mint: mint.clone(),
    destination: destination.clone(),
    authority: authority.clone(),
    amount,
    fee_payer: None,
    max_top_up: None,
}
.invoke()?
SPL
use spl_token::instruction::mint_to;

let ix = mint_to(
    &spl_token::id(),
    &mint,
    &destination,
    &mint_authority,
    &[],
    amount,
)?;

invoke(&ix, &[mint, destination, authority])?;

Add mint-to CPI to an Anchor program

CursorOpen in Cursor
---
description: Add mint-to CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add mint-to CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/mint-to
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (MintToCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/mint-to

Key CPI struct: `light_token::instruction::MintToCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|mint|supply|amount` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, mint accounts
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Program tab CPI code samples
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add mint-to to existing program, new program from scratch, migrate from SPL mint_to)
- AskUserQuestion: should the authority be an external signer or a PDA? (determines invoke vs invoke_signed)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build MintToCpi struct → call .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Transfer

Transfer with decimal validation via CPI.
Guide | Example | Source
use light_token::instruction::TransferCheckedCpi;

TransferCheckedCpi {
    source: source.clone(),
    destination: destination.clone(),
    mint: mint.clone(),
    authority: authority.clone(),
    amount,
    decimals,
}
.invoke()?
SPL
use spl_token::instruction::transfer_checked;

let ix = transfer_checked(
    &spl_token::id(),
    &source,
    &mint,
    &destination,
    &authority,
    &[],
    amount,
    decimals,
)?;

invoke(&ix, &[source, mint, destination, authority])?;

Add transfer-checked CPI to an Anchor program

CursorOpen in Cursor
---
description: Add transfer-checked CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add transfer-checked CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/transfer-checked
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (TransferCheckedCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/transfer-checked

Key CPI struct: `light_token::instruction::TransferCheckedCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|transfer|decimals|amount` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, token accounts
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Program tab CPI code samples
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add transfer-checked to existing program, new program from scratch, migrate from SPL transfer_checked)
- AskUserQuestion: should the authority be an external signer or a PDA? (determines invoke vs invoke_signed)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build TransferCheckedCpi struct → call .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

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
use light_token::instruction::TransferInterfaceCpi;

TransferInterfaceCpi::new(
    amount,
    decimals,
    source.clone(),
    destination.clone(),
    authority.clone(),
    payer.clone(),
    light_token_authority.clone(),
    system_program.clone(),
)
.invoke()?;
SPL
use spl_token::instruction::transfer_checked;

let ix = transfer_checked(
    &spl_token::id(),
    &source,
    &mint,
    &destination,
    &authority,
    &[],
    amount,
    decimals,
)?;

invoke(&ix, &[source, mint, destination, authority])?;

Add transfer-interface CPI to an Anchor program

CursorOpen in Cursor
---
description: Add transfer-interface CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add transfer-interface CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/transfer-interface
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (TransferInterfaceCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/transfer-interface

Key CPI struct: `light_token::instruction::TransferInterfaceCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|transfer|decimals|interface` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, token accounts
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Program tab CPI code samples
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add transfer-interface to existing program, new program from scratch, migrate from SPL transfer)
- AskUserQuestion: should the authority be an external signer or a PDA? (determines invoke vs invoke_signed)
- AskUserQuestion: which token types will be transferred? (SPL, Token 2022, Light Token, or all via interface)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build TransferInterfaceCpi → call .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

BurnCpi

Burn tokens via CPI.
Guide | Example | Source
use light_token::instruction::BurnCpi;

BurnCpi {
    source: source.clone(),
    mint: mint.clone(),
    authority: authority.clone(),
    amount,
}
.invoke()?
SPL
use spl_token::instruction::burn;

let ix = burn(
    &spl_token::id(),
    &source,
    &mint,
    &authority,
    &[],
    amount,
)?;

invoke(&ix, &[source, mint, authority])?;

Add burn CPI to an Anchor program

CursorOpen in Cursor
---
description: Add burn CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add burn CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/burn
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (BurnCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/burn

Key CPI struct: `light_token::instruction::BurnCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|burn|destroy|supply` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, token accounts
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Program tab CPI code samples
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add burn to existing program, new program from scratch, migrate from SPL burn)
- AskUserQuestion: should the authority be an external signer or a PDA? (determines invoke vs invoke_signed)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build BurnCpi struct → call .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

FreezeCpi and ThawCpi

Freeze or thaw a token account via CPI.
Guide | Example (freeze) | Example (thaw) | Source
use light_token::instruction::FreezeCpi;

FreezeCpi {
    token_account: token_account.clone(),
    mint: mint.clone(),
    freeze_authority: freeze_authority.clone(),
}
.invoke()?
use light_token::instruction::ThawCpi;

ThawCpi {
    token_account: token_account.clone(),
    mint: mint.clone(),
    freeze_authority: freeze_authority.clone(),
}
.invoke()?
SPL
use spl_token::instruction::{freeze_account, thaw_account};

let ix = freeze_account(
    &spl_token::id(), &account, &mint, &freeze_authority, &[],
)?;
invoke(&ix, &[account, mint, freeze_authority])?;

let ix = thaw_account(
    &spl_token::id(), &account, &mint, &freeze_authority, &[],
)?;
invoke(&ix, &[account, mint, freeze_authority])?;

Add freeze and thaw CPI to an Anchor program

CursorOpen in Cursor
---
description: Add freeze and thaw CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add freeze and thaw CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/freeze-thaw
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (FreezeCpi, ThawCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/freeze

Key CPI structs: `light_token::instruction::FreezeCpi`, `light_token::instruction::ThawCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|freeze|thaw|authority` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, freeze authority
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review both Freeze and Thaw CPI code samples
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add freeze/thaw to existing program, new program from scratch, migrate from SPL freeze/thaw)
- AskUserQuestion: should the freeze authority be an external signer or a PDA? (determines invoke vs invoke_signed)
- AskUserQuestion: do you need both freeze and thaw, or just one?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build FreezeCpi/ThawCpi structs → call .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

ApproveCpi and RevokeCpi

Approve a delegate or revoke permissions via CPI.
Guide | Example (approve) | Example (revoke) | Source
use light_token::instruction::ApproveCpi;

ApproveCpi {
    token_account: token_account.clone(),
    delegate: delegate.clone(),
    owner: owner.clone(),
    amount,
}
.invoke()?
use light_token::instruction::RevokeCpi;

RevokeCpi {
    token_account: token_account.clone(),
    owner: owner.clone(),
}
.invoke()?
SPL
use spl_token::instruction::{approve, revoke};

let ix = approve(
    &spl_token::id(), &source, &delegate, &owner, &[], amount,
)?;
invoke(&ix, &[source, delegate, owner])?;

let ix = revoke(
    &spl_token::id(), &source, &owner, &[],
)?;
invoke(&ix, &[source, owner])?;

Add approve and revoke CPI to an Anchor program

CursorOpen in Cursor
---
description: Add approve and revoke CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add approve and revoke CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/approve-revoke
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (ApproveCpi, RevokeCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/approve

Key CPI structs: `light_token::instruction::ApproveCpi`, `light_token::instruction::RevokeCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|approve|revoke|delegate` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, delegate accounts
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review both Approve and Revoke CPI code samples
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add approve/revoke to existing program, new program from scratch, migrate from SPL approve/revoke)
- AskUserQuestion: should the owner be an external signer or a PDA? (determines invoke vs invoke_signed)
- AskUserQuestion: do you need both approve and revoke, or just one?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build ApproveCpi/RevokeCpi structs → call .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

CloseAccountCpi

Close a token account and reclaim lamports via CPI.
Guide | Example | Source
use light_token::instruction::CloseAccountCpi;

CloseAccountCpi {
    account: account.clone(),
    destination: destination.clone(),
    authority: authority.clone(),
}
.invoke()?
SPL
use spl_token::instruction::close_account;

let ix = close_account(
    &spl_token::id(), &account, &destination, &owner, &[],
)?;
invoke(&ix, &[account, destination, owner])?;

Add close-account CPI to an Anchor program

CursorOpen in Cursor
---
description: Add close-account CPI to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add close-account CPI to an Anchor program

Context:
- Guide: https://zkcompression.com/light-token/cookbook/close-token-account
- Skills and resources index: https://zkcompression.com/skill.md
- Crate: light-token (CloseAccountCpi)
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-instructions/close

Key CPI struct: `light_token::instruction::CloseAccountCpi`

### 1. Index project
- Grep `declare_id|#\[program\]|anchor_lang|Account<|Pubkey|invoke|close|destination|rent` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: program ID, existing instructions, account structs, token accounts
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Program tab CPI code samples
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (add close-account to existing program, new program from scratch, migrate from SPL close_account)
- AskUserQuestion: should the owner be an external signer or a PDA? (determines invoke vs invoke_signed)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan: which files to modify, what code to add, dependency changes
- Follow the guide's step order: Build CloseAccountCpi struct → call .invoke() or .invoke_signed()
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-token anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

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_account(init,
    mint::signer = mint_signer,
    mint::authority = fee_payer,
    mint::decimals = 9,
    mint::seeds = &[MINT_SIGNER_SEED, self.authority.to_account_info().key.as_ref()],
    mint::bump = params.mint_signer_bump
)]
pub mint: UncheckedAccount<'info>,
Anchor
#[account(
    init,
    payer = fee_payer,
    mint::decimals = 9,
    mint::authority = fee_payer,
)]
pub mint: InterfaceAccount<'info, Mint>,

Create a rent-free mint with Anchor macros

CursorOpen in Cursor
---
description: Create a rent-free mint with Anchor macros
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Create a rent-free mint with Anchor macros

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-mint
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-sdk, light-sdk-macros, light-compressible, anchor-lang
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-mint

Key macros: `#[light_program]`, `LightAccounts`, `#[light_account(init, mint::...)]`

### 1. Index project
- Grep `#\[program\]|anchor_lang|Account<|Accounts|seeds|init|payer|mint` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: existing program module, account structs, mint patterns, PDA seeds
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Anchor Macros tab under Program
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new program from scratch, add rent-free mint to existing program, migrate from SPL create_mint)
- AskUserQuestion: do you need token metadata (name, symbol, uri)?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan
- Follow the guide's step order: Dependencies → Program Module (#[light_program]) → Accounts Struct (#[light_account(init, mint::...)])
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-sdk@0.18 --features anchor,v2,cpi-context` and `cargo add light-sdk-macros@0.18 light-compressible@0.1 anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Create mint with metadata

Metadata fields are declared inline instead of requiring a separate CPI.
Guide | Example | Source
#[light_account(init,
    mint::signer = mint_signer,
    mint::authority = fee_payer,
    mint::decimals = 9,
    mint::seeds = &[MINT_SIGNER_SEED, self.authority.to_account_info().key.as_ref()],
    mint::bump = params.mint_signer_bump,
    mint::name = params.name.clone(),
    mint::symbol = params.symbol.clone(),
    mint::uri = params.uri.clone(),
    mint::update_authority = authority
)]
pub mint: UncheckedAccount<'info>,
Anchor
#[account(
    init,
    payer = fee_payer,
    mint::decimals = 9,
    mint::authority = fee_payer,
    extensions::metadata_pointer::authority = fee_payer,
    extensions::metadata_pointer::metadata_address = mint_account,
)]
pub mint_account: InterfaceAccount<'info, Mint>,

// Metadata requires a separate CPI:
token_metadata_initialize(
    cpi_ctx,
    params.name,
    params.symbol,
    params.uri,
)?;

Create a rent-free mint with Anchor macros

CursorOpen in Cursor
---
description: Create a rent-free mint with Anchor macros
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Create a rent-free mint with Anchor macros

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-mint
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-sdk, light-sdk-macros, light-compressible, anchor-lang
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-mint

Key macros: `#[light_program]`, `LightAccounts`, `#[light_account(init, mint::...)]`

### 1. Index project
- Grep `#\[program\]|anchor_lang|Account<|Accounts|seeds|init|payer|mint` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: existing program module, account structs, mint patterns, PDA seeds
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Anchor Macros tab under Program
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new program from scratch, add rent-free mint to existing program, migrate from SPL create_mint)
- AskUserQuestion: do you need token metadata (name, symbol, uri)?
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan
- Follow the guide's step order: Dependencies → Program Module (#[light_program]) → Accounts Struct (#[light_account(init, mint::...)])
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-sdk@0.18 --features anchor,v2,cpi-context` and `cargo add light-sdk-macros@0.18 light-compressible@0.1 anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Create associated token account

Guide | Example | Source
#[light_account(
    init,
    associated_token::authority = ata_owner,
    associated_token::mint = ata_mint,
    associated_token::bump = params.ata_bump
)]
pub ata: UncheckedAccount<'info>,
Anchor
#[account(
    init,
    payer = fee_payer,
    associated_token::mint = mint,
    associated_token::authority = owner,
)]
pub ata: Account<'info, TokenAccount>,

Create a rent-free ATA with Anchor macros

CursorOpen in Cursor
---
description: Create a rent-free ATA with Anchor macros
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Create a rent-free ATA with Anchor macros

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-ata
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-sdk, light-sdk-macros, light-compressible, anchor-lang
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-associated-token-account

Key macros: `#[light_program]`, `LightAccounts`, `#[light_account(init, associated_token::...)]`

### 1. Index project
- Grep `#\[program\]|anchor_lang|Account<|Accounts|seeds|init|payer|ata|associated` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: existing program module, account structs, ATA patterns
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Anchor Macros tab under Program
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new program from scratch, add rent-free ATA to existing program, migrate from SPL create_associated_token_account)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan
- Follow the guide's step order: Dependencies → Program Module (#[light_program]) → Accounts Struct (#[light_account(init, associated_token::...)])
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-sdk@0.18 --features anchor,v2,cpi-context` and `cargo add light-sdk-macros@0.18 light-compressible@0.1 anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

Create token account (vault)

Guide | Example | Source
#[account(
    mut,
    seeds = [VAULT_SEED, mint.key().as_ref()],
    bump,
)]
#[light_account(init,
    token::authority = [VAULT_SEED, self.mint.key()],
    token::mint = mint,
    token::owner = vault_authority,
    token::bump = params.vault_bump
)]
pub vault: UncheckedAccount<'info>,
Anchor
#[account(
    init,
    payer = fee_payer,
    token::mint = mint,
    token::authority = authority,
)]
pub vault: Account<'info, TokenAccount>,

Create a rent-free token account with Anchor macros

CursorOpen in Cursor
---
description: Create a rent-free token account with Anchor macros
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Create a rent-free token account with Anchor macros

Context:
- Guide: https://zkcompression.com/light-token/cookbook/create-token-account
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-sdk, light-sdk-macros, light-compressible, anchor-lang
- Example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-token-account

Key macros: `#[light_program]`, `LightAccounts`, `#[light_account(init, token::...)]`

### 1. Index project
- Grep `#\[program\]|anchor_lang|Account<|Accounts|seeds|init|payer|vault|token_account` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: existing program module, account structs, vault/token account patterns
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above — review the Anchor Macros tab under Program
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new program from scratch, add rent-free token account to existing program, migrate from SPL token account init)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan
- Follow the guide's step order: Dependencies → Program Module (#[light_program]) → Accounts Struct (#[light_account(init, token::...)])
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-sdk@0.18 --features anchor,v2,cpi-context` and `cargo add light-sdk-macros@0.18 light-compressible@0.1 anchor-lang@0.31`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work

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
use light_account::{
    CompressionInfo, LightAccount, LightAccounts,
    CreateAccountsProof, derive_light_cpi_signer,
    light_program, CpiSigner, LightDiscriminator,
};

#[light_program]
#[program]
pub mod my_program {
    // instruction logic unchanged
}

#[derive(LightAccount, LightDiscriminator)]
pub struct MyState {
    pub compression_info: CompressionInfo,
    pub authority: Pubkey,
    pub data: u64,
}

#[derive(LightAccounts)]
pub struct Initialize<'info> {
    #[light_account(init)]
    pub state: UncheckedAccount<'info>,
    #[account(mut)]
    pub pda_rent_sponsor: AccountInfo<'info>,
    // ...
}
Anchor
#[program]
pub mod my_program {
    // instruction logic unchanged
}

#[account]
pub struct MyState {
    pub authority: Pubkey,
    pub data: u64,
}

#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(
        init,
        payer = payer,
        space = 8 + MyState::INIT_SPACE,
    )]
    pub state: Account<'info, MyState>,
    #[account(mut)]
    pub payer: Signer<'info>,
    pub system_program: Program<'info, System>,
}

Add rent-free PDAs to an Anchor program

CursorOpen in Cursor
---
description: Add rent-free PDAs to an Anchor program
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---

## Add rent-free PDAs to an Anchor program

Context:
- Guide: https://zkcompression.com/pda/light-pda/overview
- Skills and resources index: https://zkcompression.com/skill.md
- Crates: light-account (features: anchor), light-sdk (features: anchor, v2, cpi-context)
- Counter example: https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/counter

Key macros/APIs: #[light_program], LightAccount, LightAccounts, #[light_account(init)], CompressionInfo, CreateAccountsProof

### 1. Index project
- Grep `#\[program\]|anchor_lang|Account<|Accounts|InitSpace|seeds|init|payer` across src/
- Glob `**/*.rs` and `**/Cargo.toml` for project structure
- Identify: existing program module, account structs, PDA seeds, token accounts, init instructions
- Read Cargo.toml — note existing dependencies and framework version
- Task subagent (Grep/Read/WebFetch) if project has multiple crates to scan in parallel

### 2. Read references
- WebFetch the guide above
- WebFetch skill.md — check for a dedicated skill and resources matching this task
- TaskCreate one todo per phase below to track progress

### 3. Clarify intention
- AskUserQuestion: what is the goal? (new program from scratch, migrate existing program to rent-free, add rent-free accounts to specific instructions)
- Summarize findings and wait for user confirmation before implementing

### 4. Create plan
- Based on steps 1–3, draft an implementation plan
- Follow the guide's step order: Dependencies → State Struct → Program Module → Accounts Struct
- Identify which existing structs need changes (CompressionInfo field, LightAccount derive, etc.)
- If anything is unclear or ambiguous, loop back to step 3 (AskUserQuestion)
- Present the plan to the user for approval before proceeding

### 5. Implement
- Add deps if missing: Bash `cargo add light-account@0.20 --features anchor` and `cargo add light-sdk@0.20 --features anchor,v2,cpi-context`
- Follow the guide and the approved plan
- Write/Edit to create or modify files
- TaskUpdate to mark each step done

### 6. Verify
- Bash `anchor build`
- Bash `anchor test` if tests exist
- TaskUpdate to mark complete

### Tools
- mcp__zkcompression__SearchLightProtocol("<query>") for API details
- mcp__deepwiki__ask_question("Lightprotocol/light-protocol", "<q>") for architecture
- Task subagent with Grep/Read/WebFetch for parallel lookups
- TaskList to check remaining work