-
Notifications
You must be signed in to change notification settings - Fork 5
Add client library documentation and guides #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit ca7ebb8.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Enhances the client library README with better formatting and adds comprehensive verification checklists for documentation quality. Changes: - Improve markdown formatting in client library README (proper spacing around code blocks) - Configure CodeRabbit as ZK Compression expert with source code verification - Add GitBook syntax verification checklist - Add code snippet verification guidelines - Add developer text quality checklist
WalkthroughAdds two documentation updates: a comprehensive client-library README showing TypeScript and Rust end-to-end flows for ZK Compression (installation, RPC, tree/address metadata, validity proofs, packing accounts, instruction construction, and transaction submission), and revised compressed-tokens guides that load wallets from disk and compute balances using mint decimals. Changes
Sequence Diagram(s)(omitted — changes are documentation-only and do not introduce new runtime control flow to diagram) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
zk-compression-docs/compressed-pdas/client-library/README.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
zk-compression-docs/**/*.md
⚙️ CodeRabbit configuration file
zk-compression-docs/**/*.md: Cross-verify documentation with source code using CLAUDE.md mappings.
Prioritize accuracy over assumptions - always check actual source files.
Files:
zk-compression-docs/compressed-pdas/client-library/README.md
🪛 LanguageTool
zk-compression-docs/compressed-pdas/client-library/README.md
[uncategorized] ~140-~140: Loose punctuation mark.
Context: ...t-client`](https://docs.rs/light-client): The RPC client that provides the ZK Com...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~141-~141: Loose punctuation mark.
Context: ...light-sdk: Program-side abstractions (macros, wrap...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~237-~237: Possible missing comma found.
Context: ...ss tree to derive and store the account address and * a state tree to store the compres...
(AI_HYDRA_LEO_MISSING_COMMA)
[typographical] ~311-~311: It appears that a comma is missing.
Context: ...blic key and other metadata. With these methods you select a random state tree to store...
(DURING_THAT_TIME_COMMA)
[uncategorized] ~331-~331: Loose punctuation mark.
Context: ...nfo contains. * tree: Merkle tree account pubkey * queue: Q...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~335-~335: Loose punctuation mark.
Context: ...erts values into the queue. * treeType: Automatically set based on which tree s...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~336-~336: Loose punctuation mark.
Context: ...election method you used. * cpiContext: Optional CPI context account for batche...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~448-~448: Loose punctuation mark.
Context: ...s these parameters**: * &[b"my-seed"]: Predefined inputs, such as strings, num...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~449-~449: Loose punctuation mark.
Context: ...t addresses. * &address_tree_info.tree: Specify the tree pubkey to ensure an ad...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~450-~450: Loose punctuation mark.
Context: ...es from identical seeds. * &program_id: Specify the program owner pubkey. {% en...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~497-~497: Loose punctuation mark.
Context: ... The RPC returns**: * compressedProof: The proof that the address does not exi...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~498-~498: Loose punctuation mark.
Context: ...n your instruction data. * rootIndices: An array with root index from the valid...
(UNLIKELY_OPENING_PUNCTUATION)
[typographical] ~499-~499: Usually, there’s no comma before “when”.
Context: ...you do not reference an existing account, when you create a compressed account. {% end...
(IF_NO_COMMA)
[uncategorized] ~529-~529: Loose punctuation mark.
Context: ... The RPC returns**: * compressedProof: The proof that the account hash exists ...
(UNLIKELY_OPENING_PUNCTUATION)
[typographical] ~565-~565: Usually, there’s no comma before “when”.
Context: ...you do not reference an existing account, when you create a compressed account. {% end...
(IF_NO_COMMA)
[typographical] ~653-~653: It appears that a comma is missing.
Context: ...xample create-and-update proof In this example we generate one proof for the update of...
(DURING_THAT_TIME_COMMA)
[uncategorized] ~679-~679: Loose punctuation mark.
Context: ...2. The RPC returns: * compressedProof: A single combined proof that verifies b...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~707-~707: The preposition ‘of’ seems more likely in this position.
Context: ...ddressWithTree]` to prove non-existence in address trees. ### 2. The RPC returns ...
(AI_HYDRA_LEO_REPLACE_IN_OF)
[uncategorized] ~711-~711: Loose punctuation mark.
Context: ...alidityProofWithContextwith *proof`: A single combined proof, passed to the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~725-~725: Possible missing comma found.
Context: ... Pack Accounts To optimize instruction data we pack accounts into an array: * Ever...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~743-~743: Loose punctuation mark.
Context: ... account sections: 1. preAccounts: Program-specific accounts like signers ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~744-~744: Loose punctuation mark.
Context: ...rs or fee payer. 2. systemAccounts: [Light System accounts](https://www.zkc...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~915-~915: Loose punctuation mark.
Context: ...o three sections: 1. pre_accounts: Program-specific accounts (signers, fee...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1084-~1084: Possible missing comma found.
Context: ...read directly. The program hashes this data and the Light System Program verifies t...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~1115-~1115: Loose punctuation mark.
Context: ... from Step 5: * packedAddressTreeInfo: Index to the address tree account used ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1194-~1194: Loose punctuation mark.
Context: ...e metadata from Step 5: * accountMeta: * treeInfo: packedStateTreeInfo: Pa...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1233-~1233: Loose punctuation mark.
Context: ...e metadata from Step 5: * accountMeta: * treeInfo: packedStateTreeInfo: Pa...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1272-~1272: Loose punctuation mark.
Context: ...e metadata from Step 5: * accountMeta: * treeInfo: packedStateTreeInfo: Pa...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1329-~1329: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1335-~1335: Loose punctuation mark.
Context: ...data from Step 5: * address_tree_info: Index to the address tree account used ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1403-~1403: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1469-~1469: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1475-~1475: Loose punctuation mark.
Context: ... metadata from Step 5: * account_meta: * tree_info: Packed indices to the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1533-~1533: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1539-~1539: Loose punctuation mark.
Context: ... metadata from Step 5: * account_meta: * tree_info: Packed indices to the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1597-~1597: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1603-~1603: Loose punctuation mark.
Context: ... metadata from Step 5: * account_meta: * tree_info: Packed indices to the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1695-~1695: Possible missing comma found.
Context: ... .reinitAccount(). No account data is passed since reinit creates default-initialize...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~1797-~1797: Possible missing comma found.
Context: ... .reinitAccount(). No account data is passed since reinit creates default-initialize...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~1964-~1964: Possible missing comma found.
Context: ...uilding programs to create, or interact with compressed accounts. {% content-ref ur...
(AI_HYDRA_LEO_MISSING_COMMA)
🪛 markdownlint-cli2 (0.18.1)
zk-compression-docs/compressed-pdas/client-library/README.md
41-41: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
123-123: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
233-233: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
347-347: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
463-463: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
631-631: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
644-644: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
644-644: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
644-644: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
645-645: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
645-645: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
645-645: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
723-723: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
735-735: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
749-749: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
811-811: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
839-839: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
868-868: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
905-905: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
905-905: Multiple headings with the same content
(MD024, no-duplicate-heading)
919-919: Multiple headings with the same content
(MD024, no-duplicate-heading)
921-921: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
936-936: Multiple headings with the same content
(MD024, no-duplicate-heading)
1052-1052: Multiple headings with the same content
(MD024, no-duplicate-heading)
1077-1077: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
1146-1146: Multiple headings with the same content
(MD024, no-duplicate-heading)
1186-1186: Multiple headings with the same content
(MD024, no-duplicate-heading)
1190-1190: Multiple headings with the same content
(MD024, no-duplicate-heading)
1199-1199: Multiple headings with the same content
(MD024, no-duplicate-heading)
1225-1225: Multiple headings with the same content
(MD024, no-duplicate-heading)
1229-1229: Multiple headings with the same content
(MD024, no-duplicate-heading)
1264-1264: Multiple headings with the same content
(MD024, no-duplicate-heading)
1277-1277: Multiple headings with the same content
(MD024, no-duplicate-heading)
1327-1327: Multiple headings with the same content
(MD024, no-duplicate-heading)
1331-1331: Multiple headings with the same content
(MD024, no-duplicate-heading)
1338-1338: Multiple headings with the same content
(MD024, no-duplicate-heading)
1401-1401: Multiple headings with the same content
(MD024, no-duplicate-heading)
1405-1405: Multiple headings with the same content
(MD024, no-duplicate-heading)
1414-1414: Multiple headings with the same content
(MD024, no-duplicate-heading)
1467-1467: Multiple headings with the same content
(MD024, no-duplicate-heading)
1471-1471: Multiple headings with the same content
(MD024, no-duplicate-heading)
1480-1480: Multiple headings with the same content
(MD024, no-duplicate-heading)
1531-1531: Multiple headings with the same content
(MD024, no-duplicate-heading)
1535-1535: Multiple headings with the same content
(MD024, no-duplicate-heading)
1544-1544: Multiple headings with the same content
(MD024, no-duplicate-heading)
1595-1595: Multiple headings with the same content
(MD024, no-duplicate-heading)
1599-1599: Multiple headings with the same content
(MD024, no-duplicate-heading)
1608-1608: Multiple headings with the same content
(MD024, no-duplicate-heading)
1619-1619: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
1840-1840: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
1888-1888: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
1898-1898: Ordered list item prefix
Expected: 1; Actual: 3; Style: 1/1/1
(MD029, ol-prefix)
1916-1916: Bare URL used
(MD034, no-bare-urls)
1920-1920: Bare URL used
(MD034, no-bare-urls)
1924-1924: Bare URL used
(MD034, no-bare-urls)
1928-1928: Bare URL used
(MD034, no-bare-urls)
1932-1932: Bare URL used
(MD034, no-bare-urls)
1940-1940: Bare URL used
(MD034, no-bare-urls)
1944-1944: Bare URL used
(MD034, no-bare-urls)
1948-1948: Bare URL used
(MD034, no-bare-urls)
1952-1952: Bare URL used
(MD034, no-bare-urls)
1956-1956: Bare URL used
(MD034, no-bare-urls)
🔇 Additional comments (5)
zk-compression-docs/compressed-pdas/client-library/README.md (5)
1-8: Strong documentation structure and comprehensive coverage.This README provides well-organized, step-by-step guidance for implementing ZK Compression clients in both TypeScript and Rust. The parallel examples maintain consistency across languages while respecting idioms, and the visual diagram tabs clearly communicate operation workflows.
Key strengths:
- Clear separation of V1/V2 tree configurations
- Dual language examples with consistent conceptual flow
- Detailed packing accounts explanation with deduplication semantics
- Comprehensive instruction data sections covering all operation types
- References to external examples and error resources
39-230: I need to verify that the package versions and endpoints mentioned are current and accurate. Let me search for the latest information.Let me search for the specific Rust package versions to complete the verification.
Update package versions to stable releases.
The latest version of @lightprotocol/stateless.js is 0.22.0, but the documentation specifies
0.22.1-alpha.1. If you intend to recommend the stable release, update lines 52–56 and 75–79 to use0.22.0instead of the alpha version. If bleeding-edge is intentional, this should be documented with a note explaining why you're using a pre-release.The API documentation links and Helius RPC endpoints (https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY and https://devnet.helius-rpc.com/?api-key=YOUR_API_KEY) are accurate and current. All documentation URLs are accessible.
254-270: Based on my verification using web searches and the available information:The documented API functions reference published packages that exist but cannot be fully verified through public documentation alone.
The light-sdk Rust crate v0.13.0 for ZK Compression on Solana is published and documented on docs.rs, and @lightprotocol/stateless.js is listed as a dependency alongside @lightprotocol/compressed-token. However, web search results do not provide sufficient detail to confirm the exact function signatures referenced in the documentation (such as
getAddressTreeInfoV2(),getAddressTreeInfos(),deriveAddressV2(), etc.).The documentation assumes these functions are correctly named and available in these published packages. Incorrect function names will cause immediate compilation failures when developers attempt to use this code.
245-245: No changes required; claim is appropriately hedged and consistent with official documentation.The "up to 70%" compute unit reduction is stated in ZK Compression's official docs with the same messaging. The phrase "up to" appropriately hedges the claim, and real savings vary by transaction pattern and tree usage—this is standard for performance documentation. Users are expected to benchmark against their own workloads, which is consistent with how ZK Compression presents V2.
The documentation at lines 245 and 356 is accurate as written.
241-241: ---The documented claims are substantiated, but clarify the context on compute unit savings.
The link to Merkle tree addresses at zkcompression.com/resources/addresses-and-urls is current and does list mainnet/devnet tree addresses—no changes needed on line 241.
For lines 609–612: The ~100k CU reduction per validity proof is an empirical estimate from ZK Compression developer documentation and reflects typical on-chain verification costs. However, this figure is implementation-specific and varies based on proving scheme, proof size, and aggregation strategy. The documentation is accurate, but consider adding a brief note that "100k CU" reflects current typical costs and may vary with system configuration.
Line 647-649 reference to verifying keys source code could not be verified from available documentation without inspecting the actual source reference cited in the README.
|
|
||
| * `compressedProof`: The proof that the address does not exist in the address tree, passed to the program in your instruction data. | ||
| * `rootIndices`: An array with root index from the validity proof for the address tree. | ||
| * Empty `leafIndices` array, since you do not reference an existing account, when you create a compressed account. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Add missing commas for grammatical correctness.
Several sentences are missing commas before dependent clauses or coordinating conjunctions.
-Leave (`[]`) empty to create compressed accounts, since no compressed account exists yet to reference.
+Leave (`[]`) empty to create compressed accounts since no compressed account exists yet to reference.
-* Specify the account `hash` along with `tree` and `queue` pubkeys from the compressed account's `TreeInfo`.
-* (`[]`) remains empty, since the proof verifies the account hash exists in a state tree, not that the address doesn't exist in an address tree.
+* Specify the account `hash` along with `tree` and `queue` pubkeys from the compressed account's `TreeInfo`.
+* (`[]`) remains empty since the proof verifies the account hash exists in a state tree, not that the address doesn't exist in an address tree.
-In this example we generate one proof for the update of an existing account, and the creation of a new account.
+In this example, we generate one proof for the update of an existing account and the creation of a new account.
-To optimize instruction data we pack accounts into an array:
+To optimize instruction data, we pack accounts into an array:
-The program hashes this data and the Light System Program verifies the hash against the root in a Merkle tree account.
+The program hashes this data, and the Light System Program verifies the hash against the root in a Merkle tree account.
-Pass the proof and compressed account metadata from Step 6 as separate parameters to `.reinitAccount()`. No account data is passed since reinit creates default-initialized zero values.
+Pass the proof and compressed account metadata from Step 6 as separate parameters to `.reinitAccount()`. No account data is passed, since reinit creates default-initialized zero values.
-Pass the proof and compressed account metadata from Step 6 as separate parameters to `.reinitAccount()`. No account data is passed since reinit creates default-initialized zero values.
+Pass the proof and compressed account metadata from Step 6 as separate parameters to `.reinitAccount()`. No account data is passed, since reinit creates default-initialized zero values.
-Start building programs to create, or interact with compressed accounts.
+Start building programs to create or interact with compressed accounts.Also applies to: 565-565, 653-653, 725-725, 1084-1084, 1695-1695, 1797-1797, 1964-1964
🧰 Tools
🪛 LanguageTool
[typographical] ~499-~499: Usually, there’s no comma before “when”.
Context: ...you do not reference an existing account, when you create a compressed account. {% end...
(IF_NO_COMMA)
🤖 Prompt for AI Agents
In zk-compression-docs/compressed-pdas/client-library/README.md around lines
499, 565, 653, 725, 1084, 1695, 1797, and 1964, several sentences are missing
commas before dependent clauses or coordinating conjunctions; edit each affected
sentence to insert the appropriate comma(s) for grammatical correctness (e.g.,
before conjunctions joining independent clauses and before introductory or
dependent clauses), make punctuation consistent across similar sentences, and
run a quick read-through of the listed lines to ensure each comma placement
reads naturally.
| {% tab title="V1 Circuits" %} | ||
| V1 circuits can prove in a single proof | ||
|
|
||
| * 1, 2, 3, 4, or 8 hashes, | ||
| * 1, 2, 3, 4, or 8 addresses, or | ||
| * multiple hashes or addresses in any combination of the below. | ||
|
|
||
| | **Single Combined Proofs** | Any combination of | | ||
| | -------------------------- | :----------------: | | ||
| | Hashes | 1, 2, 3, 4, 8 | | ||
| | Addresses | 1, 2, 4, 8 | | ||
| {% endtab %} | ||
|
|
||
| {% tab title="V2 Circuits" %} | ||
| V2 circuits can prove in a single proof | ||
|
|
||
| * 1 to 20 hashes, | ||
| * 1 to 32 addresses, or | ||
| * multiple hashes or addresses in any combination of the below. | ||
|
|
||
| | **Single Combined Proofs** | Any combination of | | ||
| | -------------------------- | :----------------: | | ||
| | Hashes | 1 to 4 | | ||
| | Addresses | 1 to 4 | | ||
| {% endtab %} | ||
| {% endtabs %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix table formatting — missing leading/trailing pipes and incorrect column counts.
Tables at lines 627–631, 640–645, 843–849, and 1019–1025 are missing leading/trailing pipes and have column count errors that may cause rendering issues.
Apply this diff to fix table formatting:
-| **Single Combined Proofs** | Any combination of |
-| -------------------------- | :----------------: |
-| Hashes | 1, 2, 3, 4, 8 |
-| Addresses | 1, 2, 4, 8 |
+| **Single Combined Proofs** | Any combination of |
+| :--------------------------: | :----------------: |
+| Hashes | 1, 2, 3, 4, 8 |
+| Addresses | 1, 2, 4, 8 |Repeat for all tables (lines 627–631, 640–645, 843–849, 1019–1025). Add leading and trailing pipes and ensure consistent column alignment.
Also applies to: 843-843, 1019-1026
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
631-631: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
644-644: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
644-644: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
644-644: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
645-645: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
645-645: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
645-645: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
🤖 Prompt for AI Agents
In zk-compression-docs/compressed-pdas/client-library/README.md around lines
620–645, 843–849, and 1019–1025, the Markdown tables are malformed: they lack
leading/trailing pipe characters and have inconsistent column counts between
header, separator and rows; fix each table by adding a leading and trailing pipe
on every header and row line, ensure the header separator row (---) has the same
number of columns (pipe separators) as the header, and align columns
consistently so each row has the same number of cells (for example three
columns: | Header1 | Header2 | Header3 | with | --- | --- | --- |). Apply this
pattern to the tables at 627–631, 640–645, 843–849, and 1019–1025 so rendering
is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (2)
zk-compression-docs/compressed-pdas/client-library/README.md (2)
843-850: Correct Close operation row in Tree Accounts table — Output State Tree should show nullify action.The Close operation table row at lines 843–850 incorrectly shows "-" for the Output State Tree column. Close does not delete an account; instead, it nullifies the leaf by storing zero values in the output state tree. Update the row to reflect this:
-| Close | - | ✓ (proves existence) | ✓ (nullifies) | - | +| Close | - | ✓ (proves existence) | ✓ (nullifies) | ✓ (stores zero values) |This aligns the Close row with the actual protocol semantics where the output tree records the nullified (zero-valued) state.
61-86: Update package versions to published releases — installation currently fails.The latest npm versions are 0.22.0 for both @lightprotocol/stateless.js and @lightprotocol/compressed-token, but the documentation specifies
0.22.1-alpha.1, which does not exist as a published release. Users will encounter immediate npm installation failures when following these instructions.Update all three package manager tabs to use published versions:
- @lightprotocol/stateless.js@0.22.1-alpha.1 \ - @lightprotocol/compressed-token@0.22.1-alpha.1 \ + @lightprotocol/stateless.js@0.22.0 \ + @lightprotocol/compressed-token@0.22.0 \Apply to npm (lines 61–64), yarn (lines 72–75), and pnpm (lines 83–86).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (2)
.github/CODE_SNIPPET_VERIFICATION.mdis excluded by none and included by none.github/DEVELOPER_TEXT_CHECKLIST.mdis excluded by none and included by none
📒 Files selected for processing (1)
zk-compression-docs/compressed-pdas/client-library/README.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
zk-compression-docs/**/*.md
⚙️ CodeRabbit configuration file
zk-compression-docs/**/*.md: Cross-verify documentation with source code using CLAUDE.md mappings.
Prioritize accuracy over assumptions - always check actual source files.
Files:
zk-compression-docs/compressed-pdas/client-library/README.md
🪛 LanguageTool
zk-compression-docs/compressed-pdas/client-library/README.md
[uncategorized] ~140-~140: Loose punctuation mark.
Context: ...t-client`](https://docs.rs/light-client): The RPC client that provides the ZK Com...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~141-~141: Loose punctuation mark.
Context: ...light-sdk: Program-side abstractions (macros, wrap...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~237-~237: Possible missing comma found.
Context: ...ss tree to derive and store the account address and * a state tree to store the compres...
(AI_HYDRA_LEO_MISSING_COMMA)
[typographical] ~311-~311: It appears that a comma is missing.
Context: ...blic key and other metadata. With these methods you select a random state tree to store...
(DURING_THAT_TIME_COMMA)
[uncategorized] ~331-~331: Loose punctuation mark.
Context: ...nfo contains. * tree: Merkle tree account pubkey * queue: Q...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~335-~335: Loose punctuation mark.
Context: ...erts values into the queue. * treeType: Automatically set based on which tree s...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~336-~336: Loose punctuation mark.
Context: ...election method you used. * cpiContext: Optional CPI context account for batche...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~448-~448: Loose punctuation mark.
Context: ...s these parameters**: * &[b"my-seed"]: Predefined inputs, such as strings, num...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~449-~449: Loose punctuation mark.
Context: ...t addresses. * &address_tree_info.tree: Specify the tree pubkey to ensure an ad...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~450-~450: Loose punctuation mark.
Context: ...es from identical seeds. * &program_id: Specify the program owner pubkey. {% en...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~492-~492: Possible missing comma found.
Context: ...Leave ([]) empty to create compressed accounts since no compressed account exists yet ...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~497-~497: Loose punctuation mark.
Context: ... The RPC returns**: * compressedProof: The proof that the address does not exi...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~498-~498: Loose punctuation mark.
Context: ...n your instruction data. * rootIndices: An array with root index from the valid...
(UNLIKELY_OPENING_PUNCTUATION)
[typographical] ~499-~499: Usually, there’s no comma before “when”.
Context: ...you do not reference an existing account, when you create a compressed account. {% end...
(IF_NO_COMMA)
[uncategorized] ~529-~529: Loose punctuation mark.
Context: ... The RPC returns**: * compressedProof: The proof that the account hash exists ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~558-~558: Possible missing comma found.
Context: ...e (vec![]) empty to create compressed accounts since no compressed account exists yet ...
(AI_HYDRA_LEO_MISSING_COMMA)
[uncategorized] ~565-~565: Possible missing comma found.
Context: ...ccounts (Step 5). * An empty accounts field since you do not reference an existing ...
(AI_HYDRA_LEO_MISSING_COMMA)
[typographical] ~565-~565: Usually, there’s no comma before “when”.
Context: ...you do not reference an existing account, when you create a compressed account. {% end...
(IF_NO_COMMA)
[uncategorized] ~679-~679: Loose punctuation mark.
Context: ...2. The RPC returns: * compressedProof: A single combined proof that verifies b...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~707-~707: The preposition ‘of’ seems more likely in this position.
Context: ...ddressWithTree]` to prove non-existence in address trees. ### 2. The RPC returns ...
(AI_HYDRA_LEO_REPLACE_IN_OF)
[uncategorized] ~711-~711: Loose punctuation mark.
Context: ...alidityProofWithContextwith *proof`: A single combined proof, passed to the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~743-~743: Loose punctuation mark.
Context: ... account sections: 1. preAccounts: Program-specific accounts like signers ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~744-~744: Loose punctuation mark.
Context: ...rs or fee payer. 2. systemAccounts: [Light System accounts](https://www.zkc...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~915-~915: Loose punctuation mark.
Context: ...o three sections: 1. pre_accounts: Program-specific accounts (signers, fee...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1115-~1115: Loose punctuation mark.
Context: ... from Step 5: * packedAddressTreeInfo: Index to the address tree account used ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1194-~1194: Loose punctuation mark.
Context: ...e metadata from Step 5: * accountMeta: * treeInfo: packedStateTreeInfo: Pa...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1233-~1233: Loose punctuation mark.
Context: ...e metadata from Step 5: * accountMeta: * treeInfo: packedStateTreeInfo: Pa...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1272-~1272: Loose punctuation mark.
Context: ...e metadata from Step 5: * accountMeta: * treeInfo: packedStateTreeInfo: Pa...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1329-~1329: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1335-~1335: Loose punctuation mark.
Context: ...data from Step 5: * address_tree_info: Index to the address tree account used ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1403-~1403: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1469-~1469: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1475-~1475: Loose punctuation mark.
Context: ... metadata from Step 5: * account_meta: * tree_info: Packed indices to the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1533-~1533: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1539-~1539: Loose punctuation mark.
Context: ... metadata from Step 5: * account_meta: * tree_info: Packed indices to the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1597-~1597: Loose punctuation mark.
Context: ...abs %} ### 1. Validity Proof * proof: Validity proof from Step 4 proving the ...
(UNLIKELY_OPENING_PUNCTUATION)
[uncategorized] ~1603-~1603: Loose punctuation mark.
Context: ... metadata from Step 5: * account_meta: * tree_info: Packed indices to the ...
(UNLIKELY_OPENING_PUNCTUATION)
🪛 markdownlint-cli2 (0.18.1)
zk-compression-docs/compressed-pdas/client-library/README.md
41-41: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
123-123: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
233-233: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
347-347: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
463-463: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
631-631: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
644-644: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
644-644: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
644-644: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
645-645: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
645-645: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
645-645: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
723-723: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
735-735: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
749-749: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
811-811: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
839-839: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
868-868: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
905-905: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
905-905: Multiple headings with the same content
(MD024, no-duplicate-heading)
919-919: Multiple headings with the same content
(MD024, no-duplicate-heading)
921-921: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
936-936: Multiple headings with the same content
(MD024, no-duplicate-heading)
1052-1052: Multiple headings with the same content
(MD024, no-duplicate-heading)
1077-1077: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
1146-1146: Multiple headings with the same content
(MD024, no-duplicate-heading)
1186-1186: Multiple headings with the same content
(MD024, no-duplicate-heading)
1190-1190: Multiple headings with the same content
(MD024, no-duplicate-heading)
1199-1199: Multiple headings with the same content
(MD024, no-duplicate-heading)
1225-1225: Multiple headings with the same content
(MD024, no-duplicate-heading)
1229-1229: Multiple headings with the same content
(MD024, no-duplicate-heading)
1264-1264: Multiple headings with the same content
(MD024, no-duplicate-heading)
1277-1277: Multiple headings with the same content
(MD024, no-duplicate-heading)
1327-1327: Multiple headings with the same content
(MD024, no-duplicate-heading)
1331-1331: Multiple headings with the same content
(MD024, no-duplicate-heading)
1338-1338: Multiple headings with the same content
(MD024, no-duplicate-heading)
1401-1401: Multiple headings with the same content
(MD024, no-duplicate-heading)
1405-1405: Multiple headings with the same content
(MD024, no-duplicate-heading)
1414-1414: Multiple headings with the same content
(MD024, no-duplicate-heading)
1467-1467: Multiple headings with the same content
(MD024, no-duplicate-heading)
1471-1471: Multiple headings with the same content
(MD024, no-duplicate-heading)
1480-1480: Multiple headings with the same content
(MD024, no-duplicate-heading)
1531-1531: Multiple headings with the same content
(MD024, no-duplicate-heading)
1535-1535: Multiple headings with the same content
(MD024, no-duplicate-heading)
1544-1544: Multiple headings with the same content
(MD024, no-duplicate-heading)
1595-1595: Multiple headings with the same content
(MD024, no-duplicate-heading)
1599-1599: Multiple headings with the same content
(MD024, no-duplicate-heading)
1608-1608: Multiple headings with the same content
(MD024, no-duplicate-heading)
1619-1619: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
1840-1840: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Above
(MD022, blanks-around-headings)
1888-1888: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1
(MD029, ol-prefix)
1898-1898: Ordered list item prefix
Expected: 1; Actual: 3; Style: 1/1/1
(MD029, ol-prefix)
1916-1916: Bare URL used
(MD034, no-bare-urls)
1920-1920: Bare URL used
(MD034, no-bare-urls)
1924-1924: Bare URL used
(MD034, no-bare-urls)
1928-1928: Bare URL used
(MD034, no-bare-urls)
1932-1932: Bare URL used
(MD034, no-bare-urls)
1940-1940: Bare URL used
(MD034, no-bare-urls)
1944-1944: Bare URL used
(MD034, no-bare-urls)
1948-1948: Bare URL used
(MD034, no-bare-urls)
1952-1952: Bare URL used
(MD034, no-bare-urls)
1956-1956: Bare URL used
(MD034, no-bare-urls)
🔇 Additional comments (2)
zk-compression-docs/compressed-pdas/client-library/README.md (2)
148-151: Update Rust crate versions to match current releases.Lines 148–151 reference
light-clientandlight-sdkversion0.16.0. Verify these versions are published on crates.io and still current. If newer versions are available, update to the latest stable release to ensure users have access to the most recent features and security patches.
205-205: Update CLI version for consistency.Line 1883 and line 205 reference
@lightprotocol/zk-compression-cli@0.27.1-alpha.2. Verify this alpha version exists and is intentionally an alpha release. If a stable version is available, consider using the published release instead to avoid confusion or installation issues for users.
| | **Single Combined Proofs** | Any combination of | | ||
| | -------------------------- | :----------------: | | ||
| | Hashes | 1, 2, 3, 4, 8 | | ||
| | Addresses | 1, 2, 4, 8 | | ||
| {% endtab %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Fix Markdown table formatting — missing pipes and column count mismatches.
The tables at lines 627–631 and 640–645 lack leading/trailing pipes and have inconsistent column counts, which will render incorrectly. Each row must have matching pipe delimiters:
-| **Single Combined Proofs** | Any combination of |
-| -------------------------- | :----------------: |
-| Hashes | 1, 2, 3, 4, 8 |
-| Addresses | 1, 2, 4, 8 |
+| **Single Combined Proofs** | Any combination of |
+| :--------------------------: | :----------------: |
+| Hashes | 1, 2, 3, 4, 8 |
+| Addresses | 1, 2, 4, 8 |Repeat this fix for both V1 Circuits (lines 627–631) and V2 Circuits (lines 640–645) tables.
Also applies to: 640-645
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing leading pipe
(MD055, table-pipe-style)
631-631: Table pipe style
Expected: leading_and_trailing; Actual: no_leading_or_trailing; Missing trailing pipe
(MD055, table-pipe-style)
631-631: Table column count
Expected: 2; Actual: 1; Too few cells, row will be missing data
(MD056, table-column-count)
🤖 Prompt for AI Agents
In zk-compression-docs/compressed-pdas/client-library/README.md around lines
627–631 and 640–645 the Markdown tables are malformed: several rows are missing
leading/trailing pipe characters and column counts are inconsistent. Fix both V1
and V2 tables so every header and data row uses the same number of
pipe-delimited columns (e.g., add a leading and trailing pipe on each line and
ensure each row has the same number of cells as the header) so the tables render
correctly.
| #### Tree Accounts by Instructions Type | ||
|
|
||
| | Instruction | Address Tree | State Tree | Nullifier Queue | Output State Tree | | ||
| | ----------------------- | ------------------------ | -------------------- | --------------- | ----------------------- | | ||
| | Create | ✓ (proves non-existence) | - | - | ✓ (stores new hash) | | ||
| | Update / Close / Reinit | - | ✓ (proves existence) | ✓ (nullifies) | ✓ (stores updated hash) | | ||
| | Burn | - | ✓ (proves existence) | ✓ (nullifies) | - | | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Fix Rust section table formatting — ensure consistent columns and pipes.
The table at lines 1019–1025 (which repeats the Tree Accounts structure) has the same formatting issues as the earlier V1/V2 table. Ensure leading and trailing pipes, and consistent column counts across header, separator, and all data rows.
🤖 Prompt for AI Agents
zk-compression-docs/compressed-pdas/client-library/README.md around lines 1019
to 1026: the Markdown table for "Tree Accounts by Instructions Type" has
inconsistent column pipes and counts; fix it by making each row (header,
separator, and all data rows) use the same number of columns and include leading
and trailing pipe characters, update the separator row to have the correct
number of columns with dashes and pipes (e.g. | --- | --- | --- | --- | --- |),
and ensure each data row has five cells separated by pipes so the table renders
correctly.
…e formatting - Replace hardcoded public key with filesystem wallet loading from ~/.config/solana/id.json - Add proper balance parsing for hex string values - Fetch mint decimals to display formatted token amounts - Add error handling for mint info retrieval - Include step-by-step comments for educational clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
zk-compression-docs/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.md (1)
74-90: Inconsistent wallet loading pattern in "Get Transaction History" section.The section at lines 75-79 uses a hardcoded public key, while the "Display Compressed Token Balances" sections (lines 23-70 and 262-309) load the wallet from the filesystem. This creates an inconsistency in the guide and could confuse developers following these examples sequentially.
For consistency and practical usability, update this section to also load the wallet from filesystem and derive the public key, matching the pattern established in the other examples:
import { Rpc, createRpc } from '@lightprotocol/stateless.js'; import { PublicKey } from '@solana/web3.js'; +import * as fs from 'fs'; +import * as os from 'os'; const connection: Rpc = createRpc(); // defaults to localhost:8899 -const publicKey = new PublicKey('CLEuMG7pzJX9xAuKCFzBP154uiG1GaNo4Fq7x6KAcAfG'); + +// Load wallet from filesystem +const walletPath = `${os.homedir()}/.config/solana/id.json`; +const secretKey = JSON.parse(fs.readFileSync(walletPath, 'utf8')); +const payer = Keypair.fromSecretKey(Buffer.from(secretKey)); +const publicKey = payer.publicKey;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
zk-compression-docs/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.md(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
zk-compression-docs/**/*.md
⚙️ CodeRabbit configuration file
zk-compression-docs/**/*.md: Cross-verify documentation with source code using CLAUDE.md mappings.
Prioritize accuracy over assumptions - always check actual source files.
Files:
zk-compression-docs/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.md
🔇 Additional comments (1)
zk-compression-docs/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.md (1)
33-33: Verify RPC endpoint behavior:createRpc()without arguments.The examples call
createRpc()with no parameters and comment that it "defaults to localhost:8899". While this is documented, confirm that this default behavior is reliable for the documented use case (localnet).For mainnet/devnet deployments shown elsewhere in the guide (e.g., line 555), explicit RPC endpoints are correctly provided. Ensure developers understand this localhost default is only suitable for local testing, not production or public networks.
This is a minor but important clarification point for developers copying examples.
Also applies to: 272-272
| ```javascript | ||
| import { Rpc, createRpc } from '@lightprotocol/stateless.js'; | ||
| import { PublicKey } from '@solana/web3.js'; | ||
| import { Keypair, PublicKey } from '@solana/web3.js'; | ||
| import * as fs from 'fs'; | ||
| import * as os from 'os'; | ||
|
|
||
| const connection: Rpc = createRpc(); | ||
| const publicKey = new PublicKey('CLEuMG7pzJX9xAuKCFzBP154uiG1GaNo4Fq7x6KAcAfG'); | ||
| // 1. Setup RPC connection to local test validator | ||
| // 2. Call getCompressedTokenBalancesByOwnerV2() to fetch compressed token balances per mint | ||
| // 3. Display results with balance amounts and mint addresses | ||
|
|
||
| const connection: Rpc = createRpc(); // defaults to localhost:8899 | ||
|
|
||
| // Load wallet from filesystem | ||
| const walletPath = `${os.homedir()}/.config/solana/id.json`; | ||
| const secretKey = JSON.parse(fs.readFileSync(walletPath, 'utf8')); | ||
| const payer = Keypair.fromSecretKey(Buffer.from(secretKey)); | ||
| const publicKey = payer.publicKey; | ||
|
|
||
| (async () => { | ||
| // Fetch compressed token balances for wallet address | ||
| // Returns balance for owner per mint - can optionally apply filter: {mint, limit, cursor} | ||
| const balances = await connection.getCompressedTokenBalancesByOwnerV2(publicKey); | ||
| console.log(balances); | ||
|
|
||
| console.log(`\nMint Address ${publicKey.toString()}:\n`); | ||
|
|
||
| if (balances.value.items.length === 0) { | ||
| console.log("No compressed token balances found"); | ||
| } else { | ||
| for (const item of balances.value.items) { | ||
| const balanceValue = typeof item.balance === 'string' | ||
| ? parseInt(item.balance, 16) | ||
| : item.balance; | ||
|
|
||
| // Fetch mint info to get decimals | ||
| try { | ||
| const mintInfo = await connection.getAccountInfo(new PublicKey(item.mint)); | ||
| if (mintInfo && mintInfo.data) { | ||
| const decimals = mintInfo.data[44]; | ||
| console.log(`Compressed Token Balance: ${balanceValue / Math.pow(10, decimals)} tokens`); | ||
| } | ||
| } catch (e) { | ||
| console.log(`Could not fetch mint info: ${e}`); | ||
| } | ||
| } | ||
| } | ||
| })(); | ||
|
|
||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Code duplication: "Display Compressed Token Balances" section repeated.
Lines 23-70 and lines 262-309 contain identical code for displaying compressed token balances. While repetition can aid clarity in documentation, consider whether:
- The duplication is intentional (e.g., to show the snippet in "Code Snippets" tab and then again in the step-by-step guide)
- A single reference or link between sections would improve maintainability
If intentional for tabbed documentation, this is acceptable. If not, consolidate to a single source of truth.
Also applies to: 262-309
🤖 Prompt for AI Agents
In
zk-compression-docs/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.md
around lines 23-70 (and duplicated at 262-309), the "Display Compressed Token
Balances" code block is duplicated; consolidate by keeping a single canonical
snippet and replace the duplicate with a reference/link or include the snippet
via a single source (e.g., include file or anchor link), or if duplication is
intentional for tabbed docs, add a comment in one location indicating
intentional duplication; update whichever section you remove to point to the
canonical snippet so maintenance stays in one place.
| const balances = await connection.getCompressedTokenBalancesByOwnerV2(publicKey); | ||
| console.log(balances); | ||
|
|
||
| console.log(`\nMint Address ${publicKey.toString()}:\n`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Minor typo in console output.
Line 46 reads console.log(\\nMint Address ${publicKey.toString()}:\n`);` but the context is displaying "Compressed Token Balances", not the mint address itself. The label should be "Wallet Address" or "Owner Address" for clarity:
- console.log(`\nMint Address ${publicKey.toString()}:\n`);
+ console.log(`\nCompressed Token Balances for ${publicKey.toString()}:\n`);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| console.log(`\nMint Address ${publicKey.toString()}:\n`); | |
| console.log(`\nCompressed Token Balances for ${publicKey.toString()}:\n`); |
🤖 Prompt for AI Agents
In
zk-compression-docs/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.md
around line 46, the console output label incorrectly prints "Mint Address" while
the context is showing compressed token balances for a wallet; change the logged
label to "Wallet Address" or "Owner Address" (e.g., replace the string so it
reads "Wallet Address" or "Owner Address" before the publicKey) to accurately
reflect the value being displayed.
| // Fetch mint info to get decimals | ||
| try { | ||
| const mintInfo = await connection.getAccountInfo(new PublicKey(item.mint)); | ||
| if (mintInfo && mintInfo.data) { | ||
| const decimals = mintInfo.data[44]; | ||
| console.log(`Compressed Token Balance: ${balanceValue / Math.pow(10, decimals)} tokens`); | ||
| } | ||
| } catch (e) { | ||
| console.log(`Could not fetch mint info: ${e}`); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Error handling could be more granular for mint info fetching.
The catch block at lines 63-65 logs Could not fetch mint info: ${e} but continues silently. While this prevents transaction failure, it masks different failure modes:
- Network errors
- Invalid mint address format
- Account not found (mint was deleted)
Consider distinguishing error types or using more specific logging to help developers debug integration issues.
For improved error visibility, you might categorize errors:
catch (e) {
if (e.message?.includes('Account does not exist')) {
console.warn(`Mint account ${item.mint} not found (account may have been deleted)`);
} else if (e.message?.includes('Invalid public key')) {
console.warn(`Invalid mint address: ${item.mint}`);
} else {
console.error(`Failed to fetch mint info for ${item.mint}:`, e);
}
}🤖 Prompt for AI Agents
In
zk-compression-docs/compressed-tokens/advanced-guides/add-wallet-support-for-compressed-tokens.md
around lines 56 to 65, the generic catch for fetching mint info hides distinct
failure modes; change it to handle and log specific error cases (e.g.,
account-not-found, invalid public key, network errors) by inspecting the error
message or error type and emitting appropriate warnings or errors that include
the mint address, and ensure unexpected errors are logged with full error
objects so developers can diagnose issues.
Summary
Add comprehensive client library documentation for compressed PDAs with TypeScript and Rust examples.
Changes
Summary by CodeRabbit