Skip to content

Conversation

@SwenSchaeferjohann
Copy link
Contributor

@SwenSchaeferjohann SwenSchaeferjohann commented Nov 23, 2025

adds TS client for

  • metadata
  • mints
  • new transfer, create account instructions and actions

adds

  • getAccountInfoInterface
  • getAccountInterface

todo

  • final cleanup

before merge, squash the commit for: https://github.com/Lightprotocol/photon/pull/44/files and update cli photon setup accordingly

Summary by CodeRabbit

Release Notes

  • Documentation
    • Added comprehensive guide for c-token payment operations, including setup, sending and receiving payments, balance inquiry, transaction tracking, and token unwrapping with code examples.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 23, 2025

Walkthrough

A new documentation file ctokens_for_payments.md is added, detailing c-token payment implementation including setup instructions, five core operation flows (receive, send, balance, history, unwrap), SPL and c-token variants with instruction-level examples, and operation mapping reference.

Changes

Cohort / File(s) Change Summary
Documentation: C-Token Payments Guide
ctokens_for_payments.md
New documentation file covering c-token payment setup, five operation flows (Receive Payments, Send Payments, Show Balance, Transaction History, Unwrap to SPL), both SPL token and c-token variants with code examples, idempotent ATA creation patterns, interface references (getOrCreateAtaInterface, getAtaInterface, transferInterface, unwrap), CTOKEN_PROGRAM_ID integration, and quick reference mapping between SPL and c-token operations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Notes:

  • Pure documentation addition with no code changes—review focuses on accuracy, completeness, and clarity of explanations
  • Verify code examples are syntactically correct and reflect current API contracts
  • Cross-check interface references against actual implementation

Poem

📚 A guide unfolds with purpose clear,
C-tokens flow, no doubt or fear,
Payments made both smooth and bright,
Documentation shining light! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 70.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The PR title 'feat: ts interface' is vague and generic. While it references TypeScript interfaces, it doesn't convey the main change: adding a TypeScript client with metadata, mints, transfer/account instructions, and documentation for c-token payments. Use a more descriptive title like 'feat: add TypeScript client for metadata, mints, and transfer operations' to clearly communicate the primary objectives of this changeset.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch swen/ts-interface

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b75066 and 3c9cbf5.

⛔ Files ignored due to path filters (119)
  • .github/workflows/js-v2.yml is excluded by none and included by none
  • cli/src/utils/constants.ts is excluded by none and included by none
  • cli/src/utils/processPhotonIndexer.ts is excluded by none and included by none
  • js/compressed-token/package.json is excluded by none and included by none
  • js/compressed-token/rollup.config.js is excluded by none and included by none
  • js/compressed-token/src/actions/approve-and-mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/actions/compress-spl-token-account.ts is excluded by none and included by none
  • js/compressed-token/src/actions/compress.ts is excluded by none and included by none
  • js/compressed-token/src/actions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/actions/create-token-pool.ts is excluded by none and included by none
  • js/compressed-token/src/actions/decompress-delegated.ts is excluded by none and included by none
  • js/compressed-token/src/actions/decompress.ts is excluded by none and included by none
  • js/compressed-token/src/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/constants.ts is excluded by none and included by none
  • js/compressed-token/src/index.ts is excluded by none and included by none
  • js/compressed-token/src/program.ts is excluded by none and included by none
  • js/compressed-token/src/types.ts is excluded by none and included by none
  • js/compressed-token/src/utils/get-token-pool-infos.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-mint-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/decompress-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/load-ata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/unwrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/ata-utils.ts is excluded by none and included by none
  • js/compressed-token/src/v3/derivation.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-account-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-associated-token-address-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-mint-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-decompress-interface-instruction.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-load-accounts-params.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/unwrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint-action.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-token-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-transfer2.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/serde.ts is excluded by none and included by none
  • js/compressed-token/src/v3/unified/index.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compress.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compressible-load.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-associated-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-ata-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-compressed-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-mint-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/decompress2.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-account-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-mint-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-or-create-ata-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/layout.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-combined.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-spl-t22.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-standard.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-unified.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-compressed.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-workflow.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/multi-pool.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/payment-flows.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/unwrap.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-metadata.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/wrap.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/derive-token-pool-info.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/get-associated-token-address-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-mint-action.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-serde.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-token-metadata.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-transfer2.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/serde.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/unified-guards.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/upload.test.ts is excluded by none and included by none
  • js/compressed-token/types/buffer-layout/index.d.ts is excluded by none and included by none
  • js/stateless.js/package.json is excluded by none and included by none
  • js/stateless.js/rollup.config.js is excluded by none and included by none
  • js/stateless.js/src/actions/create-account.ts is excluded by none and included by none
  • js/stateless.js/src/actions/transfer.ts is excluded by none and included by none
  • js/stateless.js/src/constants.ts is excluded by none and included by none
  • js/stateless.js/src/programs/system/layout.ts is excluded by none and included by none
  • js/stateless.js/src/rpc-interface.ts is excluded by none and included by none
  • js/stateless.js/src/rpc.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/get-compressed-token-accounts.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/test-rpc.ts is excluded by none and included by none
  • js/stateless.js/src/utils/get-state-tree-infos.ts is excluded by none and included by none
  • js/stateless.js/src/utils/index.ts is excluded by none and included by none
  • js/stateless.js/src/utils/pack-decompress.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/compress.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/interface-methods.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/rpc-interop.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/rpc-multi-trees.test.ts is excluded by none and included by none
  • js/stateless.js/tests/unit/rpc/merge-signatures.test.ts is excluded by none and included by none
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by none
  • scripts/devenv/install-photon.sh is excluded by none and included by none
📒 Files selected for processing (1)
  • ctoken_for_payments.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md

📄 CodeRabbit inference engine (DOCS.md)

**/*.md: Path references in documentation must use absolute paths from repository root (e.g., program-libs/ctoken-types/src/state/solana_ctoken.rs).
Code examples in documentation must include working code snippets, show correct usage and common mistakes, add inline comments explaining key points, NOT include print/log statements unless essential, and focus on core logic without debugging output.
Serialization documentation must specify: for zero-copy use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut} with DataType::zero_copy_at(&bytes)? pattern; for Borsh use borsh::BorshDeserialize with DataType::deserialize(&mut &bytes[..])? pattern. Always specify which method to use in which context.
Cross-references in documentation should link to related documentation, reference source files with specific line numbers when relevant, and use relative links within the same crate.

Files:

  • ctoken_for_payments.md
🧠 Learnings (31)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:47.207Z
Learning: Applies to programs/compressed-token/program/docs/**/*.md : Documentation should be organized with a main entry point (`../CLAUDE.md`) containing instruction index and overview, supplemented by account structure reference (`ACCOUNTS.md`) and detailed instruction documentation in `instructions/` subdirectory
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/**/*.md : Instruction documentation must include the following sections: path, description (including accounts and state layout), instruction_data, Accounts (in order with checks), instruction logic and checks, and Errors (with descriptions of causes)
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/docs/instructions/*.md : All instruction documentation must include: path to instruction code, description of what the instruction does including accounts used and state layouts, instruction_data paths, accounts list with checks, instruction logic and checks, and possible errors with descriptions
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/DECOMPRESSED_TRANSFER.md : Decompressed Transfer documentation must cover SPL-compatible transfers between decompressed accounts
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: All compressed token account implementations must reference and comply with the account layout specifications in programs/compressed-token/program/docs/ACCOUNTS.md
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : ACCOUNTS.md must contain complete account layouts and data structures with references to code paths
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : All account documentation must include: description, discriminator, state layout, serialization example, hashing (for compressed accounts only), derivation (for PDAs only), and associated instructions (create, update, close)
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CLOSE_TOKEN_ACCOUNT.md : Close Token Account documentation must cover closing decompressed token accounts with rent distribution
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/README.md:0-0
Timestamp: 2025-11-24T17:54:38.537Z
Learning: Ensure compressed token program documentation is maintained at the official documentation site (https://zkcompression.com)
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:47.207Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:47.207Z
Learning: Applies to programs/compressed-token/program/docs/**/*.md : Documentation should be organized with a main entry point (`../CLAUDE.md`) containing instruction index and overview, supplemented by account structure reference (`ACCOUNTS.md`) and detailed instruction documentation in `instructions/` subdirectory

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/docs/instructions/*.md : All instruction documentation must include: path to instruction code, description of what the instruction does including accounts used and state layouts, instruction_data paths, accounts list with checks, instruction logic and checks, and possible errors with descriptions

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T03:17:28.794Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-12-07T03:17:28.794Z
Learning: Implement all 8 compressed token instructions: create_cmint, mint_to_ctoken, create_token_account_invoke, create_token_account_invoke_signed, create_ata_invoke, create_ata_invoke_signed, transfer_interface_invoke, and transfer_interface_invoke_signed

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/**/*.md : Instruction documentation must include the following sections: path, description (including accounts and state layout), instruction_data, Accounts (in order with checks), instruction logic and checks, and Errors (with descriptions of causes)

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/DECOMPRESSED_TRANSFER.md : Decompressed Transfer documentation must cover SPL-compatible transfers between decompressed accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : ACCOUNTS.md must contain complete account layouts and data structures with references to code paths

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/docs/* : For CPI documentation include: Target program (program being called), PDA signer (seeds and bump for CPI authority), Account mapping (how accounts passed through), Data passthrough (instruction data handling), Example code (complete CPI invocation).

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CLOSE_TOKEN_ACCOUNT.md : Close Token Account documentation must cover closing decompressed token accounts with rent distribution

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:59:13.714Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/ACCOUNT_ITERATOR.md:0-0
Timestamp: 2025-11-24T17:59:13.714Z
Learning: Applies to program-libs/account-checks/docs/**/*.rs : Use descriptive account names when calling AccountIterator methods (e.g., `iter.next_account("token_mint")` instead of `iter.next_account("account_3")`)

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : All account documentation must include: description, discriminator, state layout, serialization example, hashing (for compressed accounts only), derivation (for PDAs only), and associated instructions (create, update, close)

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/src/create_token_account.rs : Create token account instructions (CreateTokenAccount, CreateAssociatedCTokenAccount, CreateAssociatedTokenAccountIdempotent) require ACTIVE config validation only

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/*.md : Code examples in documentation must include working code snippets, show correct usage and common mistakes, add inline comments explaining key points, NOT include print/log statements unless essential, and focus on core logic without debugging output.

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/TRANSFER2.md : Transfer2 documentation must cover batch transfer instruction supporting compress/decompress/transfer operations

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/MINT_ACTION.md : MintAction documentation must cover batch instruction for compressed mint management supporting 9 actions: CreateCompressedMint, MintTo, UpdateMintAuthority, UpdateFreezeAuthority, CreateSplMint, MintToCToken, UpdateMetadataField, UpdateMetadataAuthority, RemoveMetadataKey

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/src/transfer2/*.rs : Transfer2 instruction (discriminator: 101) supports batch operations including Compress, Decompress, and CompressAndClose with multi-mint support and sum checks

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:55:17.323Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-libs/macros/src/compressible/README.md:0-0
Timestamp: 2025-11-24T17:55:17.323Z
Learning: Applies to sdk-libs/macros/src/compressible/**/instructions.rs : Compress/decompress instruction handlers and context struct generation should be implemented in `instructions.rs`, with compress using PDA-only and decompress supporting full PDA + ctoken

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:59:54.233Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/PACKED_ACCOUNTS.md:0-0
Timestamp: 2025-11-24T17:59:54.233Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/**/*.rs : Provide descriptive names in ProgramPackedAccounts error messages (e.g., 'token_mint' instead of 'account')

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:54:38.537Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/README.md:0-0
Timestamp: 2025-11-24T17:54:38.537Z
Learning: Ensure compressed token program documentation is maintained at the official documentation site (https://zkcompression.com)

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: All compressed token account implementations must reference and comply with the account layout specifications in programs/compressed-token/program/docs/ACCOUNTS.md

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/docs/*instructions* : Every instruction must include in documentation: discriminator (instruction value), enum (variant name), path (to processor code), description (high-level overview with integrated key concepts, NOT separate sections), instruction_data (path to struct with field descriptions), Accounts (ordered list with name, type, signer/writable requirements, validation checks, purpose), instruction logic and checks (step-by-step: input validation, deserialization, business logic, state updates, CPIs), and Errors (comprehensive list with ErrorType::Variant format and numeric codes).

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/docs/*accounts* : Account documentation Methods section must group methods by purpose (Validation, Constructors, PDA Derivation, etc.), use concise parameter names in signatures, provide one-line action-oriented descriptions, and include concrete values where helpful.

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.md : All documentation for accounts, operations, and concepts must reference corresponding markdown files (TREE_ACCOUNT.md, QUEUE_ACCOUNT.md, etc.) and source file locations

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/docs/*accounts* : Account documentation must include: description (what account represents and role), state layout (path to struct and field descriptions), associated instructions (list with discriminators), discriminator (8-byte value if applicable), size (in bytes), ownership (expected owner), serialization (zero-copy for programs and Borsh for clients with code snippets). For PDAs include derivation (seeds) and bump (stored or derived). For compressed accounts include version, hashing (method and discriminator), and data layout.

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:54:38.537Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/README.md:0-0
Timestamp: 2025-11-24T17:54:38.537Z
Learning: Implement compressed token program interfaces for third-party token creation and usage on Solana using ZK Compression

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:54:33.614Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/anchor/README.md:0-0
Timestamp: 2025-11-24T17:54:33.614Z
Learning: Implement the Compressed Token Program interface for creating and using compressed tokens on Solana with ZK Compression

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/src/ctoken_transfer.rs : CTokenTransfer instruction (discriminator: 3) must implement SPL-compatible transfers between decompressed accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:53:57.540Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: js/compressed-token/README.md:0-0
Timestamp: 2025-11-24T17:53:57.540Z
Learning: This is the JavaScript SDK for interacting with the Compressed Token program on Solana

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:49:57.458Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-token-test/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:57.458Z
Learning: Applies to sdk-tests/sdk-token-test/**/*test.rs : Tests should use light-ctoken-sdk functions from sdk-libs/compressed-token-sdk for testing ctoken instructions

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T03:17:28.794Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-12-07T03:17:28.794Z
Learning: Use compressible token account extensions that allow accounts to be compressed back into compressed state with rent payment mechanisms

Applied to files:

  • ctoken_for_payments.md
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: stateless-js-v2
  • GitHub Check: Forester e2e test

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.

@SwenSchaeferjohann SwenSchaeferjohann marked this pull request as ready for review November 24, 2025 10:19
Base automatically changed from swen/csdk-macro-rent to main November 24, 2025 15:38
]);
}

