Skip to content

Add Rust client examples to cookbook#21

Merged
tilo-14 merged 21 commits intomainfrom
add-rust-client
Feb 2, 2026
Merged

Add Rust client examples to cookbook#21
tilo-14 merged 21 commits intomainfrom
add-rust-client

Conversation

@tilo-14
Copy link
Member

@tilo-14 tilo-14 commented Feb 2, 2026

Summary

  • Add Rust client code examples (action + instruction) to cookbook pages: create-mint, create-ata, create-token-account, mint-to, transfer-interface, transfer-checked, close-token-account, burn, freeze-thaw, approve-revoke, wrap-unwrap
  • Add SPL vs Light code comparison widgets to cookbook pages
  • Remove program tabs from cookbook (moved to add-anchor branch)
  • Add client examples overview page
  • Align Rust dependency versions with examples-light-token
  • Update streaming mints/tokens toolkit pages
  • Fix MDX parsing issues (missing blank lines after imports)
  • Clean up info snippet text

Test plan

  • Verify all cookbook pages render without errors
  • Verify code snippets display correctly in Action/Instruction tabs
  • Verify code comparison widgets render
  • Check no broken imports or missing snippet files

Summary by CodeRabbit

  • New Features

    • Added cookbook guides for approve/revoke, burn, freeze/thaw, and transfer-checked operations.
    • Added new toolkit pages for streaming mints and streaming tokens.
    • Expanded client examples documentation.
  • Documentation

    • Updated installation instructions to use stable package versions instead of beta.
    • Restructured existing cookbook guides with improved code comparisons and simplified presentation.
    • Removed light-token terminology reference page.
  • Chores

    • Updated Rust and TypeScript code snippets and dependencies.
    • Enhanced code comparison component with language support.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Warning

Rate limit exceeded

@tilo-14 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 31 minutes and 37 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

This PR substantially restructures Light Token documentation by removing pre-release package tags, reorganizing cookbook guides to use component-based code examples instead of inline code blocks, adding comprehensive Rust-language code examples alongside TypeScript ones, enhancing the CodeCompare component with copy-to-clipboard and language support, introducing new toolkit pages, and updating Rust dependencies to version 0.19.0.

Changes

