Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/js-evo-sdk/src/addresses/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class AddressesFacade {
*/
async getMany(
addresses: wasm.PlatformAddressLikeArray,
): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo | undefined>> {
): Promise<Map<string, wasm.PlatformAddressInfo | undefined>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getAddressesInfos(addresses);
}
Expand All @@ -53,7 +53,7 @@ export class AddressesFacade {
*/
async getManyWithProof(
addresses: wasm.PlatformAddressLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo | undefined>>> {
): Promise<wasm.ProofMetadataResponseTyped<Map<string, wasm.PlatformAddressInfo | undefined>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getAddressesInfosWithProofInfo(addresses);
}
Expand Down Expand Up @@ -84,7 +84,7 @@ export class AddressesFacade {
*/
async transfer(
options: wasm.AddressFundsTransferOptions,
): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo>> {
): Promise<Map<string, wasm.PlatformAddressInfo>> {
const w = await this.sdk.getWasmSdkConnected();
return w.addressFundsTransfer(options);
}
Expand Down Expand Up @@ -148,7 +148,7 @@ export class AddressesFacade {
*/
async withdraw(
options: wasm.AddressFundsWithdrawOptions,
): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo>> {
): Promise<Map<string, wasm.PlatformAddressInfo>> {
const w = await this.sdk.getWasmSdkConnected();
return w.addressFundsWithdraw(options);
}
Expand Down Expand Up @@ -221,7 +221,7 @@ export class AddressesFacade {
*/
async fundFromAssetLock(
options: wasm.AddressFundingFromAssetLockOptions,
): Promise<Map<wasm.PlatformAddress, wasm.PlatformAddressInfo>> {
): Promise<Map<string, wasm.PlatformAddressInfo>> {
const w = await this.sdk.getWasmSdkConnected();
return w.addressFundingFromAssetLock(options);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/js-evo-sdk/src/contracts/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export class ContractsFacade {
return w.getDataContractHistoryWithProofInfo(query);
}

async getMany(contractIds: wasm.IdentifierLikeArray): Promise<Map<wasm.Identifier, wasm.DataContract | undefined>> {
async getMany(contractIds: wasm.IdentifierLikeArray): Promise<Map<string, wasm.DataContract | undefined>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getDataContracts(contractIds);
}

async getManyWithProof(
contractIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.DataContract | undefined>
Map<string, wasm.DataContract | undefined>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getDataContractsWithProofInfo(contractIds);
Expand Down
4 changes: 2 additions & 2 deletions packages/js-evo-sdk/src/documents/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ export class DocumentsFacade {
}

// Query many documents
async query(query: wasm.DocumentsQuery): Promise<Map<wasm.Identifier, wasm.Document | undefined>> {
async query(query: wasm.DocumentsQuery): Promise<Map<string, wasm.Document | undefined>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getDocuments(query);
}

async queryWithProof(
query: wasm.DocumentsQuery,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.Document | undefined>
Map<string, wasm.Document | undefined>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getDocumentsWithProofInfo(query);
Expand Down
8 changes: 4 additions & 4 deletions packages/js-evo-sdk/src/epoch/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,25 @@ export class EpochFacade {
}

async evonodesProposedBlocksByIds(epoch: number, ids: wasm.ProTxHashLikeArray):
Promise<Map<wasm.Identifier, bigint>> {
Promise<Map<string, bigint>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getEvonodesProposedEpochBlocksByIds(epoch, ids);
}

async evonodesProposedBlocksByIdsWithProof(epoch: number, ids: wasm.ProTxHashLikeArray):
Promise<wasm.ProofMetadataResponseTyped<Map<wasm.Identifier, bigint>>> {
Promise<wasm.ProofMetadataResponseTyped<Map<string, bigint>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getEvonodesProposedEpochBlocksByIdsWithProofInfo(epoch, ids);
}

async evonodesProposedBlocksByRange(query: EvonodeProposedBlocksRangeQuery): Promise<Map<wasm.Identifier, bigint>> {
async evonodesProposedBlocksByRange(query: EvonodeProposedBlocksRangeQuery): Promise<Map<string, bigint>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getEvonodesProposedEpochBlocksByRange(query);
}

async evonodesProposedBlocksByRangeWithProof(
query: EvonodeProposedBlocksRangeQuery,
): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.Identifier, bigint>>> {
): Promise<wasm.ProofMetadataResponseTyped<Map<string, bigint>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getEvonodesProposedEpochBlocksByRangeWithProofInfo(query);
}
Expand Down
16 changes: 8 additions & 8 deletions packages/js-evo-sdk/src/group/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export class GroupFacade {
return w.getGroupInfosWithProofInfo(query);
}

async members(query: wasm.GroupMembersQuery): Promise<Map<wasm.Identifier, bigint>> {
async members(query: wasm.GroupMembersQuery): Promise<Map<string, bigint>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupMembers(query);
}

async membersWithProof(
query: wasm.GroupMembersQuery,
): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.Identifier, bigint>>> {
): Promise<wasm.ProofMetadataResponseTyped<Map<string, bigint>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupMembersWithProofInfo(query);
}
Expand All @@ -54,43 +54,43 @@ export class GroupFacade {
return w.getIdentityGroupsWithProofInfo(query);
}

async actions(query: wasm.GroupActionsQuery): Promise<Map<wasm.Identifier, wasm.GroupAction | undefined>> {
async actions(query: wasm.GroupActionsQuery): Promise<Map<string, wasm.GroupAction | undefined>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupActions(query);
}

async actionsWithProof(
query: wasm.GroupActionsQuery,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.GroupAction | undefined>
Map<string, wasm.GroupAction | undefined>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupActionsWithProofInfo(query);
}

async actionSigners(query: wasm.GroupActionSignersQuery): Promise<Map<wasm.Identifier, bigint>> {
async actionSigners(query: wasm.GroupActionSignersQuery): Promise<Map<string, bigint>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupActionSigners(query);
}

async actionSignersWithProof(
query: wasm.GroupActionSignersQuery,
): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.Identifier, bigint>>> {
): Promise<wasm.ProofMetadataResponseTyped<Map<string, bigint>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupActionSignersWithProofInfo(query);
}

async groupsDataContracts(
dataContractIds: wasm.IdentifierLikeArray,
): Promise<Map<wasm.Identifier, Map<number, wasm.Group | undefined>>> {
): Promise<Map<string, Map<number, wasm.Group | undefined>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupsDataContracts(dataContractIds);
}

async groupsDataContractsWithProof(
dataContractIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, Map<number, wasm.Group | undefined>>
Map<string, Map<number, wasm.Group | undefined>>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getGroupsDataContractsWithProofInfo(dataContractIds);
Expand Down
8 changes: 4 additions & 4 deletions packages/js-evo-sdk/src/identities/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ export class IdentitiesFacade {
return w.getIdentityBalanceWithProofInfo(identityId);
}

async balances(identityIds: wasm.IdentifierLikeArray): Promise<Map<wasm.Identifier, bigint | undefined>> {
async balances(identityIds: wasm.IdentifierLikeArray): Promise<Map<string, bigint | undefined>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentitiesBalances(identityIds);
}

async balancesWithProof(
identityIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, bigint | undefined>
Map<string, bigint | undefined>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentitiesBalancesWithProofInfo(identityIds);
Expand Down Expand Up @@ -147,15 +147,15 @@ export class IdentitiesFacade {
}

async tokenBalances(identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray):
Promise<Map<wasm.Identifier, bigint>> {
Promise<Map<string, bigint>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentityTokenBalances(identityId, tokenIds);
}

async tokenBalancesWithProof(
identityId: wasm.IdentifierLike,
tokenIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.Identifier, bigint>>> {
): Promise<wasm.ProofMetadataResponseTyped<Map<string, bigint>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentityTokenBalancesWithProofInfo(identityId, tokenIds);
}
Expand Down
24 changes: 12 additions & 12 deletions packages/js-evo-sdk/src/tokens/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,56 +31,56 @@ export class TokensFacade {
return w.getTokenTotalSupplyWithProofInfo(tokenId);
}

async statuses(tokenIds: wasm.IdentifierLikeArray): Promise<Map<wasm.Identifier, wasm.TokenStatus>> {
async statuses(tokenIds: wasm.IdentifierLikeArray): Promise<Map<string, wasm.TokenStatus>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getTokenStatuses(tokenIds);
}

async statusesWithProof(
tokenIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.TokenStatus>
Map<string, wasm.TokenStatus>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getTokenStatusesWithProofInfo(tokenIds);
}

async balances(identityIds: wasm.IdentifierLikeArray, tokenId: wasm.IdentifierLike):
Promise<Map<wasm.Identifier, bigint>> {
Promise<Map<string, bigint>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentitiesTokenBalances(identityIds, tokenId);
}

async balancesWithProof(
identityIds: wasm.IdentifierLikeArray,
tokenId: wasm.IdentifierLike,
): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.Identifier, bigint>>> {
): Promise<wasm.ProofMetadataResponseTyped<Map<string, bigint>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentitiesTokenBalancesWithProofInfo(identityIds, tokenId);
}

async identityBalances(identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray):
Promise<Map<wasm.Identifier, bigint>> {
Promise<Map<string, bigint>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentityTokenBalances(identityId, tokenIds);
}

async identityBalancesWithProof(
identityId: wasm.IdentifierLike,
tokenIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<Map<wasm.Identifier, bigint>>> {
): Promise<wasm.ProofMetadataResponseTyped<Map<string, bigint>>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentityTokenBalancesWithProofInfo(identityId, tokenIds);
}

async identityTokenInfos(identityId: wasm.IdentifierLike, tokenIds: wasm.IdentifierLikeArray):
Promise<Map<wasm.Identifier, wasm.IdentityTokenInfo>> {
Promise<Map<string, wasm.IdentityTokenInfo>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentityTokenInfos(identityId, tokenIds);
}

async identitiesTokenInfos(identityIds: wasm.IdentifierLikeArray, tokenId: wasm.IdentifierLike):
Promise<Map<wasm.Identifier, wasm.IdentityTokenInfo>> {
Promise<Map<string, wasm.IdentityTokenInfo>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentitiesTokenInfos(identityIds, tokenId);
}
Expand All @@ -89,7 +89,7 @@ export class TokensFacade {
identityId: wasm.IdentifierLike,
tokenIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.IdentityTokenInfo>
Map<string, wasm.IdentityTokenInfo>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentityTokenInfosWithProofInfo(identityId, tokenIds);
Expand All @@ -99,21 +99,21 @@ export class TokensFacade {
identityIds: wasm.IdentifierLikeArray,
tokenId: wasm.IdentifierLike,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.IdentityTokenInfo>
Map<string, wasm.IdentityTokenInfo>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getIdentitiesTokenInfosWithProofInfo(identityIds, tokenId);
}

async directPurchasePrices(tokenIds: wasm.IdentifierLikeArray): Promise<Map<wasm.Identifier, wasm.TokenPriceInfo>> {
async directPurchasePrices(tokenIds: wasm.IdentifierLikeArray): Promise<Map<string, wasm.TokenPriceInfo>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getTokenDirectPurchasePrices(tokenIds);
}

async directPurchasePricesWithProof(
tokenIds: wasm.IdentifierLikeArray,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.TokenPriceInfo>
Map<string, wasm.TokenPriceInfo>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getTokenDirectPurchasePricesWithProofInfo(tokenIds);
Expand Down
4 changes: 2 additions & 2 deletions packages/js-evo-sdk/src/voting/facade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export class VotingFacade {

async contestedResourceIdentityVotes(
query: wasm.ContestedResourceIdentityVotesQuery,
): Promise<Map<wasm.Identifier, wasm.ResourceVote>> {
): Promise<Map<string, wasm.ResourceVote>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getContestedResourceIdentityVotes(query);
}

async contestedResourceIdentityVotesWithProof(
query: wasm.ContestedResourceIdentityVotesQuery,
): Promise<wasm.ProofMetadataResponseTyped<
Map<wasm.Identifier, wasm.ResourceVote>
Map<string, wasm.ResourceVote>
>> {
const w = await this.sdk.getWasmSdkConnected();
return w.getContestedResourceIdentityVotesWithProofInfo(query);
Expand Down
6 changes: 6 additions & 0 deletions packages/wasm-dpp2/src/core/pro_tx_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,10 @@ impl From<ProTxHash> for ProTxHashWasm {
}
}

impl From<dpp::platform_value::Identifier> for ProTxHashWasm {
fn from(id: dpp::platform_value::Identifier) -> Self {
ProTxHashWasm(ProTxHash::from_byte_array(id.to_buffer()))
}
}

impl_wasm_type_info!(ProTxHashWasm, ProTxHash);
8 changes: 4 additions & 4 deletions packages/wasm-dpp2/src/state_transitions/proof_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl_wasm_conversions!(VerifiedTokenStatusWasm, VerifiedTokenStatus);
#[wasm_bindgen(js_name = "VerifiedTokenIdentitiesBalances")]
#[derive(Clone)]
pub struct VerifiedTokenIdentitiesBalancesWasm {
balances: Map, // Map<IdentifierWasm, BigInt>
balances: Map, // Map<string(base58), BigInt>
}

#[wasm_bindgen(js_class = VerifiedTokenIdentitiesBalances)]
Expand Down Expand Up @@ -319,7 +319,7 @@ impl_wasm_conversions!(VerifiedBalanceTransferWasm, VerifiedBalanceTransfer);
#[wasm_bindgen(js_name = "VerifiedDocuments")]
#[derive(Clone)]
pub struct VerifiedDocumentsWasm {
documents: Map, // Map<IdentifierWasm, DocumentWasm | undefined>
documents: Map, // Map<string(base58), DocumentWasm | undefined>
}

#[wasm_bindgen(js_class = VerifiedDocuments)]
Expand Down Expand Up @@ -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)
}));
Expand All @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions packages/wasm-dpp2/tests/unit/Group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ describe('Group', () => {
const memberIdHex = '1111111111111111111111111111111111111111111111111111111111111111';
const member2IdHex = '2222222222222222222222222222222222222222222222222222222222222222';
function createMembersMap(membersArray: Array<[InstanceType<typeof wasm.Identifier>, number]>) {
const map = new Map<InstanceType<typeof wasm.Identifier>, number>();
const map = new Map<string, number>();
for (const [identifier, power] of membersArray) {
map.set(identifier, power);
map.set(identifier.toBase58(), power);
}
return map;
}
Expand Down
Loading
Loading