| SPL | Light | |
|---|---|---|
| Transfer | createTransferInstruction() | createTransferInterfaceInstructions() |
Agent skill
Agent skill
Use the payments agent skill to add light-token payment support to your project:For orchestration, install the general skill:
- Claude Code
- Cursor
- Any Agent
Add the marketplace and install:
Report incorrect code
Copy
Ask AI
/plugin marketplace add Lightprotocol/skills
/plugin install solana-rent-free-dev
- Open Settings (Cmd+Shift+J / Ctrl+Shift+J)
- Navigate to Rules & Commands → Project Rules → Add Rule → Remote Rule (GitHub)
- Enter:
https://github.com/Lightprotocol/skills.git
Report incorrect code
Copy
Ask AI
npx skills add Lightprotocol/skills
Report incorrect code
Copy
Ask AI
npx skills add https://zkcompression.com
- Guide
- AI Prompt
How it works
- Create the transfer instructions with
createTransferInterfaceInstructions(). - Add a memo instruction to the transfer transaction (the last batch).
- Both instructions execute atomically in the same transaction.
Setup
Report incorrect code
Copy
Ask AI
npm install @lightprotocol/compressed-token@beta \
@lightprotocol/stateless.js@beta
Report incorrect code
Copy
Ask AI
npm install @solana/spl-memo
Report incorrect code
Copy
Ask AI
import { createRpc } from "@lightprotocol/stateless.js";
const rpc = createRpc(RPC_ENDPOINT);
Send a payment with memo
Report incorrect code
Copy
Ask AI
import { Transaction, sendAndConfirmTransaction, TransactionInstruction, PublicKey } from "@solana/web3.js";
import {
createTransferInterfaceInstructions,
sliceLast,
} from "@lightprotocol/compressed-token/unified";
const MEMO_PROGRAM_ID = new PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
const instructions = await createTransferInterfaceInstructions(
rpc,
payer.publicKey,
mint,
amount,
owner.publicKey,
recipient
);
const { rest: loadInstructions, last: transferInstructions } = sliceLast(instructions);
// Send load transactions first (if any)
for (const ixs of loadInstructions) {
const tx = new Transaction().add(...ixs);
await sendAndConfirmTransaction(rpc, tx, [payer, owner]);
}
// Add memo to the transfer transaction
const memoIx = new TransactionInstruction({
keys: [],
programId: MEMO_PROGRAM_ID,
data: Buffer.from("INV-2024-001"),
});
const transferTx = new Transaction().add(...transferInstructions, memoIx);
await sendAndConfirmTransaction(rpc, transferTx, [payer, owner]);
Read memo from transaction logs
After the transaction confirms, the memo appears in the transaction logs:Report incorrect code
Copy
Ask AI
const txDetails = await rpc.getTransaction(signature, {
maxSupportedTransactionVersion: 0,
});
// Look for memo program log entries
const logs = txDetails?.meta?.logMessages || [];
const memoLogs = logs.filter((log) =>
log.includes("Program MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr")
);
console.log("Memo logs:", memoLogs);
Integrate light-token APIs for stablecoin payments
Report incorrect code
Copy
Ask AI
---
description: Integrate light-token APIs for stablecoin payments
allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch, AskUserQuestion, Task, TaskCreate, TaskGet, TaskList, TaskUpdate, TaskOutput, mcp__deepwiki, mcp__zkcompression
---
## Integrate light-token APIs for stablecoin payments
Context:
- Guide: https://zkcompression.com/light-token/payments/integration-guide
- Skills and resources index: https://zkcompression.com/skill.md
- SPL to Light reference: https://zkcompression.com/api-reference/solana-to-light-comparison
- Dedicated skill: https://github.com/Lightprotocol/skills/tree/main/skills/payments
- Packages: @lightprotocol/compressed-token, @lightprotocol/stateless.js
- Full examples: https://github.com/Lightprotocol/examples-light-token/tree/main/toolkits/payments
SPL → Light Token API mapping:
| Operation | SPL | Light Token |
| Receive | getOrCreateAssociatedTokenAccount() | createLoadAtaInstructions() / loadAta() |
| Transfer | createTransferInstruction() | createTransferInterfaceInstructions() |
| Delegated Transfer | transfer() (delegate signs) | transferDelegatedInterface() |
| Get Balance | getAccount() | getAtaInterface() |
| Tx History | getSignaturesForAddress() | getSignaturesForOwnerInterface() |
| Wrap SPL | N/A | createWrapInstruction() / wrap() |
| Unwrap | N/A | createUnwrapInstructions() / unwrap() |
### 1. Index project
- Grep `@solana/spl-token|@lightprotocol|createTransferInstruction|getAccount|Connection|Keypair|stablecoin|payment` across src/
- Glob `**/*.ts` and `**/*.tsx` for project structure
- Identify: RPC setup, existing token operations, payment flow, wallet signing pattern
- Check package.json for existing @lightprotocol/* or @solana/spl-token dependencies
- Task subagent (Grep/Read/WebFetch) if project has multiple packages to scan in parallel
### 2. Read references
- WebFetch the guide above — review Instruction and Action tabs for each operation
- 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 payment integration, migrate existing SPL payment flow, add alongside existing SPL)
- AskUserQuestion: which operations? (receive, send, balance, history, wrap, unwrap — or all)
- AskUserQuestion: instruction-level API (build your own transactions) or action-level API (high-level, fewer lines)?
- 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 (createRpc with ZK Compression endpoint)
- Key pattern: import from `@lightprotocol/compressed-token/unified` for all interface APIs
- 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`
- Set up RPC: `createRpc(RPC_ENDPOINT)` with a ZK Compression endpoint (Helius, Triton)
- Import from `@lightprotocol/compressed-token/unified` for the interface APIs
- Follow the 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
Related guides
Basic payment
Send a single transfer without memo.
Verify payments
Query balances and transaction history.
Batch payments
Pack multiple transfers into one transaction.