Skip to content

Payment docs: restructure, add guides, production readiness#31

Open
tilo-14 wants to merge 15 commits intomainfrom
payments-docs
Open

Payment docs: restructure, add guides, production readiness#31
tilo-14 wants to merge 15 commits intomainfrom
payments-docs

Conversation

@tilo-14
Copy link
Member

@tilo-14 tilo-14 commented Mar 19, 2026

Summary

  • Restructured payment docs navigation: flat files, Send Payments / Verify Payments groups, Advanced section
  • Added structured pages for all payment flows: basic, batch, memo, receive, verify, spend permissions, wrap/unwrap
  • Each page follows consistent template: API mapping table, AgentSkillPayments, Guide/AI Prompt tabs, related guides
  • Updated spend-permissions to use unified API (approveInterface/revokeInterface)
  • Added production readiness checklist with actionable links
  • Added gasless-transactions page (renamed from sponsor-top-ups)
  • Added smart-wallets page
  • Created copy-payments-snippets.sh for syncing example code
  • Removed stale Beta/devnet references
  • Moved nullifier-pda to payments Advanced section
  • Added redirects for renamed/moved pages

Test plan

  • Run mint dev and verify all payment pages render
  • Check all nav links resolve correctly
  • Verify redirects work for old paths
  • Spot-check code examples match examples repo

Open with Devin

Summary by CodeRabbit

Release Notes

  • New Features

    • Added comprehensive payment guides covering basic transfers, batch payments, memos, spend permissions, wrap/unwrap, and payment verification.
    • Added Smart Wallets guide for programmatic account management.
    • Added Production Readiness checklist for payments deployment.
  • Documentation

    • Rebranded "Sponsor Rent Top-Ups" to "Gasless Transactions" across all guides.
    • Removed beta status indicators from DeFi documentation.
    • Added LLM index resource for AI assistants.
    • Reorganized navigation structure and updated redirects for improved discoverability.

tilo-14 added 5 commits March 18, 2026 00:45
10 new pages mirroring Solana payments structure:
- Send: basic payment, memo, verify address, batch, fee abstraction
- Accept: receive payments, verify payments
- Advanced: spend permissions, deferred execution
- Interop: wrap/unwrap for CEX on/off-ramp
- Production readiness checklist
Update docs.json navigation and overview.mdx cards.
Delegation (approve/revoke) not yet supported on Light Token
associated token accounts. Remove from nav and cross-links
until SDK exposes interface functions for hot accounts.
Rename page, snippets, nav entries, redirects, and all
cross-references. Add redirect from old URL. Update
descriptions to "Abstract SOL fees so users never hold SOL.
Sponsor rent top-ups and transaction fees."
@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

Important

Review skipped

Too many files!

This PR contains 166 files, which is 16 over the limit of 150.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8988bf8e-4aa8-44c4-9e39-8d7f4a7bd227

📥 Commits

Reviewing files that changed from the base of the PR and between 87b6ddb and 8af9728.

