Skip to content

Conversation

@shumkov
Copy link
Collaborator

@shumkov shumkov commented Nov 1, 2025

Issue being fixed or feature implemented

Some query functions have mix of required and optional arguments. Sometimes too many arguments.

What was done?

  • Use param objects (TypeScript idiomatic way) for functions with many arguments
  • Use fetch_many to fetch specific keys.

How Has This Been Tested?

Updated existing tests.

Breaking Changes

Arguments of query functions are changed.

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • APIs now accept flexible identifier formats (Identifier/bytes/string) and unified query objects across documents, epochs, groups, tokens, identities, data-contract history, voting, and state transitions.
  • Refactor

    • Many methods migrated from positional arguments to single options/query objects for clearer named parameters and unified input handling.
  • Bug Fixes

    • More consistent identifier parsing/normalization and improved invalid-ID error messages.
  • Tests

    • Unit and functional tests updated to match new object-based call shapes.
  • Documentation

    • Examples adjusted to demonstrate object-style calls and flexible identifier inputs.

@shumkov shumkov changed the title refactor(sdk): use param objects instead of arguments refactor(sdk): typed wasm-sdk params Nov 2, 2025
Base automatically changed from feat/sdk/entities to v2.2-dev November 3, 2025 08:42
# Conflicts:
#	packages/js-evo-sdk/src/group/facade.ts
#	packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs
#	packages/wasm-dpp2/src/data_contract/contract_bounds.rs
#	packages/wasm-dpp2/src/data_contract/document/methods.rs
#	packages/wasm-dpp2/src/data_contract/model.rs
#	packages/wasm-dpp2/src/identifier.rs
#	packages/wasm-dpp2/src/identity/model.rs
#	packages/wasm-dpp2/src/identity/partial_identity.rs
#	packages/wasm-dpp2/src/identity/transitions/credit_withdrawal_transition.rs
#	packages/wasm-dpp2/src/identity/transitions/identity_credit_transfer_transition.rs
#	packages/wasm-dpp2/src/identity/transitions/masternode_vote_transition.rs
#	packages/wasm-dpp2/src/identity/transitions/top_up_transition.rs
#	packages/wasm-dpp2/src/identity/transitions/update_transition.rs
#	packages/wasm-dpp2/src/state_transitions/base/group_state_transition_info.rs
#	packages/wasm-dpp2/src/state_transitions/base/state_transition.rs
#	packages/wasm-dpp2/src/state_transitions/batch/batch_transition.rs
#	packages/wasm-dpp2/src/state_transitions/batch/batched_transition.rs
#	packages/wasm-dpp2/src/state_transitions/batch/document_base_transition.rs
#	packages/wasm-dpp2/src/state_transitions/batch/document_transition.rs
#	packages/wasm-dpp2/src/state_transitions/batch/document_transitions/transfer.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_base_transition.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_payment_info.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_transition.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_transitions/token_destroy_frozen_funds.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_transitions/token_freeze.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_transitions/token_mint.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_transitions/token_transfer.rs
#	packages/wasm-dpp2/src/state_transitions/batch/token_transitions/token_unfreeze.rs
#	packages/wasm-dpp2/src/tokens/configuration/action_taker.rs
#	packages/wasm-dpp2/src/tokens/configuration/authorized_action_takers.rs
#	packages/wasm-dpp2/src/tokens/configuration/change_control_rules.rs
#	packages/wasm-dpp2/src/tokens/configuration/distribution_recipient.rs
#	packages/wasm-dpp2/src/tokens/configuration/distribution_rules.rs
#	packages/wasm-dpp2/src/tokens/configuration/group.rs
#	packages/wasm-dpp2/src/tokens/configuration/pre_programmed_distribution.rs
#	packages/wasm-dpp2/src/tokens/configuration/token_configuration.rs
#	packages/wasm-dpp2/src/tokens/configuration_change_item/items/new_tokens_destination_identity.rs
#	packages/wasm-dpp2/src/utils.rs
#	packages/wasm-dpp2/src/voting/contender.rs
#	packages/wasm-dpp2/src/voting/resource_vote_choice.rs
#	packages/wasm-dpp2/src/voting/vote_poll.rs
#	packages/wasm-sdk/src/dpns.rs
#	packages/wasm-sdk/src/queries/data_contract.rs
#	packages/wasm-sdk/src/queries/document.rs
#	packages/wasm-sdk/src/queries/epoch.rs
#	packages/wasm-sdk/src/queries/group.rs
#	packages/wasm-sdk/src/queries/identity.rs
#	packages/wasm-sdk/src/queries/system.rs
#	packages/wasm-sdk/src/queries/utils.rs
#	packages/wasm-sdk/src/queries/voting/resources.rs
#	packages/wasm-sdk/src/queries/voting/state.rs
#	packages/wasm-sdk/src/queries/voting/voters.rs
#	packages/wasm-sdk/src/queries/voting/votes.rs
#	packages/wasm-sdk/tests/functional/dpns.spec.mjs
#	packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
packages/wasm-sdk/src/queries/document.rs (1)

309-324: Handle Identifier parsing beyond 44-character strings

On Line 312 we now only attempt to parse identifiers when the string length is exactly 44. Base58-encoded 32-byte identifiers have variable length (any value with leading zero bytes produces fewer than 44 characters, e.g. Identifier::from_bytes([0; 32])'11111111111111111111111111111111' with 32 chars). When such an ID appears in a where clause, this branch returns Value::Text, so equality filters on identifier fields silently stop matching. That breaks legitimate queries for any contract or document whose identifier happens to encode to fewer characters. Please attempt the Base58 parse for any string (and fall back to text on error) instead of gating it on length.

Apply this diff to fix the regression:

-            if s.len() == 44 && s.chars().all(|c| c.is_alphanumeric()) {
-                // Try to parse as identifier
-                match Identifier::from_string(
-                    s,
-                    dash_sdk::dpp::platform_value::string_encoding::Encoding::Base58,
-                ) {
-                    Ok(id) => Ok(platform_value!(id)),
-                    Err(_) => Ok(Value::Text(s.clone())),
-                }
-            } else {
-                Ok(Value::Text(s.clone()))
-            }
+            if let Ok(id) = Identifier::from_string(
+                s,
+                dash_sdk::dpp::platform_value::string_encoding::Encoding::Base58,
+            ) {
+                Ok(platform_value!(id))
+            } else {
+                Ok(Value::Text(s.clone()))
+            }
packages/wasm-sdk/src/state_transitions/documents/mod.rs (1)

608-626: Guard document revision increment against overflow

On Line 618 we compute revision + 1 directly. If a caller (maliciously or accidentally) submits revision === u64::MAX, this will overflow: debug builds panic and release builds wrap to zero, producing an invalid transition. Please use checked_add and surface a validation error instead.

Apply this diff to prevent the overflow:

