Skip to content

Conversation

thephez
Copy link
Collaborator

@thephez thephez commented Jul 28, 2025

Issue being fixed or feature implemented

The WASM SDK documentation had several issues:

  1. Get Identity Keys Example 2 was nested inside Example 1 in the UI instead of being at the same level
  2. getDataContractHistory function had a serialization error preventing it from working
  3. Run buttons were showing results in wrong locations
  4. getDataContractHistory was marked as "Work in Progress" despite being functional after fixes
  5. getTokenPerpetualDistributionLastClaim was returning errors instead of actual claim data

What was done?

  • Fixed HTML Structure: Corrected container nesting in Get Identity Keys documentation so both examples display at the same level
  • Fixed Serialization: Changed BTreeMap<u64, serde_json::Value> to BTreeMap<String, serde_json::Value> in Rust code to resolve JSON serialization constraints
  • Updated Contract ID: Changed getDataContractHistory example to use specific contract ID "HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM"
  • Removed WIP Flag: Removed "Work in Progress" notification from getDataContractHistory after fixing the underlying issues
  • Fixed Token Last Claim Query: Resolved getTokenPerpetualDistributionLastClaim function that was returning "Token distribution type not found" errors:
    • Implemented direct gRPC calls with prove: false to bypass proof verification issues caused by missing token configuration in WasmContext
    • Fixed raw bytes decoding to properly parse 8-byte server response format (first 4 bytes: timestamp, last 4 bytes: block height)
    • Updated test parameters to use identity/token combination with actual completed claims
    • Function now returns actual claim data instead of errors or zero values
  • Regenerated Documentation: Updated all generated documentation files with correct examples and structure

How Has This Been Tested?

  • Verified getDataContractHistory example works without serialization errors
  • Confirmed Get Identity Keys examples display properly at the same level
  • Checked that Run buttons show results in correct locations
  • Validated documentation generation produces correct HTML structure
  • Tested with web interface at index.html to ensure functionality
  • Verified getTokenPerpetualDistributionLastClaim returns actual claim data (block height 160,500) instead of errors
  • Confirmed raw bytes decoding works correctly for server response format

Breaking Changes

None - these are bug fixes that restore intended functionality.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

Summary by CodeRabbit

  • Documentation

    • Improved WASM SDK documentation with clearer examples and updated parameter descriptions.
    • Added new usage examples for identity key queries and updated data contract and token claim examples.
    • Updated example IDs and placeholders for data contract history and token claim queries.
  • Bug Fixes

    • Corrected default values and parameter handling for identity key queries to ensure more predictable results.
  • Refactor

    • Streamlined token claim query logic for more direct and reliable results.
    • Standardized data contract history response format for consistency.
    • Enhanced internal SDK method accessibility for improved integration.
    • Improved handling of token configuration warnings in WASM context.

thephez and others added 4 commits July 28, 2025 11:47
Fixed HTML structure issue where Example 2 was nested inside Example 1
in the Get Identity Keys endpoint documentation. Both examples are now
properly displayed at the same level.

Changes:
- Updated generate_docs.py to close the first example container before
  starting the second one
- Regenerated docs.html with correct HTML structure
- Updated AI_REFERENCE.md and docs_manifest.json accordingly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed HTML container structure where the special handling for Get Identity Keys
was causing improper container closing, making all subsequent query sections
display as new columns instead of normal layout.

Changes:
- Added early return for getIdentityKeys special case to prevent double closing
- Both examples now have proper result div placement within their containers
- Subsequent query sections now display with correct layout

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ontract ID

Updated the getDataContractHistory example to use contract ID
HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM instead of the default
test contract. This provides a better example for testing contract
history functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…P flag

- Fix BTreeMap serialization issue by using String keys instead of u64
- Update example to use specific contract ID HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM
- Remove "Work in Progress" notification from getDataContractHistory
- Regenerate documentation with updated parameters

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

coderabbitai bot commented Jul 28, 2025

Walkthrough