Cohort / File(s) Summary
Package Stability
client-library/client-guide.mdx, resources/cli-installation.mdx
Removed @beta tags from package version specifications, indicating stable releases of stateless.js, compressed-token, and zk-compression-cli packages.
Documentation Navigation & Structure
docs.json, light-token/examples/client.mdx, light-token/toolkits/overview.mdx
Added new toolkit pages (streaming-mints, streaming-tokens), created examples section, enabled streaming-mints card, and reorganized Light Token documentation hierarchy.
Cookbook Modernization
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-interface.mdx, light-token/cookbook/wrap-unwrap.mdx
Refactored cookbook pages to replace inline code examples with CodeCompare components and imported code snippets; added Rust client sections with Action/Instruction tabs; expanded content to cover both TypeScript and Rust implementations.
Toolkit Documentation
light-token/toolkits/for-streaming-mints.mdx, light-token/toolkits/for-streaming-tokens.mdx
Updated streaming-mints to use account-based filtering instead of transaction-centric events; replaced inline examples in streaming-tokens with tabbed code snippet components.
Code Snippet Infrastructure
scripts/copy-light-token-snippets.sh, scripts/copy-rust-snippets.sh
Enhanced TypeScript snippet copy script with additional paths and status messages; introduced new Rust snippet copy script handling multiple recipe categories with automated Markdown wrapping.
Component Enhancement
snippets/jsx/code-compare.jsx
Added language prop for syntax highlighting support (rust/javascript), implemented copy-to-clipboard functionality with visual feedback, refined slider state management with showingFirst flag, and improved code pane rendering with dynamic height calculation.
Code Sample Expansion
snippets/code-samples/code-compare-snippets.jsx
Massively expanded with Rust code equivalents across all token operations (transfer, create-ata, create-mint, mint-to, etc.) including macro and CPI variants; removed inline comment headers from existing TypeScript blocks.
New Code Snippets (Approve/Revoke)
snippets/code-snippets/light-token/approve-revoke/*
Added TypeScript and Rust examples demonstrating approve and revoke operations for token delegation, including action, instruction, and full-example variants.
New Code Snippets (Burn)
snippets/code-snippets/light-token/burn/, snippets/code-snippets/light-token/burn-checked/
Introduced burn and burn-checked instruction examples for Rust clients with step-by-step setup and transaction execution patterns.
New Code Snippets (Account Management)
snippets/code-snippets/light-token/close-token-account/, snippets/code-snippets/light-token/create-ata/, snippets/code-snippets/light-token/create-mint/, snippets/code-snippets/light-token/create-token-account/
Added comprehensive action, instruction, anchor-macro, and idempotent variants for account and mint creation across Rust and TypeScript; includes full-example files with test harnesses.
New Code Snippets (Transfer & Exchange)
snippets/code-snippets/light-token/freeze-thaw/, snippets/code-snippets/light-token/load-ata/, snippets/code-snippets/light-token/mint-to/, snippets/code-snippets/light-token/transfer-checked/, snippets/code-snippets/light-token/transfer-interface/, snippets/code-snippets/light-token/unwrap/, snippets/code-snippets/light-token/wrap/
Added action and instruction examples for freeze, thaw, load-ata, mint-to, transfer-checked, transfer-interface, and wrap/unwrap operations in both Rust and TypeScript clients.
Account List Documentation
snippets/accounts-list/light-token-create-accounts-list-client.mdx, snippets/accounts-list/light-token-create-accounts-list.mdx, snippets/accounts-list/light-token-create-ata-accounts-list.mdx
Updated rent sponsor and payer descriptions for clarity, changing "fronted by" language to "paid by the light token program".
Overview Tables
snippets/overview-tables/cookbook-guides-table.mdx, snippets/overview-tables/light-token-client-examples-table.mdx, snippets/overview-tables/light-token-program-examples-table.mdx
Added comprehensive tables listing cookbook guides (transfer-checked, burn, freeze-thaw, approve-revoke, load-ata), client examples with action/instruction links for TypeScript and Rust, and program instruction/macro references.
Dependency & Version Management
snippets/setup/compressed-pdas-program-setup.mdx, snippets/setup/rust-install-dependencies.mdx, snippets/versions/rust-deps-0.16.0.mdx, snippets/versions/rust-deps-0.19.0.mdx, snippets/versions/rust-deps-token-sdk-0.16.0.mdx, snippets/versions/rust-deps-token-sdk-0.19.0.mdx
Updated Rust dependencies from light-sdk 0.16.0 to 0.19.0, light-client to 0.19.0 with v2 features, light-token to 0.4.0; removed legacy package references and reorganized dependency documentation by version.
Documentation Removal
references/light-token-terminology.mdx
Deleted comprehensive terminology reference document covering concepts like Claim, Compressibility, Compressed state, and related Light Token constructs.
Configuration Files
.mintignore, .mintlifyignore
Added ignore rules for node_modules directory in both Mint and Mintlify documentation tooling.

Sequence Diagram(s)

sequenceDiagram
    participant User as Developer
    participant App as TypeScript/Rust Client
    participant RPC as Light Protocol RPC
    participant Chain as Solana Blockchain
    
    User->>App: Initialize mint interface with decimals
    App->>RPC: Create Mint transaction
    RPC->>Chain: Submit CreateMint instruction
    Chain-->>RPC: Mint account created
    
    User->>App: Create Associated Token Account (ATA)
    App->>RPC: CreateAta with idempotent flag
    RPC->>Chain: Submit CreateAta instruction
    Chain-->>RPC: ATA created/verified
    
    User->>App: Mint tokens to ATA
    App->>RPC: MintTo with amount and authority
    RPC->>Chain: Submit MintTo instruction
    Chain-->>RPC: Tokens minted, balance updated
    
    User->>App: Approve delegate for amount
    App->>RPC: Approve instruction with delegate and amount
    RPC->>Chain: Submit Approve instruction
    Chain-->>RPC: Delegate authorized
    
    User->>App: Transfer tokens with decimal check
    App->>RPC: TransferChecked with decimals validation
    RPC->>Chain: Submit TransferChecked instruction
    Chain-->>RPC: Tokens transferred, balance updated
    
    App->>RPC: Fetch updated account data
    RPC->>Chain: Query account state
    Chain-->>RPC: Return deserialized Token state
    RPC-->>App: Account data with balance/delegate
    App-->>User: Display operation result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

  • chore: update payments guide, fmt #4: Modifies same cookbook pages (create-ata.mdx, create-mint.mdx, create-token-account.mdx) with related Next Steps and navigation updates.
  • Add ZK documentation #12: Introduces snippet copy scripts and synchronizes new documentation snippets with similar automated code extraction patterns.
  • Add client library guide #1: Updates docs.json navigation configuration and client-library/client-guide.mdx in parallel with documentation restructuring.

Poem

🐰 The docs are dressed in Rust and crisp TypeScript,
No beta tags to slip from authors' lips,
Component snippets dance in neat arrays,
While CodeCompare shows the modern ways,
Approve, revoke, and transfers all aligned—
Documentation truly redesigned!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Add Rust client examples to cookbook' directly and clearly describes the main change: adding Rust client code examples to cookbook documentation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-rust-client

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

@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: 20

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
docs.json (1)

54-87: ⚠️ Potential issue | 🔴 Critical

Fix broken navigation links: 11 referenced pages do not exist.

All newly added page references in the navigation are missing from the repository and will result in 404 errors:

  • light-token/toolkits/for-streaming-mints
  • light-token/toolkits/for-streaming-tokens
  • light-token/examples/client
  • light-token/cookbook/create-mint
  • light-token/cookbook/create-ata
  • light-token/cookbook/create-token-account
  • light-token/cookbook/mint-to
  • light-token/cookbook/close-token-account
  • light-token/cookbook/transfer-interface
  • light-token/cookbook/wrap-unwrap
  • light-token/cookbook/load-ata

Either create these MDX files or remove the corresponding nav entries.

snippets/jsx/code-compare.jsx (1)

1-370: ⚠️ Potential issue | 🟠 Major

CI is failing Prettier on this file.

The pipeline reports a Prettier formatting failure for snippets/jsx/code-compare.jsx. Please run prettier --write on this file and re-check CI.

snippets/code-samples/code-compare-snippets.jsx (1)

1-3: ⚠️ Potential issue | 🟠 Major

Fix Prettier formatting failure for this file.
CI reports a Prettier check failure; please run Prettier on this file before merge.

🤖 Fix all issues with AI agents
In @.mintignore:
- Line 1: Update the `.mintignore` entry for the node_modules directory to
explicitly include a trailing slash: replace the current "node_modules" pattern
with "node_modules/" so the file unambiguously matches a directory (follow the
same convention used in `.mintlifyignore`).

In @.mintlifyignore:
- Line 1: Delete the stray `.mintlifyignore` file—Mintlify uses `.mintignore`
(already present), so remove the unused `.mintlifyignore` to avoid confusion and
duplication in repository configuration.

In `@light-token/cookbook/approve-revoke.mdx`:
- Around line 8-12: Remove the stray YAML delimiter line between the frontmatter
and imports by deleting the extra '---' that appears before the import block;
ensure the import statements (TokenClientPrerequisites, FullSetup, and
CodeCompare) come immediately after the closed frontmatter so the MDX parser
sees the imports directly following the frontmatter closure.

In `@light-token/cookbook/close-token-account.mdx`:
- Around line 19-20: The second bullet uses inconsistent capitalization ("Light
token"); update the text so both bullets use "Light Token" with capital T in
"Token" to match the rest of the page—specifically change the phrase "Light
token accounts can be closed by the owner." to "Light Token accounts can be
closed by the owner."

In `@light-token/cookbook/create-ata.mdx`:
- Around line 31-32: The sentence "Light-ATAs are on-chain accounts like SPL
ATA's, but the light token program sponsors the rent-exemption cost for you."
uses incorrect possessive/apostrophe pluralization; update the phrase "SPL
ATA's" to the plural form "SPL ATAs" so it reads "Light-ATAs are on-chain
accounts like SPL ATAs, but the light token program sponsors the rent-exemption
cost for you." to fix the grammar.

In `@light-token/cookbook/create-token-account.mdx`:
- Around line 24-25: Replace the lowercase mentions in the two lines shown:
change "Light token accounts" to "Light Token accounts" and change "light token
program" to "Light Token program" so the product name is capitalized
consistently (leave other terms like "SPL" and "Token 2022" unchanged); update
the exact phrases "Light token accounts" and "light token program" in the file
to "Light Token accounts" and "Light Token program".

In `@light-token/cookbook/transfer-checked.mdx`:
- Around line 8-12: Remove the extraneous '---' that appears immediately before
the import block so MDX imports (TokenClientPrerequisites, RustActionCode,
RustInstructionCode) come first; delete the standalone '---' after the
frontmatter (lines following the existing frontmatter) so the imports are the
first non-frontmatter content in transfer-checked.mdx.

In `@light-token/cookbook/wrap-unwrap.mdx`:
- Around line 77-129: The Rust tabs currently only include Action examples
(components WrapRustActionCode and UnwrapRustActionCode) but the PR requires
both Action and Instruction examples; add an "Instruction" Tab alongside the
existing "Action" Tab for both the Wrap and Unwrap Tabs, using the corresponding
instruction snippet components (e.g., WrapRustInstructionCode and
UnwrapRustInstructionCode) or the existing instruction content if available, and
keep TokenClientPrerequisites intact; if no instruction snippets exist, update
the PR description to state the objective changed instead of adding empty
Instruction tabs.

In `@light-token/toolkits/for-streaming-tokens.mdx`:
- Around line 11-19: Fix two text issues in the paragraph: replace the
misspelled word "autoatically" with "automatically" (occurring in the phrase
"its token accounts and related PDAs will be compressed autoatically") and
change the compound adjective "warm up" to the hyphenated form "warm-up" when
modifying "instruction" (in the phrase "prepend an idempotent decompress warm up
instruction" → "prepend an idempotent decompress warm-up instruction").

In `@scripts/copy-light-token-snippets.sh`:
- Around line 6-7: Replace the hardcoded absolute paths assigned to EXAMPLES and
SNIPPETS_DIR with portable values: derive defaults relative to the script
location using the script directory (e.g., based on dirname "$0") and/or allow
overriding via environment variables or command-line arguments (e.g., honor
EXAMPLES and SNIPPETS_DIR env vars if set, otherwise fall back to relative
defaults); update the assignments for EXAMPLES and SNIPPETS_DIR in
copy-light-token-snippets.sh and adjust any downstream uses to rely on these
variables.

In `@scripts/copy-rust-snippets.sh`:
- Around line 6-8: Replace the hard-coded absolute paths by reading optional env
overrides and falling back to repo-relative defaults: use EXAMPLES_DIR and
SNIPPETS_DIR env vars if set, otherwise compute defaults relative to the
repository root (e.g., using the script's directory via dirname "$0" or git
rev-parse --show-toplevel) and assign those to EXAMPLES_DIR and SNIPPETS_DIR;
then validate both directories exist and exit with a clear error if missing
(fail fast). Update the top of scripts/copy-rust-snippets.sh to set EXAMPLES_DIR
and SNIPPETS_DIR from env or computed repo-relative paths and add checks that
call echo + exit 1 when the paths are not directories.

In `@snippets/code-snippets/light-token/approve-revoke/approve-action.mdx`:
- Around line 26-37: The approve call uses a number literal (500) while
mintToCompressed used a bigint (1000n); update the approve invocation (function
approve) to use a bigint amount (e.g., 500n) so types are consistent with
createMintInterface/mintToCompressed and other token operations involving
BigInt; locate the approve(...) call near where Keypair.generate() creates
delegate and replace the numeric literal with a BigInt literal.

In `@snippets/code-snippets/light-token/burn/rust-client/instruction.mdx`:
- Around line 2-6: Add the missing import for the token state by adding a use
statement for light_token_interface::state::Token at the top of the file so
Token::deserialize() can be resolved; update the imports near the existing use
lines (e.g., alongside use light_token::instruction::Burn and use
rust_client::{setup, SetupContext}) to include Token so the call on
Token::deserialize(...) on the later line compiles.

In
`@snippets/code-snippets/light-token/create-mint/anchor-macro/full-example.mdx`:
- Around line 154-168: The test is missing the import of light_token_types so
references to light_token_types::CPI_AUTHORITY_PDA will fail to compile; add an
import for the module (e.g., bring CPI_AUTHORITY_PDA into scope) near the other
use/import lines and then simplify the two references (previously
light_token_types::CPI_AUTHORITY_PDA) to just CPI_AUTHORITY_PDA in the test
where find_mint_address, COMPRESSIBLE_CONFIG_V1, and RENT_SPONSOR are used.

In `@snippets/code-snippets/light-token/create-mint/rust-client/instruction.mdx`:
- Around line 31-58: Replace the three unwrap() calls with proper error
propagation using the function's Result return: call
rpc.get_random_state_tree_info()? instead of .unwrap(), await and propagate the
Result from rpc.get_validity_proof(...).await? (or map_err to a descriptive
error) instead of .await.unwrap(), and handle rpc_result.proof.0 as an Option by
using .ok_or_else(|| /* descriptive error */)? to convert it into a Result for
propagation; update references around get_random_state_tree_info,
get_validity_proof, and rpc_result.proof so CreateMintParams is built only after
these fallible calls have been converted to ?-propagated Results.

In
`@snippets/code-snippets/light-token/create-token-account/anchor-macro/full-example.mdx`:
- Around line 224-229: The test currently only logs the transaction outcome, so
failures are ignored; replace the println!("Transaction result: {:?}", result)
with a check that fails the test on error by asserting the Result returned by
rpc.create_and_send_transaction is Ok (or propagating the error) and include the
error details in the assertion message—locate the call to
rpc.create_and_send_transaction (assigned to result) and update the code to
assert/result-handling so the test fails when the transaction fails.

In `@snippets/code-snippets/light-token/transfer-interface/instruction.mdx`:
- Line 50: Fix the typo in the inline comment that reads "Transfer tokens
between light-token associate token accounts" by changing "associate" to
"associated" so the comment reads "Transfer tokens between light-token
associated token accounts"; locate and update this exact comment string in the
instruction.mdx snippet.

In `@snippets/code-snippets/light-token/unwrap/instruction.mdx`:
- Around line 17-21: The snippet references an undefined RPC_URL when calling
createRpc(RPC_URL) which causes a runtime ReferenceError; fix by either
restoring the devnet constant RPC_URL (uncomment the line that defines RPC_URL)
so createRpc(RPC_URL) has a valid value, or switch to the localnet form by
calling createRpc() with no argument; look for the RPC_URL constant and the
createRpc(...) call to update accordingly.

In `@snippets/code-snippets/light-token/wrap/instruction.mdx`:
- Around line 18-22: The snippet references RPC_URL when calling createRpc (rpc
= createRpc(RPC_URL)) but RPC_URL is currently commented out, causing a
ReferenceError; fix by either uncommenting/defining RPC_URL (e.g., set const
RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`)
before calling createRpc, or change the call to createRpc() for localnet
usage—update the line that initializes rpc (the createRpc invocation) so it
matches the intended example (devnet with RPC_URL defined or localnet using
createRpc()).

In `@snippets/jsx/code-compare.jsx`:
- Around line 11-26: The handleCopy function should guard against missing
Clipboard API and failures and should store/clear the copy timeout to avoid
state updates after unmount: update handleCopy to first check
navigator.clipboard and wrap navigator.clipboard.writeText(codeToCopy) in
try/catch (handle failures gracefully, e.g., early return or fallback), save the
setTimeout id into a ref (e.g., copyTimeoutRef) instead of ignoring it, and add
a useEffect cleanup that clears copyTimeoutRef.current (and any other related
timers) on unmount; refer to handleCopy, copied/setCopied, and create a
copyTimeoutRef to locate where to change code.
🧹 Nitpick comments (2)
snippets/code-snippets/light-token/create-token-account/rust-client/instruction.mdx (1)

23-25: Consider breaking long line for readability.

Line 24 exceeds typical line length limits. Consider formatting for better readability in documentation.

📝 Suggested formatting
     let sig = rpc
-        .create_and_send_transaction(&[create_token_account_instruction], &payer.pubkey(), &[&payer, &account])
+        .create_and_send_transaction(
+            &[create_token_account_instruction],
+            &payer.pubkey(),
+            &[&payer, &account],
+        )
         .await?;
light-token/cookbook/freeze-thaw.mdx (1)

73-85: Single-tab containers could be simplified.

The inner <Tabs> wrappers on lines 73-77 and 80-84 each contain only one tab ("Instruction"). If Action tabs aren't planned for this release, consider removing the extra nesting for cleaner structure.

If this is a placeholder for future Action tabs, consider leaving a comment to clarify the intent.

@@ -0,0 +1 @@
node_modules
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

🧩 Analysis chain

🌐 Web query:

.mintignore file format Mint documentation trailing slash

💡 Result:

Mintlify’s .mintignore is a plain-text file (placed in the root of your docs directory) that uses the same pattern syntax as .gitignore—one pattern per line, # for comments, glob patterns like *.draft.mdx, **/internal/**, and negation with !pattern. [1]

Trailing slash rule: because it follows .gitignore semantics, a pattern ending in / matches directories only (and everything under them). Without the trailing /, the pattern can match both files and directories. Example: drafts/ ignores the drafts directory; drafts could match a file or directory named drafts. [2]


Add trailing slash to match .gitignore conventions.

The .mintignore file uses .gitignore pattern syntax. For directories like node_modules, the trailing slash should be included—change node_modules to node_modules/ to explicitly indicate it's a directory match. This aligns with .gitignore best practices and the existing convention in .mintlifyignore.

🤖 Prompt for AI Agents
In @.mintignore at line 1, Update the `.mintignore` entry for the node_modules
directory to explicitly include a trailing slash: replace the current
"node_modules" pattern with "node_modules/" so the file unambiguously matches a
directory (follow the same convention used in `.mintlifyignore`).

@@ -0,0 +1 @@
node_modules/
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

.mintlifyignore file format documentation trailing slash

💡 Result:

Mintlify’s ignore file is .mintignore (not .mintlifyignore). It uses the same pattern syntax as .gitignore. (mintlify.com)

Trailing slash meaning: a pattern ending in / matches a directory (and everything under it). Example from Mintlify’s docs: drafts/ excludes the entire drafts folder. (mintlify.com)

Citations:


🏁 Script executed:

# Check if .mintignore exists in the repository
find . -name ".mintignore" -o -name ".mintlifyignore" | head -20

Repository: Lightprotocol/docs-v2

Length of output: 96


🏁 Script executed:

# Search for any references to mintify or mintignore in the codebase
rg -i "mintify|mintignore" --type json --type md --type txt | head -30

Repository: Lightprotocol/docs-v2

Length of output: 47


🏁 Script executed:

echo "=== .mintignore ===" && cat -n .mintignore && echo -e "\n=== .mintlifyignore ===" && cat -n .mintlifyignore

Repository: Lightprotocol/docs-v2

Length of output: 150


Remove .mintlifyignore — the correct filename for Mintlify is .mintignore.

Mintlify only recognizes .mintignore (not .mintlifyignore). The repository already has .mintignore configured correctly. The .mintlifyignore file will not be used by Mintlify and should be deleted to avoid confusion.

🤖 Prompt for AI Agents
In @.mintlifyignore at line 1, Delete the stray `.mintlifyignore` file—Mintlify
uses `.mintignore` (already present), so remove the unused `.mintlifyignore` to
avoid confusion and duplication in repository configuration.

Comment on lines +8 to +12
---

import TokenClientPrerequisites from "/snippets/light-token-guides/light-token-client-prerequisites.mdx";
import FullSetup from "/snippets/setup/full-setup.mdx";
import { CodeCompare } from "/snippets/jsx/code-compare.jsx";
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:

# First, let's locate and examine the file
fd "approve-revoke.mdx" -x cat -n {}

Repository: Lightprotocol/docs-v2

Length of output: 5380


🌐 Web query:

MDX import statements frontmatter horizontal rule syntax

💡 Result:

  • MDX “core” (mdxjs) doesn’t support YAML frontmatter by default. If you want metadata, the built-in/portable approach is ESM exports instead of frontmatter (e.g., export const title = ...). (mdxjs.com)
  • If your toolchain does support YAML frontmatter (via plugins), the delimiter is the same as Markdown frontmatter: a fenced block at the very top of the file using --- lines (this looks like a horizontal rule, but in this position it’s parsed as frontmatter). (github.com)

Import vs frontmatter ordering (common gotcha):

  • In Gatsby (gatsby-plugin-mdx), frontmatter must come first, and import statements go after the frontmatter block. (v3.gatsbyjs.com)

Example (Gatsby-style):

---
title: Hello
date: 2026-02-02
---

import Callout from "../components/Callout.mdx"

# Hello

<Callout />

Citations:


Remove the extraneous horizontal rule before imports.

The file has valid YAML frontmatter (lines 1–6) correctly closed with ---, followed by a blank line. The extra --- on line 8 before imports is invalid—MDX syntax expects imports to come immediately after frontmatter closure, not preceded by another --- delimiter. This stray delimiter can confuse MDX parsers and break document processing.

✅ Proposed fix
---

----
-
 import TokenClientPrerequisites from "/snippets/light-token-guides/light-token-client-prerequisites.mdx";
🤖 Prompt for AI Agents
In `@light-token/cookbook/approve-revoke.mdx` around lines 8 - 12, Remove the
stray YAML delimiter line between the frontmatter and imports by deleting the
extra '---' that appears before the import block; ensure the import statements
(TokenClientPrerequisites, FullSetup, and CodeCompare) come immediately after
the closed frontmatter so the MDX parser sees the imports directly following the
frontmatter closure.

Comment on lines +19 to +20
1. Closing a Light Token account transfers remaining lamports to a destination account and the rent sponsor can reclaim sponsored rent.
2. Light token accounts can be closed by the owner.
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

Use consistent “Light Token” capitalization in the bullet list.

The second bullet uses “Light token” (lowercase). Align with the rest of the page’s terminology.

✍️ Suggested tweak
-2. Light token accounts can be closed by the owner.
+2. Light Token accounts can be closed by the owner.
📝 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
1. Closing a Light Token account transfers remaining lamports to a destination account and the rent sponsor can reclaim sponsored rent.
2. Light token accounts can be closed by the owner.
1. Closing a Light Token account transfers remaining lamports to a destination account and the rent sponsor can reclaim sponsored rent.
2. Light Token accounts can be closed by the owner.
🤖 Prompt for AI Agents
In `@light-token/cookbook/close-token-account.mdx` around lines 19 - 20, The
second bullet uses inconsistent capitalization ("Light token"); update the text
so both bullets use "Light Token" with capital T in "Token" to match the rest of
the page—specifically change the phrase "Light token accounts can be closed by
the owner." to "Light Token accounts can be closed by the owner."

Comment on lines +31 to +32
1. Associated Light Token accounts can hold token balances of light, SPL, or Token 2022 mints.
2. Light-ATAs are on-chain accounts like SPL ATA's, but the light token program sponsors the rent-exemption cost for you.
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 pluralization in “ATA's.”
Use “ATAs” without an apostrophe.

✏️ Suggested edit
-2. Light-ATAs are on-chain accounts like SPL ATA's, but the light token program sponsors the rent-exemption cost for you.
+2. Light-ATAs are on-chain accounts like SPL ATAs, but the light token program sponsors the rent-exemption cost for you.
📝 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
1. Associated Light Token accounts can hold token balances of light, SPL, or Token 2022 mints.
2. Light-ATAs are on-chain accounts like SPL ATA's, but the light token program sponsors the rent-exemption cost for you.
1. Associated Light Token accounts can hold token balances of light, SPL, or Token 2022 mints.
2. Light-ATAs are on-chain accounts like SPL ATAs, but the light token program sponsors the rent-exemption cost for you.
🤖 Prompt for AI Agents
In `@light-token/cookbook/create-ata.mdx` around lines 31 - 32, The sentence
"Light-ATAs are on-chain accounts like SPL ATA's, but the light token program
sponsors the rent-exemption cost for you." uses incorrect possessive/apostrophe
pluralization; update the phrase "SPL ATA's" to the plural form "SPL ATAs" so it
reads "Light-ATAs are on-chain accounts like SPL ATAs, but the light token
program sponsors the rent-exemption cost for you." to fix the grammar.

Comment on lines +224 to +229
let result = rpc
.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer])
.await;

println!("Transaction result: {:?}", result);
}
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

Make the test fail on transaction errors.
The result is only logged, so the test can pass even if the transaction fails.

✅ Suggested fix
-    let result = rpc
-        .create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer])
-        .await;
-
-    println!("Transaction result: {:?}", result);
+    rpc
+        .create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer])
+        .await
+        .unwrap();
📝 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
let result = rpc
.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer])
.await;
println!("Transaction result: {:?}", result);
}
rpc
.create_and_send_transaction(&[instruction], &payer.pubkey(), &[&payer])
.await
.unwrap();
}
🤖 Prompt for AI Agents
In
`@snippets/code-snippets/light-token/create-token-account/anchor-macro/full-example.mdx`
around lines 224 - 229, The test currently only logs the transaction outcome, so
failures are ignored; replace the println!("Transaction result: {:?}", result)
with a check that fails the test on error by asserting the Result returned by
rpc.create_and_send_transaction is Ok (or propagating the error) and include the
error details in the assertion message—locate the call to
rpc.create_and_send_transaction (assigned to result) and update the code to
assert/result-handling so the test fails when the transaction fails.

recipient.publicKey,
);

// Transfer tokens between light-token associate token accounts
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

Typo in comment.

"associate" should be "associated".

-    // Transfer tokens between light-token associate token accounts
+    // Transfer tokens between light-token associated token accounts
📝 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
// Transfer tokens between light-token associate token accounts
// Transfer tokens between light-token associated token accounts
🤖 Prompt for AI Agents
In `@snippets/code-snippets/light-token/transfer-interface/instruction.mdx` at
line 50, Fix the typo in the inline comment that reads "Transfer tokens between
light-token associate token accounts" by changing "associate" to "associated" so
the comment reads "Transfer tokens between light-token associated token
accounts"; locate and update this exact comment string in the instruction.mdx
snippet.

Comment on lines 17 to 21
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Undefined RPC_URL variable will cause runtime error.

The RPC_URL constant on line 18 is commented out, but it's still referenced on line 19 in createRpc(RPC_URL). This will cause a ReferenceError when the snippet is executed.

Either uncomment the devnet URL or switch to the localnet configuration:

🐛 Option 1: Uncomment the devnet URL
 // devnet:
-// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
+const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
 const rpc = createRpc(RPC_URL);
 // localnet:
 // const rpc = createRpc();
🐛 Option 2: Switch to localnet (no URL required)
 // devnet:
 // const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
-const rpc = createRpc(RPC_URL);
 // localnet:
-// const rpc = createRpc();
+const rpc = createRpc();
📝 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
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
Suggested change
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
// devnet:
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// localnet:
const rpc = createRpc();
🤖 Prompt for AI Agents
In `@snippets/code-snippets/light-token/unwrap/instruction.mdx` around lines 17 -
21, The snippet references an undefined RPC_URL when calling createRpc(RPC_URL)
which causes a runtime ReferenceError; fix by either restoring the devnet
constant RPC_URL (uncomment the line that defines RPC_URL) so createRpc(RPC_URL)
has a valid value, or switch to the localnet form by calling createRpc() with no
argument; look for the RPC_URL constant and the createRpc(...) call to update
accordingly.

Comment on lines 18 to 22
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

RPC_URL is undefined — this code snippet will not run.

Line 19 comments out the RPC_URL definition, but line 20 still references it. This will throw a ReferenceError when developers copy and run this example.

Proposed fix

Either uncomment the definition:

 // devnet:
-// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
+const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
 const rpc = createRpc(RPC_URL);

Or if the intent is to show a placeholder for users to fill in:

 // devnet:
-// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
-const rpc = createRpc(RPC_URL);
+const RPC_URL = `https://devnet.helius-rpc.com?api-key=<YOUR_API_KEY>`;
+const rpc = createRpc(RPC_URL);
📝 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
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
Suggested change
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
// const RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
// devnet:
const RPC_URL = `https://devnet.helius-rpc.com?api-key=<YOUR_API_KEY>`;
const rpc = createRpc(RPC_URL);
// localnet:
// const rpc = createRpc();
🤖 Prompt for AI Agents
In `@snippets/code-snippets/light-token/wrap/instruction.mdx` around lines 18 -
22, The snippet references RPC_URL when calling createRpc (rpc =
createRpc(RPC_URL)) but RPC_URL is currently commented out, causing a
ReferenceError; fix by either uncommenting/defining RPC_URL (e.g., set const
RPC_URL = `https://devnet.helius-rpc.com?api-key=${process.env.API_KEY!}`)
before calling createRpc, or change the call to createRpc() for localnet
usage—update the line that initializes rpc (the createRpc invocation) so it
matches the intended example (devnet with RPC_URL defined or localnet using
createRpc()).

Comment on lines +11 to +26
const [copied, setCopied] = useState(false);
const containerRef = useRef(null);
const animationRef = useRef(null);
const firstPreRef = useRef(null);
const secondPreRef = useRef(null);
const [containerHeight, setContainerHeight] = useState(null);

const isLightMode = sliderPercent > 50;
// When slider is on the right (100%), show first code; on left (0%), show second code
const showingFirst = sliderPercent > 50;

const handleCopy = async () => {
const codeToCopy = showingFirst ? firstCode : secondCode;
await navigator.clipboard.writeText(codeToCopy);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};
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

🌐 Web query:

navigator.clipboard.writeText secure context requirements browser support Safari iOS

💡 Result:

Secure-context + security requirements for navigator.clipboard.writeText()

  • Must be a secure context: your page needs to be served over HTTPS (and “secure-context” equivalents such as localhost in many browsers). Otherwise the call will fail (often with NotAllowedError). [1][2]
  • Must be triggered by a user gesture (transient activation) in Safari (macOS + iOS) (and Firefox): call it directly inside a click/tap/pointer handler (e.g., pointerdown, pointerup, click). [2][3]
  • Permissions model differences:
    • Safari / Firefox: do not support the clipboard-read / clipboard-write Permissions API model; they rely on user activation (and Safari may show native UI for clipboard access). [2][3]
    • Chromium: can also be affected by Permissions-Policy when used in iframes (e.g., requiring clipboard-write to be allowed). [2]

Browser support (Safari iOS)

  • Safari on iOS: support for the async Clipboard API (navigator.clipboard / writeText) is reported as supported starting iOS Safari 13.4+. [4]
  • Safari (macOS): reported as supported starting Safari 13.1+. [4]
  • WebKit’s Safari 13.1 announcement notes the API is available via navigator.clipboard, requires user-gesture handlers, and requires a secure context (https://) (and uses native UI rather than a permissions prompt). [3]

Sources:
[1] MDN – Clipboard.writeText() secure context requirement https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/writeText
[2] MDN – Clipboard API security/permission model notes https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
[3] WebKit – Safari 13.1 “Async Clipboard API” notes https://webkit.org/blog/10247/new-webkit-features-in-safari-13-1/
[4] Can I use – Clipboard API (write) support table (Safari / iOS Safari versions) https://caniuse.com/mdn-api_clipboard_write


🏁 Script executed:

# Find and examine the actual code file
fd "code-compare.jsx" --type f

Repository: Lightprotocol/docs-v2

Length of output: 94


🏁 Script executed:

# Read the code-compare.jsx file to verify the concerns
cat -n "snippets/jsx/code-compare.jsx" | head -160

Repository: Lightprotocol/docs-v2

Length of output: 7096


Guard clipboard usage and clean up the copy timer.

navigator.clipboard.writeText requires a secure context (HTTPS or localhost) and can fail if the API is unavailable or the clipboard access is denied. Additionally, the setTimeout on line 25 is not stored in a ref, so it cannot be cleaned up on component unmount, risking a state update after teardown.

♻️ Suggested change
-  const [copied, setCopied] = useState(false);
+  const [copied, setCopied] = useState(false);
+  const copyTimeoutRef = useRef(null);
...
-  const handleCopy = async () => {
-    const codeToCopy = showingFirst ? firstCode : secondCode;
-    await navigator.clipboard.writeText(codeToCopy);
-    setCopied(true);
-    setTimeout(() => setCopied(false), 2000);
-  };
+  const handleCopy = async () => {
+    const codeToCopy = showingFirst ? firstCode : secondCode;
+    try {
+      if (!navigator.clipboard?.writeText) {
+        throw new Error("Clipboard API unavailable");
+      }
+      await navigator.clipboard.writeText(codeToCopy);
+      setCopied(true);
+      if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
+      copyTimeoutRef.current = setTimeout(() => setCopied(false), 2000);
+    } catch (err) {
+      console.error("Copy failed", err);
+    }
+  };
...
-    return () => {
-      if (animationRef.current) cancelAnimationFrame(animationRef.current);
-    };
+    return () => {
+      if (animationRef.current) cancelAnimationFrame(animationRef.current);
+      if (copyTimeoutRef.current) clearTimeout(copyTimeoutRef.current);
+    };

Also applies to: 150-155

🤖 Prompt for AI Agents
In `@snippets/jsx/code-compare.jsx` around lines 11 - 26, The handleCopy function
should guard against missing Clipboard API and failures and should store/clear
the copy timeout to avoid state updates after unmount: update handleCopy to
first check navigator.clipboard and wrap
navigator.clipboard.writeText(codeToCopy) in try/catch (handle failures
gracefully, e.g., early return or fallback), save the setTimeout id into a ref
(e.g., copyTimeoutRef) instead of ignoring it, and add a useEffect cleanup that
clears copyTimeoutRef.current (and any other related timers) on unmount; refer
to handleCopy, copied/setCopied, and create a copyTimeoutRef to locate where to
change code.

@tilo-14 tilo-14 merged commit 2f1478f into main Feb 2, 2026
6 checks passed
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