From 10f61961c134256e5a73478909fe47d49218c03b Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Sun, 22 Feb 2026 14:24:22 +0700 Subject: [PATCH 1/3] fix(wasm): use string keys instead of object keys in JavaScript Maps JavaScript Map uses reference equality for object keys, making lookups fail when a new object is constructed from the same bytes. Convert all IdentifierWasm keys to base58 strings and PlatformAddressWasm keys to hex strings. ProTxHash-based keys use hex to match ProTxHash conventions. Update unchecked_return_type annotations from Map to Map accordingly. Co-Authored-By: Claude Opus 4.6 --- .../src/state_transitions/proof_result.rs | 4 +- packages/wasm-dpp2/tests/unit/Group.spec.ts | 4 +- .../wasm-dpp2/tests/unit/ProofResult.spec.ts | 4 +- .../tests/unit/TokenConfiguration.spec.ts | 3 +- .../tests/unit/TokenDistributionRules.spec.ts | 3 +- .../TokenPreProgrammedDistribution.spec.ts | 7 +--- .../tests/unit/js-value-to-json.spec.ts | 2 +- packages/wasm-sdk/src/queries/address.rs | 8 ++-- .../wasm-sdk/src/queries/data_contract.rs | 8 ++-- packages/wasm-sdk/src/queries/document.rs | 8 ++-- packages/wasm-sdk/src/queries/epoch.rs | 16 ++++---- packages/wasm-sdk/src/queries/group.rs | 30 +++++++------- packages/wasm-sdk/src/queries/identity.rs | 16 ++++---- packages/wasm-sdk/src/queries/token.rs | 40 +++++++++---------- packages/wasm-sdk/src/queries/voting/votes.rs | 8 ++-- .../src/state_transitions/addresses.rs | 8 ++-- .../tests/functional/epochs-blocks.spec.ts | 8 +--- .../tests/functional/identities.spec.ts | 2 +- 18 files changed, 84 insertions(+), 95 deletions(-) diff --git a/packages/wasm-dpp2/src/state_transitions/proof_result.rs b/packages/wasm-dpp2/src/state_transitions/proof_result.rs index 619328fbd8b..e6e0509048a 100644 --- a/packages/wasm-dpp2/src/state_transitions/proof_result.rs +++ b/packages/wasm-dpp2/src/state_transitions/proof_result.rs @@ -786,7 +786,7 @@ pub fn convert_proof_result( StateTransitionProofResult::VerifiedTokenIdentitiesBalances(balances) => { let map = Map::from_entries(balances.into_iter().map(|(id, amount)| { - let key: JsValue = IdentifierWasm::from(id).into(); + let key: JsValue = IdentifierWasm::from(id).to_base58().into(); let val: JsValue = BigInt::from(amount).into(); (key, val) })); @@ -808,7 +808,7 @@ pub fn convert_proof_result( StateTransitionProofResult::VerifiedDocuments(docs) => { let map = Map::from_entries(docs.into_iter().map(|(id, maybe_doc)| { - let key: JsValue = IdentifierWasm::from(id).into(); + let key: JsValue = IdentifierWasm::from(id).to_base58().into(); let val: JsValue = match maybe_doc { Some(doc) => doc_to_wasm(doc).into(), None => JsValue::undefined(), diff --git a/packages/wasm-dpp2/tests/unit/Group.spec.ts b/packages/wasm-dpp2/tests/unit/Group.spec.ts index 5c92aaa7ac7..8041d973b20 100644 --- a/packages/wasm-dpp2/tests/unit/Group.spec.ts +++ b/packages/wasm-dpp2/tests/unit/Group.spec.ts @@ -9,9 +9,9 @@ describe('Group', () => { const memberIdHex = '1111111111111111111111111111111111111111111111111111111111111111'; const member2IdHex = '2222222222222222222222222222222222222222222222222222222222222222'; function createMembersMap(membersArray: Array<[InstanceType, number]>) { - const map = new Map, number>(); + const map = new Map(); for (const [identifier, power] of membersArray) { - map.set(identifier, power); + map.set(identifier.toBase58(), power); } return map; } diff --git a/packages/wasm-dpp2/tests/unit/ProofResult.spec.ts b/packages/wasm-dpp2/tests/unit/ProofResult.spec.ts index 58fd19b9f5a..68845856748 100644 --- a/packages/wasm-dpp2/tests/unit/ProofResult.spec.ts +++ b/packages/wasm-dpp2/tests/unit/ProofResult.spec.ts @@ -371,7 +371,7 @@ describe('StateTransitionProofResult types', () => { it('should round-trip through fromObject/toObject with Map', () => { const id1 = new wasm.Identifier(identifier); const balancesMap = new Map(); - balancesMap.set(id1, 999000n); + balancesMap.set(id1.toBase58(), 999000n); const data = { balances: balancesMap }; const result = wasm.VerifiedTokenIdentitiesBalances.fromObject(data); @@ -399,7 +399,7 @@ describe('StateTransitionProofResult types', () => { const id1 = new wasm.Identifier(identifier); const docsMap = new Map(); // null values represent absent documents - docsMap.set(id1, null); + docsMap.set(id1.toBase58(), null); const data = { documents: docsMap }; const result = wasm.VerifiedDocuments.fromObject(data); diff --git a/packages/wasm-dpp2/tests/unit/TokenConfiguration.spec.ts b/packages/wasm-dpp2/tests/unit/TokenConfiguration.spec.ts index 32cd7e5b568..8a627798c4f 100644 --- a/packages/wasm-dpp2/tests/unit/TokenConfiguration.spec.ts +++ b/packages/wasm-dpp2/tests/unit/TokenConfiguration.spec.ts @@ -45,9 +45,8 @@ describe('TokenConfiguration', () => { }); } function createPreProgrammedDistribution(timestamp: number, identifierBase58: string, amount: bigint) { - const identifier = new wasm.Identifier(identifierBase58); const innerMap = new Map(); - innerMap.set(identifier, amount); + innerMap.set(identifierBase58, amount); const outerMap = new Map(); outerMap.set(timestamp.toString(), innerMap); return new wasm.TokenPreProgrammedDistribution(outerMap); diff --git a/packages/wasm-dpp2/tests/unit/TokenDistributionRules.spec.ts b/packages/wasm-dpp2/tests/unit/TokenDistributionRules.spec.ts index 7f2cf5fc132..9cbe6019d04 100644 --- a/packages/wasm-dpp2/tests/unit/TokenDistributionRules.spec.ts +++ b/packages/wasm-dpp2/tests/unit/TokenDistributionRules.spec.ts @@ -29,9 +29,8 @@ function createChangeControlRules( // Helper to create pre-programmed distribution with proper Map format function createPreProgrammedDistribution(timestamp: number, identifierBase58: string, amount: bigint) { - const id = new wasm.Identifier(identifierBase58); const innerMap = new Map(); - innerMap.set(id, amount); + innerMap.set(identifierBase58, amount); const outerMap = new Map(); outerMap.set(timestamp.toString(), innerMap); return new wasm.TokenPreProgrammedDistribution(outerMap); diff --git a/packages/wasm-dpp2/tests/unit/TokenPreProgrammedDistribution.spec.ts b/packages/wasm-dpp2/tests/unit/TokenPreProgrammedDistribution.spec.ts index 1c97e14982d..3bfff263eb8 100644 --- a/packages/wasm-dpp2/tests/unit/TokenPreProgrammedDistribution.spec.ts +++ b/packages/wasm-dpp2/tests/unit/TokenPreProgrammedDistribution.spec.ts @@ -6,15 +6,10 @@ before(async () => { }); describe('TokenPreProgrammedDistribution', () => { - // Helper to create an Identifier object for testing - function createIdentifier(base58String: string) { - return new wasm.Identifier(base58String); - } - // Helper to create distributions Map in the expected format function createDistributionsMap(timestamp: string, identifierStr: string, amount: bigint) { const innerMap = new Map(); - innerMap.set(createIdentifier(identifierStr), amount); + innerMap.set(identifierStr, amount); const outerMap = new Map(); outerMap.set(timestamp.toString(), innerMap); diff --git a/packages/wasm-dpp2/tests/unit/js-value-to-json.spec.ts b/packages/wasm-dpp2/tests/unit/js-value-to-json.spec.ts index fbcd211b9e7..c624e8df873 100644 --- a/packages/wasm-dpp2/tests/unit/js-value-to-json.spec.ts +++ b/packages/wasm-dpp2/tests/unit/js-value-to-json.spec.ts @@ -161,7 +161,7 @@ describe('testJsValueToJson', () => { const id1 = wasm.Identifier.fromBase58('H2pb35GtKpjLinncBYeMsXkdDYXCbsFzzVmssce6pSJ1'); const id2 = wasm.Identifier.fromBase58('ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U'); - // This simulates getEvonodesProposedEpochBlocksByIds which returns Map + // This simulates getEvonodesProposedEpochBlocksByIds which returns Map const map = new Map([ [id1, 100n], [id2, 200n], diff --git a/packages/wasm-sdk/src/queries/address.rs b/packages/wasm-sdk/src/queries/address.rs index 18b85bf3bf2..ce8b5e66f0b 100644 --- a/packages/wasm-sdk/src/queries/address.rs +++ b/packages/wasm-sdk/src/queries/address.rs @@ -115,7 +115,7 @@ impl WasmSdk { /// @returns Map of PlatformAddress to PlatformAddressInfo (or undefined for unfunded addresses) #[wasm_bindgen( js_name = "getAddressesInfos", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_addresses_infos( &self, @@ -132,7 +132,7 @@ impl WasmSdk { let results_map = Map::new(); for address in platform_addresses { - let key = JsValue::from(PlatformAddressWasm::from(address)); + let key: JsValue = PlatformAddressWasm::from(address).to_hex().into(); let value = match address_infos.get(&address).and_then(|opt| opt.as_ref()) { Some(info) => { let wrapper = PlatformAddressInfoWasm::from(info.clone()); @@ -152,7 +152,7 @@ impl WasmSdk { /// @returns ProofMetadataResponse containing Map of PlatformAddress to PlatformAddressInfo #[wasm_bindgen( js_name = "getAddressesInfosWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_addresses_infos_with_proof_info( &self, @@ -174,7 +174,7 @@ impl WasmSdk { let results_map = Map::new(); for address in platform_addresses { - let key = JsValue::from(PlatformAddressWasm::from(address)); + let key: JsValue = PlatformAddressWasm::from(address).to_hex().into(); let value = match address_infos.get(&address).and_then(|opt| opt.as_ref()) { Some(info) => { let wrapper = PlatformAddressInfoWasm::from(info.clone()); diff --git a/packages/wasm-sdk/src/queries/data_contract.rs b/packages/wasm-sdk/src/queries/data_contract.rs index a199a21670b..c7bce4f40a9 100644 --- a/packages/wasm-sdk/src/queries/data_contract.rs +++ b/packages/wasm-sdk/src/queries/data_contract.rs @@ -164,7 +164,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getDataContracts", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_data_contracts( &self, @@ -181,7 +181,7 @@ impl WasmSdk { let contracts_map = Map::new(); for (id, contract) in contracts_result { - let key = JsValue::from(IdentifierWasm::from(id)); + let key: JsValue = IdentifierWasm::from(id).to_base58().into(); let value = contract.map(DataContractWasm::from); contracts_map.set(&key, &JsValue::from(value)); } @@ -226,7 +226,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getDataContractsWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_data_contracts_with_proof_info( &self, @@ -244,7 +244,7 @@ impl WasmSdk { let contracts_map = Map::new(); for (id, contract_opt) in contracts_result { - let key = JsValue::from(IdentifierWasm::from(id)); + let key: JsValue = IdentifierWasm::from(id).to_base58().into(); let value = contract_opt.map(DataContractWasm::from); contracts_map.set(&key, &JsValue::from(value)); diff --git a/packages/wasm-sdk/src/queries/document.rs b/packages/wasm-sdk/src/queries/document.rs index 8ed729bb09c..bb6a9da45f3 100644 --- a/packages/wasm-sdk/src/queries/document.rs +++ b/packages/wasm-sdk/src/queries/document.rs @@ -306,7 +306,7 @@ fn json_to_platform_value(json_val: &JsonValue) -> Result { impl WasmSdk { #[wasm_bindgen( js_name = "getDocuments", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_documents(&self, query: DocumentsQueryJs) -> Result { use dash_sdk::platform::FetchMany; @@ -322,7 +322,7 @@ impl WasmSdk { let doc_type_name = document_type_name; for (doc_id, doc_opt) in documents_result { - let key = JsValue::from(IdentifierWasm::from(doc_id)); + let key: JsValue = IdentifierWasm::from(doc_id).to_base58().into(); match doc_opt { Some(doc) => { @@ -340,7 +340,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getDocumentsWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_documents_with_proof_info( &self, @@ -357,7 +357,7 @@ impl WasmSdk { let doc_type_name = document_type_name; for (doc_id, doc_opt) in documents_result { - let key = JsValue::from(IdentifierWasm::from(doc_id)); + let key: JsValue = IdentifierWasm::from(doc_id).to_base58().into(); match doc_opt { Some(doc) => { diff --git a/packages/wasm-sdk/src/queries/epoch.rs b/packages/wasm-sdk/src/queries/epoch.rs index 17d88708848..d2b66dcf041 100644 --- a/packages/wasm-sdk/src/queries/epoch.rs +++ b/packages/wasm-sdk/src/queries/epoch.rs @@ -315,7 +315,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getEvonodesProposedEpochBlocksByIds", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_evonodes_proposed_epoch_blocks_by_ids( &self, @@ -334,7 +334,7 @@ impl WasmSdk { Ok(Map::from_entries(counts.0.into_iter().map( |(identifier, count)| { - let key = JsValue::from(IdentifierWasm::from(identifier)); + let key: JsValue = IdentifierWasm::from(identifier).to_hex().into(); let value = JsValue::from(BigInt::from(count)); (key, value) }, @@ -343,7 +343,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getEvonodesProposedEpochBlocksByRange", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_evonodes_proposed_epoch_blocks_by_range( &self, @@ -367,7 +367,7 @@ impl WasmSdk { Ok(Map::from_entries(counts_result.0.into_iter().map( |(identifier, count)| { - let key = JsValue::from(IdentifierWasm::from(identifier)); + let key: JsValue = IdentifierWasm::from(identifier).to_hex().into(); let value = JsValue::from(BigInt::from(count)); (key, value) }, @@ -497,7 +497,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getEvonodesProposedEpochBlocksByIdsWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_evonodes_proposed_epoch_blocks_by_ids_with_proof_info( &self, @@ -519,7 +519,7 @@ impl WasmSdk { .await?; let map = Map::from_entries(counts.0.into_iter().map(|(identifier, count)| { - let key = JsValue::from(IdentifierWasm::from(identifier)); + let key: JsValue = IdentifierWasm::from(identifier).to_base58().into(); let value = JsValue::from(BigInt::from(count)); (key, value) })); @@ -531,7 +531,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getEvonodesProposedEpochBlocksByRangeWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_evonodes_proposed_epoch_blocks_by_range_with_proof_info( &self, @@ -561,7 +561,7 @@ impl WasmSdk { .await?; let map = Map::from_entries(counts.0.into_iter().map(|(identifier, count)| { - let key = JsValue::from(IdentifierWasm::from(identifier)); + let key: JsValue = IdentifierWasm::from(identifier).to_base58().into(); let value = JsValue::from(BigInt::from(count)); (key, value) })); diff --git a/packages/wasm-sdk/src/queries/group.rs b/packages/wasm-sdk/src/queries/group.rs index 8b1292771a0..16518feee99 100644 --- a/packages/wasm-sdk/src/queries/group.rs +++ b/packages/wasm-sdk/src/queries/group.rs @@ -601,7 +601,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupMembers", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_group_members(&self, query: GroupMembersQueryJs) -> Result { let params = parse_group_members_query(query)?; @@ -718,7 +718,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupActions", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_group_actions(&self, query: GroupActionsQueryJs) -> Result { let params = parse_group_actions_query(query)?; @@ -737,7 +737,7 @@ impl WasmSdk { Ok(Map::from_entries(actions_result.into_iter().map( |(action_id, action_opt)| { - let key = JsValue::from(IdentifierWasm::from(action_id)); + let key: JsValue = IdentifierWasm::from(action_id).to_base58().into(); let value = JsValue::from(action_opt.map(GroupActionWasm::from)); (key, value) }, @@ -746,7 +746,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupActionSigners", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_group_action_signers( &self, @@ -768,7 +768,7 @@ impl WasmSdk { Ok(Map::from_entries(signers_result.into_iter().filter_map( |(signer_id, power_opt)| { power_opt.map(|power| { - let key = JsValue::from(IdentifierWasm::from(signer_id)); + let key: JsValue = IdentifierWasm::from(signer_id).to_base58().into(); let value = JsValue::from(BigInt::from(power as u64)); (key, value) }) @@ -778,7 +778,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupsDataContracts", - unchecked_return_type = "Map>" + unchecked_return_type = "Map>" )] pub async fn get_groups_data_contracts( &self, @@ -792,7 +792,7 @@ impl WasmSdk { let contracts_map = Map::new(); for contract_id in contract_identifiers { - let contract_key = JsValue::from(IdentifierWasm::from(contract_id)); + let contract_key: JsValue = IdentifierWasm::from(contract_id).to_base58().into(); // Fetch all groups for this contract let query = GroupInfosQuery { @@ -888,7 +888,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupMembersWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_group_members_with_proof_info( &self, @@ -999,7 +999,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupActionsWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_group_actions_with_proof_info( &self, @@ -1022,7 +1022,7 @@ impl WasmSdk { let actions_map = Map::from_entries(actions_result.into_iter().map(|(action_id, action_opt)| { - let key = JsValue::from(IdentifierWasm::from(action_id)); + let key: JsValue = IdentifierWasm::from(action_id).to_base58().into(); let value = JsValue::from(action_opt.map(GroupActionWasm::from)); (key, value) })); @@ -1036,7 +1036,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupActionSignersWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_group_action_signers_with_proof_info( &self, @@ -1058,7 +1058,7 @@ impl WasmSdk { let signers_map = Map::from_entries(signers_result.into_iter().filter_map( |(signer_id, power_opt)| { power_opt.map(|power| { - let key = JsValue::from(IdentifierWasm::from(signer_id)); + let key: JsValue = IdentifierWasm::from(signer_id).to_base58().into(); let value = JsValue::from(BigInt::from(power as u64)); (key, value) }) @@ -1074,7 +1074,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getGroupsDataContractsWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>>" + unchecked_return_type = "ProofMetadataResponseTyped>>" )] pub async fn get_groups_data_contracts_with_proof_info( &self, @@ -1090,7 +1090,7 @@ impl WasmSdk { try_to_vec::(data_contract_ids, "dataContractIds", "identifier")?; for contract_id in contract_identifiers { - let contract_key = JsValue::from(IdentifierWasm::from(contract_id)); + let contract_key: JsValue = IdentifierWasm::from(contract_id).to_base58().into(); // Fetch all groups for this contract with proof let query = GroupInfosQuery { @@ -1130,7 +1130,7 @@ fn insert_member( identifier: Identifier, power: GroupMemberPower, ) -> Result<(), WasmSdkError> { - let key = JsValue::from(IdentifierWasm::from(identifier)); + let key: JsValue = IdentifierWasm::from(identifier).to_base58().into(); let value = JsValue::from(BigInt::from(power as u64)); map.set(&key, &value); Ok(()) diff --git a/packages/wasm-sdk/src/queries/identity.rs b/packages/wasm-sdk/src/queries/identity.rs index cc0e39e46a3..a07d2df3e0a 100644 --- a/packages/wasm-sdk/src/queries/identity.rs +++ b/packages/wasm-sdk/src/queries/identity.rs @@ -656,7 +656,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentitiesBalances", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_identities_balances( &self, @@ -675,7 +675,7 @@ impl WasmSdk { let results_map = Map::new(); for identifier in identifiers { - let key = JsValue::from(IdentifierWasm::from(identifier)); + let key: JsValue = IdentifierWasm::from(identifier).to_base58().into(); let value = match balances_result.get(&identifier) { Some(Some(balance)) => BigInt::from(*balance).into(), _ => JsValue::NULL, @@ -807,7 +807,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentityTokenBalances", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_identity_token_balances( &self, @@ -838,7 +838,7 @@ impl WasmSdk { let balances_map = Map::new(); for token_id in token_identifiers { if let Some(Some(balance)) = balances.get(&token_id) { - let key = JsValue::from(IdentifierWasm::from(token_id)); + let key: JsValue = IdentifierWasm::from(token_id).to_base58().into(); let value = JsValue::from(BigInt::from(*balance)); balances_map.set(&key, &value); } @@ -939,7 +939,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentitiesBalancesWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_identities_balances_with_proof_info( &self, @@ -965,7 +965,7 @@ impl WasmSdk { let balances_map = Map::new(); for identifier in identifiers { - let key = JsValue::from(IdentifierWasm::from(identifier)); + let key: JsValue = IdentifierWasm::from(identifier).to_base58().into(); let value = match balances_result.get(&identifier) { Some(Some(balance)) => BigInt::from(*balance).into(), _ => JsValue::NULL, @@ -1135,7 +1135,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentityTokenBalancesWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_identity_token_balances_with_proof_info( &self, @@ -1169,7 +1169,7 @@ impl WasmSdk { let balances_map = Map::new(); for token_id in token_identifiers { if let Some(Some(balance)) = balances.get(&token_id) { - let key = JsValue::from(IdentifierWasm::from(token_id)); + let key: JsValue = IdentifierWasm::from(token_id).to_base58().into(); let value = JsValue::from(BigInt::from(*balance)); balances_map.set(&key, &value); } diff --git a/packages/wasm-sdk/src/queries/token.rs b/packages/wasm-sdk/src/queries/token.rs index a8d5dd0f8a8..487ae185e15 100644 --- a/packages/wasm-sdk/src/queries/token.rs +++ b/packages/wasm-sdk/src/queries/token.rs @@ -244,7 +244,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentitiesTokenBalances", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_identities_token_balances( &self, @@ -276,7 +276,7 @@ impl WasmSdk { let balances_map = Map::new(); for identifier in &identities { if let Some(Some(balance)) = balances_result.get(identifier) { - let key = JsValue::from(IdentifierWasm::from(*identifier)); + let key: JsValue = IdentifierWasm::from(*identifier).to_base58().into(); let value = JsValue::from(BigInt::from(*balance)); balances_map.set(&key, &value); } @@ -287,7 +287,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentityTokenInfos", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_identity_token_infos( &self, @@ -320,7 +320,7 @@ impl WasmSdk { for token in tokens { if let Some(Some(info)) = infos_result.get(&token) { let info_wasm = IdentityTokenInfoWasm::from(info.clone()); - let key = JsValue::from(IdentifierWasm::from(token)); + let key: JsValue = IdentifierWasm::from(token).to_base58().into(); let value = JsValue::from(info_wasm); infos_map.set(&key, &value); } @@ -331,7 +331,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentitiesTokenInfos", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_identities_token_infos( &self, @@ -364,7 +364,7 @@ impl WasmSdk { for identity in identities { if let Some(Some(info)) = infos_result.get(&identity) { let info_wasm = IdentityTokenInfoWasm::from(info.clone()); - let key = JsValue::from(IdentifierWasm::from(identity)); + let key: JsValue = IdentifierWasm::from(identity).to_base58().into(); let value = JsValue::from(info_wasm); infos_map.set(&key, &value); } @@ -375,7 +375,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getTokenStatuses", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_token_statuses( &self, @@ -394,7 +394,7 @@ impl WasmSdk { let statuses_map = Map::new(); for token in tokens { if let Some(Some(status)) = statuses_result.get(&token) { - let key = JsValue::from(IdentifierWasm::from(token)); + let key: JsValue = IdentifierWasm::from(token).to_base58().into(); let value = JsValue::from(TokenStatusWasm::from(status.clone())); statuses_map.set(&key, &value); } @@ -405,7 +405,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getTokenDirectPurchasePrices", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_token_direct_purchase_prices( &self, @@ -447,7 +447,7 @@ impl WasmSdk { let price_info = TokenPriceInfoWasm::new(token_id_wasm, current_price, base_price); - let key = JsValue::from(token_id_wasm); + let key: JsValue = token_id_wasm.to_base58().into(); let value = JsValue::from(price_info); prices_map.set(&key, &value); } @@ -527,7 +527,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentitiesTokenBalancesWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_identities_token_balances_with_proof_info( &self, @@ -561,7 +561,7 @@ impl WasmSdk { let balances_map = Map::new(); for identifier in &identities { if let Some(Some(balance)) = balances_result.get(identifier) { - let key = JsValue::from(IdentifierWasm::from(*identifier)); + let key: JsValue = IdentifierWasm::from(*identifier).to_base58().into(); let value = JsValue::from(BigInt::from(*balance)); balances_map.set(&key, &value); } @@ -576,7 +576,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getTokenStatusesWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_token_statuses_with_proof_info( &self, @@ -594,7 +594,7 @@ impl WasmSdk { let statuses_map = Map::new(); for token in tokens { if let Some(Some(status)) = statuses_result.get(&token) { - let key = JsValue::from(IdentifierWasm::from(token)); + let key: JsValue = IdentifierWasm::from(token).to_base58().into(); let value = JsValue::from(TokenStatusWasm::from(status.clone())); statuses_map.set(&key, &value); } @@ -645,7 +645,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentityTokenInfosWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_identity_token_infos_with_proof_info( &self, @@ -679,7 +679,7 @@ impl WasmSdk { for token in tokens { if let Some(Some(info)) = infos_result.get(&token) { let info_wasm = IdentityTokenInfoWasm::from(info.clone()); - let key = JsValue::from(IdentifierWasm::from(token)); + let key: JsValue = IdentifierWasm::from(token).to_base58().into(); let value = JsValue::from(info_wasm); infos_map.set(&key, &value); } @@ -692,7 +692,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getIdentitiesTokenInfosWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_identities_token_infos_with_proof_info( &self, @@ -726,7 +726,7 @@ impl WasmSdk { for identity in identities { if let Some(Some(info)) = infos_result.get(&identity) { let info_wasm = IdentityTokenInfoWasm::from(info.clone()); - let key = JsValue::from(IdentifierWasm::from(identity)); + let key: JsValue = IdentifierWasm::from(identity).to_base58().into(); let value = JsValue::from(info_wasm); infos_map.set(&key, &value); } @@ -739,7 +739,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getTokenDirectPurchasePricesWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_token_direct_purchase_prices_with_proof_info( &self, @@ -785,7 +785,7 @@ impl WasmSdk { let price_info = TokenPriceInfoWasm::new(token_id_wasm, current_price, base_price); - let key = JsValue::from(token_id_wasm); + let key: JsValue = token_id_wasm.to_base58().into(); let value = JsValue::from(price_info); prices_map.set(&key, &value); } diff --git a/packages/wasm-sdk/src/queries/voting/votes.rs b/packages/wasm-sdk/src/queries/voting/votes.rs index b61ae2b40f1..69264641770 100644 --- a/packages/wasm-sdk/src/queries/voting/votes.rs +++ b/packages/wasm-sdk/src/queries/voting/votes.rs @@ -126,7 +126,7 @@ fn parse_contested_resource_identity_votes_query( build_contested_resource_identity_votes_query(input) } -/// Convert ResourceVotesByIdentity to a Map. +/// Convert ResourceVotesByIdentity to a Map. fn resource_votes_to_map(votes: ResourceVotesByIdentity) -> Map { let map = Map::new(); @@ -135,7 +135,7 @@ fn resource_votes_to_map(votes: ResourceVotesByIdentity) -> Map { continue; }; - let key = JsValue::from(IdentifierWasm::from(vote_id)); + let key: JsValue = IdentifierWasm::from(vote_id).to_base58().into(); let value = JsValue::from(ResourceVoteWasm::from(vote)); map.set(&key, &value); @@ -148,7 +148,7 @@ fn resource_votes_to_map(votes: ResourceVotesByIdentity) -> Map { impl WasmSdk { #[wasm_bindgen( js_name = "getContestedResourceIdentityVotes", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn get_contested_resource_identity_votes( &self, @@ -163,7 +163,7 @@ impl WasmSdk { #[wasm_bindgen( js_name = "getContestedResourceIdentityVotesWithProofInfo", - unchecked_return_type = "ProofMetadataResponseTyped>" + unchecked_return_type = "ProofMetadataResponseTyped>" )] pub async fn get_contested_resource_identity_votes_with_proof_info( &self, diff --git a/packages/wasm-sdk/src/state_transitions/addresses.rs b/packages/wasm-sdk/src/state_transitions/addresses.rs index be51d42477f..90cd51c94ad 100644 --- a/packages/wasm-sdk/src/state_transitions/addresses.rs +++ b/packages/wasm-sdk/src/state_transitions/addresses.rs @@ -47,7 +47,7 @@ fn address_infos_to_js_map( address, operation_name )) })?; - let key = JsValue::from(PlatformAddressWasm::from(address)); + let key: JsValue = PlatformAddressWasm::from(address).to_hex().into(); let value = JsValue::from(PlatformAddressInfoWasm::from(info)); map.set(&key, &value); } @@ -149,7 +149,7 @@ impl WasmSdk { /// @returns Promise resolving to Map of PlatformAddress to PlatformAddressInfo #[wasm_bindgen( js_name = "addressFundsTransfer", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn address_funds_transfer( &self, @@ -419,7 +419,7 @@ impl WasmSdk { /// @returns Promise resolving to Map of PlatformAddress to PlatformAddressInfo #[wasm_bindgen( js_name = "addressFundsWithdraw", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn address_funds_withdraw( &self, @@ -713,7 +713,7 @@ impl WasmSdk { /// @returns Promise resolving to Map of PlatformAddress to PlatformAddressInfo #[wasm_bindgen( js_name = "addressFundingFromAssetLock", - unchecked_return_type = "Map" + unchecked_return_type = "Map" )] pub async fn address_funding_from_asset_lock( &self, diff --git a/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts b/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts index 30ae1196352..26799630099 100644 --- a/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts +++ b/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts @@ -100,14 +100,10 @@ describe('Epochs and Evonode Blocks', function describeEpochs() { // Get a proTxHash from the results (or use node's proTxHash if available) let testProTxHash = evonodeProTxHash; if (!testProTxHash && byRange.size > 0) { - // The keys in the map are Identifier objects - // Need to convert to hex for the API (ProTxHash requires 64 hex chars) + // The keys in the map are base58 strings (Identifier.toBase58()) const firstKey = byRange.keys().next().value; if (firstKey) { - // Convert Identifier bytes to hex string using toBytes() - testProTxHash = Array.from(firstKey.toBytes() as Uint8Array) - .map((b: number) => b.toString(16).padStart(2, '0')) - .join(''); + testProTxHash = firstKey; } } diff --git a/packages/wasm-sdk/tests/functional/identities.spec.ts b/packages/wasm-sdk/tests/functional/identities.spec.ts index 2c7a5ce4abc..e11fcbd9b39 100644 --- a/packages/wasm-sdk/tests/functional/identities.spec.ts +++ b/packages/wasm-sdk/tests/functional/identities.spec.ts @@ -169,7 +169,7 @@ describe('Identities', function describeIdentities() { describe('getIdentitiesBalances()', () => { it('should get batch identity balances', async () => { - // getIdentitiesBalances returns Map + // getIdentitiesBalances returns Map where keys are base58-encoded identifiers const balances = await client.getIdentitiesBalances([TEST_IDENTITY]); expect(balances).to.be.instanceOf(Map); expect(balances.size).to.equal(1); From 839e7c1e210e3f07c14058060054b3ab5e92d805 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Sun, 22 Feb 2026 16:02:40 +0700 Subject: [PATCH 2/3] fix(wasm): address PR review comments - Use ProTxHashWasm for ProTxHash map keys in epoch.rs instead of IdentifierWasm, with hex encoding matching ProTxHash conventions - Add From for ProTxHashWasm conversion - Fix stale doc comments in addresses.rs, proof_result.rs, and epochs-blocks.spec.ts to reflect string key types Co-Authored-By: Claude Opus 4.6 --- packages/wasm-dpp2/src/core/pro_tx_hash.rs | 6 ++++++ packages/wasm-dpp2/src/state_transitions/proof_result.rs | 4 ++-- packages/wasm-sdk/src/queries/epoch.rs | 9 ++++----- packages/wasm-sdk/src/state_transitions/addresses.rs | 2 +- packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts | 2 +- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/wasm-dpp2/src/core/pro_tx_hash.rs b/packages/wasm-dpp2/src/core/pro_tx_hash.rs index 0fd0bf3e6a7..447d1c83254 100644 --- a/packages/wasm-dpp2/src/core/pro_tx_hash.rs +++ b/packages/wasm-dpp2/src/core/pro_tx_hash.rs @@ -157,4 +157,10 @@ impl From for ProTxHashWasm { } } +impl From for ProTxHashWasm { + fn from(id: dpp::platform_value::Identifier) -> Self { + ProTxHashWasm(ProTxHash::from_byte_array(id.to_buffer())) + } +} + impl_wasm_type_info!(ProTxHashWasm, ProTxHash); diff --git a/packages/wasm-dpp2/src/state_transitions/proof_result.rs b/packages/wasm-dpp2/src/state_transitions/proof_result.rs index e6e0509048a..ec8d2011634 100644 --- a/packages/wasm-dpp2/src/state_transitions/proof_result.rs +++ b/packages/wasm-dpp2/src/state_transitions/proof_result.rs @@ -246,7 +246,7 @@ impl_wasm_conversions!(VerifiedTokenStatusWasm, VerifiedTokenStatus); #[wasm_bindgen(js_name = "VerifiedTokenIdentitiesBalances")] #[derive(Clone)] pub struct VerifiedTokenIdentitiesBalancesWasm { - balances: Map, // Map + balances: Map, // Map } #[wasm_bindgen(js_class = VerifiedTokenIdentitiesBalances)] @@ -319,7 +319,7 @@ impl_wasm_conversions!(VerifiedBalanceTransferWasm, VerifiedBalanceTransfer); #[wasm_bindgen(js_name = "VerifiedDocuments")] #[derive(Clone)] pub struct VerifiedDocumentsWasm { - documents: Map, // Map + documents: Map, // Map } #[wasm_bindgen(js_class = VerifiedDocuments)] diff --git a/packages/wasm-sdk/src/queries/epoch.rs b/packages/wasm-sdk/src/queries/epoch.rs index d2b66dcf041..3ff91426aed 100644 --- a/packages/wasm-sdk/src/queries/epoch.rs +++ b/packages/wasm-sdk/src/queries/epoch.rs @@ -13,7 +13,6 @@ use serde::Deserialize; use wasm_bindgen::prelude::wasm_bindgen; use wasm_bindgen::JsValue; use wasm_dpp2::epoch::{ExtendedEpochInfoWasm, FinalizedEpochInfoWasm}; -use wasm_dpp2::identifier::IdentifierWasm; use wasm_dpp2::utils::try_from_options_optional; use wasm_dpp2::utils::try_to_vec; use wasm_dpp2::utils::JsMapExt; @@ -334,7 +333,7 @@ impl WasmSdk { Ok(Map::from_entries(counts.0.into_iter().map( |(identifier, count)| { - let key: JsValue = IdentifierWasm::from(identifier).to_hex().into(); + let key: JsValue = ProTxHashWasm::from(identifier).to_hex().into(); let value = JsValue::from(BigInt::from(count)); (key, value) }, @@ -367,7 +366,7 @@ impl WasmSdk { Ok(Map::from_entries(counts_result.0.into_iter().map( |(identifier, count)| { - let key: JsValue = IdentifierWasm::from(identifier).to_hex().into(); + let key: JsValue = ProTxHashWasm::from(identifier).to_hex().into(); let value = JsValue::from(BigInt::from(count)); (key, value) }, @@ -519,7 +518,7 @@ impl WasmSdk { .await?; let map = Map::from_entries(counts.0.into_iter().map(|(identifier, count)| { - let key: JsValue = IdentifierWasm::from(identifier).to_base58().into(); + let key: JsValue = ProTxHashWasm::from(identifier).to_hex().into(); let value = JsValue::from(BigInt::from(count)); (key, value) })); @@ -561,7 +560,7 @@ impl WasmSdk { .await?; let map = Map::from_entries(counts.0.into_iter().map(|(identifier, count)| { - let key: JsValue = IdentifierWasm::from(identifier).to_base58().into(); + let key: JsValue = ProTxHashWasm::from(identifier).to_hex().into(); let value = JsValue::from(BigInt::from(count)); (key, value) })); diff --git a/packages/wasm-sdk/src/state_transitions/addresses.rs b/packages/wasm-sdk/src/state_transitions/addresses.rs index 90cd51c94ad..7b4d5ac0595 100644 --- a/packages/wasm-sdk/src/state_transitions/addresses.rs +++ b/packages/wasm-sdk/src/state_transitions/addresses.rs @@ -33,7 +33,7 @@ use wasm_dpp2::{ /// Converts address infos from SDK response to a JavaScript Map. /// /// This helper handles the common pattern of converting IndexMap> -/// to Map for WASM bindings. +/// to Map for WASM bindings. fn address_infos_to_js_map( address_infos: IndexMap>, operation_name: &str, diff --git a/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts b/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts index 26799630099..8506471ffcd 100644 --- a/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts +++ b/packages/wasm-sdk/tests/functional/epochs-blocks.spec.ts @@ -100,7 +100,7 @@ describe('Epochs and Evonode Blocks', function describeEpochs() { // Get a proTxHash from the results (or use node's proTxHash if available) let testProTxHash = evonodeProTxHash; if (!testProTxHash && byRange.size > 0) { - // The keys in the map are base58 strings (Identifier.toBase58()) + // The keys in the map are hex strings (ProTxHash.toHex()) const firstKey = byRange.keys().next().value; if (firstKey) { testProTxHash = firstKey; From 844f866914555369037508d27669c822531a0d78 Mon Sep 17 00:00:00 2001 From: Ivan Shumkov Date: Mon, 23 Feb 2026 16:20:08 +0700 Subject: [PATCH 3/3] refactor!: change Map keys from Identifier objects to string representations (#3146) --- packages/js-evo-sdk/src/addresses/facade.ts | 10 ++++---- packages/js-evo-sdk/src/contracts/facade.ts | 4 ++-- packages/js-evo-sdk/src/documents/facade.ts | 4 ++-- packages/js-evo-sdk/src/epoch/facade.ts | 8 +++---- packages/js-evo-sdk/src/group/facade.ts | 16 ++++++------- packages/js-evo-sdk/src/identities/facade.ts | 8 +++---- packages/js-evo-sdk/src/tokens/facade.ts | 24 ++++++++++---------- packages/js-evo-sdk/src/voting/facade.ts | 4 ++-- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/packages/js-evo-sdk/src/addresses/facade.ts b/packages/js-evo-sdk/src/addresses/facade.ts index e34c71f7a71..bca16677c65 100644 --- a/packages/js-evo-sdk/src/addresses/facade.ts +++ b/packages/js-evo-sdk/src/addresses/facade.ts @@ -40,7 +40,7 @@ export class AddressesFacade { */ async getMany( addresses: wasm.PlatformAddressLikeArray, - ): Promise> { + ): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getAddressesInfos(addresses); } @@ -53,7 +53,7 @@ export class AddressesFacade { */ async getManyWithProof( addresses: wasm.PlatformAddressLikeArray, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getAddressesInfosWithProofInfo(addresses); } @@ -84,7 +84,7 @@ export class AddressesFacade { */ async transfer( options: wasm.AddressFundsTransferOptions, - ): Promise> { + ): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.addressFundsTransfer(options); } @@ -148,7 +148,7 @@ export class AddressesFacade { */ async withdraw( options: wasm.AddressFundsWithdrawOptions, - ): Promise> { + ): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.addressFundsWithdraw(options); } @@ -221,7 +221,7 @@ export class AddressesFacade { */ async fundFromAssetLock( options: wasm.AddressFundingFromAssetLockOptions, - ): Promise> { + ): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.addressFundingFromAssetLock(options); } diff --git a/packages/js-evo-sdk/src/contracts/facade.ts b/packages/js-evo-sdk/src/contracts/facade.ts index 84a900048df..95a301682c4 100644 --- a/packages/js-evo-sdk/src/contracts/facade.ts +++ b/packages/js-evo-sdk/src/contracts/facade.ts @@ -31,7 +31,7 @@ export class ContractsFacade { return w.getDataContractHistoryWithProofInfo(query); } - async getMany(contractIds: wasm.IdentifierLikeArray): Promise> { + async getMany(contractIds: wasm.IdentifierLikeArray): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getDataContracts(contractIds); } @@ -39,7 +39,7 @@ export class ContractsFacade { async getManyWithProof( contractIds: wasm.IdentifierLikeArray, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getDataContractsWithProofInfo(contractIds); diff --git a/packages/js-evo-sdk/src/documents/facade.ts b/packages/js-evo-sdk/src/documents/facade.ts index a217e2f732b..3c3acc66dda 100644 --- a/packages/js-evo-sdk/src/documents/facade.ts +++ b/packages/js-evo-sdk/src/documents/facade.ts @@ -9,7 +9,7 @@ export class DocumentsFacade { } // Query many documents - async query(query: wasm.DocumentsQuery): Promise> { + async query(query: wasm.DocumentsQuery): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getDocuments(query); } @@ -17,7 +17,7 @@ export class DocumentsFacade { async queryWithProof( query: wasm.DocumentsQuery, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getDocumentsWithProofInfo(query); diff --git a/packages/js-evo-sdk/src/epoch/facade.ts b/packages/js-evo-sdk/src/epoch/facade.ts index 97183cd5f21..84f50780065 100644 --- a/packages/js-evo-sdk/src/epoch/facade.ts +++ b/packages/js-evo-sdk/src/epoch/facade.ts @@ -48,25 +48,25 @@ export class EpochFacade { } async evonodesProposedBlocksByIds(epoch: number, ids: wasm.ProTxHashLikeArray): - Promise> { + Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getEvonodesProposedEpochBlocksByIds(epoch, ids); } async evonodesProposedBlocksByIdsWithProof(epoch: number, ids: wasm.ProTxHashLikeArray): - Promise>> { + Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getEvonodesProposedEpochBlocksByIdsWithProofInfo(epoch, ids); } - async evonodesProposedBlocksByRange(query: EvonodeProposedBlocksRangeQuery): Promise> { + async evonodesProposedBlocksByRange(query: EvonodeProposedBlocksRangeQuery): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getEvonodesProposedEpochBlocksByRange(query); } async evonodesProposedBlocksByRangeWithProof( query: EvonodeProposedBlocksRangeQuery, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getEvonodesProposedEpochBlocksByRangeWithProofInfo(query); } diff --git a/packages/js-evo-sdk/src/group/facade.ts b/packages/js-evo-sdk/src/group/facade.ts index 9767f2a4519..cae20d22ce9 100644 --- a/packages/js-evo-sdk/src/group/facade.ts +++ b/packages/js-evo-sdk/src/group/facade.ts @@ -30,14 +30,14 @@ export class GroupFacade { return w.getGroupInfosWithProofInfo(query); } - async members(query: wasm.GroupMembersQuery): Promise> { + async members(query: wasm.GroupMembersQuery): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupMembers(query); } async membersWithProof( query: wasm.GroupMembersQuery, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupMembersWithProofInfo(query); } @@ -54,7 +54,7 @@ export class GroupFacade { return w.getIdentityGroupsWithProofInfo(query); } - async actions(query: wasm.GroupActionsQuery): Promise> { + async actions(query: wasm.GroupActionsQuery): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupActions(query); } @@ -62,27 +62,27 @@ export class GroupFacade { async actionsWithProof( query: wasm.GroupActionsQuery, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupActionsWithProofInfo(query); } - async actionSigners(query: wasm.GroupActionSignersQuery): Promise> { + async actionSigners(query: wasm.GroupActionSignersQuery): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupActionSigners(query); } async actionSignersWithProof( query: wasm.GroupActionSignersQuery, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupActionSignersWithProofInfo(query); } async groupsDataContracts( dataContractIds: wasm.IdentifierLikeArray, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupsDataContracts(dataContractIds); } @@ -90,7 +90,7 @@ export class GroupFacade { async groupsDataContractsWithProof( dataContractIds: wasm.IdentifierLikeArray, ): Promise> + Map> >> { const w = await this.sdk.getWasmSdkConnected(); return w.getGroupsDataContractsWithProofInfo(dataContractIds); diff --git a/packages/js-evo-sdk/src/identities/facade.ts b/packages/js-evo-sdk/src/identities/facade.ts index a44b68c21cc..4cee5c2ce2f 100644 --- a/packages/js-evo-sdk/src/identities/facade.ts +++ b/packages/js-evo-sdk/src/identities/facade.ts @@ -74,7 +74,7 @@ export class IdentitiesFacade { return w.getIdentityBalanceWithProofInfo(identityId); } - async balances(identityIds: wasm.IdentifierLikeArray): Promise> { + async balances(identityIds: wasm.IdentifierLikeArray): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentitiesBalances(identityIds); } @@ -82,7 +82,7 @@ export class IdentitiesFacade { async balancesWithProof( identityIds: wasm.IdentifierLikeArray, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentitiesBalancesWithProofInfo(identityIds); @@ -147,7 +147,7 @@ export class IdentitiesFacade { } async tokenBalances(identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray): - Promise> { + Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentityTokenBalances(identityId, tokenIds); } @@ -155,7 +155,7 @@ export class IdentitiesFacade { async tokenBalancesWithProof( identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentityTokenBalancesWithProofInfo(identityId, tokenIds); } diff --git a/packages/js-evo-sdk/src/tokens/facade.ts b/packages/js-evo-sdk/src/tokens/facade.ts index 0a46c2b5564..ad57c6d3ff9 100644 --- a/packages/js-evo-sdk/src/tokens/facade.ts +++ b/packages/js-evo-sdk/src/tokens/facade.ts @@ -31,7 +31,7 @@ export class TokensFacade { return w.getTokenTotalSupplyWithProofInfo(tokenId); } - async statuses(tokenIds: wasm.IdentifierLikeArray): Promise> { + async statuses(tokenIds: wasm.IdentifierLikeArray): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getTokenStatuses(tokenIds); } @@ -39,14 +39,14 @@ export class TokensFacade { async statusesWithProof( tokenIds: wasm.IdentifierLikeArray, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getTokenStatusesWithProofInfo(tokenIds); } async balances(identityIds: wasm.IdentifierLikeArray, tokenId: wasm.IdentifierLike): - Promise> { + Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentitiesTokenBalances(identityIds, tokenId); } @@ -54,13 +54,13 @@ export class TokensFacade { async balancesWithProof( identityIds: wasm.IdentifierLikeArray, tokenId: wasm.IdentifierLike, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentitiesTokenBalancesWithProofInfo(identityIds, tokenId); } async identityBalances(identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray): - Promise> { + Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentityTokenBalances(identityId, tokenIds); } @@ -68,19 +68,19 @@ export class TokensFacade { async identityBalancesWithProof( identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray, - ): Promise>> { + ): Promise>> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentityTokenBalancesWithProofInfo(identityId, tokenIds); } async identityTokenInfos(identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray): - Promise> { + Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentityTokenInfos(identityId, tokenIds); } async identitiesTokenInfos(identityIds: wasm.IdentifierLikeArray, tokenId: wasm.IdentifierLike): - Promise> { + Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentitiesTokenInfos(identityIds, tokenId); } @@ -89,7 +89,7 @@ export class TokensFacade { identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentityTokenInfosWithProofInfo(identityId, tokenIds); @@ -99,13 +99,13 @@ export class TokensFacade { identityIds: wasm.IdentifierLikeArray, tokenId: wasm.IdentifierLike, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getIdentitiesTokenInfosWithProofInfo(identityIds, tokenId); } - async directPurchasePrices(tokenIds: wasm.IdentifierLikeArray): Promise> { + async directPurchasePrices(tokenIds: wasm.IdentifierLikeArray): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getTokenDirectPurchasePrices(tokenIds); } @@ -113,7 +113,7 @@ export class TokensFacade { async directPurchasePricesWithProof( tokenIds: wasm.IdentifierLikeArray, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getTokenDirectPurchasePricesWithProofInfo(tokenIds); diff --git a/packages/js-evo-sdk/src/voting/facade.ts b/packages/js-evo-sdk/src/voting/facade.ts index 10fd21db0f5..1626578e90b 100644 --- a/packages/js-evo-sdk/src/voting/facade.ts +++ b/packages/js-evo-sdk/src/voting/facade.ts @@ -23,7 +23,7 @@ export class VotingFacade { async contestedResourceIdentityVotes( query: wasm.ContestedResourceIdentityVotesQuery, - ): Promise> { + ): Promise> { const w = await this.sdk.getWasmSdkConnected(); return w.getContestedResourceIdentityVotes(query); } @@ -31,7 +31,7 @@ export class VotingFacade { async contestedResourceIdentityVotesWithProof( query: wasm.ContestedResourceIdentityVotesQuery, ): Promise + Map >> { const w = await this.sdk.getWasmSdkConnected(); return w.getContestedResourceIdentityVotesWithProofInfo(query);