📒 Files selected for processing (166)
  • ai-tools/agent-skills.mdx
  • api-reference/solana-to-light-comparison.mdx
  • cspell.json
  • docs.json
  • faq.mdx
  • learn/light-token-standard.mdx
  • light-token/cookbook/add-interface-pda.mdx
  • light-token/cookbook/approve-revoke.mdx
  • light-token/cookbook/burn.mdx
  • light-token/cookbook/close-token-account.mdx
  • light-token/cookbook/create-ata.mdx
  • light-token/cookbook/create-mint.mdx
  • light-token/cookbook/create-token-account.mdx
  • light-token/cookbook/freeze-thaw.mdx
  • light-token/cookbook/load-ata.mdx
  • light-token/cookbook/mint-to.mdx
  • light-token/cookbook/transfer-checked.mdx
  • light-token/cookbook/transfer-delegated.mdx
  • light-token/cookbook/transfer-interface.mdx
  • light-token/cookbook/wrap-unwrap.mdx
  • light-token/extensions/close-mint.mdx
  • light-token/extensions/confidential-transfer.mdx
  • light-token/extensions/default-account-state.mdx
  • light-token/extensions/interest-bearing-tokens.mdx
  • light-token/extensions/metadata-and-metadata-pointer.mdx
  • light-token/extensions/overview.mdx
  • light-token/extensions/pausable-mint.mdx
  • light-token/extensions/permanent-delegate.mdx
  • light-token/extensions/token-groups-and-members.mdx
  • light-token/extensions/transfer-fees.mdx
  • light-token/extensions/transfer-hook.mdx
  • light-token/payments/basic-payment.mdx
  • light-token/payments/batch-payments.mdx
  • light-token/payments/integration-guide.mdx
  • light-token/payments/overview.mdx
  • light-token/payments/production-readiness.mdx
  • light-token/payments/receive-payments.mdx
  • light-token/payments/spend-permissions.mdx
  • light-token/payments/verify-payments.mdx
  • light-token/payments/verify-recipient-address.mdx
  • light-token/payments/wrap-unwrap.mdx
  • light-token/wallets/overview.mdx
  • light-token/welcome.mdx
  • llms.txt
  • pda/compressed-pdas/nullifier-pda.mdx
  • pda/compressed-pdas/overview.mdx
  • pda/light-pda/overview.mdx
  • pda/overview.mdx
  • resources/legacy-compressed-tokens.mdx
  • resources/terminology.mdx
  • scripts/copy-extensions-snippets.sh
  • scripts/copy-light-token-snippets.sh
  • scripts/copy-program-snippets.sh
  • scripts/copy-rust-snippets.sh
  • scripts/generate-llms-txt.js
  • skill.md
  • snippets/ai-prompts/all-prompts.mdx
  • snippets/ai-prompts/defi/defi-anchor.mdx
  • snippets/ai-prompts/extensions/close-mint.mdx
  • snippets/ai-prompts/extensions/confidential-transfer.mdx
  • snippets/ai-prompts/extensions/default-account-state.mdx
  • snippets/ai-prompts/extensions/interest-bearing-tokens.mdx
  • snippets/ai-prompts/extensions/metadata-and-metadata-pointer.mdx
  • snippets/ai-prompts/extensions/pausable-mint.mdx
  • snippets/ai-prompts/extensions/permanent-delegate.mdx
  • snippets/ai-prompts/extensions/token-groups-and-members.mdx
  • snippets/ai-prompts/extensions/transfer-fees.mdx
  • snippets/ai-prompts/extensions/transfer-hook.mdx
  • snippets/ai-prompts/light-token-prompts.mdx
  • snippets/ai-prompts/program-cookbook/transfer-checked.mdx
  • snippets/ai-prompts/toolkits/nullifiers.mdx
  • snippets/ai-prompts/toolkits/payments.mdx
  • snippets/ai-prompts/toolkits/wallets.mdx
  • snippets/ai-prompts/ts-cookbook/transfer-interface.mdx
  • snippets/ai-prompts/wallets/gasless-transactions.mdx
  • snippets/ai-prompts/wallets/privy.mdx
  • snippets/ai-prompts/wallets/wallet-adapter.mdx
  • snippets/code-samples/code-compare-snippets.jsx
  • snippets/code-snippets/compressed-token/approve/action.mdx
  • snippets/code-snippets/compressed-token/compress-spl-account/action.mdx
  • snippets/code-snippets/compressed-token/compress/action.mdx
  • snippets/code-snippets/compressed-token/create-mint/action.mdx
  • snippets/code-snippets/compressed-token/create-mint/instruction.mdx
  • snippets/code-snippets/compressed-token/create-token-pool/action.mdx
  • snippets/code-snippets/compressed-token/decompress/action.mdx
  • snippets/code-snippets/compressed-token/merge-token-accounts/action.mdx
  • snippets/code-snippets/compressed-token/mint-to/action.mdx
  • snippets/code-snippets/compressed-token/mint-to/instruction.mdx
  • snippets/code-snippets/compressed-token/revoke/action.mdx
  • snippets/code-snippets/compressed-token/transfer/action.mdx
  • snippets/code-snippets/light-token/approve-revoke/approve-action.mdx
  • snippets/code-snippets/light-token/approve-revoke/revoke-action.mdx
  • snippets/code-snippets/light-token/approve-revoke/rust-client/approve-instruction.mdx
  • snippets/code-snippets/light-token/approve-revoke/rust-client/revoke-instruction.mdx
  • snippets/code-snippets/light-token/approve/anchor-program/full-example.mdx
  • snippets/code-snippets/light-token/burn/anchor-program/full-example.mdx
  • snippets/code-snippets/light-token/burn/rust-client/instruction.mdx
  • snippets/code-snippets/light-token/create-ata/action.mdx
  • snippets/code-snippets/light-token/create-ata/anchor-macro/full-example.mdx
  • snippets/code-snippets/light-token/create-ata/anchor-program/full-example.mdx
  • snippets/code-snippets/light-token/create-ata/instruction.mdx
  • snippets/code-snippets/light-token/create-mint/action.mdx
  • snippets/code-snippets/light-token/create-mint/anchor-macro/full-example.mdx
  • snippets/code-snippets/light-token/create-mint/instruction.mdx
  • snippets/code-snippets/light-token/create-mint/rust-client/instruction.mdx
  • snippets/code-snippets/light-token/create-token-account/anchor-macro/full-example.mdx
  • snippets/code-snippets/light-token/delegate-transfer/action.mdx
  • snippets/code-snippets/light-token/extensions/close-mint/action.mdx
  • snippets/code-snippets/light-token/extensions/confidential-transfer/action.mdx
  • snippets/code-snippets/light-token/extensions/default-account-state/action.mdx
  • snippets/code-snippets/light-token/extensions/interest-bearing/action.mdx
  • snippets/code-snippets/light-token/extensions/metadata-pointer/action.mdx
  • snippets/code-snippets/light-token/extensions/pausable/action.mdx
  • snippets/code-snippets/light-token/extensions/permanent-delegate/action.mdx
  • snippets/code-snippets/light-token/extensions/token-groups/action.mdx
  • snippets/code-snippets/light-token/extensions/transfer-fees/action.mdx
  • snippets/code-snippets/light-token/extensions/transfer-hook/action.mdx
  • snippets/code-snippets/light-token/load-ata/action.mdx
  • snippets/code-snippets/light-token/load-ata/instruction.mdx
  • snippets/code-snippets/light-token/mint-to/action.mdx
  • snippets/code-snippets/light-token/mint-to/anchor-program/full-example.mdx
  • snippets/code-snippets/light-token/mint-to/instruction.mdx
  • snippets/code-snippets/light-token/mint-to/rust-client/instruction.mdx
  • snippets/code-snippets/light-token/revoke/anchor-program/full-example.mdx
  • snippets/code-snippets/light-token/transfer-checked/anchor-program/full-example.mdx
  • snippets/code-snippets/light-token/transfer-checked/native-program/full-example.mdx
  • snippets/code-snippets/light-token/transfer-interface/action.mdx
  • snippets/code-snippets/light-token/transfer-interface/anchor-program/full-example.mdx
  • snippets/code-snippets/light-token/transfer-interface/instruction.mdx
  • snippets/code-snippets/light-token/transfer-interface/rust-client/instruction.mdx
  • snippets/code-snippets/light-token/unwrap/action.mdx
  • snippets/code-snippets/light-token/unwrap/instruction.mdx
  • snippets/code-snippets/light-token/wrap/action.mdx
  • snippets/code-snippets/light-token/wrap/instruction.mdx
  • snippets/code-snippets/payments/receive/receive.mdx
  • snippets/code-snippets/payments/send/batch-send.mdx
  • snippets/code-snippets/payments/send/payment-with-memo.mdx
  • snippets/code-snippets/payments/send/send-action.mdx
  • snippets/code-snippets/payments/send/send-instruction.mdx
  • snippets/code-snippets/payments/send/sign-all-transactions.mdx
  • snippets/code-snippets/payments/spend-permissions/delegate-transfer-instruction.mdx
  • snippets/code-snippets/payments/spend-permissions/delegate-transfer.mdx
  • snippets/code-snippets/payments/verify/get-balance.mdx
  • snippets/code-snippets/payments/verify/get-history.mdx
  • snippets/code-snippets/privy/balances/nodejs.mdx
  • snippets/code-snippets/privy/balances/react.mdx
  • snippets/code-snippets/privy/receive/nodejs.mdx
  • snippets/code-snippets/privy/receive/react.mdx
  • snippets/code-snippets/privy/transfer/nodejs.mdx
  • snippets/code-snippets/privy/unwrap/nodejs.mdx
  • snippets/code-snippets/privy/wrap/nodejs.mdx
  • snippets/code-snippets/wallet-adapter/balances/react.mdx
  • snippets/code-snippets/wallet-adapter/receive/react.mdx
  • snippets/code-snippets/wallet-adapter/transaction-history/react.mdx
  • snippets/code-snippets/wallet-adapter/transfer/react.mdx
  • snippets/code-snippets/wallet-adapter/unwrap/react.mdx
  • snippets/code-snippets/wallet-adapter/wrap/react.mdx
  • snippets/extensions-table.mdx
  • snippets/migration-reference/ts/approve.mdx
  • snippets/migration-reference/ts/revoke.mdx
  • snippets/overview-tables/compressed-pdas-guides-table.mdx
  • snippets/overview-tables/light-token-client-examples-table.mdx
  • snippets/overview-tables/light-token-program-examples-table.mdx
  • snippets/setup/agent-skill-payments.mdx
  • snippets/setup/extensions-setup.mdx
  • snippets/setup/register-spl-mint.mdx

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR significantly expands Light Token payment documentation by introducing nine new comprehensive guides covering transfer types, verification, and spend permissions; restructures wallet guidance from "rent top-ups" to "gasless transactions"; reorganizes navigation and redirects; adds numerous TypeScript code snippets and examples; and removes beta disclaimers from DeFi program documentation.

Changes

