-
Notifications
You must be signed in to change notification settings - Fork 1
Reorganize docs navigation and home page #23
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Sync Examples Light Token | ||
|
|
||
| on: | ||
| repository_dispatch: | ||
| types: [sync-examples-light-token] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| sync: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout docs repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Checkout examples repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: Lightprotocol/examples-light-token | ||
| path: examples-light-token | ||
| ref: ${{ github.event.client_payload.commit || 'main' }} | ||
|
|
||
| - name: Run snippet sync scripts | ||
| env: | ||
| EXAMPLES_LIGHT_TOKEN: ${{ github.workspace }}/examples-light-token | ||
| run: | | ||
| chmod +x ./scripts/copy-light-token-snippets.sh | ||
| chmod +x ./scripts/copy-rust-snippets.sh | ||
| chmod +x ./scripts/copy-program-snippets.sh | ||
| chmod +x ./scripts/copy-sponsor-top-ups-snippets.sh | ||
|
|
||
| ./scripts/copy-light-token-snippets.sh | ||
| ./scripts/copy-rust-snippets.sh | ||
| ./scripts/copy-program-snippets.sh | ||
| ./scripts/copy-sponsor-top-ups-snippets.sh | ||
|
|
||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v7 | ||
| with: | ||
| branch: auto-sync/examples-light-token | ||
| delete-branch: true | ||
| title: "chore: sync code snippets from examples-light-token" | ||
| commit-message: "chore: sync snippets from examples-light-token@${{ github.event.client_payload.commit || 'manual' }}" | ||
| body: | | ||
| Auto-generated by [sync workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). | ||
|
|
||
| Source commit: Lightprotocol/examples-light-token@${{ github.event.client_payload.commit || 'manual dispatch' }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| node_modules/ | ||
| .entire/ | ||
| ai-tools/skills/ | ||
| ai-tools/prompts/ | ||
| ai-tools/.claude-plugin/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| Resources for developers to learn and build: | ||
|
|
||
| - **Light-Token Program**: High performance token program that reduces the cost of account creations by 200x, while being more CU efficient than SPL on hot paths. | ||
| - **ZK Compression Core**: Solana account primitive that lets you create tokens and PDAs without rent-exemption cost with L1 performance and security. | ||
|
|
||
| Resources for developers to learn and build: | ||
| * **Light-Token Program**: High performance token program that reduces the cost of account creations by 200x, while being more CU efficient than SPL on hot paths. | ||
| * **ZK Compression Core**: Solana account primitive that lets you create tokens and PDAs without rent-exemption with L1 performance and security. | ||
| --- | ||
|
|
||
| Find more resources here: | ||
| * Documentation: [zkcompression.com](https://www.zkcompression.com). | ||
| * [Examples](https://github.com/Lightprotocol/examples-light-token) | ||
| * [Agent Skills](https://github.com/Lightprotocol/skills/tree/main) | ||
|
|
||
| - Documentation: [zkcompression.com](https://www.zkcompression.com). | ||
| - [Examples](https://github.com/Lightprotocol/examples-light-token) | ||
| - [Agent Skills](https://github.com/Lightprotocol/skills/tree/main) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| title: "AI Prompts" | ||
| description: "Ready-to-use AI prompts for Light Protocol. Copy a prompt, paste into your AI coding agent, and let it implement the recipe in your project." | ||
| --- | ||
|
|
||
| import AllPrompts from "/snippets/ai-prompts/all-prompts.mdx"; | ||
|
|
||
| <AllPrompts /> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,194 @@ | ||||||
| --- | ||||||
| title: "Anchor Constraints LightAccount" | ||||||
| description: "Syntax reference for #[light_account] constraints with sponsored rent-exemption." | ||||||
| --- | ||||||
|
|
||||||
| - [`#[light_account(init)]`](#light_accountinit) creates a PDA | ||||||
| - [`#[light_account(init, token::...)]`](#light_accountinit-token) creates a token account via CPI | ||||||
| - [`#[light_account(init, associated_token::...)]`](#light_accountinit-associated_token) creates an ATA via CPI | ||||||
| - [`#[light_account(init, mint::...)]`](#light_accountinit-mint) creates a mint via CPI | ||||||
| - [Required accounts](#required-accounts) per account type | ||||||
|
|
||||||
| Place `#[light_account]` below standard Anchor `#[account]` on the same field. | ||||||
| Anchor handles seeds, space, and payer; LightAccount handles rent-free creation. | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### `#[light_account(init)]` | ||||||
|
|
||||||
| Creates a rent-free PDA. No additional parameters — uses Anchor `#[account]` seeds and space. | ||||||
|
|
||||||
| **attribute** | ||||||
|
|
||||||
| ``` | ||||||
| #[light_account(init)] | ||||||
| ``` | ||||||
|
|
||||||
| ```rust | ||||||
| #[account( // ← Anchor: seeds, space, payer | ||||||
| init, | ||||||
| payer = fee_payer, | ||||||
| space = 8 + <Counter as anchor_lang::Space>::INIT_SPACE, | ||||||
| seeds = [COUNTER_SEED, owner.key().as_ref()], | ||||||
| bump, | ||||||
| )] | ||||||
| #[light_account(init)] // ← Light: register for rent-free creation | ||||||
| pub counter: Account<'info, Counter>, | ||||||
| ``` | ||||||
|
|
||||||
| Examples: [Github](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/counter) | ||||||
|
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. Capitalize "GitHub" correctly (applies to lines 39, 73, 101, 165). The official spelling uses a capital "H". This appears four times in the file. -Examples: [Github](https://github.com/...
+Examples: [GitHub](https://github.com/...📝 Committable suggestion
Suggested change
🧰 Tools🪛 LanguageTool[uncategorized] ~39-~39: The official name of this software platform is spelled with a capital “H”. (GITHUB) 🤖 Prompt for AI Agents |
||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### `#[light_account(init, token::...)]` | ||||||
|
|
||||||
| Creates a rent-free token account via CPI to the Light Token program. The account type is `UncheckedAccount` because Light Token program initializes it via CPI. | ||||||
|
|
||||||
| **attribute** | ||||||
|
|
||||||
| ``` | ||||||
| #[light_account(init, | ||||||
| token::authority = <seeds>, | ||||||
| token::mint = <account>, | ||||||
| token::owner = <account>, | ||||||
| token::bump = <expr> | ||||||
| )] | ||||||
| ``` | ||||||
|
|
||||||
| ```rust | ||||||
| #[account( | ||||||
| mut, | ||||||
| seeds = [VAULT_SEED, mint.key().as_ref()], | ||||||
| bump, | ||||||
| )] | ||||||
| #[light_account(init, | ||||||
| token::authority = [VAULT_SEED, self.mint.key()], | ||||||
| token::mint = mint, | ||||||
| token::owner = vault_authority, | ||||||
| token::bump = params.vault_bump | ||||||
| )] | ||||||
| pub vault: UncheckedAccount<'info>, | ||||||
| ``` | ||||||
|
|
||||||
| Examples: [Github](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-token-account) | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### `#[light_account(init, associated_token::...)]` | ||||||
|
|
||||||
| Creates a rent-free associated token account via CPI. | ||||||
|
|
||||||
| **attribute** | ||||||
|
|
||||||
| ``` | ||||||
| #[light_account(init, | ||||||
| associated_token::authority = <account>, | ||||||
| associated_token::mint = <account>, | ||||||
| associated_token::bump = <expr> | ||||||
| )] | ||||||
| ``` | ||||||
|
|
||||||
| ```rust | ||||||
| #[account(mut)] | ||||||
| #[light_account(init, | ||||||
| associated_token::authority = associated_token_account_owner, | ||||||
| associated_token::mint = associated_token_account_mint, | ||||||
| associated_token::bump = params.associated_token_account_bump | ||||||
| )] | ||||||
| pub associated_token_account: UncheckedAccount<'info>, | ||||||
| ``` | ||||||
|
|
||||||
| Examples: [Github](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-associated-token-account) | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### `#[light_account(init, mint::...)]` | ||||||
|
|
||||||
| Creates a rent-free mint via CPI. | ||||||
|
|
||||||
| **attribute (required)** | ||||||
|
|
||||||
| ``` | ||||||
| #[light_account(init, mint, | ||||||
| mint::signer = <account>, | ||||||
| mint::authority = <account>, | ||||||
| mint::decimals = <expr>, | ||||||
| mint::seeds = <seeds>, | ||||||
| )] | ||||||
| ``` | ||||||
|
|
||||||
| **attribute (optional)** | ||||||
|
|
||||||
| ``` | ||||||
| mint::bump = <expr> | ||||||
| mint::freeze_authority = <ident> | ||||||
| mint::authority_seeds = <seeds> | ||||||
| mint::name = <expr> // requires symbol + uri | ||||||
| mint::symbol = <expr> // requires name + uri | ||||||
| mint::uri = <expr> // requires name + symbol | ||||||
| mint::update_authority = <ident> // requires name, symbol, uri | ||||||
| mint::additional_metadata = <expr> // requires name, symbol, uri | ||||||
| ``` | ||||||
|
|
||||||
| ```rust | ||||||
| #[account(mut)] | ||||||
| #[light_account(init, mint, | ||||||
| mint::signer = mint_signer, | ||||||
| mint::authority = fee_payer, | ||||||
| mint::decimals = 9, | ||||||
| mint::seeds = &[MINT_SIGNER_SEED, self.authority.to_account_info().key.as_ref()], | ||||||
| )] | ||||||
| pub mint: UncheckedAccount<'info>, | ||||||
| ``` | ||||||
|
|
||||||
| <Accordion title="Mint with metadata"> | ||||||
|
|
||||||
| ```rust | ||||||
| #[account(mut)] | ||||||
| #[light_account(init, mint, | ||||||
| mint::signer = mint_signer, | ||||||
| mint::authority = fee_payer, | ||||||
| mint::decimals = 9, | ||||||
| mint::seeds = &[MINT_SIGNER_SEED, self.authority.to_account_info().key.as_ref()], | ||||||
| mint::bump = params.mint_signer_bump, | ||||||
| mint::name = params.name.clone(), | ||||||
| mint::symbol = params.symbol.clone(), | ||||||
| mint::uri = params.uri.clone(), | ||||||
| mint::update_authority = authority, | ||||||
| mint::additional_metadata = params.additional_metadata.clone() | ||||||
| )] | ||||||
| pub mint: UncheckedAccount<'info>, | ||||||
| ``` | ||||||
|
|
||||||
| </Accordion> | ||||||
|
|
||||||
| Examples: [Github](https://github.com/Lightprotocol/examples-light-token/tree/main/programs/anchor/basic-macros/create-mint) | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Required accounts | ||||||
|
|
||||||
| Add these to your `init` struct alongside the fields above. The `LightAccounts` derive macro appends additional protocol accounts to the instruction at runtime — you don't add those manually. | ||||||
|
|
||||||
| <Tabs> | ||||||
| <Tab title="PDA"> | ||||||
|
|
||||||
| | Account | Description | | ||||||
| |:-|:-| | ||||||
| | `compression_config` | Per-program PDA. Stores rent sponsor address and compression settings. Initialize once via `InitializeRentFreeConfig`. | | ||||||
| | `pda_rent_sponsor` | Per-program PDA. Receives rent-exemption lamports when accounts compress. Must be mutable. | | ||||||
| | `system_program` | Solana System Program. Transfers lamports for rent-exemption. | | ||||||
|
|
||||||
| </Tab> | ||||||
| <Tab title="Token / ATA / Mint"> | ||||||
|
|
||||||
| | Account | Description | | ||||||
| |:-|:-| | ||||||
| | `light_token_compressible_config` | Protocol PDA. Stores rent-config for Light Token accounts. | | ||||||
| | `light_token_rent_sponsor` | Protocol PDA. Holds the lamport pool that sponsors rent-exemption. Reclaims lamports when accounts compress. | | ||||||
| | `light_token_program` | Light Token program. CPI target for token, ATA, and mint creation. | | ||||||
| | `light_token_cpi_authority` | Signer PDA. Authorizes CPI calls from your program to the Light Token program. | | ||||||
| | `system_program` | Solana System Program. Transfers lamports for rent-exemption. | | ||||||
|
|
||||||
| </Tab> | ||||||
| </Tabs> | ||||||
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.
🔴 GitHub Actions workflow calls scripts with hardcoded local paths that will fail in CI
The new
sync-examples-light-token.ymlworkflow setsEXAMPLES_LIGHT_TOKENas an environment variable and calls four scripts. Onlycopy-sponsor-top-ups-snippets.sh(new in this PR) correctly uses${EXAMPLES_LIGHT_TOKEN:?...}. The other three scripts (copy-light-token-snippets.sh,copy-rust-snippets.sh,copy-program-snippets.sh) use hardcoded paths like/home/tilo/Workspace/...which don't exist on the CI runner.Root Cause
The workflow at
.github/workflows/sync-examples-light-token.yml:23-34setsEXAMPLES_LIGHT_TOKEN: ${{ github.workspace }}/examples-light-tokenand calls all four scripts. However:scripts/copy-light-token-snippets.sh:6usesEXAMPLES="/home/tilo/Workspace/streaming-tokens/typescript-client"scripts/copy-rust-snippets.sh:6usesEXAMPLES_DIR="/home/tilo/Workspace/examples-light-token/rust-client"scripts/copy-program-snippets.sh:12usesANCHOR_EXAMPLES_DIR="/home/tilo/Workspace/examples-light-token-anchor/programs/anchor/basic-instructions"When the workflow runs on
ubuntu-latest, these paths don't exist, andcat/ file operations will fail. The workflow will never successfully sync snippets.Impact: The automated snippet sync workflow will fail every time it runs (on
repository_dispatchorworkflow_dispatch), silently preventing docs from staying in sync with the examples repo.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.