-        let document = Document::V0(DocumentV0 {
+        let next_revision = revision
+            .checked_add(1)
+            .ok_or_else(|| WasmSdkError::invalid_argument("Document revision overflow"))?;
+
+        let document = Document::V0(DocumentV0 {
             id: doc_id,
             owner_id: owner_identifier,
             properties: document_data_platform_value
                 .into_btree_string_map()
                 .map_err(|e| {
                     WasmSdkError::serialization(format!("Failed to convert document data: {}", e))
                 })?,
-            revision: Some(revision + 1),
+            revision: Some(next_revision),
             created_at: None,
             updated_at: None,
             transferred_at: None,
packages/wasm-sdk/src/queries/identity.rs (2)

538-558: Ensure search requests fetch offset + limit

For the search pathway we always send limit: Some(limit.unwrap_or(100)) and offset: None, then locally skip offset items. With offset = 50, limit = 50 Drive returns at most 50 records, we drop the first 50 locally, and the caller receives nothing. Dropping the caller’s offset and hard-coding a 100-row cap also regresses previous behaviour. Please request at least offset + limit rows (and remove the implicit 100 cap) so the local slicing produces the expected window.

-                let request = GetIdentityKeysRequest {
-                    version: Some(Version::V0(GetIdentityKeysRequestV0 {
-                        identity_id: identity_id.to_vec(),
-                        prove: false,
-                        limit: Some(limit.unwrap_or(100)),
-                        offset: None,
+                let request_limit = limit.map(|lim| lim.saturating_add(offset.unwrap_or(0)));
+                let request = GetIdentityKeysRequest {
+                    version: Some(Version::V0(GetIdentityKeysRequestV0 {
+                        identity_id: identity_id.to_vec(),
+                        prove: false,
+                        limit: request_limit,
+                        offset: None,

1095-1124: Return actual metadata/proof for specific-key proof queries

Here we drop the metadata/proof coming back from DAPI and synthesize zeroed proto structs instead. That makes getIdentityKeysWithProofInfo unusable for verification because callers receive empty proofs. Please forward the response’s metadata/proof instead of fabricating placeholders.

-                match response.version {
-                    Some(ResponseVersion::V0(response_v0)) => {
+                match response.version {
+                    Some(ResponseVersion::V0(mut response_v0)) => {
                         if let Some(result) = response_v0.result {
                             match result {
                                 dash_sdk::platform::proto::get_identity_keys_response::get_identity_keys_response_v0::Result::Keys(keys_response) => {
                                     let mut key_map = IndexMap::new();
                                     for key_bytes in keys_response.keys_bytes {
                                         use dash_sdk::dpp::serialization::PlatformDeserializable;
                                         let key = dash_sdk::dpp::identity::identity_public_key::IdentityPublicKey::deserialize_from_bytes(key_bytes.as_slice())
                                             .map_err(|e| WasmSdkError::serialization(format!("Failed to deserialize identity public key: {}", e)))?;
                                         key_map.insert(key.id(), Some(key));
                                     }
-                                    let metadata = dash_sdk::platform::proto::ResponseMetadata {
-                                        height: 0,
-                                        core_chain_locked_height: 0,
-                                        epoch: 0,
-                                        time_ms: 0,
-                                        protocol_version: 0,
-                                        chain_id: "".to_string(),
-                                    };
-                                    let proof = dash_sdk::platform::proto::Proof {
-                                        grovedb_proof: vec![],
-                                        quorum_hash: vec![],
-                                        signature: vec![],
-                                        round: 0,
-                                        block_id_hash: vec![],
-                                        quorum_type: 0,
-                                    };
-                                    (key_map, metadata, proof)
+                                    let metadata = response_v0
+                                        .metadata
+                                        .take()
+                                        .ok_or_else(|| WasmSdkError::generic("Missing metadata in response"))?;
+                                    let proof = response_v0
+                                        .proof
+                                        .take()
+                                        .ok_or_else(|| WasmSdkError::generic("Missing proof in response"))?;
+                                    (key_map, metadata, proof)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dee924e and ac1088f.

📒 Files selected for processing (31)
  • packages/js-evo-sdk/src/contracts/facade.ts (1 hunks)
  • packages/js-evo-sdk/src/epoch/facade.ts (2 hunks)
  • packages/js-evo-sdk/src/group/facade.ts (2 hunks)
  • packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs (1 hunks)
  • packages/js-evo-sdk/tests/unit/facades/epoch.spec.mjs (2 hunks)
  • packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (2 hunks)
  • packages/wasm-dpp2/src/identifier.rs (2 hunks)
  • packages/wasm-dpp2/src/tokens/configuration/action_taker.rs (2 hunks)
  • packages/wasm-dpp2/src/utils.rs (0 hunks)
  • packages/wasm-sdk/README.md (1 hunks)
  • packages/wasm-sdk/src/dpns.rs (6 hunks)
  • packages/wasm-sdk/src/queries/data_contract.rs (7 hunks)
  • packages/wasm-sdk/src/queries/document.rs (6 hunks)
  • packages/wasm-sdk/src/queries/epoch.rs (9 hunks)
  • packages/wasm-sdk/src/queries/group.rs (19 hunks)
  • packages/wasm-sdk/src/queries/identity.rs (31 hunks)
  • packages/wasm-sdk/src/queries/system.rs (4 hunks)
  • packages/wasm-sdk/src/queries/token.rs (19 hunks)
  • packages/wasm-sdk/src/queries/utils.rs (2 hunks)
  • packages/wasm-sdk/src/queries/voting/resources.rs (4 hunks)
  • packages/wasm-sdk/src/queries/voting/state.rs (5 hunks)
  • packages/wasm-sdk/src/queries/voting/voters.rs (6 hunks)
  • packages/wasm-sdk/src/queries/voting/votes.rs (7 hunks)
  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs (5 hunks)
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs (23 hunks)
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs (13 hunks)
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs (17 hunks)
  • packages/wasm-sdk/tests/functional/dpns.spec.mjs (1 hunks)
  • packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs (1 hunks)
  • packages/wasm-sdk/tests/functional/groups.spec.mjs (1 hunks)
  • packages/wasm-sdk/tests/functional/identities.spec.mjs (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/wasm-dpp2/src/utils.rs
🧰 Additional context used
📓 Path-based instructions (4)
packages/wasm-sdk/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep WASM SDK docs in sync (run generate_docs.py) when updating the WASM SDK

Files:

  • packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs
  • packages/wasm-sdk/README.md
  • packages/wasm-sdk/tests/functional/dpns.spec.mjs
  • packages/wasm-sdk/tests/functional/identities.spec.mjs
  • packages/wasm-sdk/src/queries/voting/state.rs
  • packages/wasm-sdk/src/queries/utils.rs
  • packages/wasm-sdk/tests/functional/groups.spec.mjs
  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/voting/resources.rs
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
  • packages/wasm-sdk/src/queries/epoch.rs
  • packages/wasm-sdk/src/queries/voting/votes.rs
  • packages/wasm-sdk/src/dpns.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/voting/voters.rs
  • packages/wasm-sdk/src/queries/token.rs
packages/**/tests/**

📄 CodeRabbit inference engine (AGENTS.md)

Place unit and integration tests alongside each package in packages//tests

Files:

  • packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs
  • packages/wasm-sdk/tests/functional/dpns.spec.mjs
  • packages/wasm-sdk/tests/functional/identities.spec.mjs
  • packages/wasm-sdk/tests/functional/groups.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/group.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/epoch.spec.mjs
packages/**/**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/**/**/*.{js,ts,jsx,tsx}: Adhere to ESLint with Airbnb/TypeScript configs for JS/TS code
Use camelCase for JS/TS variables and functions
Use PascalCase for JS/TS classes
Prefer kebab-case filenames within JS packages

Files:

  • packages/js-evo-sdk/src/contracts/facade.ts
  • packages/js-evo-sdk/src/epoch/facade.ts
  • packages/js-evo-sdk/src/group/facade.ts
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code

Files:

  • packages/wasm-dpp2/src/identifier.rs
  • packages/wasm-sdk/src/queries/voting/state.rs
  • packages/wasm-sdk/src/queries/utils.rs
  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/voting/resources.rs
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
  • packages/wasm-dpp2/src/tokens/configuration/action_taker.rs
  • packages/wasm-sdk/src/queries/epoch.rs
  • packages/wasm-sdk/src/queries/voting/votes.rs
  • packages/wasm-sdk/src/dpns.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/voting/voters.rs
  • packages/wasm-sdk/src/queries/token.rs
🧠 Learnings (34)
📓 Common learnings
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.
📚 Learning: 2025-07-28T20:00:08.502Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs
  • packages/wasm-sdk/README.md
  • packages/wasm-sdk/tests/functional/dpns.spec.mjs
  • packages/wasm-sdk/tests/functional/identities.spec.mjs
  • packages/wasm-sdk/src/queries/utils.rs
  • packages/wasm-sdk/tests/functional/groups.spec.mjs
  • packages/js-evo-sdk/src/epoch/facade.ts
  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
  • packages/wasm-sdk/src/dpns.rs
  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/token.rs
📚 Learning: 2025-09-03T19:33:21.688Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/api-definitions.json:1285-1285
Timestamp: 2025-09-03T19:33:21.688Z
Learning: In packages/wasm-sdk/api-definitions.json, thephez prefers to keep the existing "ripemd160hash20bytes1234" placeholder for ECDSA_HASH160 data field in documentation examples rather than using a valid base64-encoded format, maintaining consistency with the previous documentation approach.

Applied to files:

  • packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs
  • packages/wasm-sdk/README.md
  • packages/wasm-sdk/tests/functional/dpns.spec.mjs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/dpns.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2025-09-03T14:42:29.958Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/docs.html:1970-1971
Timestamp: 2025-09-03T14:42:29.958Z
Learning: In packages/wasm-sdk/, the docs.html file is auto-generated from api-definitions.json. Any documentation fixes should be made in api-definitions.json rather than directly in docs.html, as manual changes to docs.html would be overwritten during regeneration.

Applied to files:

  • packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs
  • packages/wasm-sdk/README.md
  • packages/wasm-sdk/tests/functional/dpns.spec.mjs
  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2025-09-03T14:41:16.196Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/AI_REFERENCE.md:766-766
Timestamp: 2025-09-03T14:41:16.196Z
Learning: In packages/wasm-sdk/, the AI_REFERENCE.md file is auto-generated from api-definitions.json. Any documentation fixes should be made in api-definitions.json rather than directly in AI_REFERENCE.md, as manual changes to AI_REFERENCE.md would be overwritten during regeneration.

Applied to files:

  • packages/wasm-sdk/README.md
  • packages/wasm-sdk/tests/functional/dpns.spec.mjs
  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2025-09-07T22:18:50.883Z
Learnt from: CR
Repo: dashpay/platform PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-09-07T22:18:50.883Z
Learning: Applies to packages/wasm-sdk/** : Keep WASM SDK docs in sync (run generate_docs.py) when updating the WASM SDK

Applied to files:

  • packages/wasm-sdk/README.md
  • packages/wasm-sdk/src/queries/document.rs
📚 Learning: 2025-07-28T20:00:24.323Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/README.md
  • packages/wasm-sdk/tests/functional/identities.spec.mjs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/token.rs
📚 Learning: 2025-08-05T13:55:39.147Z
Learnt from: thephez
Repo: dashpay/platform PR: 2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.147Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.

Applied to files:

  • packages/wasm-sdk/tests/functional/identities.spec.mjs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/queries/epoch.rs
  • packages/wasm-sdk/src/dpns.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/token.rs
📚 Learning: 2025-06-18T03:44:14.385Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/tests/functional/identities.spec.mjs
  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-07-28T20:04:48.458Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/tests/functional/identities.spec.mjs
  • packages/wasm-sdk/src/queries/system.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: shumkov
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/voting/state.rs
  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
  • packages/wasm-dpp2/src/tokens/configuration/action_taker.rs
  • packages/wasm-sdk/src/queries/voting/votes.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/voting/voters.rs
  • packages/wasm-sdk/src/queries/token.rs
📚 Learning: 2024-11-25T01:17:02.001Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2347
File: packages/rs-drive/tests/query_tests.rs:438-460
Timestamp: 2024-11-25T01:17:02.001Z
Learning: In Rust test files (`packages/rs-drive/tests/query_tests.rs`), when code is used only in tests, defining explicit enums for fields (like the `status` field in the `Withdrawal` struct) may not be necessary; using primitive types is acceptable.

Applied to files:

  • packages/wasm-sdk/src/queries/voting/state.rs
  • packages/wasm-sdk/src/queries/voting/resources.rs
  • packages/wasm-sdk/src/queries/voting/voters.rs
📚 Learning: 2024-10-08T13:28:03.529Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/voting/state.rs
📚 Learning: 2024-10-29T14:40:54.727Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/utils.rs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
  • packages/wasm-sdk/src/queries/voting/voters.rs
  • packages/wasm-sdk/src/queries/token.rs
📚 Learning: 2025-02-10T11:26:36.709Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs
  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/dpns.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/token.rs
📚 Learning: 2024-11-06T07:27:01.722Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In `packages/wallet-contract/test/bootstrap.js`, for Mocha tests in Node.js, async functions like `loadWasmDpp` can be assigned directly to `beforeAll` without wrapping them in another async function.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs
📚 Learning: 2025-04-11T09:08:05.652Z
Learnt from: pauldelucia
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
📚 Learning: 2025-04-11T09:08:05.652Z
Learnt from: pauldelucia
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
📚 Learning: 2025-09-02T13:30:17.703Z
Learnt from: thephez
Repo: dashpay/platform PR: 2739
File: packages/wasm-sdk/test/ui-automation/tests/state-transitions.spec.js:1-171
Timestamp: 2025-09-02T13:30:17.703Z
Learning: In packages/wasm-sdk/index.html, state transition definitions are loaded dynamically from api-definitions.json rather than being hardcoded in the HTML file. The UI loads transition categories, types, inputs, and labels from this JSON configuration file.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2025-09-02T13:30:17.703Z
Learnt from: thephez
Repo: dashpay/platform PR: 2739
File: packages/wasm-sdk/test/ui-automation/tests/state-transitions.spec.js:1-171
Timestamp: 2025-09-02T13:30:17.703Z
Learning: In packages/wasm-sdk/index.html, state transition definitions are loaded dynamically from api-definitions.json via the loadApiDefinitions() function that fetches './api-definitions.json'. The UI doesn't have hardcoded transition definitions - instead it populates categories, types, inputs, and labels from this JSON configuration file at runtime.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2024-11-25T07:48:09.831Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2345
File: packages/wallet-utils-contract/src/lib.rs:14-17
Timestamp: 2024-11-25T07:48:09.831Z
Learning: In the `wallet-utils-contract` (file `packages/wallet-utils-contract/src/lib.rs`), the `OWNER_ID_BYTES` constant is intentionally initialized to all zeros.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/contracts/mod.rs
  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2024-10-04T14:16:05.798Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-04T14:16:05.798Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.

Applied to files:

  • packages/wasm-sdk/src/queries/voting/resources.rs
  • packages/wasm-sdk/src/queries/voting/votes.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/voting/voters.rs
📚 Learning: 2024-10-06T16:11:34.946Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/identity/mod.rs
  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-01-20T16:20:59.791Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
  • packages/wasm-sdk/src/queries/token.rs
📚 Learning: 2025-01-20T16:20:59.791Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as `type TokenAmount = u64` in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-08-28T14:06:02.805Z
Learnt from: thephez
Repo: dashpay/platform PR: 2739
File: packages/wasm-sdk/test/ui-automation/fixtures/test-data.js:711-723
Timestamp: 2025-08-28T14:06:02.805Z
Learning: The tokenDestroyFrozen operation destroys the entire identity balance for that token and does not require an amount parameter.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-05-28T16:22:26.334Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/data_contract.rs
📚 Learning: 2024-10-30T11:04:33.634Z
Learnt from: lklimek
Repo: dashpay/platform 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`.

Applied to files:

  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/queries/document.rs
📚 Learning: 2025-08-14T15:03:56.681Z
Learnt from: thephez
Repo: dashpay/platform PR: 2726
File: packages/wasm-sdk/check_documentation.py:69-76
Timestamp: 2025-08-14T15:03:56.681Z
Learning: In packages/wasm-sdk/api-definitions.json, the structure is nested by categories: { "queries": { "categoryName": { "label": "...", "queries": { "actualQueryName": {...} } } } }. The check_documentation.py script correctly iterates over categories and then accesses the nested 'queries'/'transitions' objects within each category to collect the actual query/transition names.

Applied to files:

  • packages/wasm-sdk/src/queries/document.rs
  • packages/wasm-sdk/src/queries/group.rs
📚 Learning: 2025-10-01T08:37:32.168Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2790
File: packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/v1/mod.rs:65-0
Timestamp: 2025-10-01T08:37:32.168Z
Learning: In purchase document transitions (packages/rs-drive/src/drive/document/index_uniqueness/validate_document_purchase_transition_action_uniqueness/v1/mod.rs), the `changed_data_values` field in `UniquenessOfDataRequestUpdateType::ChangedDocument` should be set to an empty BTreeSet (`Cow::Owned(BTreeSet::new())`) because purchase transitions do not modify document data properties (like "price"), only ownership and transfer metadata. An empty set signals the uniqueness validation logic to skip checking unique indexes on data properties.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2025-10-01T08:37:27.687Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2790
File: packages/rs-drive/src/drive/document/index_uniqueness/validate_document_transfer_transition_action_uniqueness/mod.rs:64-0
Timestamp: 2025-10-01T08:37:27.687Z
Learning: In v1 validators for document transitions that change ownership (transfer, purchase), the owner_id parameter should be omitted from the method signature and extracted internally from the transition's document() accessor, since the owner_id is being changed by the transition itself.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/documents/mod.rs
📚 Learning: 2024-10-30T11:19:59.163Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-11-20T16:05:40.200Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-09-07T22:19:59.217Z
Learnt from: CR
Repo: dashpay/platform PR: 0
File: packages/swift-sdk/SwiftExampleApp/CLAUDE.md:0-0
Timestamp: 2025-09-07T22:19:59.217Z
Learning: Applies to packages/swift-sdk/SwiftExampleApp/**/DataContractParser.swift : Update DataContractParser to parse any newly added token control rule

Applied to files:

  • packages/wasm-sdk/src/queries/token.rs
🧬 Code graph analysis (23)
packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs (1)
packages/js-evo-sdk/src/group/facade.ts (1)
  • infos (80-88)
packages/wasm-dpp2/src/identifier.rs (1)
packages/wasm-dpp2/src/utils.rs (1)
  • get_class_type (200-210)
packages/wasm-sdk/tests/functional/dpns.spec.mjs (2)
packages/wasm-sdk/tests/functional/identities.spec.mjs (2)
  • client (9-9)
  • DPNS_CONTRACT (7-7)
packages/wasm-sdk/tests/functional/utilities.spec.mjs (1)
  • client (14-14)
packages/wasm-sdk/src/queries/voting/state.rs (4)
packages/wasm-dpp2/src/voting/vote_poll.rs (1)
  • contract_id (70-76)
packages/wasm-dpp2/src/tokens/contract_info.rs (1)
  • contract_id (26-30)
packages/wasm-sdk/src/queries/group.rs (1)
  • data_contract_id (54-56)
packages/wasm-sdk/src/queries/utils.rs (1)
  • convert_optional_limit (50-70)
packages/wasm-sdk/src/queries/utils.rs (1)
packages/wasm-dpp2/src/identifier.rs (9)
  • value (68-68)
  • value (84-84)
  • try_from (44-56)
  • try_from (61-96)
  • try_from (101-103)
  • from (19-21)
  • from (25-27)
  • from (31-33)
  • from (37-39)
packages/wasm-sdk/src/state_transitions/contracts/mod.rs (1)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (94-98)
packages/wasm-sdk/src/queries/system.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (94-98)
packages/wasm-dpp2/src/identifier.rs (1)
  • new (186-191)
packages/wasm-sdk/src/queries/voting/resources.rs (2)
packages/wasm-dpp2/src/voting/vote_poll.rs (1)
  • contract_id (70-76)
packages/wasm-dpp2/src/tokens/contract_info.rs (1)
  • contract_id (26-30)
packages/wasm-sdk/src/state_transitions/identity/mod.rs (1)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (94-98)
packages/wasm-sdk/src/state_transitions/tokens/mod.rs (4)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (94-98)
packages/wasm-sdk/src/queries/group.rs (1)
  • data_contract_id (54-56)
packages/wasm-sdk/src/queries/identity.rs (5)
  • identity_id (98-100)
  • identity_id (151-153)
  • identity_id (366-368)
  • token_ids (997-1006)
  • token_ids (1495-1504)
packages/wasm-sdk/src/queries/token.rs (2)
  • token_id (38-40)
  • calculate_token_id_from_contract (121-137)
packages/wasm-dpp2/src/tokens/configuration/action_taker.rs (1)
packages/wasm-dpp2/src/identifier.rs (6)
  • try_from (44-56)
  • try_from (61-96)
  • try_from (101-103)
  • value (68-68)
  • value (84-84)
  • new (186-191)
packages/wasm-sdk/src/queries/epoch.rs (1)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (13-30)
packages/wasm-sdk/src/queries/voting/votes.rs (4)
packages/wasm-sdk/src/queries/utils.rs (2)
  • convert_optional_limit (50-70)
  • deserialize_required_query (13-30)
packages/wasm-sdk/src/queries/voting/state.rs (2)
  • identity_id (114-116)
  • identity_id (148-150)
packages/wasm-dpp2/src/voting/contender.rs (1)
  • identity_id (48-50)
packages/wasm-dpp2/src/voting/winner_info.rs (1)
  • identity_id (60-67)
packages/wasm-sdk/src/dpns.rs (1)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (94-98)
packages/wasm-sdk/src/queries/data_contract.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (13-30)
packages/wasm-dpp2/src/identifier.rs (6)
  • try_from (44-56)
  • try_from (61-96)
  • try_from (101-103)
  • from (19-21)
  • from (25-27)
  • from (31-33)
packages/wasm-sdk/src/queries/document.rs (3)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (13-30)
packages/rs-sdk/src/platform/documents/document_query.rs (1)
  • new_with_data_contract_id (88-102)
packages/wasm-dpp2/src/identifier.rs (3)
  • try_from (44-56)
  • try_from (61-96)
  • try_from (101-103)
packages/wasm-sdk/src/queries/group.rs (2)
packages/wasm-sdk/src/queries/utils.rs (4)
  • convert_optional_limit (50-70)
  • deserialize_required_query (13-30)
  • identifiers_from_js (100-108)
  • values (76-84)
packages/wasm-dpp2/src/identifier.rs (7)
  • from (19-21)
  • from (25-27)
  • from (31-33)
  • from (37-39)
  • try_from (44-56)
  • try_from (61-96)
  • try_from (101-103)
packages/wasm-sdk/src/state_transitions/documents/mod.rs (1)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (94-98)
packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (2)
packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs (3)
  • client (6-6)
  • wasmSdk (5-5)
  • wasmSdk (46-46)
packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs (7)
  • client (6-6)
  • wasmSdk (5-5)
  • wasmSdk (65-65)
  • wasmSdk (83-83)
  • wasmSdk (183-183)
  • wasmSdk (200-200)
  • wasmSdk (216-216)
packages/js-evo-sdk/tests/unit/facades/epoch.spec.mjs (4)
packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs (3)
  • client (6-6)
  • wasmSdk (5-5)
  • wasmSdk (46-46)
packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (2)
  • client (7-7)
  • wasmSdk (6-6)
packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs (1)
  • client (6-6)
packages/wasm-sdk/tests/functional/groups.spec.mjs (1)
  • client (6-6)
packages/wasm-sdk/src/queries/identity.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (13-30)
packages/wasm-dpp2/src/identifier.rs (9)
  • try_from (44-56)
  • try_from (61-96)
  • try_from (101-103)
  • value (68-68)
  • value (84-84)
  • from (19-21)
  • from (25-27)
  • from (31-33)
  • from (37-39)
packages/wasm-sdk/src/queries/voting/voters.rs (3)
packages/wasm-dpp2/src/voting/vote_poll.rs (2)
  • contract_id (70-76)
  • index_values (93-118)
packages/wasm-dpp2/src/tokens/contract_info.rs (1)
  • contract_id (26-30)
packages/wasm-sdk/src/queries/utils.rs (1)
  • convert_json_values_to_platform_values (72-87)
packages/wasm-sdk/src/queries/token.rs (2)
packages/wasm-sdk/src/queries/utils.rs (2)
  • identifier_from_js (94-98)
  • identifiers_from_js (100-108)
packages/wasm-dpp2/src/identifier.rs (5)
  • from (19-21)
  • from (25-27)
  • from (31-33)
  • from (37-39)
  • get_base58 (194-196)
⏰ 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). (6)
  • GitHub Check: Build Docker images (RS-DAPI, rs-dapi, rs-dapi) / Build RS-DAPI image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: Determine changed packages
  • GitHub Check: Rust crates security audit
🔇 Additional comments (26)
packages/js-evo-sdk/src/contracts/facade.ts (2)

25-29: LGTM!

The refactoring to object-based parameters is clean and correct. The BigInt conversion for startAtMs properly handles null/undefined values, and the parameter rename from contractId to dataContractId improves consistency with the underlying WASM SDK API.


35-39: LGTM!

Consistent with the getHistory method, the object-based parameter passing and BigInt conversion are correctly implemented.

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

8-8: LGTM!

The identifier type updates align with the broader unification effort across the WASM SDK. The change from String to IdentifierWasm enables flexible input formats (Identifier | Uint8Array | string) while maintaining type safety through the conversion at line 135.

Also applies to: 16-16, 87-87, 135-135


25-27: Documentation improvement.

The updated comment "Data contract identifier." is more concise than the previous "Data contract identifier (base58 string)." while accurately reflecting that the field now accepts multiple formats.

packages/wasm-dpp2/src/tokens/configuration/action_taker.rs (2)

40-40: LGTM!

The .clone() call is necessary since value is borrowed (&JsValue) and try_from requires ownership. This is the correct approach.


53-53: Improved code clarity.

The changes enhance readability:

  • Type inference for BTreeSet::new() is idiomatic when the type is evident from usage
  • Explicit Identifier::from(identifier) is clearer than into()

Also applies to: 56-57

packages/wasm-sdk/README.md (1)

62-66: Excellent documentation update.

The new object-based parameter syntax is significantly more readable and self-documenting than the previous positional arguments. This accurately reflects the API changes introduced in this PR.

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

1-1: LGTM!

Good housekeeping: removed the unused convert_json_values_to_platform_values import and added the necessary Identifier and IdentifierWasm imports for the identifier unification changes.

Also applies to: 5-5, 17-17


26-28: Consistent identifier unification.

The changes to accept Identifier | Uint8Array | string for identity and vote identifiers follow the same pattern established across the WASM SDK. The conversions via into() at lines 97 and 103 are idiomatic and correct.

Also applies to: 40-40, 68-68, 78-78, 97-97, 103-103

packages/wasm-sdk/tests/functional/identities.spec.mjs (1)

40-43: LGTM!

The test correctly reflects the new object-based API for getIdentityKeys. The nested structure { identityId, request: { type } } is clear and aligns with the PR's refactoring objectives.

packages/js-evo-sdk/src/epoch/facade.ts (3)

10-14: LGTM!

The refactoring to pass object parameters to the underlying WASM SDK methods is clean and consistent with the PR's objectives.

Also applies to: 20-24


27-34: Breaking change: startEpoch now required.

The removal of the default parameter (= {}) makes startEpoch a required field for finalizedInfos and finalizedInfosWithProof. This is appropriate since there's no sensible default value for which epoch to start from. Callers must now explicitly provide this parameter.

Also applies to: 37-44


63-68: LGTM!

The evonodesProposedBlocksByRange methods correctly forward the epoch parameter along with the optional fields in the object payload.

Also applies to: 74-79

packages/wasm-sdk/tests/functional/dpns.spec.mjs (2)

23-27: LGTM!

The test correctly uses the new object-based API for getDocuments. The named parameters make the test intent much clearer.


32-39: Comprehensive test coverage.

The tests exercise various parameter combinations (where clauses, orderBy, and their combinations) using the new object-based API. The self-documenting nature of the parameter objects significantly improves test readability.

Also applies to: 44-52, 56-68

packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs (2)

47-51: getHistory expectation covers the BigInt coercion perfectly.

Thanks for asserting the forwarded object shape and the BigInt cast; this guards the façade against regressions while matching the wasm signature shift.


56-60: Explicit defaults keep the proof variant honest.

Appreciate the explicit undefined fields—this mirrors how optional inputs are serialized and ensures the stub keeps watching for accidental positional regressions.

packages/wasm-sdk/tests/functional/groups.spec.mjs (1)

24-32: Object payloads line up with the new bindings.

Good coverage of both required and optional fields; this keeps the functional path aligned with the refactored wasm entrypoints.

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

94-108: Nice reuse of IdentifierWasm::try_from.

Centralizing the Identifier parsing here keeps downstream query modules slimmer while preserving consistent error messaging.

packages/wasm-sdk/tests/functional/epochs-blocks.spec.mjs (2)

25-35: Epoch query objects exercised end-to-end.

Thanks for updating both info and finalized paths—verifies the new shape with representative counts and ordering flags.


43-46: Range query covers the hex evonode id path.

Great to see the hex startAfter making it through; this will catch regressions in identifier parsing.

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

758-779: Nice consolidation of identifier parsing.

Switching to identifier_from_js keeps the binding consistent with other queries and still returns the normalized Base58 value for JS consumers.

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

202-292: Typed identifiers at the boundary pay off here.

Deserializing into IdentifierWasm and converting once in the builder eliminates the repeated base58 parsing paths we kept fixing in other vote-state queries.

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

86-148: Consistent identifier handling looks good.

The query now receives normalized identifiers without juggling strings, and the downstream proof payload still exposes Base58, so callers get the best of both worlds.

packages/js-evo-sdk/tests/unit/facades/epoch.spec.mjs (1)

31-79: Coverage on the new object payload contract is spot on.

These assertions will catch any regression where we forget to forward the full option object to the WASM facade.

packages/wasm-sdk/src/state_transitions/contracts/mod.rs (1)

37-166: Thanks for reusing the shared identifier helper.

Normalizing owner_id at the JS boundary removes the ad-hoc parsing we had before and keeps the return payload consistent with other contract endpoints.

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/wasm-sdk/src/queries/group.rs (1)

862-907: Proof response misses coverage for additional contracts

When memberDataContracts contains more than one entry in proof mode, we fetch each contract separately but only keep the first (metadata, proof) pair. The returned ProofMetadataResponseWasm therefore includes groups that are not covered by the proof, breaking verification guarantees. Either accumulate/merge all proofs or (until that’s supported) reject multi-contract proof queries explicitly.

-        if let Some(contracts) = member_data_contracts {
-            for contract_id in contracts {
+        if let Some(contracts) = member_data_contracts {
+            if contracts.len() > 1 {
+                return Err(WasmSdkError::invalid_argument(
+                    "memberDataContracts proof queries currently support only one contract",
+                ));
+            }
+            for contract_id in contracts {
♻️ Duplicate comments (1)
packages/wasm-sdk/src/queries/identity.rs (1)

484-490: ❗ Pagination bug: insufficient keys returned for specific key requests.

This is the same issue flagged in the previous review. When offset and limit are both provided, the code requests only limit items from Drive (line 484), then discards the first offset items locally (lines 577-595).

Example: offset=5, limit=10 → requests 10 keys, discards first 5 → returns only 5 keys instead of 10.

When limit is None, the default of 100 may silently truncate large specificKeyIds arrays.

Apply this fix to request offset + limit items:

-                let request_limit = limit.unwrap_or(100);
-
-                let query = IdentityKeysQuery::new(identity_id.clone(), specific_key_ids)
-                    .with_limit(request_limit);
+                let request_limit = match limit {
+                    Some(lim) => lim.saturating_add(offset.unwrap_or(0)),
+                    None => specific_key_ids.len() as u32,
+                };
+
+                let query = IdentityKeysQuery::new(identity_id.clone(), specific_key_ids)
+                    .with_limit(request_limit);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac1088f and f3706a4.

📒 Files selected for processing (5)
  • packages/wasm-dpp2/src/identifier.rs (2 hunks)
  • packages/wasm-sdk/src/queries/group.rs (19 hunks)
  • packages/wasm-sdk/src/queries/identity.rs (31 hunks)
  • packages/wasm-sdk/src/queries/system.rs (4 hunks)
  • packages/wasm-sdk/src/queries/utils.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/wasm-sdk/src/queries/utils.rs
  • packages/wasm-dpp2/src/identifier.rs
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code

Files:

  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/group.rs
packages/wasm-sdk/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep WASM SDK docs in sync (run generate_docs.py) when updating the WASM SDK

Files:

  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/group.rs
🧠 Learnings (14)
📓 Common learnings
Learnt from: QuantumExplorer
Repo: dashpay/platform 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: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/api-definitions.json:1285-1285
Timestamp: 2025-09-03T19:33:21.688Z
Learning: In packages/wasm-sdk/api-definitions.json, thephez prefers to keep the existing "ripemd160hash20bytes1234" placeholder for ECDSA_HASH160 data field in documentation examples rather than using a valid base64-encoded format, maintaining consistency with the previous documentation approach.
Learnt from: lklimek
Repo: dashpay/platform 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.
📚 Learning: 2025-07-28T20:00:08.502Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-08-05T13:55:39.147Z
Learnt from: thephez
Repo: dashpay/platform PR: 2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.147Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/group.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: shumkov
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-09-03T19:33:21.688Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/api-definitions.json:1285-1285
Timestamp: 2025-09-03T19:33:21.688Z
Learning: In packages/wasm-sdk/api-definitions.json, thephez prefers to keep the existing "ripemd160hash20bytes1234" placeholder for ECDSA_HASH160 data field in documentation examples rather than using a valid base64-encoded format, maintaining consistency with the previous documentation approach.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
📚 Learning: 2025-02-10T11:26:36.709Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/queries/group.rs
📚 Learning: 2024-10-29T14:40:54.727Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
📚 Learning: 2024-10-30T11:19:59.163Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
📚 Learning: 2025-07-28T20:04:48.458Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/system.rs
📚 Learning: 2025-06-18T03:44:14.385Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-07-28T20:00:24.323Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-11-20T16:05:40.200Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
🧬 Code graph analysis (3)
packages/wasm-sdk/src/queries/system.rs (1)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (88-92)
packages/wasm-sdk/src/queries/identity.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (12-29)
packages/wasm-dpp2/src/identifier.rs (9)
  • try_from (43-55)
  • try_from (60-95)
  • try_from (100-102)
  • value (67-67)
  • value (83-83)
  • from (18-20)
  • from (24-26)
  • from (30-32)
  • from (36-38)
packages/wasm-sdk/src/queries/group.rs (2)
packages/wasm-sdk/src/queries/utils.rs (4)
  • convert_optional_limit (49-69)
  • deserialize_required_query (12-29)
  • identifiers_from_js (94-102)
  • values (75-83)
packages/wasm-dpp2/src/identifier.rs (7)
  • from (18-20)
  • from (24-26)
  • from (30-32)
  • from (36-38)
  • try_from (43-55)
  • try_from (60-95)
  • try_from (100-102)
⏰ 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). (12)
  • GitHub Check: Rust packages (wasm-sdk) / Tests
  • GitHub Check: Rust packages (wasm-sdk) / Unused dependencies
  • GitHub Check: Rust packages (wasm-sdk) / Formatting
  • GitHub Check: Rust packages (wasm-sdk) / Linting
  • GitHub Check: Rust packages (wasm-dpp2) / Unused dependencies
  • GitHub Check: Rust packages (wasm-dpp2) / Tests
  • GitHub Check: Rust packages (wasm-dpp2) / Linting
  • GitHub Check: Build Docker images (RS-DAPI, rs-dapi, rs-dapi) / Build RS-DAPI image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build JS packages / Build JS
  • GitHub Check: Rust crates security audit
🔇 Additional comments (7)
packages/wasm-sdk/src/queries/identity.rs (7)

220-343: LGTM: Well-structured TypeScript definitions and input types.

The TypeScript custom section provides comprehensive documentation, and the Rust deserialization structures are properly configured with matching field names and serde attributes.


345-368: LGTM: Helper function properly structured.

The parse_identity_keys_query helper correctly deserializes and converts the query input, with appropriate error messages.


373-385: LGTM: Consistent identifier conversion pattern.

The refactoring to accept flexible JsValue identifiers (supporting Identifier, Uint8Array, or string) is implemented consistently across all single-identifier methods, with appropriate error handling and descriptive error messages.

Also applies to: 388-408, 411-459, 605-625, 627-653, 655-681, 683-719, 721-739, 779-797


741-777: LGTM: Vector identifier conversions properly handled.

The multi-identifier methods correctly convert Vec<JsValue> to Vec<Identifier> using iterators with proper error propagation, and iterate over the converted identifiers when building results.

Also applies to: 827-910, 965-1011


1188-1234: LGTM: Proof-enabled multi-identifier methods properly implemented.

The batch proof methods (get_identities_balances_with_proof_info, get_identities_contract_keys_with_proof_info, get_identity_token_balances_with_proof_info) correctly handle identifier conversions and proof metadata aggregation.

Also applies to: 1361-1461, 1463-1516


912-963: LGTM: Optional identifier parameter properly handled.

Both versions of get_identity_by_non_unique_public_key_hash correctly handle the optional start_after parameter by checking for undefined/null before attempting conversion, with appropriate error messages.

Also applies to: 1301-1359


373-385: Reminder: Update WASM SDK documentation.

This PR changes the public API signatures of all identity query methods. Per the coding guidelines, please run generate_docs.py to keep the WASM SDK documentation in sync.

As per coding guidelines.

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 (2)
packages/js-evo-sdk/src/identities/facade.ts (1)

103-106: Remove redundant || undefined expression.

Line 105: startAfter || undefined is redundant because if startAfter is already undefined, the expression returns undefined anyway.

Apply this diff:

-    return w.getIdentityByNonUniquePublicKeyHashWithProofInfo(publicKeyHash, startAfter || undefined);
+    return w.getIdentityByNonUniquePublicKeyHashWithProofInfo(publicKeyHash, startAfter);
packages/js-evo-sdk/src/epoch/facade.ts (1)

22-30: Consider defaulting finalized queries

finalizedInfos/finalizedInfosWithProof now require a query argument, but the prior positional API allowed callers to omit optional inputs entirely. To preserve that ergonomics (and avoid passing undefined through to wasm when callers omit the arg), please default these parameters to {} the same way epochsInfo* does.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3706a4 and 50fcc81.

📒 Files selected for processing (16)
  • packages/js-evo-sdk/src/contracts/facade.ts (2 hunks)
  • packages/js-evo-sdk/src/documents/facade.ts (2 hunks)
  • packages/js-evo-sdk/src/epoch/facade.ts (2 hunks)
  • packages/js-evo-sdk/src/group/facade.ts (3 hunks)
  • packages/js-evo-sdk/src/identities/facade.ts (3 hunks)
  • packages/js-evo-sdk/src/tokens/facade.ts (1 hunks)
  • packages/js-evo-sdk/tests/functional/contracts.spec.mjs (1 hunks)
  • packages/js-evo-sdk/tests/functional/documents.spec.mjs (1 hunks)
  • packages/js-evo-sdk/tests/functional/epoch.spec.mjs (1 hunks)
  • packages/js-evo-sdk/tests/functional/group.spec.mjs (3 hunks)
  • packages/js-evo-sdk/tests/functional/identities.spec.mjs (1 hunks)
  • packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs (1 hunks)
  • packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs (1 hunks)
  • packages/js-evo-sdk/tests/unit/facades/epoch.spec.mjs (2 hunks)
  • packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (3 hunks)
  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/js-evo-sdk/tests/unit/facades/contracts.spec.mjs
🧰 Additional context used
📓 Path-based instructions (2)
packages/**/tests/**

📄 CodeRabbit inference engine (AGENTS.md)

Place unit and integration tests alongside each package in packages//tests

Files:

  • packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs
  • packages/js-evo-sdk/tests/functional/documents.spec.mjs
  • packages/js-evo-sdk/tests/functional/identities.spec.mjs
  • packages/js-evo-sdk/tests/functional/epoch.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/epoch.spec.mjs
  • packages/js-evo-sdk/tests/functional/contracts.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/group.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
  • packages/js-evo-sdk/tests/functional/group.spec.mjs
packages/**/**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/**/**/*.{js,ts,jsx,tsx}: Adhere to ESLint with Airbnb/TypeScript configs for JS/TS code
Use camelCase for JS/TS variables and functions
Use PascalCase for JS/TS classes
Prefer kebab-case filenames within JS packages

Files:

  • packages/js-evo-sdk/src/documents/facade.ts
  • packages/js-evo-sdk/src/contracts/facade.ts
  • packages/js-evo-sdk/src/epoch/facade.ts
  • packages/js-evo-sdk/src/tokens/facade.ts
  • packages/js-evo-sdk/src/identities/facade.ts
  • packages/js-evo-sdk/src/group/facade.ts
🧠 Learnings (16)
📓 Common learnings
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/api-definitions.json:1285-1285
Timestamp: 2025-09-03T19:33:21.688Z
Learning: In packages/wasm-sdk/api-definitions.json, thephez prefers to keep the existing "ripemd160hash20bytes1234" placeholder for ECDSA_HASH160 data field in documentation examples rather than using a valid base64-encoded format, maintaining consistency with the previous documentation approach.
📚 Learning: 2024-11-06T07:27:01.722Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2314
File: packages/wallet-contract/test/bootstrap.js:14-16
Timestamp: 2024-11-06T07:27:01.722Z
Learning: In `packages/wallet-contract/test/bootstrap.js`, for Mocha tests in Node.js, async functions like `loadWasmDpp` can be assigned directly to `beforeAll` without wrapping them in another async function.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
📚 Learning: 2025-08-14T15:03:56.681Z
Learnt from: thephez
Repo: dashpay/platform PR: 2726
File: packages/wasm-sdk/check_documentation.py:69-76
Timestamp: 2025-08-14T15:03:56.681Z
Learning: In packages/wasm-sdk/api-definitions.json, the structure is nested by categories: { "queries": { "categoryName": { "label": "...", "queries": { "actualQueryName": {...} } } } }. The check_documentation.py script correctly iterates over categories and then accesses the nested 'queries'/'transitions' objects within each category to collect the actual query/transition names.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs
📚 Learning: 2025-07-28T20:00:08.502Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/src/documents/facade.ts
  • packages/js-evo-sdk/tests/functional/identities.spec.mjs
  • packages/js-evo-sdk/src/tokens/facade.ts
  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
  • packages/js-evo-sdk/src/identities/facade.ts
📚 Learning: 2025-09-03T14:42:29.958Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/docs.html:1970-1971
Timestamp: 2025-09-03T14:42:29.958Z
Learning: In packages/wasm-sdk/, the docs.html file is auto-generated from api-definitions.json. Any documentation fixes should be made in api-definitions.json rather than directly in docs.html, as manual changes to docs.html would be overwritten during regeneration.

Applied to files:

  • packages/js-evo-sdk/src/documents/facade.ts
📚 Learning: 2025-09-03T14:41:16.196Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/AI_REFERENCE.md:766-766
Timestamp: 2025-09-03T14:41:16.196Z
Learning: In packages/wasm-sdk/, the AI_REFERENCE.md file is auto-generated from api-definitions.json. Any documentation fixes should be made in api-definitions.json rather than directly in AI_REFERENCE.md, as manual changes to AI_REFERENCE.md would be overwritten during regeneration.

Applied to files:

  • packages/js-evo-sdk/src/documents/facade.ts
📚 Learning: 2025-08-05T13:55:39.147Z
Learnt from: thephez
Repo: dashpay/platform PR: 2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.147Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.

Applied to files:

  • packages/js-evo-sdk/tests/functional/identities.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
  • packages/js-evo-sdk/src/identities/facade.ts
📚 Learning: 2025-06-18T03:44:14.385Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/tests/functional/identities.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
📚 Learning: 2025-10-15T14:45:30.856Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2716
File: packages/dashmate/src/test/constants/services.js:4-4
Timestamp: 2025-10-15T14:45:30.856Z
Learning: In the dashmate codebase (packages/dashmate), during the DAPI Rust migration (rs-dapi), the old service keys `dapi_api` and `dapi_core_streams` are intentionally kept in `generateEnvsFactory.js` for backward compatibility even though the test constants in `src/test/constants/services.js` have been updated to use `rs_dapi`. These deprecated keys will be removed in a future PR after the transition is complete.

Applied to files:

  • packages/js-evo-sdk/tests/functional/identities.spec.mjs
  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
📚 Learning: 2025-02-21T13:43:33.462Z
Learnt from: shumkov
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/src/tokens/facade.ts
📚 Learning: 2025-07-28T20:00:24.323Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
  • packages/js-evo-sdk/src/identities/facade.ts
📚 Learning: 2025-02-10T11:26:36.709Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
📚 Learning: 2024-10-30T11:19:59.163Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
📚 Learning: 2025-02-14T04:31:17.170Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2449
File: packages/rs-drive-abci/src/execution/platform_events/initialization/create_genesis_state/test/tokens.rs:35-38
Timestamp: 2025-02-14T04:31:17.170Z
Learning: In test scenarios, it's acceptable for different types of identifiers (e.g., identity IDs and contract IDs) to share the same byte values since they operate in different scopes and contexts.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
📚 Learning: 2025-09-03T19:33:21.688Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/api-definitions.json:1285-1285
Timestamp: 2025-09-03T19:33:21.688Z
Learning: In packages/wasm-sdk/api-definitions.json, thephez prefers to keep the existing "ripemd160hash20bytes1234" placeholder for ECDSA_HASH160 data field in documentation examples rather than using a valid base64-encoded format, maintaining consistency with the previous documentation approach.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
📚 Learning: 2025-07-28T20:04:48.458Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs
🧬 Code graph analysis (11)
packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs (2)
packages/js-evo-sdk/src/documents/facade.ts (1)
  • query (13-16)
packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (4)
  • query (42-42)
  • query (51-57)
  • query (66-71)
  • query (80-86)
packages/js-evo-sdk/src/documents/facade.ts (1)
packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs (2)
  • query (27-34)
  • query (40-43)
packages/js-evo-sdk/src/contracts/facade.ts (1)
packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (4)
  • query (42-42)
  • query (51-57)
  • query (66-71)
  • query (80-86)
packages/js-evo-sdk/tests/functional/epoch.spec.mjs (3)
packages/js-evo-sdk/tests/functional/documents.spec.mjs (3)
  • res (14-19)
  • res (24-28)
  • sdk (6-6)
packages/js-evo-sdk/tests/functional/group.spec.mjs (8)
  • res (15-20)
  • res (25-32)
  • res (37-37)
  • res (42-46)
  • res (51-51)
  • res (56-61)
  • res (66-66)
  • sdk (7-7)
packages/js-evo-sdk/tests/functional/identities.spec.mjs (8)
  • res (14-14)
  • res (19-19)
  • res (24-29)
  • res (34-37)
  • res (42-42)
  • res (47-47)
  • res (52-52)
  • sdk (6-6)
packages/js-evo-sdk/tests/functional/contracts.spec.mjs (3)
packages/js-evo-sdk/tests/functional/documents.spec.mjs (3)
  • res (14-19)
  • res (24-28)
  • sdk (6-6)
packages/js-evo-sdk/tests/functional/group.spec.mjs (8)
  • res (15-20)
  • res (25-32)
  • res (37-37)
  • res (42-46)
  • res (51-51)
  • res (56-61)
  • res (66-66)
  • sdk (7-7)
packages/js-evo-sdk/tests/functional/identities.spec.mjs (6)
  • res (14-14)
  • res (19-19)
  • res (24-29)
  • res (34-37)
  • res (42-42)
  • sdk (6-6)
packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (3)
packages/js-evo-sdk/src/documents/facade.ts (1)
  • query (13-16)
packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs (2)
  • query (27-34)
  • query (40-43)
packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs (2)
  • query (57-65)
  • query (71-74)
packages/js-evo-sdk/src/epoch/facade.ts (1)
packages/js-evo-sdk/src/sdk.ts (1)
  • EvoSDK (37-165)
packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs (2)
packages/js-evo-sdk/src/documents/facade.ts (1)
  • query (13-16)
packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs (6)
  • query (27-34)
  • query (40-43)
  • client (6-6)
  • wasmSdk (5-5)
  • wasmSdk (121-121)
  • wasmSdk (140-140)
packages/js-evo-sdk/src/identities/facade.ts (2)
packages/js-evo-sdk/src/documents/facade.ts (1)
  • query (13-16)
packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs (2)
  • query (57-65)
  • query (71-74)
packages/js-evo-sdk/tests/functional/group.spec.mjs (2)
packages/js-evo-sdk/tests/functional/documents.spec.mjs (3)
  • res (14-19)
  • res (24-28)
  • sdk (6-6)
packages/js-evo-sdk/tests/functional/identities.spec.mjs (12)
  • res (14-14)
  • res (19-19)
  • res (24-29)
  • res (34-37)
  • res (42-42)
  • res (47-47)
  • res (52-52)
  • res (57-57)
  • res (62-62)
  • res (67-67)
  • res (75-81)
  • sdk (6-6)
packages/js-evo-sdk/src/group/facade.ts (2)
packages/js-evo-sdk/src/documents/facade.ts (1)
  • query (13-16)
packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (4)
  • query (42-42)
  • query (51-57)
  • query (66-71)
  • query (80-86)
🔇 Additional comments (20)
packages/js-evo-sdk/src/tokens/facade.ts (1)

117-117: The code change is correct and intentional. The difference in how recipientId and publicNote are handled reflects their different parameter types in the WASM binding:

  • recipientId: Declared as JsValue with type "Identifier | Uint8Array | string | undefined". The WASM method explicitly checks if recipient_id.is_null() || recipient_id.is_undefined(), treating both as equivalent. It's designed to accept undefined directly.

  • publicNote: Declared as Option<String> in Rust. TypeScript must convert the optional parameter to null for proper serialization to a Rust Option type. Using ?? null is the correct pattern here.

This is not an inconsistency—it's correct handling of different parameter types. The change requires no modifications.

packages/js-evo-sdk/tests/functional/contracts.spec.mjs (1)

27-30: LGTM! Query object pattern improves API clarity.

The refactor from positional arguments to a single query object is clean and consistent with the broader SDK refactor.

packages/js-evo-sdk/src/contracts/facade.ts (2)

4-4: Good addition of type import for improved type safety.


23-31: LGTM! Simplified API with query object pattern.

The refactor from destructured parameters to a single DataContractHistoryQuery object improves type safety and API consistency across the SDK.

packages/js-evo-sdk/tests/functional/epoch.spec.mjs (1)

24-24: LGTM! Consistent with query object refactor.

packages/js-evo-sdk/tests/functional/identities.spec.mjs (2)

23-31: LGTM! Improved query structure with nested request object.

The nested request: { type: 'all' } structure provides better type safety and extensibility compared to flat parameters.


33-39: LGTM! Consistent with getKeys refactor.

packages/js-evo-sdk/tests/functional/documents.spec.mjs (1)

15-16: LGTM! More descriptive parameter names.

The rename from contractId to dataContractId and type to documentTypeName improves API clarity and consistency.

packages/js-evo-sdk/tests/unit/facades/documents.spec.mjs (2)

26-37: LGTM! Test properly validates query object forwarding.

The test correctly constructs a DocumentsQuery object and asserts it's forwarded as-is to the wasm SDK, validating the refactor.


39-46: LGTM! Consistent test pattern for proof variant.

packages/js-evo-sdk/src/identities/facade.ts (3)

4-4: Good addition of type import for improved type safety.


28-36: LGTM! Simplified API with IdentityKeysQuery object.

The refactor from multiple parameters to a single IdentityKeysQuery object improves consistency and type safety across the SDK.


98-101: LGTM! Cleaner optional parameter handling.

packages/js-evo-sdk/src/documents/facade.ts (2)

3-3: Good addition of type import for improved type safety.


13-21: LGTM! Simplified facade with direct query forwarding.

The refactor removes intermediate serialization and parameter construction, making the facade a clean pass-through layer. This improves maintainability and reduces the chance of serialization bugs.

packages/js-evo-sdk/tests/functional/group.spec.mjs (1)

41-62: Query-object forwarding verified

New group facade tests exercise the query object payloads (dataContractId, groupContractPosition, limit, status) and confirm they plumb straight through to the SDK, so the functional surface is protected. Nicely done keeping the assertions simple.

packages/js-evo-sdk/tests/unit/facades/identities.spec.mjs (1)

56-77: IdentityKeysQuery coverage looks solid

The unit test now pushes a fully-shaped IdentityKeysQuery (including nested request) through both getKeys paths and asserts exact forwarding, which neatly guards the refactor. Good job.

packages/js-evo-sdk/tests/unit/facades/epoch.spec.mjs (1)

26-60: Epoch query handling well covered

The updated tests prove both explicit query forwarding and the implicit {} default for epochsInfoWithProof, plus range queries for evonode blocks—great safety net for the new API surface.

packages/js-evo-sdk/tests/unit/facades/group.spec.mjs (1)

41-148: Thorough coverage of group query refactor

The test suite now exercises every group query shape—from infos to contested resources—and confirms the wasm stubs receive the exact objects, giving excellent confidence in the refactor.

packages/js-evo-sdk/src/group/facade.ts (1)

25-103: Group facade refactor looks clean

Every multi-arg method now takes the typed query object and forwards it unchanged, matching the new tests and wasm signatures. Nice tidy-up.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (7)
packages/wasm-sdk/src/queries/group.rs (4)

508-530: Guard against groupContractPosition overflow.

The direct cast at line 523 can silently wrap values above 65535. Add validation before creating the query.

Apply this diff:

         let contract_id: Identifier = IdentifierWasm::try_from(&data_contract_id)
             .map_err(|err| WasmSdkError::invalid_argument(format!("Invalid contract ID: {}", err)))?
             .into();
 
+        let group_contract_position: GroupContractPosition = group_contract_position
+            .try_into()
+            .map_err(|_| WasmSdkError::invalid_argument(format!(
+                "groupContractPosition {} exceeds maximum of {}",
+                group_contract_position,
+                u16::MAX,
+            )))?;
+
         // Create group query
         let query = GroupQuery {
             contract_id,
-            group_contract_position: group_contract_position as GroupContractPosition,
+            group_contract_position,
         };

668-707: Guard against groupContractPosition overflow.

The direct cast at line 689 can silently wrap values above 65535. Add validation before creating the query.

Apply this diff:

         let action_id: Identifier = IdentifierWasm::try_from(&action_id)
             .map_err(|err| WasmSdkError::invalid_argument(format!("Invalid action ID: {}", err)))?
             .into();
         let status = parse_group_action_status(status)?;
 
+        let group_contract_position: GroupContractPosition = group_contract_position
+            .try_into()
+            .map_err(|_| WasmSdkError::invalid_argument(format!(
+                "groupContractPosition {} exceeds maximum of {}",
+                group_contract_position,
+                u16::MAX,
+            )))?;
+
         // Create query
         let query = GroupActionSignersQuery {
             contract_id,
-            group_contract_position: group_contract_position as GroupContractPosition,
+            group_contract_position,
             status,

751-780: Guard against groupContractPosition overflow.

The direct cast at line 766 can silently wrap values above 65535. Add validation before creating the query.

Apply this diff:

         let contract_id: Identifier = IdentifierWasm::try_from(&data_contract_id)
             .map_err(|err| WasmSdkError::invalid_argument(format!("Invalid contract ID: {}", err)))?
             .into();
 
+        let group_contract_position: GroupContractPosition = group_contract_position
+            .try_into()
+            .map_err(|_| WasmSdkError::invalid_argument(format!(
+                "groupContractPosition {} exceeds maximum of {}",
+                group_contract_position,
+                u16::MAX,
+            )))?;
+
         // Create group query
         let query = GroupQuery {
             contract_id,
-            group_contract_position: group_contract_position as GroupContractPosition,
+            group_contract_position,
         };

951-994: Guard against groupContractPosition overflow.

The direct cast at line 972 can silently wrap values above 65535. Add validation before creating the query.

Apply this diff:

         let action_id: Identifier = IdentifierWasm::try_from(&action_id)
             .map_err(|err| WasmSdkError::invalid_argument(format!("Invalid action ID: {}", err)))?
             .into();
         let status = parse_group_action_status(status)?;
 
+        let group_contract_position: GroupContractPosition = group_contract_position
+            .try_into()
+            .map_err(|_| WasmSdkError::invalid_argument(format!(
+                "groupContractPosition {} exceeds maximum of {}",
+                group_contract_position,
+                u16::MAX,
+            )))?;
+
         // Create query
         let query = GroupActionSignersQuery {
             contract_id,
-            group_contract_position: group_contract_position as GroupContractPosition,
+            group_contract_position,
             status,
packages/wasm-sdk/src/queries/epoch.rs (1)

387-418: Let me search for any TODOs or comments about this limitation:The web search didn't find specific documentation. Based on my comprehensive verification of the codebase, the original review comment's concerns are confirmed and valid. Here is my final analysis:

The orderAscending parameter is parsed but explicitly unused in the WASM SDK method.

The parameter is correctly extracted from input (line 234-261) and destructured (lines 394-399), but then immediately discarded with let _ = order_ascending; (line 401). The underlying ProposerBlockCounts::fetch_proposed_blocks_by_range() method does not accept an ordering parameter, making the parsed value inaccessible to callers.

This differs from all comparable voting query methods in the codebase (votes.rs, voters.rs, resources.rs, polls.rs) which properly pass order_ascending through to their underlying fetch calls. This indicates either an unimplemented feature or a limitation in the underlying SDK's ProposerBlockCounts type.

Recommendation: Add a code comment documenting that ordering is not yet supported for this query type, so callers understand why the parameter has no effect.

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

477-594: Double-pagination in Specific case causes incorrect results.

The Specific case passes limit and offset to the SDK's IdentityKeysQuery (lines 484-486), then reapplies the same pagination locally (lines 576-594). If the SDK's fetch_many respects these query parameters, the result will be incorrectly paginated.

Example: With offset=5, limit=10:

  • SDK returns keys at positions 5-14 (10 keys)
  • Local code enumerates these (idx 0-9) and skips while idx < 5, then takes up to idx < 15
  • Result: Only returns 5 keys (local indices 5-9), which correspond to global positions 10-14

Remove the SDK-level pagination parameters and rely solely on local pagination for consistency with the All case:

-                let query = IdentityKeysQuery::new(identity_id.clone(), specific_key_ids)
-                    .with_limit(limit.unwrap_or(100))
-                    .with_offset(offset.unwrap_or(0));
+                let query = IdentityKeysQuery::new(identity_id.clone(), specific_key_ids);

490-594: Search case: fetch sufficient records for local offset.

The proto request sets limit but forces offset: None (line 526), relying on local pagination to handle the offset. However, with limit.unwrap_or(100) passed to proto, if the user requests offset=90, limit=20, the proto would return only 100 keys total. After skipping 90 locally, only 10 keys remain instead of the requested 20.

Adjust the proto limit to account for the local offset:

-                        limit: Some(limit.unwrap_or(100)),
+                        limit: Some(offset.unwrap_or(0) + limit.unwrap_or(100)),
♻️ Duplicate comments (4)
packages/wasm-sdk/src/queries/group.rs (2)

446-449: Guard against groupContractPosition overflow.

The direct cast from u32 to GroupContractPosition (u16) at line 448 can silently wrap values above 65535. Validate the range before converting.

Apply this diff:

+    let group_contract_position: GroupContractPosition = group_contract_position
+        .try_into()
+        .map_err(|_| WasmSdkError::invalid_argument(format!(
+            "groupContractPosition {} exceeds maximum of {}",
+            group_contract_position,
+            u16::MAX,
+        )))?;
+
     Ok(GroupMembersQueryParsed {
         contract_id,
-        group_contract_position: group_contract_position as GroupContractPosition,
+        group_contract_position,
         member_ids,

305-308: Guard against position overflow.

The direct cast from u32 to GroupContractPosition (u16) at line 306 can silently wrap values above 65535, leading to incorrect group selection. Apply the same try_into() validation pattern used in parse_group_actions_query.

Apply this diff:

     let start_at = if let Some(cursor) = start_at {
-        let position = cursor.position as GroupContractPosition;
+        let position: GroupContractPosition = cursor.position
+            .try_into()
+            .map_err(|_| WasmSdkError::invalid_argument(format!(
+                "position {} exceeds maximum of {}",
+                cursor.position,
+                u16::MAX,
+            )))?;
         let included = cursor.included.unwrap_or(false);
         Some((position, included))
packages/wasm-sdk/src/queries/epoch.rs (1)

159-176: Validate count explicitly or document deserialization behavior.

While the input type is now Option<u16>, JavaScript callers can still pass values exceeding 65,535. The current implementation relies on serde_wasm_bindgen's deserialization behavior, which may error or wrap silently. Explicit validation with a clear error message would improve the developer experience.

Consider adding validation after deserialization:

     let input: FinalizedEpochsQueryInput =
         deserialize_required_query(query, "Query object is required", "finalized epochs query")?;

     let start_epoch = input.start_epoch.ok_or_else(|| {
         WasmSdkError::invalid_argument("startEpoch is required for finalized epoch queries")
     })?;

     let count = input.count.unwrap_or(100).max(1);
+    // Note: serde_wasm_bindgen should error on out-of-range values during deserialization,
+    // but the error message may not be clear. Consider explicit validation if needed.

Alternatively, to verify the current behavior, you could test deserialization with an out-of-range value.

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

1035-1146: Remove proto-level pagination to prevent double-pagination.

The proto request includes limit and offset (lines 1053-1054), and the same pagination is applied locally (lines 1127-1146). The proto layer should return pre-paginated results, making the local pagination incorrect and causing the wrong keys to be returned.

Remove the pagination parameters from the proto request:

                     version: Some(Version::V0(GetIdentityKeysRequestV0 {
                         identity_id: identity_id.to_vec(),
                         prove: true,
-                        limit,
-                        offset,
+                        limit: None,
+                        offset: None,
                         request_type: Some(KeyRequestType {
🧹 Nitpick comments (2)
packages/wasm-sdk/src/state_transitions/tokens/mod.rs (1)

173-177: Consider simplifying redundant null/undefined check.

The pre-check for recipient_id.is_null() || recipient_id.is_undefined() is redundant since parse_token_params (lines 40-45) already handles Some(null/undefined) by returning None. You could simplify this to directly pass Some(&recipient_id) and let the parser handle the null/undefined case.

Apply this diff to simplify:

-        let recipient_option = if recipient_id.is_null() || recipient_id.is_undefined() {
-            None
-        } else {
-            Some(&recipient_id)
-        };
-
         // Parse and validate parameters
         let (contract_id, issuer_id, token_amount, recipient) = self
-            .parse_token_params(&data_contract_id, &identity_id, &amount, recipient_option)
+            .parse_token_params(&data_contract_id, &identity_id, &amount, Some(&recipient_id))
             .await?;
packages/wasm-sdk/src/queries/group.rs (1)

1055-1092: Remove unnecessary clone.

At line 1070, Identifier implements Copy, so .clone() is unnecessary.

Apply this diff:

-        let start_identifier = start_at.clone();
+        let start_identifier = *start_at;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50fcc81 and b4fe12b.

📒 Files selected for processing (6)
  • packages/wasm-dpp2/src/identifier.rs (3 hunks)
  • packages/wasm-sdk/src/queries/data_contract.rs (7 hunks)
  • packages/wasm-sdk/src/queries/epoch.rs (9 hunks)
  • packages/wasm-sdk/src/queries/group.rs (19 hunks)
  • packages/wasm-sdk/src/queries/identity.rs (31 hunks)
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs (19 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Format Rust code with cargo fmt
Run Clippy linter for Rust code

Files:

  • packages/wasm-sdk/src/queries/epoch.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
  • packages/wasm-dpp2/src/identifier.rs
packages/wasm-sdk/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep WASM SDK docs in sync (run generate_docs.py) when updating the WASM SDK

Files:

  • packages/wasm-sdk/src/queries/epoch.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
🧠 Learnings (26)
📓 Common learnings
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/api-definitions.json:1285-1285
Timestamp: 2025-09-03T19:33:21.688Z
Learning: In packages/wasm-sdk/api-definitions.json, thephez prefers to keep the existing "ripemd160hash20bytes1234" placeholder for ECDSA_HASH160 data field in documentation examples rather than using a valid base64-encoded format, maintaining consistency with the previous documentation approach.
📚 Learning: 2025-04-21T00:38:44.796Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2559
File: packages/rs-drive-abci/src/query/token_queries/token_perpetual_distribution_last_claim/v0/mod.rs:128-0
Timestamp: 2025-04-21T00:38:44.796Z
Learning: In the Dash Platform codebase, EpochIndex is defined as u16, making it safe to cast to u32 without overflow concerns.

Applied to files:

  • packages/wasm-sdk/src/queries/epoch.rs
📚 Learning: 2025-08-05T13:55:39.147Z
Learnt from: thephez
Repo: dashpay/platform PR: 2718
File: packages/wasm-sdk/index.html:0-0
Timestamp: 2025-08-05T13:55:39.147Z
Learning: The get_identity_keys_with_proof_info function in the Rust WASM bindings does not support the "search" key request type and lacks the searchPurposeMap parameter. When proof mode is enabled with keyRequestType === 'search', the implementation falls back to the non-proof version (get_identity_keys) to maintain functionality.

Applied to files:

  • packages/wasm-sdk/src/queries/epoch.rs
  • packages/wasm-sdk/src/queries/data_contract.rs
  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-04-11T09:08:05.652Z
Learnt from: pauldelucia
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/data_contract.rs
📚 Learning: 2025-04-11T09:08:05.652Z
Learnt from: pauldelucia
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/data_contract.rs
📚 Learning: 2025-05-28T16:22:26.334Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/data_contract.rs
📚 Learning: 2024-10-30T11:04:33.634Z
Learnt from: lklimek
Repo: dashpay/platform 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`.

Applied to files:

  • packages/wasm-sdk/src/queries/data_contract.rs
📚 Learning: 2025-06-18T03:44:14.385Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-02-10T11:26:36.709Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/group.rs
  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-07-28T20:00:08.502Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-07-28T20:00:24.323Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-10-30T11:19:59.163Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: shumkov
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: QuantumExplorer
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-10-29T14:40:54.727Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-11-20T20:43:41.185Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2257
File: packages/rs-drive-abci/tests/strategy_tests/masternodes.rs:212-220
Timestamp: 2024-11-20T20:43:41.185Z
Learning: In `packages/rs-drive-abci/tests/strategy_tests/masternodes.rs`, the pattern of generating a `PrivateKey`, converting it to bytes, and reconstructing a `BlsPrivateKey` from those bytes is intentional. Avoid suggesting to simplify this code in future reviews.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
  • packages/wasm-dpp2/src/identifier.rs
📚 Learning: 2024-11-20T16:05:40.200Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2257
File: packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs:148-151
Timestamp: 2024-11-20T16:05:40.200Z
Learning: In `packages/rs-drive-abci/src/platform_types/signature_verification_quorum_set/v0/for_saving.rs`, when converting public keys from `QuorumForSavingV0` to `VerificationQuorum`, it's acceptable to use `.expect()` for public key conversion, as the conversion has been verified and panics are acceptable in this context.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2207
File: packages/rs-drive-proof-verifier/src/proof.rs:1646-1664
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the implementation of `FromProof<platform::GetContestedResourceIdentityVotesRequest>` in `packages/rs-drive-proof-verifier/src/proof.rs`, when matching `maybe_votes`, using `.expect()` on `v.into_iter().next()` is acceptable because the prior match arm `Some(v) if v.is_empty()` ensures that the map is not empty, preventing a panic.

Applied to files:

  • packages/wasm-sdk/src/queries/identity.rs
📚 Learning: 2025-09-02T13:30:17.703Z
Learnt from: thephez
Repo: dashpay/platform PR: 2739
File: packages/wasm-sdk/test/ui-automation/tests/state-transitions.spec.js:1-171
Timestamp: 2025-09-02T13:30:17.703Z
Learning: In packages/wasm-sdk/index.html, state transition definitions are loaded dynamically from api-definitions.json rather than being hardcoded in the HTML file. The UI loads transition categories, types, inputs, and labels from this JSON configuration file.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-09-02T13:30:17.703Z
Learnt from: thephez
Repo: dashpay/platform PR: 2739
File: packages/wasm-sdk/test/ui-automation/tests/state-transitions.spec.js:1-171
Timestamp: 2025-09-02T13:30:17.703Z
Learning: In packages/wasm-sdk/index.html, state transition definitions are loaded dynamically from api-definitions.json via the loadApiDefinitions() function that fetches './api-definitions.json'. The UI doesn't have hardcoded transition definitions - instead it populates categories, types, inputs, and labels from this JSON configuration file at runtime.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-01-20T16:20:59.791Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount from crate::balances::credits is compatible with u64 when used for token base supply.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-01-20T16:20:59.791Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2432
File: packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/mod.rs:222-225
Timestamp: 2025-01-20T16:20:59.791Z
Learning: In the Dash Platform codebase, TokenAmount is defined as `type TokenAmount = u64` in balances/credits.rs, making it directly compatible with u64 values without any conversion needed.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-08-28T14:06:02.805Z
Learnt from: thephez
Repo: dashpay/platform PR: 2739
File: packages/wasm-sdk/test/ui-automation/fixtures/test-data.js:711-723
Timestamp: 2025-08-28T14:06:02.805Z
Learning: The tokenDestroyFrozen operation destroys the entire identity balance for that token and does not require an amount parameter.

Applied to files:

  • packages/wasm-sdk/src/state_transitions/tokens/mod.rs
📚 Learning: 2025-09-03T19:33:21.688Z
Learnt from: thephez
Repo: dashpay/platform PR: 2754
File: packages/wasm-sdk/api-definitions.json:1285-1285
Timestamp: 2025-09-03T19:33:21.688Z
Learning: In packages/wasm-sdk/api-definitions.json, thephez prefers to keep the existing "ripemd160hash20bytes1234" placeholder for ECDSA_HASH160 data field in documentation examples rather than using a valid base64-encoded format, maintaining consistency with the previous documentation approach.

Applied to files:

  • packages/wasm-dpp2/src/identifier.rs
📚 Learning: 2024-10-29T14:16:00.141Z
Learnt from: lklimek
Repo: dashpay/platform 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.

Applied to files:

  • packages/wasm-dpp2/src/identifier.rs
📚 Learning: 2024-10-04T14:09:58.852Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2207
File: packages/rs-sdk/src/mock/requests.rs:0-0
Timestamp: 2024-10-04T14:09:58.852Z
Learning: In Rust, when serializing `IndexMap<K, V>` with bincode, use `bincode::serde::encode_to_vec` and `bincode::serde::decode_from_slice` because `IndexMap` does not implement `bincode::Encode`.

Applied to files:

  • packages/wasm-dpp2/src/identifier.rs
🧬 Code graph analysis (6)
packages/wasm-sdk/src/queries/epoch.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (12-29)
packages/wasm-dpp2/src/error.rs (1)
  • invalid_argument (50-52)
packages/wasm-sdk/src/queries/data_contract.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (12-29)
packages/wasm-dpp2/src/identifier.rs (6)
  • try_from (43-55)
  • try_from (60-87)
  • try_from (92-94)
  • from (18-20)
  • from (24-26)
  • from (30-32)
packages/wasm-sdk/src/queries/group.rs (2)
packages/wasm-sdk/src/queries/utils.rs (4)
  • convert_optional_limit (49-69)
  • deserialize_required_query (12-29)
  • identifiers_from_js (94-102)
  • values (75-83)
packages/wasm-dpp2/src/identifier.rs (7)
  • from (18-20)
  • from (24-26)
  • from (30-32)
  • from (36-38)
  • try_from (43-55)
  • try_from (60-87)
  • try_from (92-94)
packages/wasm-sdk/src/queries/identity.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • deserialize_required_query (12-29)
packages/wasm-dpp2/src/identifier.rs (9)
  • try_from (43-55)
  • try_from (60-87)
  • try_from (92-94)
  • value (67-67)
  • value (75-75)
  • from (18-20)
  • from (24-26)
  • from (30-32)
  • from (36-38)
packages/wasm-sdk/src/state_transitions/tokens/mod.rs (2)
packages/wasm-sdk/src/queries/utils.rs (1)
  • identifier_from_js (88-92)
packages/wasm-sdk/src/queries/token.rs (2)
  • token_id (38-40)
  • calculate_token_id_from_contract (121-137)
packages/wasm-dpp2/src/identifier.rs (1)
packages/wasm-dpp2/src/error.rs (1)
  • invalid_argument (50-52)
⏰ 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). (9)
  • GitHub Check: Rust packages (wasm-sdk) / Unused dependencies
  • GitHub Check: Rust packages (wasm-sdk) / Tests
  • GitHub Check: Rust packages (wasm-sdk) / Linting
  • GitHub Check: Rust packages (wasm-dpp2) / Linting
  • GitHub Check: Rust packages (wasm-dpp2) / Unused dependencies
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build Docker images (RS-DAPI, rs-dapi, rs-dapi) / Build RS-DAPI image
  • GitHub Check: Build JS packages / Build JS
🔇 Additional comments (19)
packages/wasm-sdk/src/state_transitions/tokens/mod.rs (2)

6-6: LGTM: Clean integration of flexible identifier parsing.

The identifier_from_js helper is now consistently used throughout, and parse_token_params properly handles optional recipients with appropriate null/undefined guards. The error messages are descriptive and include field context.

Also applies to: 28-53


157-1377: Excellent refactoring: consistent flexible identifier handling across all token operations.

All 11 token operation functions have been systematically updated to:

  • Accept JsValue parameters allowing Identifier | Uint8Array | string inputs
  • Use identifier_from_js consistently for type conversion with descriptive error context
  • Maintain proper null/undefined handling for optional parameters
  • Update documentation comments to reflect new signatures

The implementation is type-safe, the error messages are clear, and the pattern is applied uniformly across mint, burn, transfer, freeze/unfreeze, destroy, pricing, purchase, claim, and configuration operations.

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

191-197: Good fix for overflow protection!

The try_into() validation properly guards against groupContractPosition overflow as flagged in previous reviews.

packages/wasm-sdk/src/queries/epoch.rs (7)

1-17: LGTM!

The imports are appropriate for the refactored query parsing flow, including the new deserialize_required_query helper and serde deserialization support.


52-110: LGTM!

The TypeScript definitions and parsing logic are well-structured with clear documentation. The use of Option<u32> for count is appropriate for general epoch queries.


178-261: LGTM!

The TypeScript definitions and parsing logic are well-structured. ProTxHash parsing includes proper error handling with clear error messages.


266-296: LGTM!

The refactored method correctly parses the query object and constructs the internal query. The logic is clear and properly handles optional fields.


299-350: LGTM!

The epoch range calculation correctly uses saturating arithmetic to handle edge cases safely. The query construction properly accounts for both ascending and descending order.


427-465: LGTM!

The proof variant correctly mirrors the non-proof implementation and properly returns metadata and proof information alongside the epochs.


483-534: LGTM!

The proof variant correctly mirrors the non-proof implementation with the same safe epoch range calculations and properly returns all required proof information.

packages/wasm-dpp2/src/identifier.rs (1)

97-174: LGTM! Deserialization implementation is well-structured.

The IdentifierWasmVisitor and try_from_str method correctly handle multiple identifier formats (hex, Base58, bytes, and JSON objects). The hex string support that was flagged in the previous review is now properly implemented at lines 165-169, which checks for 64-character hex strings before falling back to Base58.

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

220-368: LGTM! Well-structured query types and parsing.

The TypeScript definitions provide clear documentation for the IdentityKeysQuery API, and the Rust deserialization types are properly configured with serde attributes. The parse_identity_keys_query function correctly uses the deserialize_required_query helper to validate and parse the query input.


373-1010: LGTM! Consistent identifier parameter handling.

All identity-related methods now consistently accept JsValue (or Vec<JsValue>) parameters with proper conversion to Identifier via IdentifierWasm::try_from. Error messages are clear and informative. The pattern is applied uniformly across all non-query methods.


1159-1515: LGTM! Proof-enabled methods follow consistent patterns.

All proof-enabled identity query methods consistently handle JsValue parameters and convert them to Identifier instances using the same pattern as their non-proof counterparts. Error handling is appropriate throughout.

packages/wasm-sdk/src/queries/data_contract.rs (5)

128-170: LGTM: Identifier parsing follows best practices.

The migration from string-based contract IDs to flexible JsValue parameters with IdentifierWasm::try_from correctly handles multiple input formats (Identifier, Uint8Array, string) with proper error wrapping.


172-261: LGTM: History query methods cleanly refactored.

The refactor to use DataContractHistoryQueryJs provides better API ergonomics while maintaining the existing logic for history retrieval and Map construction.


196-302: LGTM: Batch contract fetching with flexible identifier inputs.

The refactor to accept Vec<JsValue> with per-element parsing and error handling is well-implemented. The use of into_iter() and early error propagation via collect() is idiomatic Rust.


48-124: IdentifierWasm deserialization verified; confirm test coverage and documentation updates.

The IdentifierWasm type correctly implements serde::Deserialize, so the deserialization at line 82 will work properly with serde_wasm_bindgen. The query parsing infrastructure is well-designed.

However, please verify:

  1. Test coverage: No tests found for DataContractHistoryQuery in the test suite. Confirm that packages/wasm-sdk/tests/unit/data-contract.spec.mjs includes tests for the new parse_data_contract_history_query function and the updated query methods.

  2. Documentation generation: The coding guideline references generate_docs.py, but this file doesn't exist in the repository. Clarify whether documentation updates are required for this new query type and the breaking changes to existing methods.

  3. Coding standards: Ensure cargo fmt has been applied and clippy warnings have been addressed for packages/wasm-sdk/src/queries/data_contract.rs.


1-303: Review comment is valid; manual verification required due to sandbox limitations.

The review comment correctly references the WASM SDK development workflow documented in CLAUDE.md. The python3 generate_docs.py script does exist and should be run after API changes to keep AI_REFERENCE.md in sync per coding guidelines. Additionally, the breaking API change (query object vs positional parameters) warrants verification of calling code. However, existing callers in js-evo-sdk already use the compatible query object format.

Since sandbox environment limitations prevented direct verification of documentation generation and Rust tooling execution, manual verification is needed.

@shumkov shumkov merged commit 912ac2a into v2.2-dev Nov 4, 2025
32 checks passed
@shumkov shumkov deleted the wasm-sdk-params branch November 4, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants