Agent skill
Agent skill
npx skills add https://zkcompression.com
Create an RPC connection
Helius exposes Solana and Photon RPC endpoints through a single URL. It’s a thin wrapper extending Solana’sConnection class that allows you to query cold Light Token balances.
- TypeScript
- Rust
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);
import { Connection } from "@solana/web3.js";
const connection = new Connection(RPC_ENDPOINT);
use light_client::rpc::{LightClient, LightClientConfig, Rpc};
let rpc = LightClient::new(
LightClientConfig::new(rpc_url.to_string(), None, None)
).await?;
use solana_client::rpc_client::RpcClient;
let client = RpcClient::new(rpc_url.to_string());
transferInterface and getAtaInterface. Call them directly for custom indexing, block explorers, or debugging.
See JSON RPC Methods.Get balance
Get balance
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);
import { getAccount } from "@solana/spl-token";
const account = await getAccount(connection, ata);
console.log(account.amount);
Transaction history
Transaction history
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
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)
- TypeScript
- 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
);
use light_token_client::actions::CreateMint;
let (sig, mint) = CreateMint {
decimals: 9,
freeze_authority: Some(payer.pubkey()),
token_metadata: None,
seed: None,
}
.execute(&mut rpc, &payer, &mint_authority)
.await?;
use spl_token::instruction::initialize_mint;
let ix = initialize_mint(
&spl_token::id(),
&mint.pubkey(),
&mint_authority,
Some(&freeze_authority),
decimals,
)?;
AI prompt
AI prompt
- TypeScript
- Rust
Add rent-free mint with token metadata
---
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 rent-free mint with token metadata
---
description: Create 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
---
## Create 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
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)
SPL equivalent: spl_token::instruction::initialize_mint → Light Token: CreateMint
### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|CreateMint|initialize_mint` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for mint 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 mint 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
Create associated token account
Associated light token accounts can hold balances of light, SPL, or Token 2022 mints.Guide | Example (TS) | Example (Rust)
- TypeScript
- 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
);
use light_token_client::actions::CreateAta;
let (sig, ata) = CreateAta {
mint,
owner: owner.pubkey(),
idempotent: false,
}
.execute(&mut rpc, &payer)
.await?;
use spl_associated_token_account::instruction::create_associated_token_account;
let ix = create_associated_token_account(
&payer.pubkey(),
&owner.pubkey(),
&mint,
&spl_token::id(),
);
AI prompt
AI prompt
- TypeScript
- Rust
Create rent-free associated token account
---
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
Create rent-free associated token account
---
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
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)
SPL equivalent: spl_associated_token_account::create → Light Token: CreateAta
### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|CreateAta|create_associated_token_account` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for ATA 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 ATA 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
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)
- TypeScript
- 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
);
use light_token_client::actions::MintTo;
let sig = MintTo {
mint,
destination,
amount,
}
.execute(&mut rpc, &payer, &authority)
.await?;
use spl_token::instruction::mint_to;
let ix = mint_to(
&spl_token::id(),
&mint,
&destination,
&mint_authority,
&[],
amount,
)?;
AI prompt
AI prompt
- TypeScript
- Rust
Mint tokens to Light Token account
---
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
Mint tokens to Light Token account
---
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
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)
SPL equivalent: spl_token::instruction::mint_to → Light Token: MintTo
### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|MintTo|mint_to` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for minting
- 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 mint 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
Transfer tokens with Transferinterface
The interface detects account types and invokes the right programs.| Light Token -> Light Token Account |
|
| SPL token -> Light Token Account |
|
| Light Token -> SPL Account |
|
Guide | Example (TS) | Example (Rust)
- TypeScript
- 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
);
use light_token_client::actions::TransferInterface;
let sig = TransferInterface {
source,
mint,
destination,
amount,
decimals,
spl_token_program: None,
restricted: false,
}
.execute(&mut rpc, &payer, &authority)
.await?;
use spl_token::instruction::transfer;
let ix = transfer(
&spl_token::id(),
&source,
&destination,
&authority,
&[],
amount,
)?;
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 ...
}
Sign all transactions together
Sign all transactions together
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);
}
Optimize sending (parallel conditional loads, then transfer)
Optimize sending (parallel conditional loads, then transfer)
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 ATA
Load ATA
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);
AI prompt
AI prompt
- TypeScript
- Rust
Transfer tokens between Light Token and SPL accounts
---
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
Transfer tokens between Light Token and SPL accounts
---
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
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)
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
SPL equivalent: spl_token::instruction::transfer → Light Token: TransferInterface
### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|TransferInterface|transfer` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for transfers
- 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 transfer 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
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)
- TypeScript
- Rust
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);
use light_token_client::actions::wrap::Wrap;
Wrap {
rpc: &mut rpc,
payer: &payer,
spl_ata,
light_ata,
owner: &owner,
mint,
amount,
}
.execute()
.await?;
use light_token_client::actions::unwrap::Unwrap;
Unwrap {
rpc: &mut rpc,
payer: &payer,
spl_ata,
owner: &owner,
mint,
amount,
}
.execute()
.await?;
AI prompt
AI prompt
- TypeScript
- Rust
Wrap and unwrap SPL tokens to Light Token
---
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
Wrap and unwrap SPL tokens to Light Token
---
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
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)
- Wrap: move tokens from SPL or Token 2022 account → Light Token ATA (hot balance)
- Unwrap: move tokens from Light Token ATA (hot balance) → SPL or Token 2022 account
No direct SPL equivalent — Wrap/Unwrap are Light Token operations → Light Token: Wrap / Unwrap
### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|Wrap|Unwrap|wrap|unwrap` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for wrap/unwrap
- 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 wrap/unwrap 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
Approve delegate
Approve a delegate to spend tokens up to a specified amount.Guide | Example (TS) | Example (Rust)
- TypeScript
- Rust
import { approve } from "@lightprotocol/compressed-token";
const tx = await approve(
rpc,
payer,
mint,
amount,
owner,
delegate
);
import { approve } from "@solana/spl-token";
const tx = await approve(
connection,
payer,
source,
delegate,
owner,
amount
);
use light_token_client::actions::Approve;
let sig = Approve {
token_account: ata,
delegate: delegate.pubkey(),
amount,
owner: None,
}
.execute(&mut rpc, &payer)
.await?;
use spl_token::instruction::approve;
let ix = approve(
&spl_token::id(),
&source,
&delegate,
&owner,
&[],
amount,
)?;
AI prompt
AI prompt
- TypeScript
- Rust
Approve and revoke token delegates
---
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
Approve and revoke token delegates
---
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
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)
SPL equivalent: spl_token::instruction::approve / revoke → Light Token: Approve / Revoke
### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|Approve|Revoke|delegate` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for delegation
- 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 delegation 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
Revoke delegate
Remove all delegate permissions.Guide | Example (TS) | Example (Rust)
- TypeScript
- Rust
import { revoke } from "@lightprotocol/compressed-token";
const tx = await revoke(
rpc,
payer,
delegatedAccounts,
owner
);
import { revoke } from "@solana/spl-token";
const tx = await revoke(
connection,
payer,
source,
owner
);
use light_token_client::actions::Revoke;
let sig = Revoke {
token_account: ata,
owner: None,
}
.execute(&mut rpc, &payer)
.await?;
use spl_token::instruction::revoke;
let ix = revoke(
&spl_token::id(),
&source,
&owner,
&[],
)?;
AI prompt
AI prompt
- TypeScript
- Rust
Approve and revoke token delegates
---
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
Approve and revoke token delegates
---
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
- Crates: light-token-client (actions), light-token (instructions), light-client (RPC)
SPL equivalent: spl_token::instruction::approve / revoke → Light Token: Approve / Revoke
### 1. Index project
- Grep `light_token::|light_token_client::|solana_sdk|Keypair|async|Approve|Revoke|delegate` across src/
- Glob `**/*.rs` for project structure
- Identify: RPC setup, existing token ops, entry point for delegation
- 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 delegation 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
Create token account
Guide | Example
use light_token::instruction::CreateTokenAccount;
let ix = CreateTokenAccount::new(
payer.pubkey(),
account.pubkey(),
mint,
owner,
)
.instruction()?;
use spl_token::instruction::initialize_account;
let ix = initialize_account(
&spl_token::id(),
&account,
&mint,
&owner,
)?;
AI prompt
AI prompt
Create Light Token account
---
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()?;
use spl_token::instruction::burn;
let ix = burn(
&spl_token::id(),
&source,
&mint,
&authority,
&[],
amount,
)?;
AI prompt
AI prompt
Burn Light Tokens
---
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()?;
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,
&[],
)?;
AI prompt
AI prompt
Freeze and thaw Light Token accounts
---
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()?;
use spl_token::instruction::close_account;
let ix = close_account(
&spl_token::id(),
&account,
&destination,
&owner,
&[],
)?;
AI prompt
AI prompt
Close Light Token account
---
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()?
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])?;
AI prompt
AI prompt
Add create-mint CPI to an Anchor program
---
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()?
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])?;
AI prompt
AI prompt
Add create-ATA CPI to an Anchor program
---
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()?
use spl_token::instruction::initialize_account;
let ix = initialize_account(
&spl_token::id(),
&account,
&mint,
&owner,
)?;
invoke(&ix, &[account, mint, owner])?;
AI prompt
AI prompt
Add create-token-account CPI to an Anchor program
---
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()?
use spl_token::instruction::mint_to;
let ix = mint_to(
&spl_token::id(),
&mint,
&destination,
&mint_authority,
&[],
amount,
)?;
invoke(&ix, &[mint, destination, authority])?;
AI prompt
AI prompt
Add mint-to CPI to an Anchor program
---
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()?
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])?;
AI prompt
AI prompt
Add transfer-checked CPI to an Anchor program
---
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
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()?;
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])?;
AI prompt
AI prompt
Add transfer-interface CPI to an Anchor program
---
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()?
use spl_token::instruction::burn;
let ix = burn(
&spl_token::id(),
&source,
&mint,
&authority,
&[],
amount,
)?;
invoke(&ix, &[source, mint, authority])?;
AI prompt
AI prompt
Add burn CPI to an Anchor program
---
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()?
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])?;
AI prompt
AI prompt
Add freeze and thaw CPI to an Anchor program
---
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()?
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])?;
AI prompt
AI prompt
Add approve and revoke CPI to an Anchor program
---
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()?
use spl_token::instruction::close_account;
let ix = close_account(
&spl_token::id(), &account, &destination, &owner, &[],
)?;
invoke(&ix, &[account, destination, owner])?;
AI prompt
AI prompt
Add close-account CPI to an Anchor program
---
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>,
#[account(
init,
payer = fee_payer,
mint::decimals = 9,
mint::authority = fee_payer,
)]
pub mint: InterfaceAccount<'info, Mint>,
AI prompt
AI prompt
Create a rent-free mint with Anchor macros
---
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>,
#[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,
)?;
AI prompt
AI prompt
Create a rent-free mint with Anchor macros
---
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>,
#[account(
init,
payer = fee_payer,
associated_token::mint = mint,
associated_token::authority = owner,
)]
pub ata: Account<'info, TokenAccount>,
AI prompt
AI prompt
Create a rent-free ATA with Anchor macros
---
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>,
#[account(
init,
payer = fee_payer,
token::mint = mint,
token::authority = authority,
)]
pub vault: Account<'info, TokenAccount>,
AI prompt
AI prompt
Create a rent-free token account with Anchor macros
---
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>,
// ...
}
#[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>,
}
AI prompt
AI prompt
Add rent-free PDAs to an Anchor program
---
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