export function createMintInstruction(
Copy link
Contributor

Choose a reason for hiding this comment

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

can we also make the input type an object?
( in encodeCreateMintInstructionData thats already the case.)

};
}

export function parseCTokenOnchain(
Copy link
Contributor

Choose a reason for hiding this comment

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

parseCTokenOnchain means parse ctoken solana account?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed onchain/compressed in here to hot/cold for better association

@SwenSchaeferjohann SwenSchaeferjohann force-pushed the swen/ts-interface branch 2 times, most recently from 87cd0b3 to e30548d Compare November 27, 2025 19:44
Copy link
Contributor

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e1f7d11 and 2fe31f1.

⛔ Files ignored due to path filters (83)
  • .github/workflows/js-v2.yml is excluded by none and included by none
  • cli/src/commands/create-mint/index.ts is excluded by none and included by none
  • cli/src/utils/constants.ts is excluded by none and included by none
  • cli/src/utils/processPhotonIndexer.ts is excluded by none and included by none
  • cli/test/helpers/helpers.ts is excluded by none and included by none
  • js/compressed-token/package.json is excluded by none and included by none
  • js/compressed-token/src/actions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/compressible/derivation.ts is excluded by none and included by none
  • js/compressed-token/src/compressible/helpers.ts is excluded by none and included by none
  • js/compressed-token/src/compressible/index.ts is excluded by none and included by none
  • js/compressed-token/src/compressible/serde.ts is excluded by none and included by none
  • js/compressed-token/src/constants.ts is excluded by none and included by none
  • js/compressed-token/src/index.ts is excluded by none and included by none
  • js/compressed-token/src/layout-transfer2.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/create-mint-interface.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/get-or-create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/index.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/load-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/mint/actions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/mint/get-account-interface.ts is excluded by none and included by none
  • js/compressed-token/src/mint/helpers.ts is excluded by none and included by none
  • js/compressed-token/src/mint/index.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/index.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/mint-action-layout.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/mint/instructions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/mint/serde.ts is excluded by none and included by none
  • js/compressed-token/src/mint/upload.ts is excluded by none and included by none
  • js/compressed-token/src/program.ts is excluded by none and included by none
  • js/compressed-token/src/utils/ata-utils.ts is excluded by none and included by none
  • js/compressed-token/src/utils/index.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compress-spl-token-account.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compress.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-associated-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-compressed-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-token-pool.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/decompress-delegated.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/decompress.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/delegate.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/layout.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/merge-token-accounts.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-compressed.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-workflow.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/multi-pool.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/rpc-multi-trees.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/rpc-token-interop.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer-delegated.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-metadata.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/wrap.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/serde.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/upload.test.ts is excluded by none and included by none
  • js/stateless.js/package.json is excluded by none and included by none
  • js/stateless.js/src/actions/create-account.ts is excluded by none and included by none
  • js/stateless.js/src/constants.ts is excluded by none and included by none
  • js/stateless.js/src/rpc-interface.ts is excluded by none and included by none
  • js/stateless.js/src/rpc.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/get-compressed-token-accounts.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/test-rpc.ts is excluded by none and included by none
  • js/stateless.js/src/utils/index.ts is excluded by none and included by none
  • js/stateless.js/src/utils/pack-decompress.ts is excluded by none and included by none
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by none
  • scripts/devenv/install-photon.sh is excluded by none and included by none
  • scripts/devenv/versions.sh is excluded by none and included by none
📒 Files selected for processing (1)
  • forester/tests/e2e_test.rs (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
forester/**/*e2e*.rs

📄 CodeRabbit inference engine (forester/README.md)

forester/**/*e2e*.rs: Test environment variables should use TEST_MODE to specify 'local' or 'devnet' mode (default: devnet)
Test feature flags TEST_V1_STATE, TEST_V2_STATE, TEST_V1_ADDRESS, and TEST_V2_ADDRESS should default to true and control which test scenarios run
Devnet mode tests require PHOTON_RPC_URL, PHOTON_WSS_RPC_URL, PHOTON_INDEXER_URL, PHOTON_PROVER_URL, and PHOTON_API_KEY environment variables
Local validator mode tests should automatically spawn a local validator, start a local prover service, and use predefined local URLs (localhost:8899 for RPC, localhost:8784 for indexer)
Tests should automatically skip minting tokens, executing transactions, and root verification for disabled test types

Files:

  • forester/tests/e2e_test.rs
🧠 Learnings (34)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md:0-0
Timestamp: 2025-11-24T17:57:02.558Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : In `insert_into_current_queue_batch` helper, handle batch state transitions: if state is `Fill`, proceed; if state is `Inserted`, verify bloom filter is zeroed, clear hash chain stores, transition to `Fill`, and reset batch metadata; if state is `Full`, return `BatchedMerkleTreeError::BatchNotReady` (error code 14301).
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : Use BatchedMerkleTreeAccount for state trees with integrated input queue (for nullifiers) and separate BatchedQueueAccount for output operations
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Initialize integrated input queue with 2 bloom filter stores (one per batch, size = bloom_filter_capacity / 8 bytes each) and 2 hash chain stores (one per batch, capacity = input_queue_batch_size / input_queue_zkp_batch_size each)
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:35.079Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : Zero out input queue bloom filter when all conditions are met: (1) current batch is ≥50% full (`num_inserted_elements >= batch_size / 2`), (2) current batch NOT in `Inserted` state, (3) previous batch in `Inserted` state, (4) previous batch bloom filter not already zeroed, (5) at least one tree update since batch completion (`batch.sequence_number != current_tree.sequence_number`)
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:35.079Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : In `src/queue.rs`, define BatchedQueueAccount layout and implement `mark_as_inserted_in_merkle_tree` method to increment `num_inserted_zkp_batches` and transition batch state to `Inserted` when all ZKP batches are complete
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:10.392Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : In src/merkle_tree.rs, implement BatchedMerkleTreeAccount::update_tree_from_input_queue method for batch nullify operations on StateV2 trees. The method must verify ZKP proving correctness of: old_root + queue nullifiers → new_root, update tree root, increment tree sequence_number, increment tree nullifier_next_index by zkp_batch_size, mark ZKP batch as inserted, transition batch state to Inserted when all ZKP batches complete, and zero out bloom filter when current batch is 50% inserted.
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:57:24.369Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : When a batch is in `Inserted` state, clear the value vec and hash chain stores, advance batch state to `Fill`, and reset batch metadata before allowing new insertions
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/merkle_tree.rs : Tree updates from input queue must use update_tree_from_input_queue function for state trees and update_tree_from_address_queue for address trees with ZKP verification
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:57:24.369Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Transition batch state from `Fill` to `Full` and increment currently_processing_batch_index when num_inserted_elements reaches batch_size in the output queue
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Check `tree_capacity` (2^height) against new insertions to prevent overflow in `BatchedQueueAccount`
📚 Learning: 2025-11-24T17:57:02.558Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md:0-0
Timestamp: 2025-11-24T17:57:02.558Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : In `insert_into_current_queue_batch` helper, handle batch state transitions: if state is `Fill`, proceed; if state is `Inserted`, verify bloom filter is zeroed, clear hash chain stores, transition to `Fill`, and reset batch metadata; if state is `Full`, return `BatchedMerkleTreeError::BatchNotReady` (error code 14301).

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : Use BatchedMerkleTreeAccount for state trees with integrated input queue (for nullifiers) and separate BatchedQueueAccount for output operations

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:35.079Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:35.079Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : In `src/queue.rs`, define BatchedQueueAccount layout and implement `mark_as_inserted_in_merkle_tree` method to increment `num_inserted_zkp_batches` and transition batch state to `Inserted` when all ZKP batches are complete

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:10.392Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:10.392Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : In src/merkle_tree.rs, implement BatchedMerkleTreeAccount::update_tree_from_address_queue method for batch address append operations on AddressV2 trees. The method must verify ZKP proving correctness of: old_root + queue addresses → new_root using indexed Merkle tree insertion, update tree root, increment tree sequence_number, increment tree next_index by zkp_batch_size, mark ZKP batch as inserted, transition batch state to Inserted when all ZKP batches complete, and zero out bloom filter when current batch is 50% inserted.

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:10.392Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:10.392Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : Batch nullify operations must check that tree type is TreeType::StateV2 before processing, verify batch has ready ZKP batches (num_full_zkp_batches > num_inserted_zkp_batches), and reject if batch is already in Inserted state.

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:10.392Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:10.392Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : In src/merkle_tree.rs, implement BatchedMerkleTreeAccount::update_tree_from_input_queue method for batch nullify operations on StateV2 trees. The method must verify ZKP proving correctness of: old_root + queue nullifiers → new_root, update tree root, increment tree sequence_number, increment tree nullifier_next_index by zkp_batch_size, mark ZKP batch as inserted, transition batch state to Inserted when all ZKP batches complete, and zero out bloom filter when current batch is 50% inserted.

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:35.079Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:35.079Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : BatchedMerkleTreeAccount must be of type `TreeType::StateV2` when updating tree from output queue

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:57:02.558Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INSERT_ADDRESS_QUEUE.md:0-0
Timestamp: 2025-11-24T17:57:02.558Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : After inserting an address into the batch, check if `num_inserted_elements == batch_size`. If true, transition batch state from `Fill` to `Full`, increment `currently_processing_batch_index` to switch to the other batch, and update `pending_batch_index` to mark this batch ready for tree update.

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:35.079Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:35.079Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : Transition batch state to `Inserted` when all ZKP batches are complete and increment `pending_batch_index` to switch to other batch

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:57:24.369Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:57:24.369Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : When a batch is in `Inserted` state, clear the value vec and hash chain stores, advance batch state to `Fill`, and reset batch metadata before allowing new insertions

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/initialize_state_tree.rs : State tree initialization must create two Solana accounts: BatchedMerkleTreeAccount with integrated input queue and separate BatchedQueueAccount

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Initialize a state Merkle tree with a `TreeType::StateV2` (4) tree type, storing tree roots, root history, and integrated input queue (bloom filters + hash chains for nullifiers) in the `BatchedMerkleTreeAccount` with discriminator b`BatchMta` [66, 97, 116, 99, 104, 77, 116, 97]

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Set state Merkle tree account discriminator to b`BatchMta` (8 bytes) and initialize tree metadata with TreeType::StateV2 (4)

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Initialize an output queue account as `BatchedQueueAccount` with `QueueType::OutputStateV2`, temporary storage for compressed account hashes before tree insertion with immediate spending capability via proof-by-index, using discriminator b`queueacc` [113, 117, 101, 117, 101, 97, 99, 99]

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Define batch size parameters in `InitStateTreeAccountsInstructionData` struct: input_queue_batch_size (u64, default 15,000), output_queue_batch_size (u64, default 15,000), input_queue_zkp_batch_size (u64, default 500), and output_queue_zkp_batch_size (u64, default 500)

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Use `check_account_balance_is_rent_exempt` function from `light-account-checks` to verify rent exemption for both queue_account and merkle_tree_account during initialization

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:57:53.312Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/TREE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:53.312Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/*.rs : State trees must initialize with zero bytes root for the specified height and have a separate BatchedQueueAccount for output operations

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Compute and store hashed pubkeys by hashing and truncating to 31 bytes for bn254 field compatibility in both queue and tree accounts

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Check `tree_capacity` (2^height) against new insertions to prevent overflow in `BatchedQueueAccount`

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Initialize output queue with 2 alternating batches, each with batch_size = output_queue_batch_size and zkp_batch_size = output_queue_zkp_batch_size

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Associate output queue with merkle_tree_account pubkey in queue metadata and calculate rollover_fee based on rollover_threshold, height, and total rent (merkle_tree_rent + additional_bytes_rent + queue_rent)

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Associate state tree with queue_account pubkey in tree metadata and set rollover_fee to 0 (charged on queue insertion, not tree operations)

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:35.079Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:35.079Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : In `src/merkle_tree.rs`, implement `BatchedMerkleTreeAccount::update_tree_from_output_queue_account` method that batch appends values from output queue to state Merkle tree with ZKP verification, verifying proof of old_root + queue_values → new_root

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:57:24.369Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INSERT_OUTPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:57:24.369Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Before inserting into the output queue, validate that the tree is not full by checking that next_index < tree_capacity

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/queue.rs : Output queue insertion must use BatchedQueueAccount::insert_into_current_batch method

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Store `BatchedQueueAccount` layout and `BatchedQueueMetadata` in src/queue.rs

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:50.011Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/INITIALIZE_STATE_TREE.md:0-0
Timestamp: 2025-11-24T17:56:50.011Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/initialize_state_tree.rs : Initialize output queue value vectors (2 vectors, one per batch with capacity = batch_size each) and hash chain stores (2 vectors with capacity = batch_size / zkp_batch_size each)

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T18:01:30.012Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:30.012Z
Learning: Run batched tree transfer test using `cargo test-sbf -p compressed-token-test -- test_transfer_with_photon_and_batched_tree` and apply retry logic in CI (max 3 attempts, 5s delay) due to known flakiness

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T18:01:30.012Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:30.012Z
Learning: Run Light system program compression tests using `cargo test-sbf -p system-test -- test_with_compression` and `cargo test-sbf -p system-test --test test_re_init_cpi_account` to test compressed account operations

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:57:39.230Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/QUEUE_ACCOUNT.md:0-0
Timestamp: 2025-11-24T17:57:39.230Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/queue.rs : Store compressed account hashes in `BatchedQueueAccount` value vectors for immediate proof-by-index access before tree insertion

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:58:10.392Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/UPDATE_FROM_INPUT_QUEUE.md:0-0
Timestamp: 2025-11-24T17:58:10.392Z
Learning: Applies to program-libs/batched-merkle-tree/docs/src/merkle_tree.rs : Batch address append operations must check that tree type is TreeType::AddressV2 before processing, verify tree capacity constraint (tree.next_index + zkp_batch_size <= tree_capacity), verify batch has ready ZKP batches (num_full_zkp_batches > num_inserted_zkp_batches), and reject if batch is already in Inserted state.

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T17:56:00.229Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/batched-merkle-tree/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T17:56:00.229Z
Learning: Applies to program-libs/batched-merkle-tree/docs/**/queue.rs : Output queues must store compressed account hashes in value vectors (one per batch) enabling access by leaf index before tree insertion

Applied to files:

  • forester/tests/e2e_test.rs
📚 Learning: 2025-11-24T18:01:30.012Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-tests/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:30.012Z
Learning: Run account-compression tests using `cargo test-sbf -p account-compression-test` to test core account compression program (Merkle tree management)

Applied to files:

  • forester/tests/e2e_test.rs
🧬 Code graph analysis (1)
forester/tests/e2e_test.rs (1)
program-libs/batched-merkle-tree/src/merkle_tree.rs (4)
  • BatchedMerkleTreeAccount (1080-1080)
  • BatchedMerkleTreeAccount (1090-1090)
  • BatchedMerkleTreeAccount (1100-1100)
  • state_from_bytes (133-139)
🪛 GitHub Actions: lint
forester/tests/e2e_test.rs

[warning] 782-792: Code style formatting suggestion: multi-line the long panic! message for consistency with code style.


[error] 1-1: lint step failed (exit code 1). Command: 'nx run @lightprotocol/sdk-anchor-test:lint'.

🪛 GitHub Check: lint
forester/tests/e2e_test.rs

[warning] 782-782:
Diff in /home/runner/work/light-protocol/light-protocol/forester/tests/e2e_test.rs

🔇 Additional comments (2)
forester/tests/e2e_test.rs (2)

15-18: BatchState import is appropriate for queue introspection

Pulling in BatchState here is consistent with the new helper that inspects batch states, and keeps the test strongly typed instead of relying on raw state integers. No issues from my side.


899-901: V2 transaction gating is good, but confirm the queue-space check targets the actual output queue

Placing wait_for_queue_space(rpc, &env.v2_state_trees[0].merkle_tree).await; at the top of the V2 branch usefully avoids hammering the program when both batches are Full, and it will reduce transient BatchNotReady failures.

However, given the helper currently decodes a BatchedMerkleTreeAccount, please verify that:

  • The queue_batches it inspects are the same batches backing env.v2_state_trees[0].output_queue (the queue you pass into compress / V2 transfers), and
  • You’re not accidentally keying off the integrated input queue for nullifiers instead of the dedicated output queue account.

If it turns out the output queue uses its own BatchedQueueAccount with separate queue_batches, this call site should pass that account’s pubkey into a helper that decodes BatchedQueueAccount rather than the tree.

@SwenSchaeferjohann SwenSchaeferjohann force-pushed the swen/ts-interface branch 2 times, most recently from 07129f7 to 6a1bdf0 Compare December 3, 2025 22:01
tokenPoolInfos,
},
);
await loadATA(rpc, payer, recipientAta, recipient, undefined, {
Copy link
Contributor

Choose a reason for hiding this comment

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

loadATA ATA is inconsistent with variable naming eg recipientAta

*
* @return Object with mint address and transaction signature
*/
export async function createMint(
Copy link
Contributor

Choose a reason for hiding this comment

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

could it make sense to rename to createSplMint?

Copy link
Contributor Author

@SwenSchaeferjohann SwenSchaeferjohann Dec 6, 2025

Choose a reason for hiding this comment

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

if we change name it would break, its just still here to not break old consumers.

added the deprecation notice with link to createMintInterface which everyone should switch to. it allows SPL-token, token-22 and c-token

but good catch is that I need to revert the freezeAuthority position change, its here on accident

@@ -46,7 +46,7 @@ pub fn generate_ctoken_seed_provider_implementation(
let authority_arm = quote! {
CTokenAccountVariant::#variant_name => {
Err(anchor_lang::prelude::ProgramError::Custom(
CompressibleInstructionError::AtaDoesNotUseSeedDerivation.into()
CompressibleInstructionError::ATADoesNotUseSeedDerivation.into()
Copy link
Contributor

Choose a reason for hiding this comment

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

ATA or Ata ?

@SwenSchaeferjohann SwenSchaeferjohann force-pushed the swen/ts-interface branch 2 times, most recently from cc8b2e3 to 4e636f2 Compare December 8, 2025 12:51
Copy link
Contributor

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a1bdf0 and 7b75066.

⛔ Files ignored due to path filters (115)
  • .github/workflows/js-v2.yml is excluded by none and included by none
  • cli/src/utils/constants.ts is excluded by none and included by none
  • cli/src/utils/processPhotonIndexer.ts is excluded by none and included by none
  • js/compressed-token/package.json is excluded by none and included by none
  • js/compressed-token/rollup.config.js is excluded by none and included by none
  • js/compressed-token/src/actions/approve-and-mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/actions/compress-spl-token-account.ts is excluded by none and included by none
  • js/compressed-token/src/actions/compress.ts is excluded by none and included by none
  • js/compressed-token/src/actions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/actions/create-token-pool.ts is excluded by none and included by none
  • js/compressed-token/src/actions/decompress-delegated.ts is excluded by none and included by none
  • js/compressed-token/src/actions/decompress.ts is excluded by none and included by none
  • js/compressed-token/src/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/constants.ts is excluded by none and included by none
  • js/compressed-token/src/index.ts is excluded by none and included by none
  • js/compressed-token/src/program.ts is excluded by none and included by none
  • js/compressed-token/src/types.ts is excluded by none and included by none
  • js/compressed-token/src/utils/get-token-pool-infos.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-mint-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/decompress-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/load-ata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/unwrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/ata-utils.ts is excluded by none and included by none
  • js/compressed-token/src/v3/derivation.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-account-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-associated-token-address-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-mint-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-decompress-interface-instruction.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-load-accounts-params.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/unwrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint-action.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-token-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-transfer2.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/serde.ts is excluded by none and included by none
  • js/compressed-token/src/v3/unified/index.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compress.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compressible-load.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-associated-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-ata-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-compressed-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-mint-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/decompress2.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-account-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-mint-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-or-create-ata-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/layout.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-combined.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-spl-t22.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-standard.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-unified.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-compressed.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-workflow.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/payment-flows.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/unwrap.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-metadata.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/wrap.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/derive-token-pool-info.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/get-associated-token-address-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-mint-action.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-serde.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-token-metadata.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-transfer2.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/serde.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/unified-guards.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/upload.test.ts is excluded by none and included by none
  • js/compressed-token/types/buffer-layout/index.d.ts is excluded by none and included by none
  • js/stateless.js/package.json is excluded by none and included by none
  • js/stateless.js/rollup.config.js is excluded by none and included by none
  • js/stateless.js/src/actions/create-account.ts is excluded by none and included by none
  • js/stateless.js/src/actions/transfer.ts is excluded by none and included by none
  • js/stateless.js/src/constants.ts is excluded by none and included by none
  • js/stateless.js/src/rpc-interface.ts is excluded by none and included by none
  • js/stateless.js/src/rpc.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/get-compressed-token-accounts.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/test-rpc.ts is excluded by none and included by none
  • js/stateless.js/src/utils/get-state-tree-infos.ts is excluded by none and included by none
  • js/stateless.js/src/utils/index.ts is excluded by none and included by none
  • js/stateless.js/src/utils/pack-decompress.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/compress.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/interface-methods.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/rpc-interop.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/rpc-multi-trees.test.ts is excluded by none and included by none
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by none
📒 Files selected for processing (1)
  • ctoken_for_payments.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md

📄 CodeRabbit inference engine (DOCS.md)

**/*.md: Path references in documentation must use absolute paths from repository root (e.g., program-libs/ctoken-types/src/state/solana_ctoken.rs).
Code examples in documentation must include working code snippets, show correct usage and common mistakes, add inline comments explaining key points, NOT include print/log statements unless essential, and focus on core logic without debugging output.
Serialization documentation must specify: for zero-copy use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut} with DataType::zero_copy_at(&bytes)? pattern; for Borsh use borsh::BorshDeserialize with DataType::deserialize(&mut &bytes[..])? pattern. Always specify which method to use in which context.
Cross-references in documentation should link to related documentation, reference source files with specific line numbers when relevant, and use relative links within the same crate.

Files:

  • ctoken_for_payments.md
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/PACKED_ACCOUNTS.md:0-0
Timestamp: 2025-11-24T17:59:54.233Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/**/*.rs : Provide descriptive names in ProgramPackedAccounts error messages (e.g., 'token_mint' instead of 'account')
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:47.207Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:47.207Z
Learning: Applies to programs/compressed-token/program/docs/**/*.md : Documentation should be organized with a main entry point (`../CLAUDE.md`) containing instruction index and overview, supplemented by account structure reference (`ACCOUNTS.md`) and detailed instruction documentation in `instructions/` subdirectory

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/DECOMPRESSED_TRANSFER.md : Decompressed Transfer documentation must cover SPL-compatible transfers between decompressed accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T03:17:28.794Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-12-07T03:17:28.794Z
Learning: Implement all 8 compressed token instructions: create_cmint, mint_to_ctoken, create_token_account_invoke, create_token_account_invoke_signed, create_ata_invoke, create_ata_invoke_signed, transfer_interface_invoke, and transfer_interface_invoke_signed

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/docs/* : For CPI documentation include: Target program (program being called), PDA signer (seeds and bump for CPI authority), Account mapping (how accounts passed through), Data passthrough (instruction data handling), Example code (complete CPI invocation).

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/**/*.md : Instruction documentation must include the following sections: path, description (including accounts and state layout), instruction_data, Accounts (in order with checks), instruction logic and checks, and Errors (with descriptions of causes)

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CLOSE_TOKEN_ACCOUNT.md : Close Token Account documentation must cover closing decompressed token accounts with rent distribution

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : ACCOUNTS.md must contain complete account layouts and data structures with references to code paths

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/docs/ACCOUNTS.md : All account documentation must include: description, discriminator, state layout, serialization example, hashing (for compressed accounts only), derivation (for PDAs only), and associated instructions (create, update, close)

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/docs/instructions/*.md : All instruction documentation must include: path to instruction code, description of what the instruction does including accounts used and state layouts, instruction_data paths, accounts list with checks, instruction logic and checks, and possible errors with descriptions

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:54:38.537Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/README.md:0-0
Timestamp: 2025-11-24T17:54:38.537Z
Learning: Implement compressed token program interfaces for third-party token creation and usage on Solana using ZK Compression

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:54:33.614Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/anchor/README.md:0-0
Timestamp: 2025-11-24T17:54:33.614Z
Learning: Implement the Compressed Token Program interface for creating and using compressed tokens on Solana with ZK Compression

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: All compressed token account implementations must reference and comply with the account layout specifications in programs/compressed-token/program/docs/ACCOUNTS.md

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/src/ctoken_transfer.rs : CTokenTransfer instruction (discriminator: 3) must implement SPL-compatible transfers between decompressed accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:53:57.540Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: js/compressed-token/README.md:0-0
Timestamp: 2025-11-24T17:53:57.540Z
Learning: This is the JavaScript SDK for interacting with the Compressed Token program on Solana

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:49:57.458Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-token-test/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:57.458Z
Learning: Applies to sdk-tests/sdk-token-test/**/*test.rs : Tests should use light-ctoken-sdk functions from sdk-libs/compressed-token-sdk for testing ctoken instructions

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T03:17:28.794Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-12-07T03:17:28.794Z
Learning: Use compressible token account extensions that allow accounts to be compressed back into compressed state with rent payment mechanisms

Applied to files:

  • ctoken_for_payments.md
🔇 Additional comments (1)
ctoken_for_payments.md (1)

326-326: Reconcile SPL transfer API discrepancy in Quick Reference table.

The table lists transferChecked() but the earlier examples use transfer(). Both exist in @solana/spl-token but serve different purposes: transfer() assumes the caller trusts the mint/decimals, while transferChecked() validates them. Clarify which is recommended for this payment flow, or update the table to match the examples.

If transferChecked() is preferred, update the earlier examples (lines 101–113) to match. If transfer() is correct, update the table.

Comment on lines +32 to +41
const ata = await getOrCreateAssociatedTokenAccount(
connection,
payer,
mint,
recipient
);
// Share ata.address with sender

console.log(ata.amount);
```
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add inline comments explaining the idempotent creation pattern.

The SPL example shows getOrCreateAssociatedTokenAccount but doesn't explain what "idempotent" means or why this pattern matters. This is key to understanding why the c-token equivalent is valuable. Add a comment explaining that this function safely creates the ATA if it doesn't exist, or returns it if it already does.

// Safe account creation: creates ATA if missing, returns existing ATA if present
const ata = await getOrCreateAssociatedTokenAccount(
  connection,
  payer,
  mint,
  recipient
);
// Use ata.address to share with sender (existing or newly created)
🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 32 to 41, the example using
getOrCreateAssociatedTokenAccount lacks an inline explanation of the idempotent
creation pattern; add a concise comment before the call stating that this helper
will create the associated token account only if it doesn't exist and otherwise
return the existing account (so repeated calls are safe), and add a short
follow-up comment clarifying that ata.address can be shared with the sender
regardless of whether the account was newly created or already present.

);
// Share ata.address with sender

console.log(ata.amount);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove console.log() statements from code examples.

Per coding guidelines, code examples should NOT include print/log statements unless essential. These are demo artifacts and distract from core logic. Remove or clearly mark as optional debugging statements.

Affected lines: 40 (console.log(ata.amount)), 69 (console.log(ata.parsed.amount)), 229-230 (SPL balance), 239 (c-token balance), 249 (tx history), 256-260 (merged results).

Suggested approach: Either remove these lines entirely or preface them with a comment like // Optional: log to console to indicate they're not part of the core flow.

-console.log(ata.amount);
+// Account object retrieved; use ata.amount to access token balance

Also applies to: 69-69, 229-230, 239-239, 249-249, 256-260

🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 40, 69, 229-230, 239, 249, and 256-260,
remove the incidental console.log() statements (ata.amount, ata.parsed.amount,
SPL balance, c-token balance, tx history, and merged results) or convert them
into clearly marked optional debug lines by prefixing with a comment like "//
Optional: log to console" so examples show only core logic; ensure the examples
remain functional after removal and update surrounding text if it references
those logs.

Comment on lines +161 to +176
const tx = new Transaction().add(
...(await createLoadAtaInstructions(
rpc,
sourceAta,
owner.publicKey,
mint,
payer.publicKey
)),
createTransferInterfaceInstruction(
sourceAta,
destinationAta,
owner.publicKey,
amount
)
);
```
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add inline comments explaining the instruction-level ATA loading pattern.

The createLoadAtaInstructions call is not self-explanatory. Add context about why this is needed: it loads the compressed ATA data on-chain so the transfer instruction can read it. This is necessary only at instruction-level; the high-level transferInterface handles this internally.

const tx = new Transaction().add(
  // Load ATA data on-chain for the transfer instruction to consume
  ...(await createLoadAtaInstructions(
    rpc,
    sourceAta,
    owner.publicKey,
    mint,
    payer.publicKey
  )),
  // Perform the actual transfer
  createTransferInterfaceInstruction(
    sourceAta,
    destinationAta,
    owner.publicKey,
    amount
  )
);
🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 161–176 the call to
createLoadAtaInstructions is not documented and readers may not understand why
ATA data is loaded at instruction-level; add an inline comment before the spread
that explains it loads the compressed ATA data on-chain so the following
transfer instruction can read it (this is necessary only when constructing
instruction-level transfers; the high-level transferInterface handles ATA
loading internally), and add a short comment before
createTransferInterfaceInstruction indicating that the next instruction performs
the actual transfer.

Comment on lines +256 to +260
const result = await rpc.getSignaturesForOwnerInterface(owner);

console.log(result.signatures); // Merged + deduplicated
console.log(result.solana); // On-chain txs only
console.log(result.compressed); // Compressed txs only
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove console.log() output from transaction history example; add guidance on when to use owner vs. address history.

See earlier comment on console.log removal. Additionally, add context on why you might use getSignaturesForAddressInterface(address) vs. getSignaturesForOwnerInterface(owner): the former gives history for a specific ATA, the latter gives all compressed transactions for an owner across all ATAs.

// Merged + deduplicated signatures (on-chain + compressed)
const result = await rpc.getSignaturesForOwnerInterface(owner);

// Use result.signatures for all activity, result.solana for on-chain only, result.compressed for compressed only
🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 256 to 260, remove the three console.log
statements showing result.signatures/result.solana/result.compressed and replace
them with a short explanatory comment; also add a one-line guidance clarifying
when to use getSignaturesForAddressInterface(address) (to fetch history for a
specific ATA) versus getSignaturesForOwnerInterface(owner) (to fetch all
compressed transactions for an owner across all ATAs), and indicate that
result.signatures is the merged/deduplicated set while result.solana and
result.compressed are on-chain-only and compressed-only respectively.

Comment on lines +296 to +297
const splInterfaceInfos = await getSplInterfaceInfos(rpc, mint);
const splInterfaceInfo = splInterfaceInfos.find((i) => i.isInitialized);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add inline comments explaining the getSplInterfaceInfos lookup pattern.

The pattern of fetching splInterfaceInfos and finding the initialized one is opaque. Explain: SPL interface infos represent the underlying SPL token pool backing this c-token mint. Only one will be initialized; we fetch it to pass to the unwrap instruction so it knows which SPL account to transfer to.

// Fetch SPL interface info for this mint (required for unwrap)
const splInterfaceInfos = await getSplInterfaceInfos(rpc, mint);
// Use the initialized SPL interface info (there will be only one)
const splInterfaceInfo = splInterfaceInfos.find((i) => i.isInitialized);
🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 296 to 297, add brief inline comments
explaining the getSplInterfaceInfos lookup pattern: note that
getSplInterfaceInfos returns SPL interface info objects representing underlying
SPL token pools for the c-token mint, only one of which will be initialized for
this mint, and that we select the initialized entry to pass into the unwrap
instruction so it knows which SPL account to transfer to; update the two lines
to include those explanatory comments directly above or on the same line.

Copy link
Contributor

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a1bdf0 and 7b75066.

⛔ Files ignored due to path filters (115)
  • .github/workflows/js-v2.yml is excluded by none and included by none
  • cli/src/utils/constants.ts is excluded by none and included by none
  • cli/src/utils/processPhotonIndexer.ts is excluded by none and included by none
  • js/compressed-token/package.json is excluded by none and included by none
  • js/compressed-token/rollup.config.js is excluded by none and included by none
  • js/compressed-token/src/actions/approve-and-mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/actions/compress-spl-token-account.ts is excluded by none and included by none
  • js/compressed-token/src/actions/compress.ts is excluded by none and included by none
  • js/compressed-token/src/actions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/actions/create-token-pool.ts is excluded by none and included by none
  • js/compressed-token/src/actions/decompress-delegated.ts is excluded by none and included by none
  • js/compressed-token/src/actions/decompress.ts is excluded by none and included by none
  • js/compressed-token/src/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/constants.ts is excluded by none and included by none
  • js/compressed-token/src/index.ts is excluded by none and included by none
  • js/compressed-token/src/program.ts is excluded by none and included by none
  • js/compressed-token/src/types.ts is excluded by none and included by none
  • js/compressed-token/src/utils/get-token-pool-infos.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/create-mint-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/decompress-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/get-or-create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/load-ata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/unwrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/actions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/ata-utils.ts is excluded by none and included by none
  • js/compressed-token/src/v3/derivation.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-account-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-associated-token-address-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/get-mint-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-associated-ctoken.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-ata-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-decompress-interface-instruction.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-load-accounts-params.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/create-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-compressed.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/mint-to.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/transfer-interface.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/unwrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/update-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/instructions/wrap.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/index.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint-action.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-mint.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-token-metadata.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/layout-transfer2.ts is excluded by none and included by none
  • js/compressed-token/src/v3/layout/serde.ts is excluded by none and included by none
  • js/compressed-token/src/v3/unified/index.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compress.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/compressible-load.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-associated-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-ata-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-compressed-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-mint-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/create-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/decompress2.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-account-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-mint-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/get-or-create-ata-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/layout.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-combined.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-spl-t22.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-standard.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/load-ata-unified.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-compressed.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-ctoken.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-to-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/mint-workflow.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/payment-flows.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/transfer.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/unwrap.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-metadata.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/update-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/e2e/wrap.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/derive-token-pool-info.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/get-associated-token-address-interface.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-mint-action.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-mint.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-serde.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-token-metadata.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/layout-transfer2.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/serde.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/unified-guards.test.ts is excluded by none and included by none
  • js/compressed-token/tests/unit/upload.test.ts is excluded by none and included by none
  • js/compressed-token/types/buffer-layout/index.d.ts is excluded by none and included by none
  • js/stateless.js/package.json is excluded by none and included by none
  • js/stateless.js/rollup.config.js is excluded by none and included by none
  • js/stateless.js/src/actions/create-account.ts is excluded by none and included by none
  • js/stateless.js/src/actions/transfer.ts is excluded by none and included by none
  • js/stateless.js/src/constants.ts is excluded by none and included by none
  • js/stateless.js/src/rpc-interface.ts is excluded by none and included by none
  • js/stateless.js/src/rpc.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/get-compressed-token-accounts.ts is excluded by none and included by none
  • js/stateless.js/src/test-helpers/test-rpc/test-rpc.ts is excluded by none and included by none
  • js/stateless.js/src/utils/get-state-tree-infos.ts is excluded by none and included by none
  • js/stateless.js/src/utils/index.ts is excluded by none and included by none
  • js/stateless.js/src/utils/pack-decompress.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/compress.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/interface-methods.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/rpc-interop.test.ts is excluded by none and included by none
  • js/stateless.js/tests/e2e/rpc-multi-trees.test.ts is excluded by none and included by none
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by none
📒 Files selected for processing (1)
  • ctoken_for_payments.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md

📄 CodeRabbit inference engine (DOCS.md)

**/*.md: Path references in documentation must use absolute paths from repository root (e.g., program-libs/ctoken-types/src/state/solana_ctoken.rs).
Code examples in documentation must include working code snippets, show correct usage and common mistakes, add inline comments explaining key points, NOT include print/log statements unless essential, and focus on core logic without debugging output.
Serialization documentation must specify: for zero-copy use light_zero_copy::traits::{ZeroCopyAt, ZeroCopyAtMut} with DataType::zero_copy_at(&bytes)? pattern; for Borsh use borsh::BorshDeserialize with DataType::deserialize(&mut &bytes[..])? pattern. Always specify which method to use in which context.
Cross-references in documentation should link to related documentation, reference source files with specific line numbers when relevant, and use relative links within the same crate.

Files:

  • ctoken_for_payments.md
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: program-libs/account-checks/docs/PACKED_ACCOUNTS.md:0-0
Timestamp: 2025-11-24T17:59:54.233Z
Learning: Applies to program-libs/account-checks/docs/program-libs/account-checks/src/**/*.rs : Provide descriptive names in ProgramPackedAccounts error messages (e.g., 'token_mint' instead of 'account')
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CREATE_TOKEN_ACCOUNT.md : Create Token Account Instructions documentation must cover creation of regular and associated ctoken accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:47.207Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:47.207Z
Learning: Applies to programs/compressed-token/program/docs/**/*.md : Documentation should be organized with a main entry point (`../CLAUDE.md`) containing instruction index and overview, supplemented by account structure reference (`ACCOUNTS.md`) and detailed instruction documentation in `instructions/` subdirectory

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/DECOMPRESSED_TRANSFER.md : Decompressed Transfer documentation must cover SPL-compatible transfers between decompressed accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:50:17.433Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: DOCS.md:0-0
Timestamp: 2025-12-06T00:50:17.433Z
Learning: Applies to **/docs/* : For CPI documentation include: Target program (program being called), PDA signer (seeds and bump for CPI authority), Account mapping (how accounts passed through), Data passthrough (instruction data handling), Example code (complete CPI invocation).

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/**/*.md : Instruction documentation must include the following sections: path, description (including accounts and state layout), instruction_data, Accounts (in order with checks), instruction logic and checks, and Errors (with descriptions of causes)

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/docs/instructions/*.md : All instruction documentation must include: path to instruction code, description of what the instruction does including accounts used and state layouts, instruction_data paths, accounts list with checks, instruction logic and checks, and possible errors with descriptions

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/instructions/CLOSE_TOKEN_ACCOUNT.md : Close Token Account documentation must cover closing decompressed token accounts with rent distribution

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T18:01:54.689Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/docs/instructions/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:01:54.689Z
Learning: Applies to programs/compressed-token/program/docs/instructions/**/ACCOUNTS.md : ACCOUNTS.md must contain complete account layouts and data structures with references to code paths

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T03:17:28.794Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-12-07T03:17:28.794Z
Learning: Implement all 8 compressed token instructions: create_cmint, mint_to_ctoken, create_token_account_invoke, create_token_account_invoke_signed, create_ata_invoke, create_ata_invoke_signed, transfer_interface_invoke, and transfer_interface_invoke_signed

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:54:38.537Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/README.md:0-0
Timestamp: 2025-11-24T17:54:38.537Z
Learning: Implement compressed token program interfaces for third-party token creation and usage on Solana using ZK Compression

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:54:33.614Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/anchor/README.md:0-0
Timestamp: 2025-11-24T17:54:33.614Z
Learning: Implement the Compressed Token Program interface for creating and using compressed tokens on Solana with ZK Compression

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: All compressed token account implementations must reference and comply with the account layout specifications in programs/compressed-token/program/docs/ACCOUNTS.md

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T18:10:14.595Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: programs/compressed-token/program/CLAUDE.md:0-0
Timestamp: 2025-12-07T18:10:14.595Z
Learning: Applies to programs/compressed-token/program/src/ctoken_transfer.rs : CTokenTransfer instruction (discriminator: 3) must implement SPL-compatible transfers between decompressed accounts

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-11-24T17:53:57.540Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: js/compressed-token/README.md:0-0
Timestamp: 2025-11-24T17:53:57.540Z
Learning: This is the JavaScript SDK for interacting with the Compressed Token program on Solana

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-06T00:49:57.458Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-token-test/CLAUDE.md:0-0
Timestamp: 2025-12-06T00:49:57.458Z
Learning: Applies to sdk-tests/sdk-token-test/**/*test.rs : Tests should use light-ctoken-sdk functions from sdk-libs/compressed-token-sdk for testing ctoken instructions

Applied to files:

  • ctoken_for_payments.md
📚 Learning: 2025-12-07T03:17:28.794Z
Learnt from: CR
Repo: Lightprotocol/light-protocol PR: 0
File: sdk-tests/sdk-ctoken-test/README.md:0-0
Timestamp: 2025-12-07T03:17:28.794Z
Learning: Use compressible token account extensions that allow accounts to be compressed back into compressed state with rent payment mechanisms

Applied to files:

  • ctoken_for_payments.md
🔇 Additional comments (2)
ctoken_for_payments.md (2)

100-130: Verify file existence and SPL API usage before proceeding.

The file ctoken_for_payments.md could not be located in the repository. Please confirm:

  1. The correct file path and name
  2. Whether the file has been committed to version control

Regarding the SPL Token API concern: Both transfer() and transferChecked() exist in @solana/spl-token. The transfer() function operates on pre-validated tokens and takes 7 parameters (connection, payer, source, destination, owner, amount, decimals), while transferChecked() adds mint validation. If both functions are used in the documentation, ensure consistency with best practices—transferChecked() is recommended for security when the mint must be validated.

For createLoadAtaInstructions(): If this function appears in the c-token examples without explanation, add an inline comment clarifying its purpose and why it's necessary for c-token transfers but not SPL.


269-316: Verify file location and path; the referenced ctoken_for_payments.md does not exist in the repository.

The file ctoken_for_payments.md at lines 269-316 could not be located in the repository through any search method. Before the concerns can be properly addressed, please confirm:

  1. The correct file path or name (currently appears as ctoken_for_payments.md)
  2. Whether this file is new and only exists in staging or the PR
  3. If the section reference is intended for a different documentation file (e.g., DOCS.md in programs/compressed-token/program/)

Once the file is located, the review's concerns about prerequisite documentation, error handling in code examples, and account/interface details should be addressed per the documentation standards in learnings.

Comment on lines +1 to +21
# Using c-token for Payments

**TL;DR**: Same API patterns, 1/200th ATA creation cost. Your users get the same USDC, just stored more efficiently.

---

## Setup

```typescript
import { createRpc } from "@lightprotocol/stateless.js";

import {
getOrCreateAtaInterface,
getAtaInterface,
getAssociatedTokenAddressInterface,
transferInterface,
unwrap,
} from "@lightprotocol/compressed-token/unified";

const rpc = createRpc(RPC_ENDPOINT);
```
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add cross-references and explain key concepts in the introduction.

The documentation lacks connection to related docs and explanation of foundational concepts. Per the codebase documentation structure, this guide should reference:

  1. The main compressed token documentation (if it exists at programs/compressed-token/program/docs/CLAUDE.md or similar)
  2. Account structure documentation for context on why unified patterns matter
  3. A brief explanation of what "1/200th ATA creation cost" means (ZK compression benefit?)

Additionally, the setup imports should include brief inline comments explaining each function's purpose, or cross-reference an API reference document.

Consider adding:

  • A "See Also" section linking to related docs (ACCOUNTS.md, main compressed-token docs, instruction reference)
  • A one-sentence explanation of the cost reduction benefit upfront
  • Brief comments in the imports block explaining what each function does
🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 1 to 21, the intro and setup lack
cross-references and explanations of key concepts; add links to the main
compressed-token docs (e.g., programs/compressed-token/program/docs/CLAUDE.md or
the actual path in the repo), the accounts/account-structure doc (ACCOUNTS.md),
and the instruction/API reference, add a one-sentence explanation of what
"1/200th ATA creation cost" means (briefly describe that compressed-token
reduces on-chain ATA creation overhead via ZK/compression techniques), and
annotate the import block with short inline comments for each function (one-line
purpose for getOrCreateAtaInterface, getAtaInterface,
getAssociatedTokenAddressInterface, transferInterface, unwrap) plus a new "See
Also" section linking the referenced docs.

Comment on lines +1 to +333
# Using c-token for Payments

**TL;DR**: Same API patterns, 1/200th ATA creation cost. Your users get the same USDC, just stored more efficiently.

---

## Setup

```typescript
import { createRpc } from "@lightprotocol/stateless.js";

import {
getOrCreateAtaInterface,
getAtaInterface,
getAssociatedTokenAddressInterface,
transferInterface,
unwrap,
} from "@lightprotocol/compressed-token/unified";

const rpc = createRpc(RPC_ENDPOINT);
```

---

## 1. Receive Payments

**SPL Token:**

```typescript
import { getOrCreateAssociatedTokenAccount } from "@solana/spl-token";

const ata = await getOrCreateAssociatedTokenAccount(
connection,
payer,
mint,
recipient
);
// Share ata.address with sender

console.log(ata.amount);
```

**SPL Token (instruction-level):**

```typescript
import {
getAssociatedTokenAddressSync,
createAssociatedTokenAccountIdempotentInstruction,
} from "@solana/spl-token";

const ata = getAssociatedTokenAddressSync(mint, recipient);

const tx = new Transaction().add(
createAssociatedTokenAccountIdempotentInstruction(
payer.publicKey,
ata,
recipient,
mint
)
);
```

**c-token:**

```typescript
const ata = await getOrCreateAtaInterface(rpc, payer, mint, recipient);
// Share ata.parsed.address with sender

console.log(ata.parsed.amount);
```

**c-token (instruction-level):**

```typescript
import {
createAssociatedTokenAccountInterfaceIdempotentInstruction,
getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token/unified";
import { CTOKEN_PROGRAM_ID } from "@lightprotocol/stateless.js";

const ata = getAssociatedTokenAddressInterface(mint, recipient);

const tx = new Transaction().add(
createAssociatedTokenAccountInterfaceIdempotentInstruction(
payer.publicKey,
ata,
recipient,
mint,
CTOKEN_PROGRAM_ID
)
);
```

---

## 2. Send Payments

**SPL Token:**

```typescript
import { transfer } from "@solana/spl-token";
const sourceAta = getAssociatedTokenAddressSync(mint, owner.publicKey);
const destinationAta = getAssociatedTokenAddressSync(mint, recipient);

await transfer(
connection,
payer,
sourceAta,
destinationAta,
owner,
amount,
decimals
);
```

**SPL Token (instruction-level):**

```typescript
import {
getAssociatedTokenAddressSync,
createTransferInstruction,
} from "@solana/spl-token";

const sourceAta = getAssociatedTokenAddressSync(mint, owner.publicKey);
const destinationAta = getAssociatedTokenAddressSync(mint, recipient);

const tx = new Transaction().add(
createTransferInstruction(sourceAta, destinationAta, owner.publicKey, amount)
);
```

**c-token:**

```typescript
const sourceAta = getAssociatedTokenAddressInterface(mint, owner.publicKey);
const destinationAta = getAssociatedTokenAddressInterface(mint, recipient);

await transferInterface(
rpc,
payer,
sourceAta,
mint,
destinationAta,
owner,
amount
);
```

**c-token (instruction-level):**

```typescript
import {
createLoadAtaInstructions,
createTransferInterfaceInstruction,
getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token/unified";

const sourceAta = getAssociatedTokenAddressInterface(mint, owner.publicKey);
const destinationAta = getAssociatedTokenAddressInterface(mint, recipient);

const tx = new Transaction().add(
...(await createLoadAtaInstructions(
rpc,
sourceAta,
owner.publicKey,
mint,
payer.publicKey
)),
createTransferInterfaceInstruction(
sourceAta,
destinationAta,
owner.publicKey,
amount
)
);
```

To ensure your recipient's ATA exists you can prepend an idempotent creation instruction in the same atomic transaction:

**SPL Token:**

```typescript
import {
getAssociatedTokenAddressSync,
createAssociatedTokenAccountIdempotentInstruction,
} from "@solana/spl-token";

const destinationAta = getAssociatedTokenAddressSync(mint, recipient);
const createAtaIx = createAssociatedTokenAccountIdempotentInstruction(
payer.publicKey,
destinationAta,
recipient,
mint
);

new Transaction().add(createAtaIx, transferIx);
```

**c-token:**

```typescript
import {
getAssociatedTokenAddressInterface,
createAssociatedTokenAccountInterfaceIdempotentInstruction,
} from "@lightprotocol/compressed-token/unified";
import { CTOKEN_PROGRAM_ID } from "@lightprotocol/stateless.js";

const destinationAta = getAssociatedTokenAddressInterface(mint, recipient);
const createAtaIx = createAssociatedTokenAccountInterfaceIdempotentInstruction(
payer.publicKey,
destinationAta,
recipient,
mint,
CTOKEN_PROGRAM_ID
);

new Transaction().add(createAtaIx, transferIx);
```

---

## 3. Show Balance

**SPL Token:**

```typescript
import { getAccount } from "@solana/spl-token";

const account = await getAccount(connection, ata);
console.log(account.amount);
```

**c-token:**

```typescript
const ata = getAssociatedTokenAddressInterface(mint, owner);
const account = await getAtaInterface(rpc, ata, owner, mint);

console.log(account.parsed.amount);
```

---

## 4. Transaction History

**SPL Token:**

```typescript
const signatures = await connection.getSignaturesForAddress(ata);
```

**c-token:**

```typescript
// Unified: fetches both on-chain and compressed tx signatures
const result = await rpc.getSignaturesForOwnerInterface(owner);

console.log(result.signatures); // Merged + deduplicated
console.log(result.solana); // On-chain txs only
console.log(result.compressed); // Compressed txs only
```

Use `getSignaturesForAddressInterface(address)` if you want address-specific rather than owner-wide history.

---

## 5. Unwrap to SPL

When users need vanilla SPL tokens (eg., for CEX off-ramp):

**c-token -> SPL ATA:**

```typescript
import { getAssociatedTokenAddressSync } from "@solana/spl-token";

// SPL ATA must exist
const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey);

await unwrap(rpc, payer, owner, mint, splAta, amount);
```

**c-token (instruction-level):**

```typescript
import { getAssociatedTokenAddressSync } from "@solana/spl-token";
import {
createLoadAtaInstructions,
createUnwrapInstruction,
getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token/unified";
import { getSplInterfaceInfos } from "@lightprotocol/compressed-token";

const ctokenAta = getAssociatedTokenAddressInterface(mint, owner.publicKey);
const splAta = getAssociatedTokenAddressSync(mint, owner.publicKey);

const splInterfaceInfos = await getSplInterfaceInfos(rpc, mint);
const splInterfaceInfo = splInterfaceInfos.find((i) => i.isInitialized);

const tx = new Transaction().add(
...(await createLoadAtaInstructions(
rpc,
ctokenAta,
owner.publicKey,
mint,
payer.publicKey
)),
createUnwrapInstruction(
ctokenAta,
splAta,
owner.publicKey,
mint,
amount,
splInterfaceInfo
)
);
```

---

## Quick Reference

| Operation | SPL Token | c-token (unified) |
| -------------- | ------------------------------------- | -------------------------------------- |
| Get/Create ATA | `getOrCreateAssociatedTokenAccount()` | `getOrCreateAtaInterface()` |
| Derive ATA | `getAssociatedTokenAddress()` | `getAssociatedTokenAddressInterface()` |
| Transfer | `transferChecked()` | `transferInterface()` |
| Get Balance | `getAccount()` | `getAtaInterface()` |
| Tx History | `getSignaturesForAddress()` | `rpc.getSignaturesForOwnerInterface()` |
| Exit to SPL | N/A | `unwrap()` |

---

Need help with integration? Reach out: [support@lightprotocol.com](mailto:support@lightprotocol.com)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Overall: Strong foundation, but needs API documentation, cross-references, and clearer explanations of c-token-specific patterns.

This guide does a great job side-by-side comparing SPL and c-token workflows. However, three categories of work remain:

  1. Cross-reference missing docs (lines 1–21): Link to main compressed-token documentation, ACCOUNTS.md, and related instruction references. Per codebase guidelines, documentation should have a main entry point with an instruction index.

  2. API documentation gaps: Functions like getAtaInterface(), getOrCreateAtaInterface(), transferInterface(), and getSplInterfaceInfos() are used but not documented. Add return types, error conditions, and purpose to the guide or link to an API reference.

  3. Explain c-token specifics (lines 45–176, 283–316): Developers migrating from SPL need to understand:

    • Why c-token examples require CTOKEN_PROGRAM_ID but SPL doesn't
    • What .parsed means on account objects
    • Why createLoadAtaInstructions() is needed (zk state loading)
    • Why splInterfaceInfo is required for unwrap (and what to do if it's not found)

These are the blocking issues. The other comments above address specific fixes. Once addressed, this will be an excellent quick-start guide for developers.

🤖 Prompt for AI Agents
In ctoken_for_payments.md (start lines 1–21, 45–176, 283–316) add the missing
cross-references and detailed API/docs: at the top (lines 1–21) insert links to
the main compressed-token documentation, ACCOUNTS.md, and an instruction
reference/index per repo docs; for the API gaps, add short API doc blocks or
links for getAtaInterface(), getOrCreateAtaInterface(), transferInterface(),
createLoadAtaInstructions(), getSplInterfaceInfos(), unwrap() that list return
types, possible errors/edge cases, and intended usage (or point to the canonical
API reference); in the c-token explanation sections (lines 45–176 and 283–316)
add concise notes explaining why CTOKEN_PROGRAM_ID is required, what the .parsed
field contains, why createLoadAtaInstructions() is necessary (zk state/load
behavior), and why splInterfaceInfo is needed for unwrap (and what to do if none
found, e.g., error handling or fallback), ensuring each explanation is a couple
of sentences and includes links to deeper docs where appropriate.

Comment on lines +29 to +92
```typescript
import { getOrCreateAssociatedTokenAccount } from "@solana/spl-token";

const ata = await getOrCreateAssociatedTokenAccount(
connection,
payer,
mint,
recipient
);
// Share ata.address with sender

console.log(ata.amount);
```

**SPL Token (instruction-level):**

```typescript
import {
getAssociatedTokenAddressSync,
createAssociatedTokenAccountIdempotentInstruction,
} from "@solana/spl-token";

const ata = getAssociatedTokenAddressSync(mint, recipient);

const tx = new Transaction().add(
createAssociatedTokenAccountIdempotentInstruction(
payer.publicKey,
ata,
recipient,
mint
)
);
```

**c-token:**

```typescript
const ata = await getOrCreateAtaInterface(rpc, payer, mint, recipient);
// Share ata.parsed.address with sender

console.log(ata.parsed.amount);
```

**c-token (instruction-level):**

```typescript
import {
createAssociatedTokenAccountInterfaceIdempotentInstruction,
getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token/unified";
import { CTOKEN_PROGRAM_ID } from "@lightprotocol/stateless.js";

const ata = getAssociatedTokenAddressInterface(mint, recipient);

const tx = new Transaction().add(
createAssociatedTokenAccountInterfaceIdempotentInstruction(
payer.publicKey,
ata,
recipient,
mint,
CTOKEN_PROGRAM_ID
)
);
```
Copy link
Contributor

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

🏁 Script executed:

# Find the ctoken_for_payments.md file
find . -name "ctoken_for_payments.md" -type f

Repository: Lightprotocol/light-protocol

Length of output: 96


🏁 Script executed:

# Search for getOrCreateAtaInterface implementation
rg "getOrCreateAtaInterface" --type ts --type js -B 3 -A 5

Repository: Lightprotocol/light-protocol

Length of output: 220


🏁 Script executed:

# Search for createAssociatedTokenAccountInterfaceIdempotentInstruction signature
rg "createAssociatedTokenAccountInterfaceIdempotentInstruction" --type ts --type js -B 2 -A 10

Repository: Lightprotocol/light-protocol

Length of output: 220


🏁 Script executed:

# Find unified API exports
find . -path "*/unified*" -type f -name "*.ts" -o -name "*.js" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 89


🏁 Script executed:

# Search for TokenAccount type definitions to understand .parsed structure
rg "\.parsed" --type ts --type js -B 2 -A 2 | head -100

Repository: Lightprotocol/light-protocol

Length of output: 220


🏁 Script executed:

# Read the ctoken_for_payments.md file to see the actual content
cat -n ctoken_for_payments.md | sed -n '25,95p'

Repository: Lightprotocol/light-protocol

Length of output: 1954


🏁 Script executed:

# Search for getOrCreateAtaInterface in all files
rg "getOrCreateAtaInterface" -B 3 -A 8 --max-count 5

Repository: Lightprotocol/light-protocol

Length of output: 2214


🏁 Script executed:

# Search for createAssociatedTokenAccountInterfaceIdempotentInstruction
rg "createAssociatedTokenAccountInterfaceIdempotentInstruction" -B 2 -A 8

Repository: Lightprotocol/light-protocol

Length of output: 1881


🏁 Script executed:

# List files in unified directory if it exists
find . -type d -name "unified" 2>/dev/null | head -5

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

# Check js directory structure for API definitions
find ./js -name "*.ts" -o -name "*.js" | grep -E "(unified|index)" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

# Search for unified directory and API implementations
find . -type f -name "*.ts" -path "*/unified*" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

# Search for getOrCreateAtaInterface function definition
rg "export.*getOrCreateAtaInterface|function getOrCreateAtaInterface|const getOrCreateAtaInterface" -B 2 -A 15

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

# Search for the return type definition
rg "interface.*AtaInterface|type.*AtaInterface" -B 2 -A 10

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

# Look for coding guidelines document
find . -name "*.md" -path "*guide*" -o -name "GUIDELINES*" -o -name "CODING*" | grep -i guide

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

# Check the actual structure returned - look for .parsed in code
rg "\.parsed\s*\." -B 3 -A 1 | head -50

Repository: Lightprotocol/light-protocol

Length of output: 680


🏁 Script executed:

# Check if there are other examples in the file that demonstrate best practices
cat -n ctoken_for_payments.md | grep -E "(console\.|import|//) " | head -40

Repository: Lightprotocol/light-protocol

Length of output: 1188


🏁 Script executed:

# Verify the file structure and see all comment examples
rg "//\s" ctoken_for_payments.md | head -20

Repository: Lightprotocol/light-protocol

Length of output: 390


Remove console.log statements and add inline comments explaining API structure differences.

Lines 40 and 69 include logging without explanatory context, violating documentation guidelines. Unlike the logging at lines 258-260 (which includes comments explaining the output), these examples should either remove the console.log or add comments explaining why the logging is essential.

Additionally, the instruction-level examples (lines 73-92) need inline comments explaining:

  • Why createAssociatedTokenAccountInterfaceIdempotentInstruction requires CTOKEN_PROGRAM_ID as the final parameter, unlike the SPL equivalent
  • The purpose of the .parsed property returned by getOrCreateAtaInterface (already referenced at line 67)
🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 29 to 92, remove the bare console.log
statements at lines ~40 and ~69 and replace them with concise inline comments
that explain the API output structure (e.g., for
getOrCreateAssociatedTokenAccount / getOrCreateAtaInterface show which field
holds the address and which holds the token amount) and mirror the style used at
lines 258-260; additionally add short inline comments in the instruction-level
example (lines ~73-92) explaining why
createAssociatedTokenAccountInterfaceIdempotentInstruction requires
CTOKEN_PROGRAM_ID as the final parameter (to target the c-token program) and
what the .parsed property returned by getOrCreateAtaInterface contains and why
callers should use ata.parsed.address / ata.parsed.amount instead of ata.address
/ ata.amount.

Comment on lines +222 to +264
## 3. Show Balance

**SPL Token:**

```typescript
import { getAccount } from "@solana/spl-token";

const account = await getAccount(connection, ata);
console.log(account.amount);
```

**c-token:**

```typescript
const ata = getAssociatedTokenAddressInterface(mint, owner);
const account = await getAtaInterface(rpc, ata, owner, mint);

console.log(account.parsed.amount);
```

---

## 4. Transaction History

**SPL Token:**

```typescript
const signatures = await connection.getSignaturesForAddress(ata);
```

**c-token:**

```typescript
// Unified: fetches both on-chain and compressed tx signatures
const result = await rpc.getSignaturesForOwnerInterface(owner);

console.log(result.signatures); // Merged + deduplicated
console.log(result.solana); // On-chain txs only
console.log(result.compressed); // Compressed txs only
```

Use `getSignaturesForAddressInterface(address)` if you want address-specific rather than owner-wide history.

Copy link
Contributor

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

🏁 Script executed:

find . -name "ctoken_for_payments.md" -o -name "*ctoken*payments*" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 96


🏁 Script executed:

git ls-files | grep -i "ctoken.*payment\|payment.*ctoken" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 94


🏁 Script executed:

git ls-files | grep -i "docs" | grep -i "token" | head -30

Repository: Lightprotocol/light-protocol

Length of output: 2231


🏁 Script executed:

cat -n ctoken_for_payments.md | head -280

Repository: Lightprotocol/light-protocol

Length of output: 7933


🏁 Script executed:

rg "getAtaInterface" --type ts --type js -A 5 | head -60

Repository: Lightprotocol/light-protocol

Length of output: 220


🏁 Script executed:

rg "getSignaturesForOwnerInterface|getSignaturesForAddressInterface" --type ts --type js -A 3 | head -80

Repository: Lightprotocol/light-protocol

Length of output: 220


🏁 Script executed:

find . -name "unified*" -o -path "*/compressed-token/*" -name "*.ts" | grep -E "(index|types|unified)" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

find . -path "*/compressed-token*" -name "*.md" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 987


🏁 Script executed:

find . -path "*unified*" -type f | head -20

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

rg "getAtaInterface" --max-count 20 | head -80

Repository: Lightprotocol/light-protocol

Length of output: 321


🏁 Script executed:

find ./js/compressed-token -name "*.ts" -o -name "*.js" | grep -E "(index|unified)" | head -20

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

ls -la ./js/compressed-token/

Repository: Lightprotocol/light-protocol

Length of output: 304


🏁 Script executed:

find ./js/compressed-token -type f -name "*.ts" | head -30

Repository: Lightprotocol/light-protocol

Length of output: 54


🏁 Script executed:

cat ./js/compressed-token/README.md

Repository: Lightprotocol/light-protocol

Length of output: 4917


🏁 Script executed:

rg "getSignaturesForOwnerInterface|getSignaturesForAddressInterface" -A 10 -B 2

Repository: Lightprotocol/light-protocol

Length of output: 1771


Remove or replace console.log statements; document API signatures and behavior.

The balance and transaction history sections have documentation gaps:

  1. Lines 230, 239, 258–260: Remove the three console.log statements in the transaction history example (lines 258–260) or replace all console.log calls with inline comments. Per guidelines, logging statements are not essential here—replace with comments like // result.signatures: array of merged signatures to show structure without the output calls.

  2. Line 237: Add inline comments documenting getAtaInterface() return type and behavior:

    const account = await getAtaInterface(rpc, ata, owner, mint);
    // Returns: { parsed: { amount: bigint, ... } }
    // Fetches current token balance for the ATA
  3. Line 256: Clarify that getSignaturesForOwnerInterface() is a method on the rpc object (from createRpc()), not an imported function. Add a comment: // rpc method: fetches merged on-chain and compressed signatures

  4. Line 263: Add a one-line example or explanation for getSignaturesForAddressInterface(address)—when/why to use it instead of getSignaturesForOwnerInterface().

🤖 Prompt for AI Agents
In ctoken_for_payments.md around lines 222 to 264, remove the three console.log
statements and replace them with inline comments describing the returned
structures, add a brief inline comment after the getAtaInterface call explaining
its return shape and that it fetches the current ATA token balance (e.g.
parsed.amount is bigint), clarify at line ~256 that
getSignaturesForOwnerInterface is an rpc instance method (from createRpc()) by
adding a comment like “rpc method: fetches merged on-chain and compressed
signatures”, and add a one-line note at ~263 explaining when to use
getSignaturesForAddressInterface(address) vs
getSignaturesForOwnerInterface(owner) (address-specific ATA history vs
owner-wide merged history).

export const PHOTON_GIT_REPO = "https://github.com/lightprotocol/photon.git";
export const PHOTON_GIT_COMMIT = "711c47b20330c6bb78feb0a2c15e8292fcd0a7b0"; // If empty, will use main branch.

//8bc3a8baeda38c62a7ac71be1d51d5c28e783842
Copy link
Contributor

Choose a reason for hiding this comment

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

leftover?

- name: Run compressed-token ctoken tests with V2
run: |
echo "Running compressed-token ctoken tests with retry logic (max 2 attempts)..."
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need multiple attempts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

think that was to hot fix an issue with build dependency ordering. let me try without retries

Copy link
Contributor

Choose a reason for hiding this comment

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

it wasn't a hotfix it was so that the ci tests fail less often because test validator didn't start correctly
please preserve these retries.

wip

add borsh_compat compressed_proof

add new_address_owner to instructiondata trait

add derive_compressed_address

remaining new_address_owner impl

add csdk-anchor-test program

lint add address_owner trait impl

add sdk libs - wip

add transfer_interface, transfer_ctoken, transfer_spl_to_ctoken, transfer_ctoken_to_spl, signed, instructions

rename consistently transfer_x

rename file transfer_decompressed to transfer_ctoken

add todos

add create_ctoken_account_signed, rename create_compressible_token_account to create_compressible_token_account_instruction

add create_associated_ctoken_account

add inline comment to copyLocalProgramBinaries.sh

remove new_address_owner

add pack and unpack for tokendata

first pass, compressible helpers for light-sdk

wip

compiles

lint

compressAccountsIdempotent csdk works, adjust test asserts to account is_none

ctoken add signer flags for decompress_full_ctoken_accounts_with_indices

wip

stash: removing ctoken from compression

all tests working

add auto-comp, clean up tests

rm dependency on patch

fmt

lint

lint

refactor

rm

wip

clean

fmt

clean

clean

clean

rm macro

clean

clean

dedupe derivation methods

clean

fmt

revert copyLocalProgramBinaries.sh diff

add csdk_anchor_test binary to ci

fix indexer

fix doctest

fix cli ci build target

fix cli build

clean

address nits

fix cli cache

fix cache

clean

fix csdk anchor test program build

add pkg.json csdk

rebuild

fix syntax

fix nx

rm panics

fix ci

fix build sdk-anchor-test

try fix

bmt keccak

spawn_prover fix

fix lint

fix clock sysvar

add test feature to account-compression

revert profiler

refactor csdk-anchor-test program lib.rs

split tests

fmt

revert cli script

reset close_for_compress_and_close to main

fmt

try revert

build account-compression with test flag

fmt

fix workflow to ensure we build account-compression with test feature

fix sdk test nav

try sdk-tests.yml with hyphen

rm idl build

csdk anchor test artifact

wip

reuse ctoken_types

move ctoken to light-compressed-token-sdk

clean

move pack to compressed-token-sdk

clean

clean

clean

clean

clean

clean

wip - add macro

lint

clean

clean

fmt clean, rename to sdk-compressible-test

cargo lock

default auto compress false

wip

patch to compile

wip

add borsh_compat compressed_proof

add new_address_owner to instructiondata trait

add derive_compressed_address

remaining new_address_owner impl

add csdk-anchor-test program

lint add address_owner trait impl

add sdk libs - wip

add transfer_interface, transfer_ctoken, transfer_spl_to_ctoken, transfer_ctoken_to_spl, signed, instructions

rename consistently transfer_x

rename file transfer_decompressed to transfer_ctoken

add todos

add create_ctoken_account_signed, rename create_compressible_token_account to create_compressible_token_account_instruction

add create_associated_ctoken_account

add inline comment to copyLocalProgramBinaries.sh

remove new_address_owner

add pack and unpack for tokendata

first pass, compressible helpers for light-sdk

wip

compiles

lint

compressAccountsIdempotent csdk works, adjust test asserts to account is_none

ctoken add signer flags for decompress_full_ctoken_accounts_with_indices

wip

stash: removing ctoken from compression

all tests working

add auto-comp, clean up tests

rm dependency on patch

fmt

lint

lint

refactor

rm

wip

clean

fmt

clean

clean

clean

rm macro

clean

clean

dedupe derivation methods

clean

fmt

revert copyLocalProgramBinaries.sh diff

add csdk_anchor_test binary to ci

fix indexer

fix doctest

fix cli ci build target

fix cli build

clean

address nits

fix cli cache

fix cache

clean

fix csdk anchor test program build

add pkg.json csdk

rebuild

fix syntax

fix nx

rm panics

fix ci

fix build sdk-anchor-test

try fix

bmt keccak

spawn_prover fix

fix lint

fix clock sysvar

add test feature to account-compression

revert profiler

refactor csdk-anchor-test program lib.rs

split tests

fmt

revert cli script

reset close_for_compress_and_close to main

fmt

try revert

build account-compression with test flag

fmt

fix workflow to ensure we build account-compression with test feature

fix sdk test nav

try sdk-tests.yml with hyphen

rm idl build

csdk anchor test artifact

wip

reuse ctoken_types

move ctoken to light-compressed-token-sdk

clean

move pack to compressed-token-sdk

clean

clean

clean

clean

clean

clean

wip - add macro

push macros

refactor compressible_instructions macro

split into compressible_instructions_decompress

modularized decompressaccountsidempotent

add decompresscontext derive macro

clean

macros done

compress runtime and clean

fmt

use small derive macros

wip

csdk anchor derived test using derive macros

lint

wip

clean

rm dead code

clean

lint

fmt

clean

fmt

dry

clean

lint

clean

rent cpi

wip

fmt and lint

clean

avoid reallocs in decompress_accounts_idempotent ixn builder

remove rent sponsor and compression authority

optional ctoken keys for decompress_accounts_idempotent

wip

auto compress pda

auto compress test

derive_rent_sponsor macro

add disable cold state mining flag

wip

add complex seed test

wip

clean

clean

ignore doctest

wip

revert to devnenv for lightprogramtest until we can remove it

clean

wip

address comments fixes

apply suggestion in decompress_runtime.rs

lint

wip

fix lint

fix macros lint

fix macro lint

add standard derive_rent_sponsor helper

remove unused ctoken-types dep from sdk

patch

rm unwrap from nested field access

address final comments

move decompress_runtime.rs

rm derive_light_cpi_signer

impl additional suggestions

fix forester deps

add c-token/compressible TS

rename to grpc-url

make grpc url opt

fix tests, mint

bump photon

all js tests working, update ci

clean up getAccountInfoInterface

add v2 bound for getAccountInfoInterface

wip

wip

add mintinstructiondata type, add serde tests. use borsh serde with overrides

replace with borsh

clean

clean

clean

remove uploaders, add schema converters

add unit tests for metadata json conv

include unit tests in js ci cov

wip

fix token delegate coption parser

clean

fmt and lint

fix v2 stateless.js ci

try fix forester test with wait_for_queue_space

revert

stateless js skip createAccount if v2

update photon commit to parse-token + rebased to sergey/get_queue_elements_v2_rpc

add load, decompress2, transferInterface, and various other helpers

ts wip

fmt lint, skipIf v2 for create-account js tests

bump photon commit

bump photon

skip in rpc-multi-trees

rm logs

renamings

fix buffer-layout and bosh upd

Ata -> ATA
add console logs

wip

enable opt tokenMetadata additionalMetadata instruction data. createMintInterface action matching spl-token call signature

refactor metadata methods, add helpers

adjust test suite

move back to transparent params

export unified

tests

bump photon version

fmt

cleanup

add fail safe to ata derivation in unified path and tests

update imports and test

wip

refactor ctoken dirs

update tests imports

fix lint

set to temp photon commit

fix photon version again

dont break old createMint

bump photon again

fmt

fix chunking

max topup

sync to latest program instruction changes

update compresstopubkey

use photon main

bump photon commit

ATA -> Ata

add test cov

atomic tokenpool helper

move to SplInterfacePda naming

more unit layout and e2e interface tests

add test coverage for mint-to-compressed

spin out create-ata-interface.ts

cleanup docstrings

clean

test cov: decompress2 in get-or-create-ata-interface

fix decompress2 rn to decompressInterface, add test cov

clean moving

get-account-interface

add invariants to load-ata, add test cov

tests

wip
@SwenSchaeferjohann SwenSchaeferjohann merged commit 2953172 into main Dec 11, 2025
17 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.

4 participants