This update modifies the WASM SDK documentation to clarify and expand example usage, particularly for identity and token operations. It also adjusts internal SDK code for token queries, updates request parameter handling, and changes serialization types for data contract history responses. No public API signatures are altered.

Changes

Cohort / File(s) Change Summary
Documentation Updates
packages/wasm-sdk/docs.html
Revised and expanded documentation examples, updated parameters and example code for identity and token operations, clarified UI elements, and added new example scenarios.
Example Code Generation & Doc Generation Logic
packages/wasm-sdk/generate_docs.py
Updated example code generation for specific queries, improved test data values, enhanced "getIdentityKeys" doc examples, and removed "Work in Progress" label for "getDataContractHistory".
Data Contract History Serialization
packages/wasm-sdk/src/queries/data_contract.rs
Changed versions field in DataContractHistoryResponse from BTreeMap<u64, ...> to BTreeMap<String, ...> and updated insertion logic accordingly.
Identity Keys Query Parameter Handling
packages/wasm-sdk/src/queries/identity.rs
Modified construction of GetIdentityKeysRequestV0 to set prove: false, default limit to 100 if not provided, and set offset: None.
Token Perpetual Distribution Last Claim Refactor
packages/wasm-sdk/src/queries/token.rs
Refactored to use direct gRPC calls for last claim queries, parsing protobuf responses and handling raw byte formats for claim data.
Context Provider Token Configuration
packages/wasm-sdk/src/context_provider.rs
Replaced unused parameter, added warning log and explanatory comment for unimplemented token configuration fetching in WASM context.
WasmSdk Internal Accessor
packages/wasm-sdk/src/sdk.rs
Added pub(crate) fn inner_sdk(&self) -> &Sdk method to expose internal SDK reference within the crate.
Input Placeholder Updates
packages/wasm-sdk/fixed_definitions.json, packages/wasm-sdk/update_inputs.py
Updated placeholder value for "Data Contract ID" in the "getDataContractHistory" query input field.
AI Reference Update
packages/wasm-sdk/AI_REFERENCE.md
Updated example Data Contract ID for the getDataContractHistory query parameters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WASM Docs UI
    participant WASM SDK

    User->>WASM Docs UI: Selects example and runs code
    WASM Docs UI->>WASM SDK: Calls query or state transition (e.g., identityCreate, getIdentityKeys)
    WASM SDK-->>WASM Docs UI: Returns result (uses updated parameters and example data)
    WASM Docs UI-->>User: Displays result in updated UI container
Loading
sequenceDiagram
    participant WASM SDK
    participant gRPC Client
    participant DAPI Server

    WASM SDK->>gRPC Client: Build and send GetTokenPerpetualDistributionLastClaimRequest (prove: false)
    gRPC Client->>DAPI Server: Send request
    DAPI Server-->>gRPC Client: Return protobuf response
    gRPC Client-->>WASM SDK: Deliver response
    WASM SDK->>WASM SDK: Parse response, extract claim info or handle raw bytes
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 In docs and code the carrots grow,

Examples bloom and parameters flow.
Keys and tokens, fresh and bright,
Queries dance in clearer light.
From seed phrase sown to claim's delight,
Hop through changes, swift and right! 🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a1f863 and 243e31e.

