pshenmic-dpp 2.0.0-dev.4 → 2.0.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/binaries/bindingsTypes.d.ts +6 -2
  2. package/dist/binaries/pshenmic_dpp.android.node/x86_64/libpshenmic_dpp.so +0 -0
  3. package/dist/binaries/pshenmic_dpp.d.ts +1 -0
  4. package/dist/binaries/pshenmic_dpp.js +1 -1
  5. package/dist/binaries/wasm/wasmBytes.js +1 -1
  6. package/dist/binaries/wasm.d.ts +1 -0
  7. package/dist/binaries/wasm.js +1 -1
  8. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentCreateTransition.d.ts +1 -1
  9. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentCreateTransition.js +1 -1
  10. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentReplaceTransition.d.ts +1 -1
  11. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentReplaceTransition.js +1 -1
  12. package/dist/src/dpp/structs/DataContract.d.ts +4 -4
  13. package/dist/src/dpp/structs/DataContract.js +1 -1
  14. package/dist/src/dpp/structs/Document.d.ts +1 -1
  15. package/dist/src/dpp/structs/Document.js +1 -1
  16. package/dist/src/dpp/structs/IdentityPublicKey.d.ts +1 -0
  17. package/dist/src/dpp/structs/IdentityPublicKey.js +5 -0
  18. package/dist/src/dpp/structs/IdentityPublicKeyInCreation.d.ts +1 -0
  19. package/dist/src/dpp/structs/IdentityPublicKeyInCreation.js +5 -0
  20. package/dist/src/dpp/types.d.ts +6 -2
  21. package/dist/src/dpp/utils.d.ts +1 -1
  22. package/dist/src/dpp/utils.js +12 -6
  23. package/dist/src/dpp/verify/Contested/verifyVotePollVoteStateProof.js +1 -1
  24. package/dist/src/dpp/verify/System/verifyEpochsInfoProof.js +1 -1
  25. package/dist/src/dpp/verify/Tokens/verifyTokenBalancesForIdentitiesProof.js +1 -1
  26. package/dist/src/dpp/verify/Tokens/verifyTokensBalancesForIdentityProof.js +1 -1
  27. package/package.json +1 -1
  28. package/tests/unit/DynamicValue.spec.ts +13 -0
@@ -64,6 +64,7 @@ export const IdentityNAPI: any;
64
64
  export const IdentityPublicKeyInCreationNAPI: any;
65
65
  export const IdentityPublicKeyNAPI: any;
66
66
  export const IdentityTokenBalanceNAPI: any;
67
+ export const IdentityTokenBalanceOptionalNAPI: any;
67
68
  export const IdentityTokenInfoNAPI: any;
68
69
  export const IdentityTopUpFromAddressesTransitionNAPI: any;
69
70
  export const IdentityTopUpTransitionNAPI: any;
@@ -41,4 +41,4 @@ const wasm = instantiateNapiModuleSync(decompressSync(wasmBytes), {
41
41
  }
42
42
  }
43
43
  });
44
- export const { verifyContractProof, verifyDocumentsProof, verifyEpochsInfoProof, verifyIdentifierByNonUniquePublicKeyHashProof, verifyIdentityBalanceProof, verifyIdentityByIdentifierProof, verifyIdentityByUniqueKeyHashProof, verifyIdentityContractNonceProof, verifyIdentityKeysByIdentifierProof, verifyIdentityNonceProof, verifySignatureDigest, verifyStateTransitionResult, verifyTokenBalancesForIdentitiesProof, verifyTokenContractInfoProof, verifyTokenDirectPurchasePrices, verifyTokensBalancesForIdentityProof, verifyTokenTotalSupplyProof, verifyTotalCreditsProof, verifyVotePollVoteStateProof, ActionTakerNAPI, AddressCreditWithdrawalTransitionNAPI, AddressFundingFromAssetLockTransitionNAPI, AddressFundsFeeStrategyStepNAPI, AddressFundsTransferTransitionNAPI, AddressWitnessNAPI, AssetLockProofNAPI, AuthorizedActionTakersNAPI, BatchedTransitionNAPI, BatchTransitionNAPI, BlockBasedDistributionNAPI, BlockInfoNAPI, ChainAssetLockProofNAPI, ChangeControlRulesNAPI, ConsensusErrorNAPI, ContenderWithSerializedDocumentNAPI, ContestedDocumentVotePollQueryExecutionResultNAPI, ContractBoundsNAPI, CoreScriptNAPI, DataContractCreateTransitionNAPI, DataContractNAPI, DataContractUpdateTransitionNAPI, DistributionFunctionNAPI, DocumentBaseTransitionNAPI, DocumentCreateTransitionNAPI, DocumentDeleteTransitionNAPI, DocumentNAPI, DocumentPurchaseTransitionNAPI, DocumentReplaceTransitionNAPI, DocumentTransferTransitionNAPI, DocumentTransitionNAPI, DocumentUpdatePriceTransitionNAPI, DynamicValue, EpochBasedDistributionNAPI, ExtendedEpochInfoNAPI, GroupNAPI, GroupStateTransitionInfoNAPI, IdentifierNAPI, IdentityCreateFromAddressesTransitionNAPI, IdentityCreateTransitionNAPI, IdentityCreditTransferNAPI, IdentityCreditTransferToAddressesTransitionNAPI, IdentityCreditWithdrawalTransitionNAPI, IdentityNAPI, IdentityPublicKeyInCreationNAPI, IdentityPublicKeyNAPI, IdentityTokenBalanceNAPI, IdentityTokenInfoNAPI, IdentityTopUpFromAddressesTransitionNAPI, IdentityTopUpTransitionNAPI, IdentityUpdateTransitionNAPI, InputAddressNAPI, InstantAssetLockProofNAPI, InstantLockNAPI, MasternodeVoteTransitionNAPI, OutPointNAPI, OutputAddressNAPI, OutputAddressNullableCreditsNAPI, PartialIdentityNAPI, PlatformAddressNAPI, PrefundedVotingBalanceNAPI, PrivateEncryptedNoteNAPI, PrivateKeyNAPI, PublicKeyNAPI, ResourceVoteChoiceNAPI, RewardDistributionTypeNAPI, SharedEncryptedNoteNAPI, StateTransitionNAPI, TimeBasedDistributionNAPI, TokenBaseTransitionNAPI, TokenBurnTransitionNAPI, TokenClaimTransitionNAPI, TokenConfigUpdateTransitionNAPI, TokenConfigurationChangeItemNAPI, TokenConfigurationConventionNAPI, TokenConfigurationLocalizationNAPI, TokenConfigurationNAPI, TokenContractInfoNAPI, TokenDestroyFrozenFundsTransitionNAPI, TokenDirectPurchaseTransitionNAPI, TokenDistributionRecipientNAPI, TokenDistributionRulesNAPI, TokenEmergencyActionTransitionNAPI, TokenFreezeTransitionNAPI, TokenKeepsHistoryRulesNAPI, TokenMarketplaceRulesNAPI, TokenMintTransitionNAPI, TokenPaymentInfoNAPI, TokenPerpetualDistributionNAPI, TokenPreProgrammedDistributionNAPI, TokenPricingScheduleNAPI, TokenSetPriceForDirectPurchaseTransitionNAPI, TokenStatusNAPI, TokenTradeModeNAPI, TokenTransferTransitionNAPI, TokenTransitionNAPI, TokenUnFreezeTransitionNAPI, TotalSingleTokenBalanceNAPI, TransactionNAPI, TxInNAPI, TxOutNAPI, VerifiedAddressInfosNAPI, VerifiedBalanceTransferNAPI, VerifiedContractNAPI, VerifiedDocumentNAPI, VerifiedDocumentsNAPI, VerifiedEpochsInfoNAPI, VerifiedIdentifierByNonUniquePublicKeyHashNAPI, VerifiedIdentityBalanceRootHashNAPI, VerifiedIdentityByIdentifierNAPI, VerifiedIdentityByUniqueKeyHashNAPI, VerifiedIdentityContractNonceNAPI, VerifiedIdentityFullWithAddressInfosNAPI, VerifiedIdentityKeysByIdentifierNAPI, VerifiedIdentityNonceNAPI, VerifiedIdentityTokenInfoNAPI, VerifiedIdentityWithAddressInfosNAPI, VerifiedStateTransitionResultNAPI, VerifiedTokenBalancesForIdentitiesNAPI, VerifiedTokenContractInfoNAPI, VerifiedTokenDirectPurchasePricesNAPI, VerifiedTokenGroupActionWithDocumentNAPI, VerifiedTokenGroupActionWithTokenBalanceNAPI, VerifiedTokenGroupActionWithTokenIdentityInfoNAPI, VerifiedTokenGroupActionWithTokenPricingScheduleNAPI, VerifiedTokenPricingScheduleNAPI, VerifiedTokensBalancesForIdentityNAPI, VerifiedTokenTotalSupplyNAPI, VerifiedTotalCreditsNAPI, VerifiedVoteStateNAPI, VoteNAPI, VotePollNAPI, WitnessNAPI, ActionGoalNAPI, AssetLockProofTypeNAPI, BatchTypeNAPI, GasFeesPaidByNAPI, GroupActionStatusNAPI, KeyTypeNAPI, NetworkNAPI, PlatformVersionNAPI, PoolingNAPI, PurposeNAPI, SecurityLevelNAPI, TokenDistributionTypeNAPI, TokenEmergencyActionNAPI, VoteStateResultTypeNAPI } = wasm.napiModule.exports;
44
+ export const { verifyContractProof, verifyDocumentsProof, verifyEpochsInfoProof, verifyIdentifierByNonUniquePublicKeyHashProof, verifyIdentityBalanceProof, verifyIdentityByIdentifierProof, verifyIdentityByUniqueKeyHashProof, verifyIdentityContractNonceProof, verifyIdentityKeysByIdentifierProof, verifyIdentityNonceProof, verifySignatureDigest, verifyStateTransitionResult, verifyTokenBalancesForIdentitiesProof, verifyTokenContractInfoProof, verifyTokenDirectPurchasePrices, verifyTokensBalancesForIdentityProof, verifyTokenTotalSupplyProof, verifyTotalCreditsProof, verifyVotePollVoteStateProof, ActionTakerNAPI, AddressCreditWithdrawalTransitionNAPI, AddressFundingFromAssetLockTransitionNAPI, AddressFundsFeeStrategyStepNAPI, AddressFundsTransferTransitionNAPI, AddressWitnessNAPI, AssetLockProofNAPI, AuthorizedActionTakersNAPI, BatchedTransitionNAPI, BatchTransitionNAPI, BlockBasedDistributionNAPI, BlockInfoNAPI, ChainAssetLockProofNAPI, ChangeControlRulesNAPI, ConsensusErrorNAPI, ContenderWithSerializedDocumentNAPI, ContestedDocumentVotePollQueryExecutionResultNAPI, ContractBoundsNAPI, CoreScriptNAPI, DataContractCreateTransitionNAPI, DataContractNAPI, DataContractUpdateTransitionNAPI, DistributionFunctionNAPI, DocumentBaseTransitionNAPI, DocumentCreateTransitionNAPI, DocumentDeleteTransitionNAPI, DocumentNAPI, DocumentPurchaseTransitionNAPI, DocumentReplaceTransitionNAPI, DocumentTransferTransitionNAPI, DocumentTransitionNAPI, DocumentUpdatePriceTransitionNAPI, DynamicValue, EpochBasedDistributionNAPI, ExtendedEpochInfoNAPI, GroupNAPI, GroupStateTransitionInfoNAPI, IdentifierNAPI, IdentityCreateFromAddressesTransitionNAPI, IdentityCreateTransitionNAPI, IdentityCreditTransferNAPI, IdentityCreditTransferToAddressesTransitionNAPI, IdentityCreditWithdrawalTransitionNAPI, IdentityNAPI, IdentityPublicKeyInCreationNAPI, IdentityPublicKeyNAPI, IdentityTokenBalanceNAPI, IdentityTokenBalanceOptionalNAPI, IdentityTokenInfoNAPI, IdentityTopUpFromAddressesTransitionNAPI, IdentityTopUpTransitionNAPI, IdentityUpdateTransitionNAPI, InputAddressNAPI, InstantAssetLockProofNAPI, InstantLockNAPI, MasternodeVoteTransitionNAPI, OutPointNAPI, OutputAddressNAPI, OutputAddressNullableCreditsNAPI, PartialIdentityNAPI, PlatformAddressNAPI, PrefundedVotingBalanceNAPI, PrivateEncryptedNoteNAPI, PrivateKeyNAPI, PublicKeyNAPI, ResourceVoteChoiceNAPI, RewardDistributionTypeNAPI, SharedEncryptedNoteNAPI, StateTransitionNAPI, TimeBasedDistributionNAPI, TokenBaseTransitionNAPI, TokenBurnTransitionNAPI, TokenClaimTransitionNAPI, TokenConfigUpdateTransitionNAPI, TokenConfigurationChangeItemNAPI, TokenConfigurationConventionNAPI, TokenConfigurationLocalizationNAPI, TokenConfigurationNAPI, TokenContractInfoNAPI, TokenDestroyFrozenFundsTransitionNAPI, TokenDirectPurchaseTransitionNAPI, TokenDistributionRecipientNAPI, TokenDistributionRulesNAPI, TokenEmergencyActionTransitionNAPI, TokenFreezeTransitionNAPI, TokenKeepsHistoryRulesNAPI, TokenMarketplaceRulesNAPI, TokenMintTransitionNAPI, TokenPaymentInfoNAPI, TokenPerpetualDistributionNAPI, TokenPreProgrammedDistributionNAPI, TokenPricingScheduleNAPI, TokenSetPriceForDirectPurchaseTransitionNAPI, TokenStatusNAPI, TokenTradeModeNAPI, TokenTransferTransitionNAPI, TokenTransitionNAPI, TokenUnFreezeTransitionNAPI, TotalSingleTokenBalanceNAPI, TransactionNAPI, TxInNAPI, TxOutNAPI, VerifiedAddressInfosNAPI, VerifiedBalanceTransferNAPI, VerifiedContractNAPI, VerifiedDocumentNAPI, VerifiedDocumentsNAPI, VerifiedEpochsInfoNAPI, VerifiedIdentifierByNonUniquePublicKeyHashNAPI, VerifiedIdentityBalanceRootHashNAPI, VerifiedIdentityByIdentifierNAPI, VerifiedIdentityByUniqueKeyHashNAPI, VerifiedIdentityContractNonceNAPI, VerifiedIdentityFullWithAddressInfosNAPI, VerifiedIdentityKeysByIdentifierNAPI, VerifiedIdentityNonceNAPI, VerifiedIdentityTokenInfoNAPI, VerifiedIdentityWithAddressInfosNAPI, VerifiedStateTransitionResultNAPI, VerifiedTokenBalancesForIdentitiesNAPI, VerifiedTokenContractInfoNAPI, VerifiedTokenDirectPurchasePricesNAPI, VerifiedTokenGroupActionWithDocumentNAPI, VerifiedTokenGroupActionWithTokenBalanceNAPI, VerifiedTokenGroupActionWithTokenIdentityInfoNAPI, VerifiedTokenGroupActionWithTokenPricingScheduleNAPI, VerifiedTokenPricingScheduleNAPI, VerifiedTokensBalancesForIdentityNAPI, VerifiedTokenTotalSupplyNAPI, VerifiedTotalCreditsNAPI, VerifiedVoteStateNAPI, VoteNAPI, VotePollNAPI, WitnessNAPI, ActionGoalNAPI, AssetLockProofTypeNAPI, BatchTypeNAPI, GasFeesPaidByNAPI, GroupActionStatusNAPI, KeyTypeNAPI, NetworkNAPI, PlatformVersionNAPI, PoolingNAPI, PurposeNAPI, SecurityLevelNAPI, TokenDistributionTypeNAPI, TokenEmergencyActionNAPI, VoteStateResultTypeNAPI } = wasm.napiModule.exports;
@@ -8,7 +8,7 @@ export declare class DocumentCreateTransitionWASM {
8
8
  /** @private **/
9
9
  _rawDocumentCreateTransition: DocumentCreateTransitionNAPI;
10
10
  constructor(document: DocumentWASM, identityContractNonce: bigint, prefundedVotingBalance?: PrefundedVotingBalanceWASM, tokenPaymentInfo?: TokenPaymentInfoWASM);
11
- get data(): object;
11
+ get data(): any;
12
12
  set data(value: object);
13
13
  get base(): DocumentBaseTransitionWASM;
14
14
  set base(value: DocumentBaseTransitionWASM);
@@ -10,7 +10,7 @@ export class DocumentCreateTransitionWASM {
10
10
  this._rawDocumentCreateTransition = new dppProvider.dpp.DocumentCreateTransitionNAPI(document._rawDocument, identityContractNonce.toString(), prefundedVotingBalance?._rawPrefundedVotingBalance, tokenPaymentInfo?._rawTokenPaymentInfo);
11
11
  }
12
12
  get data() {
13
- return valueFromDynamicValue(this._rawDocumentCreateTransition.data);
13
+ return valueFromDynamicValue(this._rawDocumentCreateTransition.data, true);
14
14
  }
15
15
  set data(value) {
16
16
  this._rawDocumentCreateTransition.data = valueToDynamicValue(value);
@@ -7,7 +7,7 @@ export declare class DocumentReplaceTransitionWASM {
7
7
  /** @private **/
8
8
  _rawDocumentReplaceTransition: DocumentReplaceTransitionNAPI;
9
9
  constructor(document: DocumentWASM, identityContractNonce: bigint, tokenPaymentInfo?: TokenPaymentInfoWASM);
10
- get data(): object;
10
+ get data(): any;
11
11
  set data(value: object);
12
12
  get base(): DocumentBaseTransitionWASM;
13
13
  set base(value: DocumentBaseTransitionWASM);
@@ -9,7 +9,7 @@ export class DocumentReplaceTransitionWASM {
9
9
  this._rawDocumentReplaceTransition = new dppProvider.dpp.DocumentReplaceTransitionNAPI(document._rawDocument, identityContractNonce.toString(), tokenPaymentInfo?._rawTokenPaymentInfo);
10
10
  }
11
11
  get data() {
12
- return valueFromDynamicValue(this._rawDocumentReplaceTransition.data);
12
+ return valueFromDynamicValue(this._rawDocumentReplaceTransition.data, true);
13
13
  }
14
14
  set data(value) {
15
15
  this._rawDocumentReplaceTransition.data = valueToDynamicValue(value);
@@ -21,14 +21,14 @@ export declare class DataContractWASM {
21
21
  set description(value: string | undefined);
22
22
  get keywords(): string[];
23
23
  set keywords(value: string[]);
24
- getSchemas(): object;
25
- getConfig(): object;
24
+ getSchemas(): any;
25
+ getConfig(): any;
26
26
  setConfig(value: object, platformVersion?: PlatformVersionLike): void;
27
27
  bytes(platformVersion: PlatformVersionLike): Uint8Array;
28
28
  hex(platformVersion: PlatformVersionLike): string;
29
29
  base64(platformVersion: PlatformVersionLike): string;
30
- toJSON(platformVersion: PlatformVersionLike): object;
31
- toValue(platformVersion: PlatformVersionLike): object;
30
+ toJSON(platformVersion: PlatformVersionLike): any;
31
+ toValue(platformVersion: PlatformVersionLike): any;
32
32
  static fromValue(value: object, fullValidation: boolean, platformVersion?: PlatformVersionLike): DataContractWASM;
33
33
  static fromBytes(bytes: Uint8Array, fullValidation: boolean, platformVersion?: PlatformVersionLike): DataContractWASM;
34
34
  static fromHex(hex: string, fullValidation: boolean, platformVersion?: PlatformVersionLike): DataContractWASM;
@@ -79,7 +79,7 @@ export class DataContractWASM {
79
79
  this._rawDataContract.keywords = value;
80
80
  }
81
81
  getSchemas() {
82
- return valueFromDynamicValue(this._rawDataContract.getSchemas());
82
+ return valueFromDynamicValue(this._rawDataContract.getSchemas(), true);
83
83
  }
84
84
  getConfig() {
85
85
  return valueFromDynamicValue(this._rawDataContract.getConfig());
@@ -14,7 +14,7 @@ export declare class DocumentWASM {
14
14
  set dataContractId(value: IdentifierLike);
15
15
  get ownerId(): IdentifierWASM;
16
16
  set ownerId(value: IdentifierLike);
17
- get properties(): object;
17
+ get properties(): any;
18
18
  set properties(value: object);
19
19
  get revision(): bigint | undefined;
20
20
  set revision(value: bigint | undefined);
@@ -32,7 +32,7 @@ export class DocumentWASM {
32
32
  this._rawDocument.ownerId = prepareIdentifierValue(value);
33
33
  }
34
34
  get properties() {
35
- return valueFromDynamicValue(this._rawDocument.properties);
35
+ return valueFromDynamicValue(this._rawDocument.properties, true);
36
36
  }
37
37
  set properties(value) {
38
38
  this._rawDocument.properties = valueToDynamicValue(value);
@@ -29,6 +29,7 @@ export declare class IdentityPublicKeyWASM {
29
29
  set disabledAt(disabledAt: bigint | number);
30
30
  get contractBounds(): ContractBoundsWASM | undefined;
31
31
  set contractBounds(contractBounds: ContractBoundsWASM | undefined | null);
32
+ getContractBounds(): ContractBoundsWASM | undefined;
32
33
  removeDisabledAt(): void;
33
34
  getPublicKeyHash(): string;
34
35
  isMaster(): boolean;
@@ -84,6 +84,11 @@ export class IdentityPublicKeyWASM {
84
84
  set contractBounds(contractBounds) {
85
85
  this._rawIdentityPublicKey.contractBounds = contractBounds?._rawContractBounds;
86
86
  }
87
+ getContractBounds() {
88
+ if (this._rawIdentityPublicKey.contractBounds != null) {
89
+ return ContractBoundsWASM.createFromRawInstance(this._rawIdentityPublicKey.contractBounds);
90
+ }
91
+ }
87
92
  removeDisabledAt() {
88
93
  this._rawIdentityPublicKey.removeDisabledAt();
89
94
  }
@@ -10,6 +10,7 @@ export declare class IdentityPublicKeyInCreationWASM {
10
10
  toIdentityPublicKey(): IdentityPublicKeyWASM;
11
11
  validatePrivateKey(privateKey: string | Uint8Array | PrivateKeyWASM, network: NetworkLike): boolean;
12
12
  getHash(): Uint8Array;
13
+ getContractBounds(): ContractBoundsWASM | undefined;
13
14
  get contractBounds(): ContractBoundsWASM | undefined;
14
15
  set contractBounds(value: ContractBoundsWASM);
15
16
  get keyId(): number;
@@ -19,6 +19,11 @@ export class IdentityPublicKeyInCreationWASM {
19
19
  getHash() {
20
20
  return this._rawKeyInCreation.getHash();
21
21
  }
22
+ getContractBounds() {
23
+ if (this._rawKeyInCreation.contractBounds != null) {
24
+ return ContractBoundsWASM.createFromRawInstance(this._rawKeyInCreation.contractBounds);
25
+ }
26
+ }
22
27
  get contractBounds() {
23
28
  if (this._rawKeyInCreation.contractBounds != null) {
24
29
  return ContractBoundsWASM.createFromRawInstance(this._rawKeyInCreation.contractBounds);
@@ -243,9 +243,13 @@ export interface IdentityTokenBalance {
243
243
  balance: bigint;
244
244
  id: IdentifierWASM;
245
245
  }
246
+ export interface IdentityTokenBalanceOptional {
247
+ balance?: bigint;
248
+ id: IdentifierWASM;
249
+ }
246
250
  export interface VerifiedTokenBalancesForIdentities {
247
251
  rootHash: Uint8Array;
248
- balances: IdentityTokenBalance[];
252
+ balances: IdentityTokenBalanceOptional[];
249
253
  }
250
254
  export interface TokenContractInfo {
251
255
  contractId: IdentifierWASM;
@@ -269,5 +273,5 @@ export interface VerifiedTokenTotalSupply {
269
273
  }
270
274
  export interface VerifiedTokensBalancesForIdentity {
271
275
  rootHash: Uint8Array;
272
- balances: IdentityTokenBalance[];
276
+ balances: IdentityTokenBalanceOptional[];
273
277
  }
@@ -1,5 +1,5 @@
1
1
  import type { DynamicValue, IdentifierLikeNAPI } from '../../binaries/bindingsTypes.js';
2
2
  import { IdentifierLike } from './types.js';
3
3
  export declare function valueToDynamicValue(value: any): DynamicValue;
4
- export declare function valueFromDynamicValue(dynamicValue: DynamicValue): any;
4
+ export declare function valueFromDynamicValue(dynamicValue: DynamicValue, jsonLike?: boolean): any;
5
5
  export declare function prepareIdentifierValue(identifier: IdentifierLike): IdentifierLikeNAPI;
@@ -2,7 +2,7 @@ import { dppProvider } from './provider.js';
2
2
  import { UINT32MAX } from './constants.js';
3
3
  import { IdentifierWASM } from './structs/Identifier.js';
4
4
  export function valueToDynamicValue(value) {
5
- if (typeof value === 'bigint' || value > UINT32MAX) {
5
+ if (typeof value === 'bigint' || (value > UINT32MAX && typeof value !== 'string')) {
6
6
  return dppProvider.dpp.DynamicValue.fromBigIntString(BigInt(value.toString()).toString());
7
7
  }
8
8
  else if (value instanceof IdentifierWASM || value instanceof dppProvider.dpp.IdentifierNAPI) {
@@ -43,21 +43,27 @@ export function valueToDynamicValue(value) {
43
43
  return new dppProvider.dpp.DynamicValue(value);
44
44
  }
45
45
  }
46
- export function valueFromDynamicValue(dynamicValue) {
46
+ export function valueFromDynamicValue(dynamicValue, jsonLike = false) {
47
47
  if (dynamicValue.value instanceof dppProvider.dpp.DynamicValue) {
48
- return valueToDynamicValue(dynamicValue.value);
48
+ return valueFromDynamicValue(dynamicValue.value, jsonLike);
49
49
  }
50
50
  else if (dynamicValue.isBigInt()) {
51
- return BigInt(dynamicValue.value);
51
+ const num = BigInt(dynamicValue.value);
52
+ if (jsonLike && num < BigInt(Number.MAX_SAFE_INTEGER) && num > BigInt(Number.MIN_SAFE_INTEGER)) {
53
+ return Number(dynamicValue.value);
54
+ }
55
+ else {
56
+ return num;
57
+ }
52
58
  }
53
59
  else if (Array.isArray(dynamicValue.value)) {
54
- return dynamicValue.value.map(valueFromDynamicValue);
60
+ return dynamicValue.value.map(v => valueFromDynamicValue(v, jsonLike));
55
61
  }
56
62
  else if (typeof dynamicValue.value === 'object' && !(dynamicValue.value instanceof Uint8Array) && dynamicValue.value !== null) {
57
63
  const obj = {};
58
64
  const keys = Object.keys(dynamicValue.value);
59
65
  for (const key of keys) {
60
- obj[key] = valueFromDynamicValue(dynamicValue.value[key]);
66
+ obj[key] = valueFromDynamicValue(dynamicValue.value[key], jsonLike);
61
67
  }
62
68
  return obj;
63
69
  }
@@ -2,7 +2,7 @@ import { dppProvider } from '../../provider.js';
2
2
  import { valueFromDynamicValue, valueToDynamicValue } from '../../utils.js';
3
3
  import { IdentifierWASM } from '../../structs/Identifier.js';
4
4
  export function verifyVotePollVoteStateProof(proof, contract, documentTypeName, indexName, indexValues, resultType, allowIncludeLockedAndAbstainingVoteTally, count, startAt, platformVersion) {
5
- const result = dppProvider.dpp.verifyVotePollVoteStateProof(proof, contract._rawDataContract, documentTypeName, indexName, indexValues, valueToDynamicValue(resultType), allowIncludeLockedAndAbstainingVoteTally, count, valueToDynamicValue(startAt), valueToDynamicValue(platformVersion));
5
+ const result = dppProvider.dpp.verifyVotePollVoteStateProof(proof, contract._rawDataContract, documentTypeName, indexName, indexValues, valueToDynamicValue(resultType), allowIncludeLockedAndAbstainingVoteTally ?? true, count, valueToDynamicValue(startAt), valueToDynamicValue(platformVersion));
6
6
  const winner = valueFromDynamicValue(result.result.winner);
7
7
  const winnerBlockInfo = winner?.blockInfo;
8
8
  const outWinner = winner != null
@@ -1,7 +1,7 @@
1
1
  import { dppProvider } from '../../provider.js';
2
2
  import { valueToDynamicValue } from '../../utils.js';
3
3
  export function verifyEpochsInfoProof(proof, currentEpoch, startEpoch, count, ascending, platformVersion) {
4
- const result = dppProvider.dpp.verifyEpochsInfoProof(proof, currentEpoch, startEpoch, count, ascending, valueToDynamicValue(platformVersion));
4
+ const result = dppProvider.dpp.verifyEpochsInfoProof(proof, currentEpoch, startEpoch, count, ascending ?? false, valueToDynamicValue(platformVersion));
5
5
  return {
6
6
  rootHash: result.rootHash,
7
7
  epochsInfo: result.epochsInfo.map(info => ({
@@ -6,7 +6,7 @@ export function verifyTokenBalancesForIdentitiesProof(proof, tokenId, isProofSub
6
6
  return {
7
7
  rootHash: result.rootHash,
8
8
  balances: result.balances.map(balance => ({
9
- balance: BigInt(balance.balance),
9
+ balance: balance.balance != null ? BigInt(balance.balance) : undefined,
10
10
  id: IdentifierWASM.createFromRawInstance(balance.id)
11
11
  }))
12
12
  };
@@ -6,7 +6,7 @@ export function verifyTokensBalancesForIdentityProof(proof, tokenIds, identityId
6
6
  return {
7
7
  rootHash: result.rootHash,
8
8
  balances: result.balances.map(balance => ({
9
- balance: BigInt(balance.balance),
9
+ balance: balance.balance != null ? BigInt(balance.balance) : undefined,
10
10
  id: IdentifierWASM.createFromRawInstance(balance.id)
11
11
  }))
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pshenmic-dpp",
3
- "version": "2.0.0-dev.4",
3
+ "version": "2.0.0-dev.6",
4
4
  "main": "dist/src/wasm.js",
5
5
  "types": "dist/src/wasm.d.ts",
6
6
  "react-native": "./dist/src/react-native.js",
@@ -94,6 +94,7 @@ describe('DynamicValue', () => {
94
94
  stringUint: '11',
95
95
  stringInt: '-11',
96
96
  stringFloat: '11.2',
97
+ bigStringNumber: '11111111111111111111111111111111'
97
98
  }
98
99
 
99
100
  const dynValue = valueToDynamicValue(mock)
@@ -110,4 +111,16 @@ describe('DynamicValue', () => {
110
111
  expect(dynValue.value.stringInt.getType()).toStrictEqual('String')
111
112
  expect(dynValue.value.stringFloat.getType()).toStrictEqual('String')
112
113
  })
114
+
115
+ describe('should decode document from state transition in jsonLike', function () {
116
+ const stateTransition = dpp.StateTransitionWASM.fromBase64('AgHv88sfWzscuW2Ob/0v5d+EgqmWG7ZIvlQG7mHWBH7z9gEAAAAB7JH7W+JkM0Vne2U1zlWYVeQNzRPTpdiWRfsgfwNS2UoCCGJsb2dQb3N0KBdMgeznVQ1smUXVFNPfE2PC379wpWVH8cdu2ilzeI0Ah/i2xfrKCm5ACQAbEQkSc+GRUkdLor4Eu7Vzf6oRc9UHBmJsb2dJZAogdhC4nVm3ufPCgdfoOKXtnhqwg7O3axyTS9WB3EFvNBYPY29tbWVudHNFbmFibGVkEwEHY29udGVudAr7AUh4nM2TTWrDMBCFrxK0jkCyJMvqLnRV6A1KFhpplJgotrEVaAi+e8clpdBuvCnNcn7ezPvQ6O3G2siemKgNSGETT8ZarhUm7hpX8yStEpVCk6xlW1auA1L34Ed/GP1wpNQw9sPEnm6s4Ht57nM/UkPE5C+5UBl8OB3G/tLF37VFscvtoTtjV6iSMRU2b1nou/KZIXf3jUvrXUHRrosbv8ltKRk30JbNl2LLpnLNuPiZ5z1NOrY5jtjRqP28vbM656zTleagJHCNXnIQiUIpgozGg2/0N2s4Yji9tlN5KXj+A97FJG1AcpZ8nnANv1wHGo22ASrFXQDJde0SBzDIdQBVRQEoDDw2aLUONPkKtfF0s9bR9bqGkJW3PNYCg/FOgIqPDarWgQrRxKapBXdCJ3pR7TjUVnJrpAo6yhSc/4dv+tPu/gNBt2qtC3B1Ymxpc2hlZEF0Av0AAAGcptJlIwRzbHVnEhV0aGlzLWlzLW15LWZpcnN0LXBvc3QIc3VidGl0bGUSD1dpdGggYSBzdWJ0aXRsZQV0aXRsZRIVVGhpcyBpcyBteSBmaXJzdCBwb3N0AAABQR+H40MbUEmFXQbTPcwy9vMD8EiTwDzMpW3YIkfSIDvHij5ZIAVvqm0ZJScJzKV7EnRUi/f1tZ/wFJfd1+LDtpps')
117
+
118
+ const batch = dpp.BatchTransitionWASM.fromStateTransition(stateTransition)
119
+
120
+ const transition = batch.transitions[0].toTransition() as dpp.DocumentTransitionWASM
121
+
122
+ const publishedAt = transition.createTransition.data.publishedAt
123
+
124
+ expect(typeof publishedAt).toEqual('number')
125
+ })
113
126
  })