Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Add Rust client examples to cookbook#21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
2395ef46b81885bb0256e263cb990672c1eb081708708d6dd01972b9ccf3ebe28f9e094028ff07b7dad6f01b3d45ffcf46307a015d169d4df9099582ba4573360930d327443f8786823File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node_modules | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node_modules/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Mintlify’s ignore file is Trailing slash meaning: a pattern ending in Citations:
🏁 Script executed: # Check if .mintignore exists in the repository
find . -name ".mintignore" -o -name ".mintlifyignore"| head -20Repository: 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 -30Repository: Lightprotocol/docs-v2 Length of output: 47 🏁 Script executed: echo"=== .mintignore ==="&& cat -n .mintignore &&echo -e "\n=== .mintlifyignore ==="&& cat -n .mintlifyignoreRepository: Lightprotocol/docs-v2 Length of output: 150 Remove Mintlify only recognizes 🤖 Prompt for AI Agents | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| --- | ||
| title: Approve and Revoke Delegates | ||
| sidebarTitle: Approve / Revoke | ||
| description: Rust client guide to approve and revoke delegates for Light Token accounts. Includes step-by-step implementation and full code examples. | ||
| keywords: ["approve delegate solana", "revoke delegate solana", "token delegation"] | ||
| --- | ||
| --- | ||
| 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"; | ||
Comment on lines
+8
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 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:
💡 Result:
Import vs frontmatter ordering (common gotcha):
Example (Gatsby-style): ---title: Hellodate: 2026-02-02---importCalloutfrom"../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 ✅ Proposed fix--------
import TokenClientPrerequisites from "/snippets/light-token-guides/light-token-client-prerequisites.mdx";🤖 Prompt for AI Agents | ||
| import { | ||
| splApproveCode, | ||
| lightApproveCode, | ||
| splRevokeCode, | ||
| lightRevokeCode, | ||
| splApproveRustCode, | ||
| lightApproveRustCode, | ||
| splRevokeRustCode, | ||
| lightRevokeRustCode, | ||
| } from "/snippets/code-samples/code-compare-snippets.jsx"; | ||
| import TsApproveActionCode from "/snippets/code-snippets/light-token/approve-revoke/approve-action.mdx"; | ||
| import TsRevokeActionCode from "/snippets/code-snippets/light-token/approve-revoke/revoke-action.mdx"; | ||
| import ApproveActionCode from "/snippets/code-snippets/light-token/approve-revoke/rust-client/approve-action.mdx"; | ||
| import ApproveInstructionCode from "/snippets/code-snippets/light-token/approve-revoke/rust-client/approve-instruction.mdx"; | ||
| import RevokeActionCode from "/snippets/code-snippets/light-token/approve-revoke/rust-client/revoke-action.mdx"; | ||
| import RevokeInstructionCode from "/snippets/code-snippets/light-token/approve-revoke/rust-client/revoke-instruction.mdx"; | ||
| import ApproveAnchorProgramCode from "/snippets/code-snippets/light-token/approve/anchor-program/full-example.mdx"; | ||
| import RevokeAnchorProgramCode from "/snippets/code-snippets/light-token/revoke/anchor-program/full-example.mdx"; | ||
| 1. Approve grants a delegate permission to transfer up to a specified amount of tokens from your account. | ||
| * Each token account can have only one delegate at a time. | ||
| * Any new approval overwrites the previous one. | ||
| 2. Revoke removes all delegate permissions from a Light Token account. | ||
| 3. Only the token account owner can approve or revoke delegates. | ||
| <Tabs> | ||
| <Tab title="TypeScript Client"> | ||
| <Tabs> | ||
| <Tab title="Approve"> | ||
| `approve` grants a delegate permission to transfer up to a specified amount of tokens. | ||
| <CodeCompare | ||
| firstCode={lightApproveCode} | ||
| secondCode={splApproveCode} | ||
| firstLabel="light-token" | ||
| secondLabel="SPL" | ||
| /> | ||
| </Tab> | ||
| <Tab title="Revoke"> | ||
| `revoke` removes all delegate permissions from a Light Token account. | ||
| <CodeCompare | ||
| firstCode={lightRevokeCode} | ||
| secondCode={splRevokeCode} | ||
| firstLabel="light-token" | ||
| secondLabel="SPL" | ||
| /> | ||
| </Tab> | ||
| </Tabs> | ||
| <Info> | ||
| Find the source code | ||
| [here](https://github.com/Lightprotocol/examples-light-token/tree/main/typescript-client/actions). | ||
| </Info> | ||
| <Steps> | ||
| <Step> | ||
| ### Approve a delegate | ||
| <FullSetup /> | ||
| <TsApproveActionCode /> | ||
| </Step> | ||
| <Step> | ||
| ### Revoke a delegate | ||
| <TsRevokeActionCode /> | ||
| </Step> | ||
| </Steps> | ||
| </Tab> | ||
| <Tab title="Rust Client"> | ||
| <Tabs> | ||
| <Tab title="Approve"> | ||
| <CodeCompare | ||
| firstCode={lightApproveRustCode} | ||
| secondCode={splApproveRustCode} | ||
| firstLabel="light-token" | ||
| secondLabel="SPL" | ||
| language="rust" | ||
| /> | ||
| </Tab> | ||
| <Tab title="Revoke"> | ||
| <CodeCompare | ||
| firstCode={lightRevokeRustCode} | ||
| secondCode={splRevokeRustCode} | ||
| firstLabel="light-token" | ||
| secondLabel="SPL" | ||
| language="rust" | ||
| /> | ||
| </Tab> | ||
| </Tabs> | ||
| <Steps> | ||
| <Step> | ||
| ### Prerequisites | ||
| <TokenClientPrerequisites /> | ||
| </Step> | ||
| <Step> | ||
| ### Approve or revoke delegates | ||
| <Info> | ||
| Find the full example including shared test utilities in the | ||
| [examples-light-token](https://github.com/Lightprotocol/examples-light-token/tree/main/rust-client). | ||
| </Info> | ||
| <Tabs> | ||
| <Tab title="Approve"> | ||
| <Tabs> | ||
| <Tab title="Action"> | ||
| <ApproveActionCode /> | ||
| </Tab> | ||
| <Tab title="Instruction"> | ||
| <ApproveInstructionCode /> | ||
| </Tab> | ||
| </Tabs> | ||
| </Tab> | ||
| <Tab title="Revoke"> | ||
| <Tabs> | ||
| <Tab title="Action"> | ||
| <RevokeActionCode /> | ||
| </Tab> | ||
| <Tab title="Instruction"> | ||
| <RevokeInstructionCode /> | ||
| </Tab> | ||
| </Tabs> | ||
| </Tab> | ||
| </Tabs> | ||
| </Step> | ||
| </Steps> | ||
| </Tab> | ||
| </Tabs> | ||
| # Next Steps | ||
| <Card | ||
| title="Go back to the overview for the Light Token standard" | ||
| icon="chevron-right" | ||
| color="#0066ff" | ||
| href="/light-token/welcome" | ||
| horizontal | ||
| /> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --- | ||
| title: Burn Light Tokens | ||
| sidebarTitle: Burn | ||
| description: Rust client guide to burn Light Tokens. Includes step-by-step implementation and full code examples. | ||
| keywords: ["burn tokens on solana", "destroy tokens solana", "reduce token supply"] | ||
| --- | ||
| --- | ||
| import TokenClientPrerequisites from "/snippets/light-token-guides/light-token-client-prerequisites.mdx"; | ||
| import { CodeCompare } from "/snippets/jsx/code-compare.jsx"; | ||
| import { | ||
| splBurnRustCode, | ||
| lightBurnRustCode, | ||
| } from "/snippets/code-samples/code-compare-snippets.jsx"; | ||
| import RustInstructionCode from "/snippets/code-snippets/light-token/burn/rust-client/instruction.mdx"; | ||
| import BurnCheckedRustInstructionCode from "/snippets/code-snippets/light-token/burn-checked/rust-client/instruction.mdx"; | ||
| 1. Burn permanently destroys tokens by reducing the balance in a token account. | ||
| 2. Burned tokens are removed from circulation and decreases the supply tracked on the mint account. | ||
| 3. Only the token account owner (or approved delegate) can burn tokens. | ||
| <Tabs> | ||
| <Tab title="Rust Client"> | ||
| Compare to SPL: | ||
| <CodeCompare | ||
| firstCode={lightBurnRustCode} | ||
| secondCode={splBurnRustCode} | ||
| firstLabel="light-token" | ||
| secondLabel="SPL" | ||
| language="rust" | ||
| /> | ||
| <Steps> | ||
| <Step> | ||
| ### Prerequisites | ||
| <TokenClientPrerequisites /> | ||
| </Step> | ||
| <Step> | ||
| ### Burn Light Tokens | ||
| <Info> | ||
| Find the full example including shared test utilities in the | ||
| [examples-light-token](https://github.com/Lightprotocol/examples-light-token/tree/main/rust-client). | ||
| </Info> | ||
| <Tabs> | ||
| <Tab title="Instruction"> | ||
| <RustInstructionCode /> | ||
| </Tab> | ||
| </Tabs> | ||
| </Step> | ||
| </Steps> | ||
| </Tab> | ||
| </Tabs> | ||
| # Next Steps | ||
| <Card | ||
| title="Learn to freeze and thaw Light Token accounts" | ||
| icon="chevron-right" | ||
| color="#0066ff" | ||
| href="/light-token/cookbook/freeze-thaw" | ||
| horizontal | ||
| /> |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
.mintignore file format Mint documentation trailing slash💡 Result:
Mintlify’s
.mintignoreis 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
.gitignoresemantics, 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 thedraftsdirectory;draftscould match a file or directory nameddrafts. [2]Add trailing slash to match
.gitignoreconventions.The
.mintignorefile uses.gitignorepattern syntax. For directories likenode_modules, the trailing slash should be included—changenode_modulestonode_modules/to explicitly indicate it's a directory match. This aligns with.gitignorebest practices and the existing convention in.mintlifyignore.🤖 Prompt for AI Agents