📒 Files selected for processing (1)
  • packages/wasm-sdk/docs.html (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/wasm-sdk/docs.html
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-wasm-sdk-examples

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thephez thephez changed the title fix(wasm-sdk): fix documentation examples and getDataContractHistory issues fix(sdk): fix documentation examples and getDataContractHistory issues Jul 28, 2025
thephez and others added 4 commits July 28, 2025 14:42
…onality

Add Example 3 - Search Keys by Purpose to getIdentityKeys documentation,
demonstrating how to use the search key request type with purpose mapping
for authentication and encryption keys.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Returns no results but doesn't error
…roofs to get example working

Claude identified an issue in the rs-drive-proof-verifier preventing the SDK from properly handling the proof
@thephez
Copy link
Collaborator Author

thephez commented Jul 28, 2025

@coderabbitai reveiw

Copy link
Contributor

coderabbitai bot commented Jul 28, 2025

Tip

For best results, initiate chat on the files or code changes.

@thephez I'll review the changes in this PR that fixes the WASM SDK documentation examples and getDataContractHistory issues.

[review]


🧠 Learnings used
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.459Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.272Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/generate_docs.py : Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'

@thephez thephez changed the title fix(sdk): fix documentation examples and getDataContractHistory issues fix(sdk): fix documentation examples Jul 28, 2025
thephez and others added 2 commits July 29, 2025 08:24
…ecoding

- Implement direct gRPC calls with prove: false to bypass proof verification issues
- Fix raw bytes decoding to properly parse 8-byte server response format:
  - First 4 bytes: timestamp (u32, in seconds)
  - Last 4 bytes: block height (u32)
- Update test parameters to use identity/token with actual completed claims
- Function now returns actual claim data instead of errors or zero values

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@thephez thephez marked this pull request as ready for review July 29, 2025 13:42
@thephez thephez requested a review from QuantumExplorer as a code owner July 29, 2025 13:42
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: 2

🧹 Nitpick comments (3)
packages/wasm-sdk/src/sdk.rs (1)

58-62: Helper method duplicates existing AsRef/Deref functionality

inner_sdk() returns the same &Sdk reference already obtainable through
wasm_sdk.as_ref() (via the AsRef<Sdk> impl) or *wasm_sdk (via Deref).
Unless there is a caller that cannot rely on those trait APIs, this method adds
surface area without new capability and may confuse future maintainers.

packages/wasm-sdk/docs.html (2)

1377-1378: Update the parameter hint to match the new contract ID

The example now uses contract HLY575c…, but the “Example” note under the Parameters table (lines 1357-1361) still shows GWRSAVF….
Synchronise those two values to avoid copy-paste confusion.


2034-2035: 🚧 Work in Progress marker is no longer accurate

get_token_perpetual_distribution_last_claim was fixed in the Rust code and now returns data.
Consider dropping the WIP badge or adding a short note explaining any remaining limitation (e.g. “proof verification disabled”).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4a4ff99 and 673e92b.

📒 Files selected for processing (7)
  • packages/wasm-sdk/docs.html (5 hunks)
  • packages/wasm-sdk/generate_docs.py (3 hunks)
  • packages/wasm-sdk/src/context_provider.rs (1 hunks)
  • packages/wasm-sdk/src/queries/data_contract.rs (3 hunks)
  • packages/wasm-sdk/src/queries/identity.rs (2 hunks)
  • packages/wasm-sdk/src/queries/token.rs (1 hunks)
  • packages/wasm-sdk/src/sdk.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
packages/wasm-sdk/src/**/*.rs

📄 CodeRabbit Inference Engine (packages/wasm-sdk/CLAUDE.md)

packages/wasm-sdk/src/**/*.rs: When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.
For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().
Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.
The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Files:

  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/sdk.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/context_provider.rs
  • packages/wasm-sdk/src/queries/token.rs
packages/wasm-sdk/generate_docs.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'

Files:

  • packages/wasm-sdk/generate_docs.py
packages/wasm-sdk/**/generate_docs.py

📄 CodeRabbit Inference Engine (packages/wasm-sdk/CLAUDE.md)

When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Files:

  • packages/wasm-sdk/generate_docs.py
🧠 Learnings (8)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.
packages/wasm-sdk/src/queries/data_contract.rs (16)

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().

Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions structure within packages/rs-platform-version/src/version/v2.rs, the field credit_withdrawal does not need the identity_ prefix since it is already encompassed within identity state transitions.

Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions structure within packages/rs-platform-version/src/version/v2.rs, the field credit_withdrawal does not need the identity_ prefix since it is already encompassed within identity state transitions.

Learnt from: pauldelucia
PR: #2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts (ensuring it's between 3 and 100 characters) is already handled at the data contract validation level in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs, making additional checks in the update operations redundant.

Learnt from: QuantumExplorer
PR: #2644
File: packages/rs-drive/src/cache/system_contracts.rs:18-19
Timestamp: 2025-05-28T16:22:26.334Z
Learning: In packages/rs-drive/src/cache/system_contracts.rs, the active_since_protocol_version field in ActiveSystemDataContract struct is intentionally added for future use, not current implementation. QuantumExplorer confirmed this is "meant for later" when questioned about the #[allow(unused)] attribute.

Learnt from: pauldelucia
PR: #2523
File: packages/rs-drive/src/drive/contract/update/update_contract/v1/update_description/v1/mod.rs:147-151
Timestamp: 2025-04-11T09:08:05.652Z
Learning: Description length validation for data contracts is already handled in the data contract validation process, specifically in packages/rs-dpp/src/data_contract/methods/validate_update/v0/mod.rs.

Learnt from: QuantumExplorer
PR: #2227
File: packages/rs-drive-abci/src/platform_types/platform_state/mod.rs:141-141
Timestamp: 2024-10-08T13:28:03.529Z
Learning: When converting PlatformStateV0 to PlatformStateForSavingV1 in packages/rs-drive-abci/src/platform_types/platform_state/mod.rs, only version 0 needs to be handled in the match on platform_state_for_saving_structure_default because the changes are retroactive.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Learnt from: lklimek
PR: #2277
File: packages/dapi-grpc/src/mock.rs:125-145
Timestamp: 2024-10-29T14:16:00.141Z
Learning: Using serde_json encoding produces deterministic output required to identify requests and responses by hash, therefore serde_json is used as the basic serialization algorithm for mocking.

Learnt from: lklimek
PR: #2139
File: packages/rs-drive-proof-verifier/src/types.rs:0-0
Timestamp: 2024-09-27T08:25:11.059Z
Learning: Build failures are intended when new versions are added to the Version enum in TryFrom implementations, so that developers are forced to handle them explicitly. Therefore, it's acceptable not to include a wildcard arm for Some(_) when matching on response.version.

Learnt from: lklimek
PR: #2139
File: packages/rs-drive-proof-verifier/src/types.rs:0-0
Timestamp: 2024-10-09T00:22:57.778Z
Learning: Build failures are intended when new versions are added to the Version enum in TryFrom implementations, so that developers are forced to handle them explicitly. Therefore, it's acceptable not to include a wildcard arm for Some(_) when matching on response.version.

Learnt from: shumkov
PR: #2345
File: packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:93-99
Timestamp: 2024-11-22T08:19:14.448Z
Learning: In packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs, the insert_contract method requires an owned BlockInfo, so cloning block_info is necessary when calling it.

Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists_return_existing_element/mod.rs:46-50
Timestamp: 2024-09-28T20:43:05.154Z
Learning: In this codebase, match statements for versions are intentionally designed to handle known versions and treat unknown versions as mismatches.

Learnt from: QuantumExplorer
PR: #2182
File: packages/rs-drive/src/util/grove_operations/batch_insert_if_not_exists_return_existing_element/mod.rs:46-50
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In this codebase, match statements for versions are intentionally designed to handle known versions and treat unknown versions as mismatches.

packages/wasm-sdk/src/sdk.rs (10)

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:90-95
Timestamp: 2024-10-10T10:30:19.883Z
Learning: In packages/rs-sdk/src/mock/sdk.rs, the load_expectations method in MockDashPlatformSdk remains asynchronous (async) for backward compatibility, even though it now delegates to the synchronous load_expectations_sync method.

Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs and packages/rs-sdk/src/core/transaction.rs, certain places don't implement IntoInner, so direct error mappings cannot be simplified using IntoInner. A TODO comment has been added to address this in a future PR.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: lklimek
PR: #2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the abs_diff() method.

Learnt from: lklimek
PR: #2232
File: packages/rs-sdk/src/mock/sdk.rs:129-130
Timestamp: 2024-10-10T10:30:25.283Z
Learning: In the codebase packages/rs-sdk/src/mock/sdk.rs, tokio::sync::Mutex is used instead of std::sync::Mutex because std::sync::MutexGuard is not Send and cannot be used in async contexts.

packages/wasm-sdk/src/queries/identity.rs (11)

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: QuantumExplorer
PR: #2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-06T16:11:34.946Z
Learning: In the Rust file packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs, within the create_owner_identity_v1 function, the add_public_keys method of the Identity struct cannot fail and does not require explicit error handling.

Learnt from: QuantumExplorer
PR: #2215
File: packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs:19-30
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust file packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_masternode_identities/create_owner_identity/v1/mod.rs, within the create_owner_identity_v1 function, the add_public_keys method of the Identity struct cannot fail and does not require explicit error handling.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.

Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions structure within packages/rs-platform-version/src/version/v2.rs, the field credit_withdrawal does not need the identity_ prefix since it is already encompassed within identity state transitions.

Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions structure within packages/rs-platform-version/src/version/v2.rs, the field credit_withdrawal does not need the identity_ prefix since it is already encompassed within identity state transitions.

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs, the execute() method consumes the request object, so cloning the request is necessary before passing it to execute() and maybe_from_unproved_with_metadata.

packages/wasm-sdk/docs.html (10)

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/generate_docs.py : Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

packages/wasm-sdk/src/context_provider.rs (10)

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: lklimek
PR: #2380
File: packages/rs-drive-proof-verifier/src/error.rs:122-125
Timestamp: 2024-12-06T14:15:49.367Z
Learning: All error variants in ContextProviderError within packages/rs-drive-proof-verifier/src/error.rs are designed to take String as their parameter.

Learnt from: lklimek
PR: #2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.

Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the IdentityTransitionVersions structure within packages/rs-platform-version/src/version/v2.rs, the field credit_withdrawal does not need the identity_ prefix since it is already encompassed within identity state transitions.

Learnt from: shumkov
PR: #2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the IdentityTransitionVersions structure within packages/rs-platform-version/src/version/v2.rs, the field credit_withdrawal does not need the identity_ prefix since it is already encompassed within identity state transitions.

Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/tests/fetch/config.rs:233-233
Timestamp: 2024-10-30T11:19:59.163Z
Learning: In the Rust SDK's rs-sdk/tests integration tests (e.g., in packages/rs-sdk/tests/fetch/config.rs), we cannot create objects during tests because there is no support for object creation in this context. Therefore, hardcoded values for test identities must be used.

Learnt from: shumkov
PR: #2449
File: packages/dapi/lib/externalApis/drive/fetchProofForStateTransitionFactory.js:110-112
Timestamp: 2025-02-21T13:43:33.462Z
Learning: The getRecipientId() method has different signatures for mint and transfer token transitions - mint requires tokenConfiguration parameter while transfer does not, due to their different logic and states.

packages/wasm-sdk/src/queries/token.rs (10)

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/platform/fetch_unproved.rs:0-0
Timestamp: 2024-10-30T11:04:33.634Z
Learning: In packages/rs-sdk/src/platform/fetch_unproved.rs, the execute() method consumes the request object, so cloning the request is necessary before passing it to execute() and maybe_from_unproved_with_metadata.

Learnt from: QuantumExplorer
PR: #2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In run_block_proposal in packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs, when retrieving last_block_time_ms, it's acceptable to use platform_state instead of block_platform_state, even after updating the protocol version.

Learnt from: QuantumExplorer
PR: #2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In run_block_proposal in packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs, when retrieving last_block_time_ms, it's acceptable to use platform_state instead of block_platform_state, even after updating the protocol version.

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/index.html:4360-4416
Timestamp: 2025-07-28T20:04:48.458Z
Learning: In packages/wasm-sdk, the wallet helper derive_key_from_seed_with_path (Rust function in src/wallet/key_derivation.rs) is synchronous; its JS wrapper returns a value immediately, so await is unnecessary.

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: lklimek
PR: #2277
File: packages/rs-sdk/src/core/transaction.rs:0-0
Timestamp: 2024-10-29T14:40:54.727Z
Learning: In packages/rs-sdk/src/platform/document_query.rs and packages/rs-sdk/src/core/transaction.rs, certain places don't implement IntoInner, so direct error mappings cannot be simplified using IntoInner. A TODO comment has been added to address this in a future PR.

packages/wasm-sdk/generate_docs.py (10)

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/generate_docs.py : Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

🪛 Gitleaks (8.27.2)
packages/wasm-sdk/generate_docs.py

156-156: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: Rust crates security audit
🔇 Additional comments (13)
packages/wasm-sdk/src/queries/data_contract.rs (2)

60-63: Key type switched to String; be mindful of ordering & downstream expectations

Moving from BTreeMap<u64, _> to BTreeMap<String, _> fixes the JSON-
serialization issue (non-string keys are invalid).
Note, however, that the resulting map will now sort lexicographically
("10" < "2"), which differs from numeric ordering.
If any consumer relies on revision order, consider:

  1. Returning a Vec<(u64, Value)> instead, or
  2. Retaining a numeric map internally and converting to a serde_json::Map
    right before serialization.

95-99: Consistent conversion pattern – looks good

Using revision.to_string() at insertion points aligns with the new schema and
keeps the code self-contained. No further issues spotted.

Also applies to: 184-187

packages/wasm-sdk/src/queries/identity.rs (2)

160-162: LGTM! Systematic improvements to query reliability.

The changes consistently disable proof verification and enforce proper parameter handling:

  • Setting prove: false avoids proof verification issues in WASM context
  • Enforcing a default limit of 100 ensures queries have reasonable bounds
  • Explicitly setting offset: None with clear documentation about lack of support when prove=false

These changes align with the PR objectives to fix WASM SDK issues and improve reliability.


257-259: LGTM! Consistent parameter handling across request types.

These changes mirror the improvements made to the "specific" request type, ensuring consistent behavior across all key request methods. The systematic approach to disabling proof verification and enforcing parameter constraints improves the overall reliability of the identity key queries.

packages/wasm-sdk/src/context_provider.rs (1)

48-62: Excellent improvement in transparency and user guidance.

The enhanced implementation addresses several important aspects:

  1. Parameter usage: Now properly utilizes the token_id parameter instead of ignoring it
  2. Clear documentation: Comprehensive comments explain the current limitations and future enhancement needs
  3. User guidance: The warning log appropriately informs users about proof verification implications and suggests using trusted context builders
  4. Maintainability: The TODO comment clearly marks future work needed

This change significantly improves the developer experience by providing clear feedback about why token configuration is unavailable and how to work around it.

packages/wasm-sdk/generate_docs.py (5)

147-148: LGTM! Improved test data specificity.

The parameter mapping updates provide more precise test values for specific queries, which aligns with the PR objectives of fixing examples and using concrete IDs for better documentation.


156-156: LGTM! Static analysis false positive addressed.

The updated token ID parameter mapping is correct for the getTokenPerpetualDistributionLastClaim example. The static analysis hint about a "Generic API Key" is a false positive - this is a public token identifier used for documentation examples, not a sensitive credential.


209-212: LGTM! Consistent example generation for getDataContractHistory.

The special case handling ensures that getDataContractHistory always uses the specific contract ID mentioned in the PR objectives, providing consistent and working examples. The parameter structure (id, limit, offset) is appropriate for this query.


406-406: LGTM! Correctly updated Work in Progress status.

Removing getDataContractHistory from the Work in Progress list aligns with the PR objectives. The function has been fixed and should no longer display the WIP warning to users.


411-429: LGTM! Fixed HTML structure for identity keys examples.

This change addresses the HTML structure issue mentioned in the PR objectives by creating properly separated example containers for "Get Identity Keys Example 2" and "Example 3". Each example now has its own code block, run button, and result div with unique IDs, preventing the nesting issue that existed before.

The example code demonstrates appropriate usage of the get_identity_keys function with different parameter combinations (specific key IDs and purpose-based search).

packages/wasm-sdk/src/queries/token.rs (1)

544-568: Successfully addresses proof verification issues

The refactoring to use direct gRPC calls with prove: false effectively resolves the token configuration and proof verification errors mentioned in the PR objectives. This approach bypasses the context provider dependency while still retrieving the claim data.

packages/wasm-sdk/docs.html (2)

1038-1047: No functional issues – restructure looks good

Splitting Example 1 from Example 2/3 removes the accidental nesting and the IDs are still unique (getIdentityKeys, getIdentityKeys2, getIdentityKeys3).
Everything will render correctly and runExample() will continue to find the right code blocks.


1049-1053: get_identity_keys intentionally takes a JSON string for purpose_map

The JS binding for get_identity_keys is defined as

pub async fn get_identity_keys(,
    search_purpose_map: Option<String>, // JSON string)

so the example’s use of a literal JSON string is correct and required by the current wasm-bindgen signature. You can ignore the suggestion to pass a JS object here.

Likely an incorrect or invalid review comment.

thephez and others added 2 commits July 29, 2025 11:03
…w bytes parsing

- Document exact 8-byte format specification for PaidAt::RawBytes parsing
- Add validation ranges for timestamp (>= Jan 1, 2021) and block height (>= 1)
- Include defensive programming with console warnings for invalid values
- Implement graceful fallbacks to safe defaults instead of silent failures
- Maintain backward compatibility while improving robustness

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove WIP note and sync contract id in getDataContractHistory example
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: 0

🧹 Nitpick comments (1)
packages/wasm-sdk/generate_docs.py (1)

148-149: Parameter mapping updates are correct but consider refactoring.

The conditional logic properly handles the specific requirements for getDataContractHistory and getTokenPerpetualDistributionLastClaim functions as outlined in the PR objectives.

Consider extracting these function-specific mappings into a separate dictionary to improve readability:

function_specific_mappings = {
    'getDataContractHistory': {
        'id': f"'{test_data['data_contract_history_id']}'"
    },
    'getTokenPerpetualDistributionLastClaim': {
        'identityId': "'5RG84o6KsTaZudDqS8ytbaRB8QP4YYQ2uwzb6Hj8cfjX'"
    }
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b32cd43 and 71db515.

📒 Files selected for processing (4)
  • packages/wasm-sdk/docs.html (6 hunks)
  • packages/wasm-sdk/fixed_definitions.json (1 hunks)
  • packages/wasm-sdk/generate_docs.py (4 hunks)
  • packages/wasm-sdk/update_inputs.py (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/wasm-sdk/fixed_definitions.json
  • packages/wasm-sdk/update_inputs.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/wasm-sdk/docs.html
🧰 Additional context used
📓 Path-based instructions (2)
packages/wasm-sdk/generate_docs.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'

Files:

  • packages/wasm-sdk/generate_docs.py
packages/wasm-sdk/**/generate_docs.py

📄 CodeRabbit Inference Engine (packages/wasm-sdk/CLAUDE.md)

When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Files:

  • packages/wasm-sdk/generate_docs.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.
Learnt from: QuantumExplorer
PR: dashpay/platform#2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.
Learnt from: QuantumExplorer
PR: dashpay/platform#2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.
Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'
Learnt from: QuantumExplorer
PR: dashpay/platform#2439
File: packages/rs-dpp/src/errors/consensus/state/token/mod.rs:4-22
Timestamp: 2025-01-23T02:10:08.979Z
Learning: The user QuantumExplorer prefers to handle documentation of breaking changes separately from the code changes, particularly for token-related error types and validation rules.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : For WASM builds, fix 'time not implemented on this platform' errors by using js_sys::Date::now().
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : Token functions are methods on WasmSdk, not standalone functions; avoid importing them as standalone.
Learnt from: lklimek
PR: dashpay/platform#2405
File: packages/wasm-sdk/src/verify.rs:26-68
Timestamp: 2025-02-10T11:26:36.709Z
Learning: In the wasm-sdk package, empty vectors and placeholder values are intentionally used in verification functions during the proof-of-concept stage to ensure proper compilation and type checking.
Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.
packages/wasm-sdk/generate_docs.py (10)

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/AI_REFERENCE.md:771-783
Timestamp: 2025-07-28T20:00:08.502Z
Learning: In packages/wasm-sdk/AI_REFERENCE.md, the documentation correctly shows the actual SDK method signatures (including identityCreate and identityTopUp with their full parameter lists), which may differ from the UI inputs shown in fixed_definitions.json. The UI may collect fewer parameters from users while handling additional requirements internally.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/generate_docs.py : When adding new queries or state transitions, run python3 generate_docs.py to regenerate documentation.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : When adding new queries or state transitions, update the definitions in index.html.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/**/index.html : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: QuantumExplorer
PR: #2711
File: packages/wasm-sdk/docs.html:2359-2383
Timestamp: 2025-07-28T20:00:24.323Z
Learning: In packages/wasm-sdk/docs.html, QuantumExplorer confirmed that placeholder private keys in documentation examples are acceptable as they are not real keys, though field name accuracy for the SDK API should still be maintained.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/generate_docs.py : Keep documentation for the WASM SDK in sync by running 'python3 generate_docs.py' in 'packages/wasm-sdk'

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : When implementing WASM SDK functionality, always refer to AI_REFERENCE.md first for accurate method signatures and examples.

Learnt from: CR
PR: dashpay/platform#0
File: packages/wasm-sdk/CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:42.268Z
Learning: Applies to packages/wasm-sdk/src/**/*.rs : The WASM SDK now fully supports where and orderBy clauses for document queries; use the specified JSON array formats and supported operators.

Learnt from: CR
PR: dashpay/platform#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-23T08:31:05.082Z
Learning: Applies to packages/wasm-sdk/index.html : Test the WASM SDK using the web interface at 'index.html' in 'packages/wasm-sdk'

Learnt from: QuantumExplorer
PR: #2673
File: packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/mod.rs:1164-1197
Timestamp: 2025-06-18T03:44:14.385Z
Learning: QuantumExplorer determined that a CodeRabbit suggestion about fixing signable_bytes calculation in identity update tests with contract-bound keys was incorrect - the code flow is working as intended without the suggested changes.

🪛 Gitleaks (8.27.2)
packages/wasm-sdk/generate_docs.py

157-157: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (5)
packages/wasm-sdk/generate_docs.py (5)

133-133: LGTM: Test data update aligns with PR objectives.

The update to use the specific contract ID 'HLY575cNazmc5824FxqaEMEBuzFeE4a98GDRNKbyJqCM' for getDataContractHistory examples is consistent with the PR's goal of fixing this function's documentation.


157-157: LGTM: Token ID update for test examples.

The updated tokenId mapping correctly handles the getTokenPerpetualDistributionLastClaim function with appropriate test data. The static analysis warning about a "Generic API Key" is a false positive - this is a legitimate token ID used for documentation examples, not a real API key.


210-213: LGTM: Special case handling for getDataContractHistory.

The hardcoded parameters ensure the getDataContractHistory examples work correctly with the specific contract ID and reasonable defaults (limit=10, offset=0). This directly addresses the serialization issues mentioned in the PR objectives.


407-407: LGTM: Removed getDataContractHistory from Work in Progress list.

Correctly removes the WIP label from getDataContractHistory after fixing its issues, as documented in the PR objectives.


412-430: LGTM: Enhanced getIdentityKeys examples improve documentation.

The addition of multiple example containers for getIdentityKeys effectively demonstrates different usage patterns:

  • Example 2 shows getting specific keys by index
  • Example 3 shows searching keys by purpose with JSON filters

The HTML structure is well-formed and addresses the structural issues mentioned in the PR objectives. The examples provide valuable guidance for users working with identity keys.

@thephez thephez force-pushed the fix-wasm-sdk-examples branch 2 times, most recently from 0d8cc7a to 8d02f7d Compare July 29, 2025 16:55
@thephez thephez force-pushed the fix-wasm-sdk-examples branch from 8d02f7d to 243e31e Compare July 29, 2025 16:56
@QuantumExplorer QuantumExplorer merged commit 1e5107b into v2.1-dev Jul 29, 2025
22 checks passed
@QuantumExplorer QuantumExplorer deleted the fix-wasm-sdk-examples branch July 29, 2025 18:41
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.

2 participants