Cohort / File(s) Summary
Navigation & Site Structure
README.md, docs.json, skill.md, light-token/welcome.mdx, snippets/overview-tables/light-token-client-examples-table.mdx
Updated docs.json navigation to restructure payment section with new grouped pages and add wallet guides; consolidated legacy redirects for nullifier-pda pages; renamed sponsor-top-ups concept to gasless-transactions throughout site metadata; added LLM index link to README.
Wallet Guides
light-token/wallets/gasless-transactions.mdx, light-token/wallets/smart-wallets.mdx, light-token/wallets/overview.mdx
Added new gasless-transactions and smart-wallets guides; updated wallet overview to reference new pages and remove sponsor-top-ups link. Covers fee abstraction, rent sponsorship, PDA-based wallets with Squads integration, and sync/async execution patterns.
Payment Guides (New)
light-token/payments/basic-payment.mdx, light-token/payments/batch-payments.mdx, light-token/payments/payment-with-memo.mdx, light-token/payments/receive-payments.mdx, light-token/payments/spend-permissions.mdx, light-token/payments/verify-payments.mdx, light-token/payments/verify-recipient-address.mdx, light-token/payments/wrap-unwrap.mdx
Added eight comprehensive payment documentation pages with TypeScript examples, comparisons to SPL Token APIs, guides for single/batch transfers, memo integration, receiving payments, delegation/spend permissions, balance verification, address validation, and SPL↔Light Token wrapping.
Payment Guides (Updated)
light-token/payments/integration-guide.mdx, light-token/payments/overview.mdx, light-token/payments/production-readiness.mdx
Updated integration guide to reference gasless-transactions; added new production-readiness guide with RPC failover, transaction landing, error handling, and pre-launch checklist; restructured overview with new card groups for payment flows, gasless transactions, and signing options.
DeFi Documentation
light-token/defi/programs-pinocchio.mdx, light-token/defi/programs.mdx, light-token/defi/routers.mdx
Removed "API is in Beta and subject to change" disclaimer from three DeFi program documentation files.
FAQ & General Content
faq.mdx
Updated rent sponsorship Q&A from "sponsor rent top-ups" to "gasless transactions"; clarified that payer sponsor covers both rent top-ups and transaction fees in question and code comment.
AI Prompts
snippets/ai-prompts/wallets/gasless-transactions.mdx, snippets/ai-prompts/wallets/smart-wallets.mdx, snippets/ai-prompts/all-prompts.mdx
Added new smart-wallets AI prompt with integration context and assistant control flow; updated gasless-transactions prompt metadata and descriptions; consolidated wallet prompts in all-prompts index.
Code Snippets - Payment Flows
snippets/code-snippets/payments/send/send-instruction.mdx, snippets/code-snippets/payments/send/send-action.mdx, snippets/code-snippets/payments/send/batch-send.mdx, snippets/code-snippets/payments/send/sign-all-transactions.mdx, snippets/code-snippets/payments/send/payment-with-memo.mdx
Added TypeScript examples for single transfer (instruction/action patterns), batch multi-recipient transfers with deduplication, parallel load + consolidated transfer, and memo-attached transfers with log extraction.
Code Snippets - Receive & Verify
snippets/code-snippets/payments/receive/receive.mdx, snippets/code-snippets/payments/verify/get-balance.mdx, snippets/code-snippets/payments/verify/get-history.mdx, snippets/code-snippets/payments/verify/verify-address.mdx
Added TypeScript examples for receiving payments with ATA loading, fetching token balance via getAtaInterface, retrieving transaction history via getSignaturesForOwnerInterface, and on/off-curve address verification.
Code Snippets - Spend Permissions
snippets/code-snippets/payments/spend-permissions/delegate-approve.mdx, snippets/code-snippets/payments/spend-permissions/delegate-check.mdx, snippets/code-snippets/payments/spend-permissions/delegate-full-flow.mdx, snippets/code-snippets/payments/spend-permissions/delegate-revoke.mdx
Added TypeScript examples for approve/revoke delegate flows and querying delegation status with state inspection patterns.
Code Snippets - Interop
snippets/code-snippets/payments/interop/wrap.mdx, snippets/code-snippets/payments/interop/unwrap.mdx, snippets/code-snippets/payments/interop/register-spl-mint.mdx
Added TypeScript examples for SPL↔Light Token wrapping/unwrapping and SPL mint registration with the Light token program.
Build & Automation
scripts/copy-payments-snippets.sh
Added bash script to automate copying TypeScript example files into MDX snippet format across send, receive, verify, spend-permissions, and interop categories.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through payment flows,
New guides sprouting row by row,
From sponsor-top-ups, gasless grows,
With snippets wise and prompts that glow,
Documentation's grand rebirth—
Light Token's documented worth!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main structural change: payment documentation was restructured, new guides were added, and production readiness guidance was introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch payments-docs
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

View 3 additional findings in Devin Review.

Open in Devin Review

<Card title="Basic payment" icon="arrow-right" href="/light-token/payments/basic-payment">
Send a single token transfer.
</Card>
<Card title="Verify address" icon="shield-check" href="/light-token/payments/verify-address">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Broken internal link to non-existent page /light-token/payments/verify-address

In the newly added verify-payments.mdx, the "Verify address" card links to /light-token/payments/verify-address, but the actual page file is light-token/payments/verify-recipient-address.mdx and is registered in docs.json:73 as "light-token/payments/verify-recipient-address". There is no redirect defined for /light-token/payments/verify-address either. Clicking this card will result in a 404.

Suggested change
<Card title="Verify address" icon="shield-check" href="/light-token/payments/verify-address">
<Card title="Verify address" icon="shield-check" href="/light-token/payments/verify-recipient-address">
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +6 to +7
EXAMPLES="/home/tilo/Workspace/examples-light-token-main/toolkits/payments"
SNIPPETS_DIR="/home/tilo/Workspace/docs-main/snippets/code-snippets/payments"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Hardcoded absolute local paths in copy-payments-snippets.sh

The new script scripts/copy-payments-snippets.sh has hardcoded absolute paths referencing /home/tilo/Workspace/... (lines 6-7). This script will fail for any developer other than the original author since these paths are machine-specific. The script should use relative paths or environment variables.

Prompt for agents
In scripts/copy-payments-snippets.sh lines 6-7, replace the hardcoded absolute paths with relative paths or environment variables. For example, use SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) to derive the docs snippets directory relative to the script location, and accept the examples-light-token repo path as a command-line argument or environment variable (e.g. EXAMPLES=${1:-../examples-light-token/toolkits/payments}).
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 13

🧹 Nitpick comments (6)
snippets/code-snippets/payments/interop/wrap.mdx (1)

20-20: Non-null assertion on process.env.API_KEY may fail silently.

Same issue as in register-spl-mint.mdx — if API_KEY is not set, the URL will contain undefined, causing cryptic RPC errors. Consider adding validation for consistency across snippets.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/code-snippets/payments/interop/wrap.mdx` at line 20, The RPC_URL
constant is built using a non-null assertion on process.env.API_KEY which can
produce a URL with "undefined" if the env var is missing; update the
initialization of RPC_URL to validate process.env.API_KEY first (e.g., check
API_KEY presence at startup or throw/log a clear error) and only interpolate
when present, ensuring code that uses RPC_URL (the RPC_URL constant) will never
receive an invalid URL; include a clear error message that mentions API_KEY when
it is absent.
snippets/code-snippets/payments/interop/register-spl-mint.mdx (2)

29-29: Placeholder address will cause a runtime PublicKey error.

The string "YOUR_EXISTING_MINT_ADDRESS" is not a valid base58 public key, so new PublicKey(...) will throw immediately if users run this snippet without modification. Consider adding a validation check or a clearer early-exit pattern.

💡 Suggested improvement
-    const mint = new PublicKey("YOUR_EXISTING_MINT_ADDRESS");
+    const MINT_ADDRESS = "YOUR_EXISTING_MINT_ADDRESS"; // Replace with actual mint
+    if (MINT_ADDRESS.startsWith("YOUR_")) {
+        throw new Error("Replace MINT_ADDRESS with your actual SPL mint public key");
+    }
+    const mint = new PublicKey(MINT_ADDRESS);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/code-snippets/payments/interop/register-spl-mint.mdx` at line 29,
The snippet creates a PublicKey from the literal "YOUR_EXISTING_MINT_ADDRESS"
which will throw at runtime; update the mint creation to validate the input
before calling new PublicKey and handle errors gracefully: check that the
provided mint string is not the placeholder/empty and matches expected base58
length/format, then construct PublicKey(mintString) inside a try/catch (or
explicit validation function) and if invalid log/throw a clear message and
early-exit; refer to the PublicKey constructor and the mint variable when making
these changes.

16-16: Non-null assertion on process.env.API_KEY may fail silently.

If API_KEY is not set, the URL will contain undefined, causing cryptic RPC errors rather than a clear failure. Adding an early check improves DX.

💡 Suggested improvement
+if (!process.env.API_KEY) {
+    throw new Error("API_KEY environment variable is required");
+}
 const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/code-snippets/payments/interop/register-spl-mint.mdx` at line 16,
The RPC_URL constant uses a non-null assertion on process.env.API_KEY which can
produce an invalid URL if the env var is missing; update the top-level
initialization around RPC_URL to explicitly validate process.env.API_KEY (the
API_KEY env) before building RPC_URL (the RPC_URL constant) and fail fast with a
clear error/exception or process exit when the key is absent so you never
construct a URL containing "undefined".
snippets/code-snippets/payments/send/payment-with-memo.mdx (1)

65-69: Memo log filtering captures program invocation logs, not the memo content itself.

The filter matches log lines containing the Memo program ID, which includes the program invocation entry. To extract the actual memo text, you may also want to look for the subsequent log line or parse the data more specifically. Current approach works for demonstration but users may expect to see "INV-2024-001" directly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/code-snippets/payments/send/payment-with-memo.mdx` around lines 65 -
69, The current filter (logs.filter(...) using the Memo program ID) only
captures the program invocation line, not the memo text; update the extraction
so after finding lines that include "Program
MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" (or the variable holding that
program id) you also read the subsequent log line(s) (or the "Program log:"
entry) to capture the actual memo string (e.g., "INV-2024-001"); change the
memoLogs derivation (where txDetails, logs, and memoLogs are used) to locate the
invocation index and pull the next log entry or parse the "Program log:" entries
instead of only filtering by program id.
snippets/code-snippets/payments/verify/verify-address.mdx (1)

42-46: Empty catch blocks swallow all errors, not just "account not found".

The catch blocks assume any error means the account doesn't exist, but this could mask network failures, RPC rate limits, or other unexpected errors. For production-quality examples, consider checking the error type.

💡 Suggested improvement
     } catch (e) {
+        // In production, check if error indicates "account not found" vs other failures
         console.log(
             "Account does not exist yet — will be created on first transfer"
         );
     }

Also applies to: 52-59

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/code-snippets/payments/verify/verify-address.mdx` around lines 42 -
46, Empty catch blocks swallow errors when checking account existence; update
the two catch blocks (the one handling "Account does not exist yet — will be
created on first transfer" and the second catch at 52-59) to inspect the thrown
error and only treat it as "account not found" when it matches a specific error
code/message; otherwise log the full error (e.g., console.error) and rethrow or
surface it so network/RPC/permission errors aren’t silently ignored.
snippets/code-snippets/payments/interop/unwrap.mdx (1)

20-21: Fail fast when API_KEY is missing.

Using process.env.API_KEY! here can produce a broken URL silently. Add an explicit guard so the snippet fails with a clear message.

Suggested patch
-const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
+const apiKey = process.env.API_KEY;
+if (!apiKey) {
+    throw new Error("Missing API_KEY. Set API_KEY in your environment.");
+}
+const RPC_URL = `https://devnet.helius-rpc.com?api-key=${apiKey}`;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/code-snippets/payments/interop/unwrap.mdx` around lines 20 - 21, The
snippet builds RPC_URL using process.env.API_KEY! which can produce a broken URL
silently; add an explicit guard before constructing RPC_URL to check
process.env.API_KEY (or a const like API_KEY) and throw or
console.error+process.exit with a clear message if missing, then use that
validated API_KEY when creating RPC_URL and calling createRpc (reference
symbols: RPC_URL, createRpc, process.env.API_KEY); ensure the guard runs early
so the example fails fast with a clear error instead of producing an invalid
URL.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@light-token/payments/batch-payments.mdx`:
- Around line 96-104: The loop currently iterates only over ixs[0], dropping
additional batches returned by createTransferInterfaceInstructions; change the
loop to iterate over each batch in ixs (e.g., for (const batch of ixs)) and then
iterate each TransactionInstruction in the batch, applying the same duplicate
ComputeBudget filter (using COMPUTE_BUDGET_ID) and pushing valid instructions
into allTransferIxs while preserving the isFirst check; update references around
the ixs variable, the inner iterator, and the duplicate filter logic so all
transaction batches are processed.

In `@light-token/payments/overview.mdx`:
- Line 105: Update the Card component's title prop to use the correct
singular/possessive form: locate the Card with title="Verify Recipients Address"
(the Card element in the diff) and change the title string to either "Verify
Recipient Address" or "Verify Recipient's Address" so the grammar is correct.

In `@light-token/payments/payment-with-memo.mdx`:
- Around line 46-50: The docs advertise installing `@solana/spl-memo` but the
examples still manually build a memo instruction; either remove the npm install
line or update the examples to import and use createMemoInstruction from that
package (replace the manual TransactionInstruction construction with
createMemoInstruction(memo, signers?) and add the import statement for
createMemoInstruction from "@solana/spl-memo"); update all examples that
manually construct a memo to use the createMemoInstruction helper so the
installation instruction is actually used.

In `@light-token/payments/receive-payments.mdx`:
- Around line 14-15: Reword the sentence that currently reads “We recommend to
prepend a load instruction before.” to a clear, grammatical instruction:
explicitly state that users should prepend a "load" instruction (or call) to
create the associated token account if needed and to load any cold balance into
it — e.g., "Prepend a 'load' instruction to create the associated token account
if needed and to load any cold balance into it." Ensure the term Load (or "load"
instruction) is used consistently.
- Around line 106-123: Import Transaction from "@solana/web3.js" and avoid
redeclaring the ata const: in the example that builds an instruction using
createAssociatedTokenAccountInstruction, add Transaction to the imports and
either reuse the existing ata variable or rename the result of
getOrCreateAssociatedTokenAccount (e.g., ataAccount) instead of re-declaring
const ata; update references so getAssociatedTokenAddressSync(mint, recipient)
-> ata is used for the instruction and the await
getOrCreateAssociatedTokenAccount(connection, payer, mint, recipient) result is
stored in a distinct identifier (or assigned to the same variable without a new
const).

In `@light-token/payments/spend-permissions.mdx`:
- Around line 76-84: The delegate approval snippets pass the wrong signer:
update each approveInterface(...) call to use the token owner as the signing
argument (owner) instead of payer so the token-owner actually signs the
approval; specifically, change the final argument in approveInterface
invocations in delegate-approve.mdx, delegate-full-flow.mdx, delegate-check.mdx,
and delegate-revoke.mdx to pass owner (matching the documented behavior) while
keeping delegate.publicKey, amount cap, and other args unchanged.

In `@light-token/payments/verify-recipient-address.mdx`:
- Around line 3-4: Frontmatter contains typos: fix the navigation metadata by
correcting the keys' values — change sidebarTitle from "Verify Recipients
Address" to "Verify Recipient Address" and update description from "VVerify
recipient addresses before sending payments. Address validation prevents sending
tokens to invalid or unexpected account types." to "Verify recipient addresses
before sending payments. Address validation prevents sending tokens to invalid
or unexpected account types." so the sidebarTitle and description strings are
spelled and capitalized correctly.

In `@light-token/payments/wrap-unwrap.mdx`:
- Around line 14-16: Update the compound modifiers for readability by
hyphenating them where they describe an associated token account: replace
occurrences of "Light Token associated token account" with "Light
Token-associated token account" and "SPL or Token 2022 account" usages that
describe the account target with "SPL-associated token account" and "Token
2022-associated token account" (also update the occurrences around the same
phrasing at lines ~118-119). Ensure all similar phrases in wrap-unwrap.mdx use
the hyphenated form for consistency.

In `@light-token/wallets/gasless-transactions.mdx`:
- Around line 21-22: Fix the grammar in the paragraph beginning "Rent
sponsorship is a built-in feature..." by replacing the incorrect possessive
"Light SDK’s that sponsors" with a correct plural/verb agreement and clearer
wording: refer to the phrase "Light SDKs" (no apostrophe) and use "sponsor" or
rephrase to "The Light SDKs sponsor rent-exemption for all account types..." and
ensure the second sentence references "under the hood" and "SPL-token"
consistently (e.g., "This is handled under the hood in a way that doesn’t
disrupt the UX your users expect from SPL Token.") so subject-verb agreement and
punctuation are corrected while preserving original meaning.

In `@light-token/wallets/smart-wallets.mdx`:
- Line 11: Remove the stray horizontal rule marker '---' that appears
immediately after the imports in smart-wallets.mdx; locate the standalone line
containing only '---' (top of file after the import block) and delete it so the
page no longer renders an unintended separator.

In `@scripts/copy-payments-snippets.sh`:
- Around line 6-7: The script uses hardcoded absolute paths in the EXAMPLES and
SNIPPETS_DIR variables which will fail on other machines/CI; update
scripts/copy-payments-snippets.sh to read EXAMPLES and SNIPPETS_DIR from
environment variables (e.g., ${EXAMPLES:-...} style) or require them and exit
with an error if unset, mirroring the pattern used in
copy-sponsor-top-ups-snippets.sh; ensure you reference and replace the EXAMPLES
and SNIPPETS_DIR variable assignments in the file and add a guard that prints a
helpful message and exits nonzero when either variable is not provided.

In `@snippets/ai-prompts/wallets/smart-wallets.mdx`:
- Line 32: Whitelist the token "sqds" for cspell so CI stops failing: add "sqds"
to the repository cspell dictionary (cspell.json/cspell.yaml) or add an inline
cspell directive at the top of the file smart-wallets.mdx to ignore/allow `sqds`
(the occurrences are the `@sqds` package token mentioned around the
smartAccount/createLightTokenTransferInstruction lines). Ensure the change only
whitelists the token (do not alter the package name) and apply the same fix for
both occurrences mentioned (lines near 32 and 60).

In `@snippets/code-snippets/payments/send/batch-send.mdx`:
- Around line 53-57: The loop only consumes ixs[0], dropping any preceding
“load” batches returned by createTransferInterfaceInstructions; fix by either
pre-loading ATAs with createLoadAtaInstructions before creating transfers, or
iterate all instruction batches in ixs (for each batch in ixs) and append their
instructions to allTransferIxs (still skipping COMPUTE_BUDGET_ID entries as done
now), ensuring createTransferInterfaceInstructions' multi-batch output is fully
processed.

---

Nitpick comments:
In `@snippets/code-snippets/payments/interop/register-spl-mint.mdx`:
- Line 29: The snippet creates a PublicKey from the literal
"YOUR_EXISTING_MINT_ADDRESS" which will throw at runtime; update the mint
creation to validate the input before calling new PublicKey and handle errors
gracefully: check that the provided mint string is not the placeholder/empty and
matches expected base58 length/format, then construct PublicKey(mintString)
inside a try/catch (or explicit validation function) and if invalid log/throw a
clear message and early-exit; refer to the PublicKey constructor and the mint
variable when making these changes.
- Line 16: The RPC_URL constant uses a non-null assertion on process.env.API_KEY
which can produce an invalid URL if the env var is missing; update the top-level
initialization around RPC_URL to explicitly validate process.env.API_KEY (the
API_KEY env) before building RPC_URL (the RPC_URL constant) and fail fast with a
clear error/exception or process exit when the key is absent so you never
construct a URL containing "undefined".

In `@snippets/code-snippets/payments/interop/unwrap.mdx`:
- Around line 20-21: The snippet builds RPC_URL using process.env.API_KEY! which
can produce a broken URL silently; add an explicit guard before constructing
RPC_URL to check process.env.API_KEY (or a const like API_KEY) and throw or
console.error+process.exit with a clear message if missing, then use that
validated API_KEY when creating RPC_URL and calling createRpc (reference
symbols: RPC_URL, createRpc, process.env.API_KEY); ensure the guard runs early
so the example fails fast with a clear error instead of producing an invalid
URL.

In `@snippets/code-snippets/payments/interop/wrap.mdx`:
- Line 20: The RPC_URL constant is built using a non-null assertion on
process.env.API_KEY which can produce a URL with "undefined" if the env var is
missing; update the initialization of RPC_URL to validate process.env.API_KEY
first (e.g., check API_KEY presence at startup or throw/log a clear error) and
only interpolate when present, ensuring code that uses RPC_URL (the RPC_URL
constant) will never receive an invalid URL; include a clear error message that
mentions API_KEY when it is absent.

In `@snippets/code-snippets/payments/send/payment-with-memo.mdx`:
- Around line 65-69: The current filter (logs.filter(...) using the Memo program
ID) only captures the program invocation line, not the memo text; update the
extraction so after finding lines that include "Program
MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr" (or the variable holding that
program id) you also read the subsequent log line(s) (or the "Program log:"
entry) to capture the actual memo string (e.g., "INV-2024-001"); change the
memoLogs derivation (where txDetails, logs, and memoLogs are used) to locate the
invocation index and pull the next log entry or parse the "Program log:" entries
instead of only filtering by program id.

In `@snippets/code-snippets/payments/verify/verify-address.mdx`:
- Around line 42-46: Empty catch blocks swallow errors when checking account
existence; update the two catch blocks (the one handling "Account does not exist
yet — will be created on first transfer" and the second catch at 52-59) to
inspect the thrown error and only treat it as "account not found" when it
matches a specific error code/message; otherwise log the full error (e.g.,
console.error) and rethrow or surface it so network/RPC/permission errors aren’t
silently ignored.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0915083e-9e5a-40a4-bb3c-9a5cdf8d12eb

📥 Commits

Reviewing files that changed from the base of the PR and between bcc3459 and 87b6ddb.

📒 Files selected for processing (47)
  • README.md
  • docs.json
  • faq.mdx
  • light-token/defi/programs-pinocchio.mdx
  • light-token/defi/programs.mdx
  • light-token/defi/routers.mdx
  • light-token/payments/basic-payment.mdx
  • light-token/payments/batch-payments.mdx
  • light-token/payments/integration-guide.mdx
  • light-token/payments/overview.mdx
  • light-token/payments/payment-with-memo.mdx
  • light-token/payments/production-readiness.mdx
  • light-token/payments/receive-payments.mdx
  • light-token/payments/spend-permissions.mdx
  • light-token/payments/verify-payments.mdx
  • light-token/payments/verify-recipient-address.mdx
  • light-token/payments/wrap-unwrap.mdx
  • light-token/wallets/gasless-transactions.mdx
  • light-token/wallets/overview.mdx
  • light-token/wallets/smart-wallets.mdx
  • light-token/wallets/sponsor-top-ups.mdx
  • light-token/welcome.mdx
  • pda/compressed-pdas/nullifier-pda.mdx
  • scripts/copy-payments-snippets.sh
  • skill.md
  • snippets/ai-prompts/all-prompts.mdx
  • snippets/ai-prompts/wallets/gasless-transactions.mdx
  • snippets/ai-prompts/wallets/smart-wallets.mdx
  • snippets/code-snippets/light-token/gasless-transactions/rust-instruction.mdx
  • snippets/code-snippets/light-token/gasless-transactions/ts-instruction.mdx
  • snippets/code-snippets/payments/interop/register-spl-mint.mdx
  • snippets/code-snippets/payments/interop/unwrap.mdx
  • snippets/code-snippets/payments/interop/wrap.mdx
  • snippets/code-snippets/payments/receive/receive.mdx
  • snippets/code-snippets/payments/send/batch-send.mdx
  • snippets/code-snippets/payments/send/payment-with-memo.mdx
  • snippets/code-snippets/payments/send/send-action.mdx
  • snippets/code-snippets/payments/send/send-instruction.mdx
  • snippets/code-snippets/payments/send/sign-all-transactions.mdx
  • snippets/code-snippets/payments/spend-permissions/delegate-approve.mdx
  • snippets/code-snippets/payments/spend-permissions/delegate-check.mdx
  • snippets/code-snippets/payments/spend-permissions/delegate-full-flow.mdx
  • snippets/code-snippets/payments/spend-permissions/delegate-revoke.mdx
  • snippets/code-snippets/payments/verify/get-balance.mdx
  • snippets/code-snippets/payments/verify/get-history.mdx
  • snippets/code-snippets/payments/verify/verify-address.mdx
  • snippets/overview-tables/light-token-client-examples-table.mdx
💤 Files with no reviewable changes (4)
  • light-token/defi/programs.mdx
  • light-token/defi/routers.mdx
  • light-token/defi/programs-pinocchio.mdx
  • light-token/wallets/sponsor-top-ups.mdx

Comment on lines +96 to +104
for (const { address, amount } of recipients) {
const ixs = await createTransferInterfaceInstructions(
rpc, payer.publicKey, mint, amount, owner.publicKey, address
);
// Filter duplicate ComputeBudget instructions from subsequent calls
for (const ix of ixs[0]) {
if (!isFirst && ix.programId.toBase58() === COMPUTE_BUDGET_ID) continue;
allTransferIxs.push(ix);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify single-batch indexing usage on createTransferInterfaceInstructions output.
rg -n 'createTransferInterfaceInstructions|ixs\[0\]' light-token/payments/batch-payments.mdx

Repository: Lightprotocol/docs-v2

Length of output: 461


🏁 Script executed:

# Read the batch-payments.mdx file to understand context and other usages
wc -l light-token/payments/batch-payments.mdx

Repository: Lightprotocol/docs-v2

Length of output: 108


🏁 Script executed:

# Get context around the problematic lines and other usages
head -175 light-token/payments/batch-payments.mdx | tail -80

Repository: Lightprotocol/docs-v2

Length of output: 2419


🏁 Script executed:

# Check how other usages handle the return value (lines 125, 150, 170)
sed -n '120,180p' light-token/payments/batch-payments.mdx

Repository: Lightprotocol/docs-v2

Length of output: 1804


Use for (const batch of ixs) instead of for (const ix of ixs[0]) to process all transaction batches.

The code only accesses ixs[0], but createTransferInterfaceInstructions() returns TransactionInstruction[][] and can return multiple batches (e.g., for cold account loading). Accessing only the first batch silently drops instructions that may be required. The documentation in this same file explicitly states: "The loop pattern handles the rare multi-transaction case (cold account loading) automatically" and shows the correct pattern in the "TransactionInstruction[][] pattern" section.

Proposed fix
for (const { address, amount } of recipients) {
  const ixs = await createTransferInterfaceInstructions(
    rpc, payer.publicKey, mint, amount, owner.publicKey, address
  );
  // Filter duplicate ComputeBudget instructions from subsequent calls
- for (const ix of ixs[0]) {
+ for (const batch of ixs) {
+   for (const ix of batch) {
      if (!isFirst && ix.programId.toBase58() === COMPUTE_BUDGET_ID) continue;
      allTransferIxs.push(ix);
-   }
+     isFirst = false;
+   }
- isFirst = false;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@light-token/payments/batch-payments.mdx` around lines 96 - 104, The loop
currently iterates only over ixs[0], dropping additional batches returned by
createTransferInterfaceInstructions; change the loop to iterate over each batch
in ixs (e.g., for (const batch of ixs)) and then iterate each
TransactionInstruction in the batch, applying the same duplicate ComputeBudget
filter (using COMPUTE_BUDGET_ID) and pushing valid instructions into
allTransferIxs while preserving the isFirst check; update references around the
ixs variable, the inner iterator, and the duplicate filter logic so all
transaction batches are processed.

<Card title="Receive payments" icon="arrow-down" href="/light-token/payments/receive-payments" horizontal />
<Card title="Payment with memo" icon="memo" href="/light-token/payments/payment-with-memo" horizontal />
<Card title="Get Balance and Transaction History" icon="magnifying-glass" href="/light-token/payments/verify-payments" horizontal />
<Card title="Verify Recipients Address" icon="shield-check" href="/light-token/payments/verify-recipient-address" horizontal />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix grammar in the card title.

“Verify Recipients Address” should be singular/possessive (e.g., “Verify Recipient Address” or “Verify Recipient’s Address”).

✏️ Suggested text fix
-<Card title="Verify Recipients Address" icon="shield-check" href="/light-token/payments/verify-recipient-address" horizontal />
+<Card title="Verify Recipient Address" icon="shield-check" href="/light-token/payments/verify-recipient-address" horizontal />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Card title="Verify Recipients Address" icon="shield-check" href="/light-token/payments/verify-recipient-address" horizontal />
<Card title="Verify Recipient Address" icon="shield-check" href="/light-token/payments/verify-recipient-address" horizontal />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@light-token/payments/overview.mdx` at line 105, Update the Card component's
title prop to use the correct singular/possessive form: locate the Card with
title="Verify Recipients Address" (the Card element in the diff) and change the
title string to either "Verify Recipient Address" or "Verify Recipient's
Address" so the grammar is correct.

Comment on lines +46 to +50
Additionally install the memo program package:

```bash
npm install @solana/spl-memo
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Package installation suggested but not used in code examples.

The documentation instructs users to install @solana/spl-memo, but the code examples manually construct the memo instruction instead of using createMemoInstruction from that package. Either remove the install instruction or update the code to use the library.

Option A: Use the installed package
+import { createMemo } from "@solana/spl-memo";
+
 // Add memo to the transfer transaction
-const memoIx = new TransactionInstruction({
-  keys: [],
-  programId: MEMO_PROGRAM_ID,
-  data: Buffer.from("INV-2024-001"),
-});
+const memoIx = createMemo({ memo: "INV-2024-001" }, []);
Option B: Remove the unused package instruction
-Additionally install the memo program package:
-
-```bash
-npm install `@solana/spl-memo`
-```
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Additionally install the memo program package:
```bash
npm install @solana/spl-memo
```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@light-token/payments/payment-with-memo.mdx` around lines 46 - 50, The docs
advertise installing `@solana/spl-memo` but the examples still manually build a
memo instruction; either remove the npm install line or update the examples to
import and use createMemoInstruction from that package (replace the manual
TransactionInstruction construction with createMemoInstruction(memo, signers?)
and add the import statement for createMemoInstruction from "@solana/spl-memo");
update all examples that manually construct a memo to use the
createMemoInstruction helper so the installation instruction is actually used.

Comment on lines +14 to +15
2. We recommend to prepend a load instruction before.
Load creates the associated token account if needed and loads any cold balance into it.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Tighten the load-step instruction wording.

Current phrasing is hard to parse (“prepend a load instruction before”). Suggest making this explicit and grammatical for first-time readers.

✏️ Suggested wording
-2. We recommend to prepend a load instruction before.
-Load creates the associated token account if needed and loads any cold balance into it.
+2. We recommend prepending a load step before sending.
+   This creates the associated token account if needed and loads any cold balance into it.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
2. We recommend to prepend a load instruction before.
Load creates the associated token account if needed and loads any cold balance into it.
2. We recommend prepending a load step before sending.
This creates the associated token account if needed and loads any cold balance into it.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@light-token/payments/receive-payments.mdx` around lines 14 - 15, Reword the
sentence that currently reads “We recommend to prepend a load instruction
before.” to a clear, grammatical instruction: explicitly state that users should
prepend a "load" instruction (or call) to create the associated token account if
needed and to load any cold balance into it — e.g., "Prepend a 'load'
instruction to create the associated token account if needed and to load any
cold balance into it." Ensure the term Load (or "load" instruction) is used
consistently.

Comment on lines +106 to +123
```typescript
import {
createAssociatedTokenAccountInstruction,
getAssociatedTokenAddressSync,
getOrCreateAssociatedTokenAccount,
} from "@solana/spl-token";

const ata = getAssociatedTokenAddressSync(mint, recipient);

// Instruction:
const tx = new Transaction().add(
createAssociatedTokenAccountInstruction(payer.publicKey, ata, recipient, mint)
);

// Action:
const ata = await getOrCreateAssociatedTokenAccount(
connection, payer, mint, recipient
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify duplicate declaration and missing Transaction import in this snippet block.
rg -n 'const ata =|new Transaction\(' light-token/payments/receive-payments.mdx

Repository: Lightprotocol/docs-v2

Length of output: 474


🏁 Script executed:

sed -n '100,130p' light-token/payments/receive-payments.mdx | cat -n

Repository: Lightprotocol/docs-v2

Length of output: 872


Fix non-compiling SPL comparison snippet (const redeclaration + missing import).

Line 116 uses Transaction without importing it from @solana/web3.js, and line 121 redeclares const ata already declared on line 113. This snippet won't compile as-is when copied.

💡 Proposed fix
+import { Transaction } from "@solana/web3.js";
 import {
   createAssociatedTokenAccountInstruction,
   getAssociatedTokenAddressSync,
   getOrCreateAssociatedTokenAccount,
 } from "@solana/spl-token";

-const ata = getAssociatedTokenAddressSync(mint, recipient);
+const destinationAta = getAssociatedTokenAddressSync(mint, recipient);

 // Instruction:
 const tx = new Transaction().add(
-  createAssociatedTokenAccountInstruction(payer.publicKey, ata, recipient, mint)
+  createAssociatedTokenAccountInstruction(
+    payer.publicKey,
+    destinationAta,
+    recipient,
+    mint
+  )
 );

 // Action:
-const ata = await getOrCreateAssociatedTokenAccount(
+const destinationAccount = await getOrCreateAssociatedTokenAccount(
   connection, payer, mint, recipient
 );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```typescript
import {
createAssociatedTokenAccountInstruction,
getAssociatedTokenAddressSync,
getOrCreateAssociatedTokenAccount,
} from "@solana/spl-token";
const ata = getAssociatedTokenAddressSync(mint, recipient);
// Instruction:
const tx = new Transaction().add(
createAssociatedTokenAccountInstruction(payer.publicKey, ata, recipient, mint)
);
// Action:
const ata = await getOrCreateAssociatedTokenAccount(
connection, payer, mint, recipient
);
import { Transaction } from "@solana/web3.js";
import {
createAssociatedTokenAccountInstruction,
getAssociatedTokenAddressSync,
getOrCreateAssociatedTokenAccount,
} from "@solana/spl-token";
const destinationAta = getAssociatedTokenAddressSync(mint, recipient);
// Instruction:
const tx = new Transaction().add(
createAssociatedTokenAccountInstruction(
payer.publicKey,
destinationAta,
recipient,
mint
)
);
// Action:
const destinationAccount = await getOrCreateAssociatedTokenAccount(
connection, payer, mint, recipient
);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@light-token/payments/receive-payments.mdx` around lines 106 - 123, Import
Transaction from "@solana/web3.js" and avoid redeclaring the ata const: in the
example that builds an instruction using
createAssociatedTokenAccountInstruction, add Transaction to the imports and
either reuse the existing ata variable or rename the result of
getOrCreateAssociatedTokenAccount (e.g., ataAccount) instead of re-declaring
const ata; update references so getAssociatedTokenAddressSync(mint, recipient)
-> ata is used for the instruction and the await
getOrCreateAssociatedTokenAccount(connection, payer, mint, recipient) result is
stored in a distinct identifier (or assigned to the same variable without a new
const).

Comment on lines +21 to +22
Rent sponsorship is a built-in feature of the Light SDK’s that sponsors rent-exemption for all account types to reduce creation cost.
This is dealt with under the hood in a way that doesn’t disrupt the UX of what your users are used to with SPL-token.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix grammar in rent sponsorship explanation.

“Light SDK’s that sponsors…” reads incorrectly and may reduce trust in a core concept section.

✏️ Suggested wording
-Rent sponsorship is a built-in feature of the Light SDK’s that sponsors rent-exemption for all account types to reduce creation cost.
+Rent sponsorship is a built-in feature of the Light SDK that sponsors rent-exemption for all account types to reduce account-creation cost.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Rent sponsorship is a built-in feature of the Light SDK’s that sponsors rent-exemption for all account types to reduce creation cost.
This is dealt with under the hood in a way that doesnt disrupt the UX of what your users are used to with SPL-token.
Rent sponsorship is a built-in feature of the Light SDK that sponsors rent-exemption for all account types to reduce account-creation cost.
This is dealt with under the hood in a way that doesn't disrupt the UX of what your users are used to with SPL-token.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@light-token/wallets/gasless-transactions.mdx` around lines 21 - 22, Fix the
grammar in the paragraph beginning "Rent sponsorship is a built-in feature..."
by replacing the incorrect possessive "Light SDK’s that sponsors" with a correct
plural/verb agreement and clearer wording: refer to the phrase "Light SDKs" (no
apostrophe) and use "sponsor" or rephrase to "The Light SDKs sponsor
rent-exemption for all account types..." and ensure the second sentence
references "under the hood" and "SPL-token" consistently (e.g., "This is handled
under the hood in a way that doesn’t disrupt the UX your users expect from SPL
Token.") so subject-verb agreement and punctuation are corrected while
preserving original meaning.

import SmartWalletsAiPrompt from "/snippets/ai-prompts/wallets/smart-wallets.mdx";
import SupportFooter from "/snippets/support-footer.mdx";

---
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove the stray horizontal rule marker.

The standalone --- after imports is likely accidental and introduces an unnecessary top-of-page separator.

🧹 Proposed fix
----
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@light-token/wallets/smart-wallets.mdx` at line 11, Remove the stray
horizontal rule marker '---' that appears immediately after the imports in
smart-wallets.mdx; locate the standalone line containing only '---' (top of file
after the import block) and delete it so the page no longer renders an
unintended separator.

Comment on lines +6 to +7
EXAMPLES="/home/tilo/Workspace/examples-light-token-main/toolkits/payments"
SNIPPETS_DIR="/home/tilo/Workspace/docs-main/snippets/code-snippets/payments"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Hardcoded absolute paths will break on other machines and CI.

The paths /home/tilo/Workspace/... are user-specific and won't work for other contributors or CI environments. The existing copy-sponsor-top-ups-snippets.sh script demonstrates the recommended pattern using environment variables with a required check.

🔧 Suggested fix using environment variables
-EXAMPLES="/home/tilo/Workspace/examples-light-token-main/toolkits/payments"
-SNIPPETS_DIR="/home/tilo/Workspace/docs-main/snippets/code-snippets/payments"
+SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
+EXAMPLES="${EXAMPLES_LIGHT_TOKEN:?Set EXAMPLES_LIGHT_TOKEN to examples-light-token repo root}/toolkits/payments"
+SNIPPETS_DIR="$SCRIPT_DIR/../snippets/code-snippets/payments"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
EXAMPLES="/home/tilo/Workspace/examples-light-token-main/toolkits/payments"
SNIPPETS_DIR="/home/tilo/Workspace/docs-main/snippets/code-snippets/payments"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
EXAMPLES="${EXAMPLES_LIGHT_TOKEN:?Set EXAMPLES_LIGHT_TOKEN to examples-light-token repo root}/toolkits/payments"
SNIPPETS_DIR="$SCRIPT_DIR/../snippets/code-snippets/payments"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/copy-payments-snippets.sh` around lines 6 - 7, The script uses
hardcoded absolute paths in the EXAMPLES and SNIPPETS_DIR variables which will
fail on other machines/CI; update scripts/copy-payments-snippets.sh to read
EXAMPLES and SNIPPETS_DIR from environment variables (e.g., ${EXAMPLES:-...}
style) or require them and exit with an error if unset, mirroring the pattern
used in copy-sponsor-top-ups-snippets.sh; ensure you reference and replace the
EXAMPLES and SNIPPETS_DIR variable assignments in the file and add a guard that
prints a helpful message and exits nonzero when either variable is not provided.

Comment on lines +53 to +57
for (const ix of ixs[0]) {
if (!isFirst && ix.programId.toBase58() === COMPUTE_BUDGET_ID)
continue;
allTransferIxs.push(ix);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for createTransferInterfaceInstructions usage and handling..."
rg -n -C3 'createTransferInterfaceInstructions\(|sliceLast\(|TransactionInstruction\[\]\[\]'

Repository: Lightprotocol/docs-v2

Length of output: 50379


🏁 Script executed:

cat -n snippets/code-snippets/payments/send/batch-send.mdx | sed -n '40,70p'

Repository: Lightprotocol/docs-v2

Length of output: 1383


🏁 Script executed:

cat -n light-token/payments/batch-payments.mdx | sed -n '90,110p'

Repository: Lightprotocol/docs-v2

Length of output: 931


🏁 Script executed:

cat -n snippets/code-snippets/payments/send/batch-send.mdx | sed -n '1,50p'

Repository: Lightprotocol/docs-v2

Length of output: 2098


🏁 Script executed:

cat -n light-token/payments/batch-payments.mdx | sed -n '60,95p'

Repository: Lightprotocol/docs-v2

Length of output: 1562


🏁 Script executed:

cat -n snippets/code-snippets/payments/send/batch-send.mdx | sed -n '24,40p'

Repository: Lightprotocol/docs-v2

Length of output: 873


🏁 Script executed:

grep -n "createAtaInterfaceIdempotent\|Idempotent" light-token/payments/batch-payments.mdx

Repository: Lightprotocol/docs-v2

Length of output: 47


🏁 Script executed:

cat -n light-token/payments/batch-payments.mdx | sed -n '140,180p'

Repository: Lightprotocol/docs-v2

Length of output: 1648


Pre-load accounts or loop all instruction batches instead of only processing ixs[0].

The batch-send example creates ATAs idempotently but does not pre-load accounts like the batch-payments guide does. If accounts remain cold/compressed, createTransferInterfaceInstructions will return multiple instruction batches (load + transfer), but this code only processes ixs[0] and silently drops the load instructions in ixs[1..n].

Compare against the batch-payments guide, which explicitly pre-loads all accounts with createLoadAtaInstructions before the batch transfer. Alternatively, follow the documented TransactionInstruction[][] pattern (shown at batch-payments.mdx:145–158) and loop through all batches.

Suggested fix: Pre-load accounts
// Step 2: Create ATAs idempotently for sender + all recipients
await createAtaInterfaceIdempotent(rpc, payer, mint, payer.publicKey);
for (const { address } of recipients) {
    await createAtaInterfaceIdempotent(rpc, payer, mint, address);
}

+// Step 2b: Pre-load sender + recipient accounts to ensure they are hot
+const senderAta = getAssociatedTokenAddressInterface(mint, payer.publicKey);
+const loadSenderIxs = await createLoadAtaInstructions(
+    rpc, senderAta, payer.publicKey, mint, payer.publicKey
+);
+for (const ixs of loadSenderIxs) {
+    await sendAndConfirmTransaction(rpc, new Transaction().add(...ixs), [payer]);
+}
+
+for (const { address } of recipients) {
+    const recipientAta = getAssociatedTokenAddressInterface(mint, address);
+    const loadIxs = await createLoadAtaInstructions(
+        rpc, recipientAta, address, mint, payer.publicKey
+    );
+    for (const ixs of loadIxs) {
+        await sendAndConfirmTransaction(rpc, new Transaction().add(...ixs), [payer]);
+    }
+}

// Step 3: Derive ATA addresses
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@snippets/code-snippets/payments/send/batch-send.mdx` around lines 53 - 57,
The loop only consumes ixs[0], dropping any preceding “load” batches returned by
createTransferInterfaceInstructions; fix by either pre-loading ATAs with
createLoadAtaInstructions before creating transfers, or iterate all instruction
batches in ixs (for each batch in ixs) and append their instructions to
allTransferIxs (still skipping COMPUTE_BUDGET_ID entries as done now), ensuring
createTransferInterfaceInstructions' multi-batch output is fully processed.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment on lines +372 to +375
{
"source": "/pda/compressed-pdas/nullifier-pda",
"destination": "https://zkcompression.com/pda/compressed-pdas/nullifier-pda"
},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Self-referential redirect creates infinite loop for nullifier-pda page

The PR adds a redirect from /pda/compressed-pdas/nullifier-pda to https://zkcompression.com/pda/compressed-pdas/nullifier-pda at docs.json:372-375. Since the site is hosted at zkcompression.com, this redirects the page to itself. The page pda/compressed-pdas/nullifier-pda.mdx exists as an actual file and is listed in the navigation at docs.json:109, so this redirect is both unnecessary and potentially creates an infinite redirect loop depending on how Mintlify prioritizes redirects vs. navigation pages.

Suggested change
{
"source": "/pda/compressed-pdas/nullifier-pda",
"destination": "https://zkcompression.com/pda/compressed-pdas/nullifier-pda"
},
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant