pshenmic-dpp 2.0.0-dev.2 → 2.0.0-dev.20

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 (172) hide show
  1. package/dist/binaries/bindingsTypes.d.ts +200 -37
  2. package/dist/binaries/bindingsTypes.js +4 -3
  3. package/dist/binaries/native/aarch64-apple-darwin/pshenmic_dpp.node +0 -0
  4. package/dist/binaries/native/x86_64-apple-darwin/pshenmic_dpp.node +0 -0
  5. package/dist/binaries/native/x86_64-unknown-linux-gnu/pshenmic_dpp.node +0 -0
  6. package/dist/binaries/native/x86_64-unknown-linux-musl/pshenmic_dpp.node +0 -0
  7. package/dist/binaries/node.cjs +50 -0
  8. package/dist/binaries/node.d.cts +2 -0
  9. package/dist/binaries/pshenmic_dpp.android.node/arm64-v8a/libpshenmic_dpp.so +0 -0
  10. package/dist/binaries/pshenmic_dpp.apple.node/Info.plist +29 -0
  11. package/dist/binaries/pshenmic_dpp.apple.node/ios-arm64-simulator/libpshenmic_dpp.framework/Info.plist +24 -0
  12. package/dist/binaries/pshenmic_dpp.apple.node/ios-arm64-simulator/libpshenmic_dpp.framework/libpshenmic_dpp +0 -0
  13. package/dist/binaries/pshenmic_dpp.apple.node/react-native-node-api-module +0 -0
  14. package/dist/binaries/pshenmic_dpp.d.ts +15 -1
  15. package/dist/binaries/pshenmic_dpp.js +1 -1
  16. package/dist/binaries/wasm/wasmBytes.cjs +3 -0
  17. package/dist/binaries/wasm/wasmBytes.d.cts +1 -0
  18. package/dist/binaries/wasm.d.ts +15 -1
  19. package/dist/binaries/wasm.js +2 -44
  20. package/dist/binaries/wasmCreation.cjs +46 -0
  21. package/dist/binaries/wasmCreation.d.cts +2 -0
  22. package/dist/src/dpp/dpp.d.ts +11 -2
  23. package/dist/src/dpp/dpp.js +11 -2
  24. package/dist/src/dpp/structs/AddressTransitions/AddressCreditWithdrawalTransition.d.ts +1 -1
  25. package/dist/src/dpp/structs/AddressTransitions/AddressCreditWithdrawalTransition.js +2 -2
  26. package/dist/src/dpp/structs/AddressTransitions/AddressFundingFromAssetLockTransition.d.ts +1 -1
  27. package/dist/src/dpp/structs/AddressTransitions/AddressFundingFromAssetLockTransition.js +3 -3
  28. package/dist/src/dpp/structs/AddressTransitions/AddressFundsTransferTransition.d.ts +1 -1
  29. package/dist/src/dpp/structs/AddressTransitions/AddressFundsTransferTransition.js +3 -3
  30. package/dist/src/dpp/structs/AddressTransitions/IdentityCreateFromAddressesTransition.d.ts +1 -1
  31. package/dist/src/dpp/structs/AddressTransitions/IdentityCreateFromAddressesTransition.js +2 -2
  32. package/dist/src/dpp/structs/AddressTransitions/IdentityCreditTransferToAddressesTransition.js +1 -1
  33. package/dist/src/dpp/structs/AddressTransitions/IdentityTopUpFromAddressesTransition.d.ts +1 -1
  34. package/dist/src/dpp/structs/AddressTransitions/IdentityTopUpFromAddressesTransition.js +2 -2
  35. package/dist/src/dpp/structs/AddressTransitions/entities/InputAddress.d.ts +4 -3
  36. package/dist/src/dpp/structs/AddressTransitions/entities/InputAddress.js +5 -4
  37. package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddress.d.ts +4 -3
  38. package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddress.js +5 -4
  39. package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddressNullableCredits.d.ts +4 -3
  40. package/dist/src/dpp/structs/AddressTransitions/entities/OutputAddressNullableCredits.js +5 -4
  41. package/dist/src/dpp/structs/AssetLockProof/AssetLockProof.js +1 -1
  42. package/dist/src/dpp/structs/AssetLockProof/ChainAssetLockProof.js +2 -2
  43. package/dist/src/dpp/structs/AssetLockProof/InstantAssetLockProof.js +1 -1
  44. package/dist/src/dpp/structs/AssetLockProof/OutPoint.js +1 -1
  45. package/dist/src/dpp/structs/AssetLockProof/Transaction.js +1 -1
  46. package/dist/src/dpp/structs/AssetLockProof/TxIn.js +1 -1
  47. package/dist/src/dpp/structs/AssetLockProof/TxOut.js +1 -1
  48. package/dist/src/dpp/structs/AssetLockProof/Witness.js +1 -1
  49. package/dist/src/dpp/structs/Batch/BatchTransition.js +1 -1
  50. package/dist/src/dpp/structs/Batch/BatchedTransition.js +1 -1
  51. package/dist/src/dpp/structs/Batch/DocumentBaseTransition.js +1 -1
  52. package/dist/src/dpp/structs/Batch/DocumentTransition.d.ts +1 -0
  53. package/dist/src/dpp/structs/Batch/DocumentTransition.js +4 -1
  54. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentCreateTransition.d.ts +1 -1
  55. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentCreateTransition.js +2 -2
  56. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentDeleteTransition.js +1 -1
  57. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentPurchaseTransition.js +1 -1
  58. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentReplaceTransition.d.ts +1 -1
  59. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentReplaceTransition.js +2 -2
  60. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentTransferTransition.js +1 -1
  61. package/dist/src/dpp/structs/Batch/DocumentTransitions/DocumentUpdatePriceTransition.js +1 -1
  62. package/dist/src/dpp/structs/Batch/PrefundedVotingBalance.js +1 -1
  63. package/dist/src/dpp/structs/Batch/TokenBaseTransition.js +1 -1
  64. package/dist/src/dpp/structs/Batch/TokenPaymentInfo.js +1 -1
  65. package/dist/src/dpp/structs/Batch/TokenPricingSchedule.js +1 -1
  66. package/dist/src/dpp/structs/Batch/TokenTransition.d.ts +1 -0
  67. package/dist/src/dpp/structs/Batch/TokenTransition.js +4 -1
  68. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenBurnTransition.js +1 -1
  69. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenClaimTransition.js +1 -1
  70. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenConfigUpdateTransition.js +1 -1
  71. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenDestroyFrozenFundsTransition.js +1 -1
  72. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenDirectPurchaseTransition.js +1 -1
  73. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenEmergencyActionTransition.js +1 -1
  74. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenFreezeTransition.js +1 -1
  75. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenMintTransition.js +1 -1
  76. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenSetPriceForDirectPurchaseTransition.js +1 -1
  77. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenTransferTransition.d.ts +3 -0
  78. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenTransferTransition.js +8 -1
  79. package/dist/src/dpp/structs/Batch/TokenTransitions/TokenUnFreezeTransition.js +1 -1
  80. package/dist/src/dpp/structs/ContractBounds.js +1 -1
  81. package/dist/src/dpp/structs/CoreScript.js +1 -1
  82. package/dist/src/dpp/structs/DataContract.d.ts +6 -4
  83. package/dist/src/dpp/structs/DataContract.js +8 -2
  84. package/dist/src/dpp/structs/DataContractTransitions/DataContractCreateTransition.js +1 -1
  85. package/dist/src/dpp/structs/DataContractTransitions/DataContractUpdateTransition.js +1 -1
  86. package/dist/src/dpp/structs/Document.d.ts +1 -1
  87. package/dist/src/dpp/structs/Document.js +1 -1
  88. package/dist/src/dpp/structs/EncryptedNote/PrivateEncryptedNote.js +1 -1
  89. package/dist/src/dpp/structs/EncryptedNote/SharedEncryptedNote.js +1 -1
  90. package/dist/src/dpp/structs/GroupStateTransitionInfo.js +1 -1
  91. package/dist/src/dpp/structs/Identifier.js +1 -1
  92. package/dist/src/dpp/structs/Identity.js +1 -1
  93. package/dist/src/dpp/structs/IdentityPublicKey.d.ts +1 -0
  94. package/dist/src/dpp/structs/IdentityPublicKey.js +6 -1
  95. package/dist/src/dpp/structs/IdentityPublicKeyInCreation.d.ts +1 -0
  96. package/dist/src/dpp/structs/IdentityPublicKeyInCreation.js +6 -1
  97. package/dist/src/dpp/structs/IdentityTransitions/IdentityCreateTransition.js +1 -1
  98. package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditTransfer.js +1 -1
  99. package/dist/src/dpp/structs/IdentityTransitions/IdentityCreditWithdrawalTransition.js +1 -1
  100. package/dist/src/dpp/structs/IdentityTransitions/IdentityTopUpTransition.js +1 -1
  101. package/dist/src/dpp/structs/IdentityTransitions/IdentityUpdateTransition.js +1 -1
  102. package/dist/src/dpp/structs/InstantLock.js +1 -1
  103. package/dist/src/dpp/structs/MasternodeVote/MasternodeVoteTransition.d.ts +0 -2
  104. package/dist/src/dpp/structs/MasternodeVote/MasternodeVoteTransition.js +1 -7
  105. package/dist/src/dpp/structs/MasternodeVote/Vote.js +1 -1
  106. package/dist/src/dpp/structs/MasternodeVote/VotePoll.d.ts +1 -1
  107. package/dist/src/dpp/structs/MasternodeVote/VotePoll.js +3 -3
  108. package/dist/src/dpp/structs/PartialIdentity.js +1 -1
  109. package/dist/src/dpp/structs/{Address → PlatformAddress}/AddressWitness.d.ts +2 -2
  110. package/dist/src/dpp/structs/{Address → PlatformAddress}/AddressWitness.js +2 -2
  111. package/dist/src/dpp/structs/{Address → PlatformAddress}/PlatformAddress.d.ts +4 -2
  112. package/dist/src/dpp/structs/{Address → PlatformAddress}/PlatformAddress.js +9 -3
  113. package/dist/src/dpp/structs/PrivateKey.js +1 -1
  114. package/dist/src/dpp/structs/PublicKey.js +1 -1
  115. package/dist/src/dpp/structs/ShieldedTransitions/IdentityCreateFromShieldedPoolTransition.d.ts +31 -0
  116. package/dist/src/dpp/structs/ShieldedTransitions/IdentityCreateFromShieldedPoolTransition.js +73 -0
  117. package/dist/src/dpp/structs/ShieldedTransitions/SerializedAction.d.ts +19 -0
  118. package/dist/src/dpp/structs/ShieldedTransitions/SerializedAction.js +49 -0
  119. package/dist/src/dpp/structs/ShieldedTransitions/ShieldFromAssetLockTransition.d.ts +30 -0
  120. package/dist/src/dpp/structs/ShieldedTransitions/ShieldFromAssetLockTransition.js +77 -0
  121. package/dist/src/dpp/structs/ShieldedTransitions/ShieldTransition.d.ts +32 -0
  122. package/dist/src/dpp/structs/ShieldedTransitions/ShieldTransition.js +78 -0
  123. package/dist/src/dpp/structs/ShieldedTransitions/ShieldedTransferTransition.d.ts +21 -0
  124. package/dist/src/dpp/structs/ShieldedTransitions/ShieldedTransferTransition.js +51 -0
  125. package/dist/src/dpp/structs/ShieldedTransitions/ShieldedWithdrawalTransition.d.ts +29 -0
  126. package/dist/src/dpp/structs/ShieldedTransitions/ShieldedWithdrawalTransition.js +71 -0
  127. package/dist/src/dpp/structs/ShieldedTransitions/UnshieldTransition.d.ts +25 -0
  128. package/dist/src/dpp/structs/ShieldedTransitions/UnshieldTransition.js +59 -0
  129. package/dist/src/dpp/structs/StateTransition.d.ts +1 -0
  130. package/dist/src/dpp/structs/StateTransition.js +3 -0
  131. package/dist/src/dpp/structs/TokenConfiguration/ActionTaker.js +1 -1
  132. package/dist/src/dpp/structs/TokenConfiguration/ChangeControlRules.js +1 -1
  133. package/dist/src/dpp/structs/TokenConfiguration/Group.js +1 -1
  134. package/dist/src/dpp/structs/TokenConfiguration/TokenConfiguration.js +1 -1
  135. package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationConvention.js +1 -1
  136. package/dist/src/dpp/structs/TokenConfiguration/TokenConfigurationLocalization.js +1 -1
  137. package/dist/src/dpp/structs/TokenConfiguration/TokenDistributionRules.js +1 -1
  138. package/dist/src/dpp/structs/TokenConfiguration/TokenKeepsHistoryRules.js +1 -1
  139. package/dist/src/dpp/structs/TokenConfiguration/TokenMarketplaceRules.js +1 -1
  140. package/dist/src/dpp/structs/TokenConfiguration/TokenPerpetualDistribution.js +1 -1
  141. package/dist/src/dpp/structs/TokenConfiguration/TokenPreProgrammedDistribution.js +1 -1
  142. package/dist/src/dpp/types.d.ts +50 -11
  143. package/dist/src/dpp/utils.d.ts +4 -3
  144. package/dist/src/dpp/utils.js +24 -6
  145. package/dist/src/dpp/verify/Contested/verifyVotePollVoteStateProof.d.ts +1 -1
  146. package/dist/src/dpp/verify/Contested/verifyVotePollVoteStateProof.js +1 -1
  147. package/dist/src/dpp/verify/PlatformAddress/verifyPlatformAddressInfo.d.ts +2 -0
  148. package/dist/src/dpp/verify/PlatformAddress/verifyPlatformAddressInfo.js +12 -0
  149. package/dist/src/dpp/verify/PlatformAddress/verifyPlatformAddressesInfos.d.ts +2 -0
  150. package/dist/src/dpp/verify/PlatformAddress/verifyPlatformAddressesInfos.js +14 -0
  151. package/dist/src/dpp/verify/StateTransition/utils.js +80 -15
  152. package/dist/src/dpp/verify/System/verifyEpochsInfoProof.js +1 -1
  153. package/dist/src/dpp/verify/Tokens/verifyTokenBalancesForIdentitiesProof.js +1 -1
  154. package/dist/src/dpp/verify/Tokens/verifyTokensBalancesForIdentityProof.js +1 -1
  155. package/dist/src/native.d.ts +3 -0
  156. package/dist/src/native.js +8 -0
  157. package/dist/utils/{base122.js → base122.cjs} +3 -1
  158. package/package.json +18 -28
  159. package/tests/unit/DataContract.spec.ts +281 -0
  160. package/tests/unit/DynamicValue.spec.ts +42 -2
  161. package/tests/unit/Identifier.spec.ts +1 -1
  162. package/tests/unit/Identity.spec.ts +1 -1
  163. package/tests/unit/IdentityPublicKey.spec.ts +1 -1
  164. package/tests/unit/NodeApi.spec.ts +49 -0
  165. package/tests/unit/ShieldedTransitions.spec.ts +709 -0
  166. package/tests/unit/TokenConfiguration.spec.ts +114 -0
  167. package/tests/unit/WebAssembly.spec.ts +49 -0
  168. package/tests/unit/utils/buildTokenConfiguration.ts +66 -0
  169. package/dist/binaries/pshenmic_dpp.android.node/x86_64/libpshenmic_dpp.so +0 -0
  170. package/dist/binaries/wasm/wasmBytes.d.ts +0 -2
  171. package/dist/binaries/wasm/wasmBytes.js +0 -2
  172. /package/dist/utils/{base122.d.ts → base122.d.cts} +0 -0
@@ -0,0 +1,21 @@
1
+ import type { ShieldedTransferTransitionNAPI } from '../../../../binaries/bindingsTypes.js';
2
+ import { SerializedActionWASM } from './SerializedAction.js';
3
+ import { StateTransitionWASM } from '../StateTransition.js';
4
+ export declare class ShieldedTransferTransitionWASM {
5
+ /** @private **/
6
+ _rawShieldedTransferTransition: ShieldedTransferTransitionNAPI;
7
+ constructor(actions: SerializedActionWASM[], valueBalance: bigint, anchor: Uint8Array, proof: Uint8Array, bindingsSignature: Uint8Array);
8
+ get actions(): SerializedActionWASM[];
9
+ set actions(value: SerializedActionWASM[]);
10
+ get valueBalance(): bigint;
11
+ set valueBalance(value: bigint);
12
+ get anchor(): Uint8Array;
13
+ set anchor(value: Uint8Array);
14
+ get proof(): Uint8Array;
15
+ set proof(value: Uint8Array);
16
+ get bindingsSignature(): Uint8Array;
17
+ set bindingsSignature(value: Uint8Array);
18
+ toStateTransition(): StateTransitionWASM;
19
+ static fromStateTransition(st: StateTransitionWASM): ShieldedTransferTransitionWASM;
20
+ static createFromRawInstance(rawInstance: ShieldedTransferTransitionNAPI): ShieldedTransferTransitionWASM;
21
+ }
@@ -0,0 +1,51 @@
1
+ import { SerializedActionWASM } from './SerializedAction.js';
2
+ import { dppProvider } from '../../provider.js';
3
+ import { StateTransitionWASM } from '../StateTransition.js';
4
+ export class ShieldedTransferTransitionWASM {
5
+ /** @private **/
6
+ _rawShieldedTransferTransition;
7
+ constructor(actions, valueBalance, anchor, proof, bindingsSignature) {
8
+ this._rawShieldedTransferTransition = new dppProvider.dpp.ShieldedTransferTransitionNAPI(actions.map(a => a._rawSerializedAction), valueBalance.toString(), anchor, proof, bindingsSignature);
9
+ }
10
+ get actions() {
11
+ return this._rawShieldedTransferTransition.actions.map(SerializedActionWASM.createFromRawInstance);
12
+ }
13
+ set actions(value) {
14
+ this._rawShieldedTransferTransition.actions = value.map(a => a._rawSerializedAction);
15
+ }
16
+ get valueBalance() {
17
+ return BigInt(this._rawShieldedTransferTransition.valueBalance);
18
+ }
19
+ set valueBalance(value) {
20
+ this._rawShieldedTransferTransition.valueBalance = value.toString();
21
+ }
22
+ get anchor() {
23
+ return this._rawShieldedTransferTransition.anchor;
24
+ }
25
+ set anchor(value) {
26
+ this._rawShieldedTransferTransition.anchor = value;
27
+ }
28
+ get proof() {
29
+ return this._rawShieldedTransferTransition.proof;
30
+ }
31
+ set proof(value) {
32
+ this._rawShieldedTransferTransition.proof = value;
33
+ }
34
+ get bindingsSignature() {
35
+ return this._rawShieldedTransferTransition.bindingsSignature;
36
+ }
37
+ set bindingsSignature(value) {
38
+ this._rawShieldedTransferTransition.bindingsSignature = value;
39
+ }
40
+ toStateTransition() {
41
+ return StateTransitionWASM.createFromRawInstance(this._rawShieldedTransferTransition.toStateTransition());
42
+ }
43
+ static fromStateTransition(st) {
44
+ return ShieldedTransferTransitionWASM.createFromRawInstance(dppProvider.dpp.ShieldedTransferTransitionNAPI.fromStateTransition(st._rawStateTransition));
45
+ }
46
+ static createFromRawInstance(rawInstance) {
47
+ const instance = Object.create(ShieldedTransferTransitionWASM.prototype);
48
+ instance._rawShieldedTransferTransition = rawInstance;
49
+ return instance;
50
+ }
51
+ }
@@ -0,0 +1,29 @@
1
+ import type { ShieldedWithdrawalTransitionNAPI } from '../../../../binaries/bindingsTypes.js';
2
+ import { SerializedActionWASM } from './SerializedAction.js';
3
+ import { CoreScriptWASM } from '../CoreScript.js';
4
+ import { PoolingLike } from '../../types.js';
5
+ import { StateTransitionWASM } from '../StateTransition.js';
6
+ export declare class ShieldedWithdrawalTransitionWASM {
7
+ /** @private **/
8
+ _rawShieldedWithdrawalTransition: ShieldedWithdrawalTransitionNAPI;
9
+ constructor(actions: SerializedActionWASM[], unshieldingAmount: bigint, anchor: Uint8Array, proof: Uint8Array, bindingsSignature: Uint8Array, coreFeePerByte: number, pooling: PoolingLike, outputScript: CoreScriptWASM);
10
+ get actions(): SerializedActionWASM[];
11
+ set actions(value: SerializedActionWASM[]);
12
+ get unshieldingAmount(): bigint;
13
+ set unshieldingAmount(value: bigint);
14
+ get anchor(): Uint8Array;
15
+ set anchor(value: Uint8Array);
16
+ get proof(): Uint8Array;
17
+ set proof(value: Uint8Array);
18
+ get bindingsSignature(): Uint8Array;
19
+ set bindingsSignature(value: Uint8Array);
20
+ get coreFeePerByte(): number;
21
+ set coreFeePerByte(value: number);
22
+ get pooling(): string;
23
+ set pooling(value: PoolingLike);
24
+ get outputScript(): CoreScriptWASM;
25
+ set outputScript(value: CoreScriptWASM);
26
+ toStateTransition(): StateTransitionWASM;
27
+ static fromStateTransition(st: StateTransitionWASM): ShieldedWithdrawalTransitionWASM;
28
+ static createFromRawInstance(rawInstance: ShieldedWithdrawalTransitionNAPI): ShieldedWithdrawalTransitionWASM;
29
+ }
@@ -0,0 +1,71 @@
1
+ import { SerializedActionWASM } from './SerializedAction.js';
2
+ import { CoreScriptWASM } from '../CoreScript.js';
3
+ import { dppProvider } from '../../provider.js';
4
+ import { valueToDynamicValue } from '../../utils.js';
5
+ import { StateTransitionWASM } from '../StateTransition.js';
6
+ export class ShieldedWithdrawalTransitionWASM {
7
+ /** @private **/
8
+ _rawShieldedWithdrawalTransition;
9
+ constructor(actions, unshieldingAmount, anchor, proof, bindingsSignature, coreFeePerByte, pooling, outputScript) {
10
+ this._rawShieldedWithdrawalTransition = new dppProvider.dpp.ShieldedWithdrawalTransitionNAPI(actions.map(a => a._rawSerializedAction), unshieldingAmount.toString(), anchor, proof, bindingsSignature, coreFeePerByte, valueToDynamicValue(pooling), outputScript._rawCoreScript);
11
+ }
12
+ get actions() {
13
+ return this._rawShieldedWithdrawalTransition.actions.map(SerializedActionWASM.createFromRawInstance);
14
+ }
15
+ set actions(value) {
16
+ this._rawShieldedWithdrawalTransition.actions = value.map(a => a._rawSerializedAction);
17
+ }
18
+ get unshieldingAmount() {
19
+ return BigInt(this._rawShieldedWithdrawalTransition.unshieldingAmount);
20
+ }
21
+ set unshieldingAmount(value) {
22
+ this._rawShieldedWithdrawalTransition.unshieldingAmount = value.toString();
23
+ }
24
+ get anchor() {
25
+ return this._rawShieldedWithdrawalTransition.anchor;
26
+ }
27
+ set anchor(value) {
28
+ this._rawShieldedWithdrawalTransition.anchor = value;
29
+ }
30
+ get proof() {
31
+ return this._rawShieldedWithdrawalTransition.proof;
32
+ }
33
+ set proof(value) {
34
+ this._rawShieldedWithdrawalTransition.proof = value;
35
+ }
36
+ get bindingsSignature() {
37
+ return this._rawShieldedWithdrawalTransition.bindingsSignature;
38
+ }
39
+ set bindingsSignature(value) {
40
+ this._rawShieldedWithdrawalTransition.bindingsSignature = value;
41
+ }
42
+ get coreFeePerByte() {
43
+ return this._rawShieldedWithdrawalTransition.coreFeePerByte;
44
+ }
45
+ set coreFeePerByte(value) {
46
+ this._rawShieldedWithdrawalTransition.coreFeePerByte = value;
47
+ }
48
+ get pooling() {
49
+ return this._rawShieldedWithdrawalTransition.pooling;
50
+ }
51
+ set pooling(value) {
52
+ this._rawShieldedWithdrawalTransition.pooling = valueToDynamicValue(value);
53
+ }
54
+ get outputScript() {
55
+ return CoreScriptWASM.createFromRawInstance(this._rawShieldedWithdrawalTransition.outputScript);
56
+ }
57
+ set outputScript(value) {
58
+ this._rawShieldedWithdrawalTransition.outputScript = value._rawCoreScript;
59
+ }
60
+ toStateTransition() {
61
+ return StateTransitionWASM.createFromRawInstance(this._rawShieldedWithdrawalTransition.toStateTransition());
62
+ }
63
+ static fromStateTransition(st) {
64
+ return ShieldedWithdrawalTransitionWASM.createFromRawInstance(dppProvider.dpp.ShieldedWithdrawalTransitionNAPI.fromStateTransition(st._rawStateTransition));
65
+ }
66
+ static createFromRawInstance(rawInstance) {
67
+ const instance = Object.create(ShieldedWithdrawalTransitionWASM.prototype);
68
+ instance._rawShieldedWithdrawalTransition = rawInstance;
69
+ return instance;
70
+ }
71
+ }
@@ -0,0 +1,25 @@
1
+ import type { UnshieldTransitionNAPI } from '../../../../binaries/bindingsTypes.js';
2
+ import { SerializedActionWASM } from './SerializedAction.js';
3
+ import { PlatformAddressWASM } from '../PlatformAddress/PlatformAddress.js';
4
+ import { PlatformAddressLike } from '../../types.js';
5
+ import { StateTransitionWASM } from '../StateTransition.js';
6
+ export declare class UnshieldTransitionWASM {
7
+ /** @private **/
8
+ _rawUnshieldTransition: UnshieldTransitionNAPI;
9
+ constructor(outputAddress: PlatformAddressLike, actions: SerializedActionWASM[], unshieldingAmount: bigint, anchor: Uint8Array, proof: Uint8Array, bindingsSignature: Uint8Array);
10
+ get outputAddress(): PlatformAddressWASM;
11
+ set outputAddress(value: PlatformAddressLike);
12
+ get actions(): SerializedActionWASM[];
13
+ set actions(value: SerializedActionWASM[]);
14
+ get unshieldingAmount(): bigint;
15
+ set unshieldingAmount(value: bigint);
16
+ get anchor(): Uint8Array;
17
+ set anchor(value: Uint8Array);
18
+ get proof(): Uint8Array;
19
+ set proof(value: Uint8Array);
20
+ get bindingsSignature(): Uint8Array;
21
+ set bindingsSignature(value: Uint8Array);
22
+ toStateTransition(): StateTransitionWASM;
23
+ static fromStateTransition(st: StateTransitionWASM): UnshieldTransitionWASM;
24
+ static createFromRawInstance(rawInstance: UnshieldTransitionNAPI): UnshieldTransitionWASM;
25
+ }
@@ -0,0 +1,59 @@
1
+ import { SerializedActionWASM } from './SerializedAction.js';
2
+ import { PlatformAddressWASM } from '../PlatformAddress/PlatformAddress.js';
3
+ import { dppProvider } from '../../provider.js';
4
+ import { preparePlatformAddressValue } from '../../utils.js';
5
+ import { StateTransitionWASM } from '../StateTransition.js';
6
+ export class UnshieldTransitionWASM {
7
+ /** @private **/
8
+ _rawUnshieldTransition;
9
+ constructor(outputAddress, actions, unshieldingAmount, anchor, proof, bindingsSignature) {
10
+ this._rawUnshieldTransition = new dppProvider.dpp.UnshieldTransitionNAPI(preparePlatformAddressValue(outputAddress), actions.map(a => a._rawSerializedAction), unshieldingAmount.toString(), anchor, proof, bindingsSignature);
11
+ }
12
+ get outputAddress() {
13
+ return PlatformAddressWASM.createFromRawInstance(this._rawUnshieldTransition.outputAddress);
14
+ }
15
+ set outputAddress(value) {
16
+ this._rawUnshieldTransition.outputAddress = preparePlatformAddressValue(value);
17
+ }
18
+ get actions() {
19
+ return this._rawUnshieldTransition.actions.map(SerializedActionWASM.createFromRawInstance);
20
+ }
21
+ set actions(value) {
22
+ this._rawUnshieldTransition.actions = value.map(a => a._rawSerializedAction);
23
+ }
24
+ get unshieldingAmount() {
25
+ return BigInt(this._rawUnshieldTransition.unshieldingAmount);
26
+ }
27
+ set unshieldingAmount(value) {
28
+ this._rawUnshieldTransition.unshieldingAmount = value.toString();
29
+ }
30
+ get anchor() {
31
+ return this._rawUnshieldTransition.anchor;
32
+ }
33
+ set anchor(value) {
34
+ this._rawUnshieldTransition.anchor = value;
35
+ }
36
+ get proof() {
37
+ return this._rawUnshieldTransition.proof;
38
+ }
39
+ set proof(value) {
40
+ this._rawUnshieldTransition.proof = value;
41
+ }
42
+ get bindingsSignature() {
43
+ return this._rawUnshieldTransition.bindingsSignature;
44
+ }
45
+ set bindingsSignature(value) {
46
+ this._rawUnshieldTransition.bindingsSignature = value;
47
+ }
48
+ toStateTransition() {
49
+ return StateTransitionWASM.createFromRawInstance(this._rawUnshieldTransition.toStateTransition());
50
+ }
51
+ static fromStateTransition(st) {
52
+ return UnshieldTransitionWASM.createFromRawInstance(dppProvider.dpp.UnshieldTransitionNAPI.fromStateTransition(st._rawStateTransition));
53
+ }
54
+ static createFromRawInstance(rawInstance) {
55
+ const instance = Object.create(UnshieldTransitionWASM.prototype);
56
+ instance._rawUnshieldTransition = rawInstance;
57
+ return instance;
58
+ }
59
+ }
@@ -28,6 +28,7 @@ export declare class StateTransitionWASM {
28
28
  setOwnerId(ownerId: IdentifierLike): void;
29
29
  setIdentityContractNonce(nonce: bigint): void;
30
30
  setIdentityNonce(nonce: bigint): void;
31
+ getSignableBytes(): Uint8Array;
31
32
  bytes(): Uint8Array;
32
33
  hex(): string;
33
34
  base64(): string;
@@ -76,6 +76,9 @@ export class StateTransitionWASM {
76
76
  setIdentityNonce(nonce) {
77
77
  this._rawStateTransition.setIdentityNonce(nonce.toString());
78
78
  }
79
+ getSignableBytes() {
80
+ return this._rawStateTransition.getSignableBytes();
81
+ }
79
82
  bytes() {
80
83
  return this._rawStateTransition.bytes();
81
84
  }
@@ -37,7 +37,7 @@ export class ActionTakerWASM {
37
37
  this._rawActionTaker.value = normalValue;
38
38
  }
39
39
  static createFromRawInstance(rawInstance) {
40
- const instance = Object.create(this.prototype);
40
+ const instance = Object.create(ActionTakerWASM.prototype);
41
41
  instance._rawActionTaker = rawInstance;
42
42
  return instance;
43
43
  }
@@ -45,7 +45,7 @@ export class ChangeControlRulesWASM {
45
45
  return this._rawChangeControlRules.canChangeAdminActionTakers(adminActionTakers._rawAuthorizedActionTakers, prepareIdentifierValue(contractOwnerId), mainGroup, normalGroups, actionTaker._rawActionTaker, valueToDynamicValue(goal));
46
46
  }
47
47
  static createFromRawInstance(rawInstance) {
48
- const instance = Object.create(this.prototype);
48
+ const instance = Object.create(ChangeControlRulesWASM.prototype);
49
49
  instance._rawChangeControlRules = rawInstance;
50
50
  return instance;
51
51
  }
@@ -37,7 +37,7 @@ export class GroupWASM {
37
37
  this._rawGroup.setMemberRequiredPower(prepareIdentifierValue(member), power);
38
38
  }
39
39
  static createFromRawInstance(rawInstance) {
40
- const instance = Object.create(this.prototype);
40
+ const instance = Object.create(GroupWASM.prototype);
41
41
  instance._rawGroup = rawInstance;
42
42
  return instance;
43
43
  }
@@ -132,7 +132,7 @@ export class TokenConfigurationWASM {
132
132
  return IdentifierWASM.createFromRawInstance(dppProvider.dpp.TokenConfigurationNAPI.calculateTokenId(prepareIdentifierValue(contractId), tokenPosition));
133
133
  }
134
134
  static createFromRawInstance(rawInstance) {
135
- const instance = Object.create(this.prototype);
135
+ const instance = Object.create(TokenConfigurationWASM.prototype);
136
136
  instance._rawTokenConfiguration = rawInstance;
137
137
  return instance;
138
138
  }
@@ -40,7 +40,7 @@ export class TokenConfigurationConventionWASM {
40
40
  this._rawTokenConfigurationConvention.localizations = normalLocalization;
41
41
  }
42
42
  static createFromRawInstance(rawInstance) {
43
- const instance = Object.create(this.prototype);
43
+ const instance = Object.create(TokenConfigurationConventionWASM.prototype);
44
44
  instance._rawTokenConfigurationConvention = rawInstance;
45
45
  return instance;
46
46
  }
@@ -27,7 +27,7 @@ export class TokenConfigurationLocalizationWASM {
27
27
  return this._rawTokenConfigurationLocalization.toJSON();
28
28
  }
29
29
  static createFromRawInstance(rawInstance) {
30
- const instance = Object.create(this.prototype);
30
+ const instance = Object.create(TokenConfigurationLocalizationWASM.prototype);
31
31
  instance._rawTokenConfigurationLocalization = rawInstance;
32
32
  return instance;
33
33
  }
@@ -68,7 +68,7 @@ export class TokenDistributionRulesWASM {
68
68
  this._rawTokenDistributionRules.changeDirectPurchasePricingRules = changeDirectPurchasePricingRules._rawChangeControlRules;
69
69
  }
70
70
  static createFromRawInstance(rawInstance) {
71
- const instance = Object.create(this.prototype);
71
+ const instance = Object.create(TokenDistributionRulesWASM.prototype);
72
72
  instance._rawTokenDistributionRules = rawInstance;
73
73
  return instance;
74
74
  }
@@ -42,7 +42,7 @@ export class TokenKeepsHistoryRulesWASM {
42
42
  this._rawTokenKeepsHistoryRules.keepsDirectPurchaseHistory = keepsDirectPurchaseHistory;
43
43
  }
44
44
  static createFromRawInstance(rawInstance) {
45
- const instance = Object.create(this.prototype);
45
+ const instance = Object.create(TokenKeepsHistoryRulesWASM.prototype);
46
46
  instance._rawTokenKeepsHistoryRules = rawInstance;
47
47
  return instance;
48
48
  }
@@ -20,7 +20,7 @@ export class TokenMarketplaceRulesWASM {
20
20
  this._rawTokenMarketplaceRules.tradeModeChangeRules = value._rawChangeControlRules;
21
21
  }
22
22
  static createFromRawInstance(rawInstance) {
23
- const instance = Object.create(this.prototype);
23
+ const instance = Object.create(TokenMarketplaceRulesWASM.prototype);
24
24
  instance._rawTokenMarketplaceRules = rawInstance;
25
25
  return instance;
26
26
  }
@@ -20,7 +20,7 @@ export class TokenPerpetualDistributionWASM {
20
20
  this._rawTokenPerpetualDistribution.distributionRecipient = value._rawTokenDistributionRecipient;
21
21
  }
22
22
  static createFromRawInstance(rawInstance) {
23
- const instance = Object.create(this.prototype);
23
+ const instance = Object.create(TokenPerpetualDistributionWASM.prototype);
24
24
  instance._rawTokenPerpetualDistribution = rawInstance;
25
25
  return instance;
26
26
  }
@@ -35,7 +35,7 @@ export class TokenPreProgrammedDistributionWASM {
35
35
  this._rawTokenPreProgrammedDistribution.distributions = objectToDistributionArray(distributions);
36
36
  }
37
37
  static createFromRawInstance(rawInstance) {
38
- const instance = Object.create(this.prototype);
38
+ const instance = Object.create(TokenPreProgrammedDistributionWASM.prototype);
39
39
  instance._rawTokenPreProgrammedDistribution = rawInstance;
40
40
  return instance;
41
41
  }
@@ -28,9 +28,10 @@ import { PartialIdentityWASM } from './structs/PartialIdentity.js';
28
28
  import { DocumentWASM } from './structs/Document.js';
29
29
  import { VoteWASM } from './structs/MasternodeVote/Vote.js';
30
30
  import { TokenPricingScheduleWASM } from './structs/Batch/TokenPricingSchedule.js';
31
- import { PlatformAddressWASM } from './structs/Address/PlatformAddress.js';
31
+ import { PlatformAddressWASM } from './structs/PlatformAddress/PlatformAddress.js';
32
32
  export type DashPlatformProtocol = typeof protocol;
33
33
  export type IdentifierLike = string | Uint8Array | protocol.IdentifierNAPI | IdentifierWASM;
34
+ export type PlatformAddressLike = string | Uint8Array | protocol.PlatformAddressNAPI | PlatformAddressWASM;
34
35
  export type KeyTypeLike = KeyType | keyof typeof KeyType | Lowercase<keyof typeof KeyType>;
35
36
  export type NetworkLike = NetworkWASM | keyof typeof NetworkWASM | Lowercase<keyof typeof NetworkWASM>;
36
37
  export type SecurityLevelLike = SecurityLevel | keyof typeof SecurityLevel | Lowercase<keyof typeof SecurityLevel>;
@@ -43,7 +44,6 @@ export type TokenEmergencyActionLike = TokenEmergencyActionWASM | keyof typeof T
43
44
  export type AssetLockProofTypeLike = AssetLockProofType | keyof typeof AssetLockProofType | Lowercase<keyof typeof AssetLockProofType>;
44
45
  export type PoolingLike = PoolingWASM | keyof typeof PoolingWASM | Lowercase<keyof typeof PoolingWASM>;
45
46
  export type VoteStateResultTypeLike = VoteStateResultType | keyof typeof VoteStateResultType | Lowercase<keyof typeof VoteStateResultType>;
46
- export type EnumLike = KeyTypeLike | NetworkLike | SecurityLevelLike | PlatformVersionLike | PurposeLike;
47
47
  export type AddressWitnessP2PKH = protocol.AddressWitnessP2pkhNAPI;
48
48
  export type AddressWitnessP2SH = protocol.AddressWitnessP2shNAPI;
49
49
  export type TokenConfigurationLocalizationJson = protocol.TokenConfigurationLocalizationJsonNAPI;
@@ -182,21 +182,49 @@ export interface VerifiedTokenGroupActionWithTokenPricingSchedule {
182
182
  groupActionStatus: string;
183
183
  pricingSchedule?: TokenPricingScheduleWASM;
184
184
  }
185
- export interface VerifiedAddressInfo {
185
+ export interface VerifiedPlatformAddressInfo {
186
+ address?: PlatformAddressWASM;
186
187
  nonce?: number;
187
- address: PlatformAddressWASM;
188
- credits?: bigint;
188
+ balance?: bigint;
189
189
  }
190
190
  export interface VerifiedIdentityFullWithAddressInfos {
191
191
  identity: IdentityWASM;
192
- infos: VerifiedAddressInfo[];
192
+ infos: VerifiedPlatformAddressInfo[];
193
193
  }
194
194
  export interface VerifiedIdentityWithAddressInfos {
195
195
  identity: PartialIdentityWASM;
196
- infos: VerifiedAddressInfo[];
196
+ infos: VerifiedPlatformAddressInfo[];
197
+ }
198
+ export interface AssetLockValue {
199
+ initialCreditValue: bigint;
200
+ txOutScript: Uint8Array;
201
+ remainingCreditValue: bigint;
202
+ usedTags: Uint8Array[];
203
+ }
204
+ export type StoredAssetLockInfoType = 'FullyConsumed' | 'PartiallyConsumed' | 'NotPresent';
205
+ export interface StoredAssetLockInfo {
206
+ type: StoredAssetLockInfoType;
207
+ value?: AssetLockValue;
208
+ }
209
+ export type ShieldedNullifier = [Uint8Array, boolean];
210
+ export interface VerifiedShieldedNullifiersWithAddressInfos {
211
+ nullifiers: ShieldedNullifier[];
212
+ infos: VerifiedPlatformAddressInfo[];
213
+ }
214
+ export interface VerifiedShieldedNullifiersWithWithdrawalDocument {
215
+ nullifiers: ShieldedNullifier[];
216
+ documents: VerifiedDocument[];
217
+ }
218
+ export interface VerifiedAssetLockConsumedWithAddressInfos {
219
+ storedAssetLockInfo: StoredAssetLockInfo;
220
+ infos: VerifiedPlatformAddressInfo[];
221
+ }
222
+ export interface VerifiedIdentityWithShieldedNullifiers {
223
+ identity: IdentityWASM;
224
+ nullifiers: ShieldedNullifier[];
197
225
  }
198
- export type VerifiedStateTransitionResultVariants = DataContractWASM | IdentityWASM | IdentifierWASM | VerifiedIdentityBalance | VerifiedIdentityTokenInfo | VerifiedTokenPricingSchedule | TokenStatus | VerifiedIdentityBalance[] | PartialIdentityWASM | VerifiedBalanceTransfer | VerifiedDocument[] | DocumentWASM | VerifiedTokenGroupActionWithDocument | VerifiedTokenGroupActionWithTokenBalance | VerifiedTokenGroupActionWithTokenIdentityInfo | VerifiedTokenGroupActionWithTokenPricingSchedule | VoteWASM | VerifiedAddressInfo[] | VerifiedIdentityFullWithAddressInfos | VerifiedIdentityWithAddressInfos;
199
- export type VerifiedStateTransitionResultVariantsRAW = protocol.DataContractNAPI | protocol.IdentityNAPI | protocol.IdentifierNAPI | protocol.VerifiedIdentityBalanceNAPI | protocol.VerifiedIdentityTokenInfoNAPI | protocol.VerifiedTokenPricingScheduleNAPI | protocol.TokenStatusNAPI | protocol.VerifiedIdentityBalanceNAPI[] | protocol.PartialIdentityNAPI | protocol.VerifiedBalanceTransferNAPI | protocol.VerifiedDocumentNAPI[] | protocol.DocumentNAPI | protocol.VerifiedTokenGroupActionWithDocumentNAPI | protocol.VerifiedTokenGroupActionWithTokenBalanceNAPI | protocol.VerifiedTokenGroupActionWithTokenIdentityInfoNAPI | protocol.VerifiedTokenGroupActionWithTokenPricingScheduleNAPI | protocol.VoteNAPI | protocol.VerifiedAddressInfosNAPI[] | protocol.VerifiedIdentityFullWithAddressInfosNAPI | protocol.VerifiedIdentityWithAddressInfosNAPI;
226
+ export type VerifiedStateTransitionResultVariants = DataContractWASM | IdentityWASM | IdentifierWASM | VerifiedIdentityBalance | VerifiedIdentityTokenInfo | VerifiedTokenPricingSchedule | TokenStatus | VerifiedIdentityBalance[] | PartialIdentityWASM | VerifiedBalanceTransfer | VerifiedDocument[] | DocumentWASM | VerifiedTokenGroupActionWithDocument | VerifiedTokenGroupActionWithTokenBalance | VerifiedTokenGroupActionWithTokenIdentityInfo | VerifiedTokenGroupActionWithTokenPricingSchedule | VoteWASM | VerifiedPlatformAddressInfo[] | VerifiedIdentityFullWithAddressInfos | VerifiedIdentityWithAddressInfos | StoredAssetLockInfo | ShieldedNullifier[] | VerifiedShieldedNullifiersWithAddressInfos | VerifiedShieldedNullifiersWithWithdrawalDocument | VerifiedAssetLockConsumedWithAddressInfos | VerifiedIdentityWithShieldedNullifiers;
227
+ export type VerifiedStateTransitionResultVariantsRAW = protocol.DataContractNAPI | protocol.IdentityNAPI | protocol.IdentifierNAPI | protocol.VerifiedIdentityBalanceNAPI | protocol.VerifiedIdentityTokenInfoNAPI | protocol.VerifiedTokenPricingScheduleNAPI | protocol.TokenStatusNAPI | protocol.VerifiedIdentityBalanceNAPI[] | protocol.PartialIdentityNAPI | protocol.VerifiedBalanceTransferNAPI | protocol.VerifiedDocumentNAPI[] | protocol.DocumentNAPI | protocol.VerifiedTokenGroupActionWithDocumentNAPI | protocol.VerifiedTokenGroupActionWithTokenBalanceNAPI | protocol.VerifiedTokenGroupActionWithTokenIdentityInfoNAPI | protocol.VerifiedTokenGroupActionWithTokenPricingScheduleNAPI | protocol.VoteNAPI | protocol.PlatformAddressInfoNAPI[] | protocol.VerifiedIdentityFullWithAddressInfosNAPI | protocol.VerifiedIdentityWithAddressInfosNAPI | protocol.StoredAssetLockInfoNAPI | Array<[Uint8Array, boolean]> | [Array<[Uint8Array, boolean]>, protocol.PlatformAddressInfoNAPI[]] | [Array<[Uint8Array, boolean]>, protocol.VerifiedDocumentNAPI[]] | [protocol.StoredAssetLockInfoNAPI, protocol.PlatformAddressInfoNAPI[]] | [protocol.IdentityNAPI, Array<[Uint8Array, boolean]>];
200
228
  export interface VerifiedStateTransitionResult {
201
229
  rootHash: Uint8Array;
202
230
  result: VerifiedStateTransitionResultVariants;
@@ -243,9 +271,13 @@ export interface IdentityTokenBalance {
243
271
  balance: bigint;
244
272
  id: IdentifierWASM;
245
273
  }
274
+ export interface IdentityTokenBalanceOptional {
275
+ balance?: bigint;
276
+ id: IdentifierWASM;
277
+ }
246
278
  export interface VerifiedTokenBalancesForIdentities {
247
279
  rootHash: Uint8Array;
248
- balances: IdentityTokenBalance[];
280
+ balances: IdentityTokenBalanceOptional[];
249
281
  }
250
282
  export interface TokenContractInfo {
251
283
  contractId: IdentifierWASM;
@@ -269,5 +301,12 @@ export interface VerifiedTokenTotalSupply {
269
301
  }
270
302
  export interface VerifiedTokensBalancesForIdentity {
271
303
  rootHash: Uint8Array;
272
- balances: IdentityTokenBalance[];
304
+ balances: IdentityTokenBalanceOptional[];
305
+ }
306
+ export type VerifiedPlatformAddressInfoWithRootHash = VerifiedPlatformAddressInfo & {
307
+ rootHash: Uint8Array;
308
+ };
309
+ export interface VerifiedPlatformAddressesInfosWithRootHash {
310
+ rootHash: Uint8Array;
311
+ infos: VerifiedPlatformAddressInfo[];
273
312
  }
@@ -1,5 +1,6 @@
1
- import type { DynamicValue, IdentifierLikeNAPI } from '../../binaries/bindingsTypes.js';
2
- import { IdentifierLike } from './types.js';
1
+ import type { DynamicValue, IdentifierLikeNAPI, PlatformAddressLikeNAPI } from '../../binaries/bindingsTypes.js';
2
+ import { IdentifierLike, PlatformAddressLike } 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;
6
+ export declare function preparePlatformAddressValue(address: PlatformAddressLike): PlatformAddressLikeNAPI;
@@ -1,8 +1,9 @@
1
1
  import { dppProvider } from './provider.js';
2
2
  import { UINT32MAX } from './constants.js';
3
3
  import { IdentifierWASM } from './structs/Identifier.js';
4
+ import { PlatformAddressWASM } from './structs/PlatformAddress/PlatformAddress.js';
4
5
  export function valueToDynamicValue(value) {
5
- if (typeof value === 'bigint' || value > UINT32MAX) {
6
+ if (typeof value === 'bigint' || (value > UINT32MAX && typeof value !== 'string')) {
6
7
  return dppProvider.dpp.DynamicValue.fromBigIntString(BigInt(value.toString()).toString());
7
8
  }
8
9
  else if (value instanceof IdentifierWASM || value instanceof dppProvider.dpp.IdentifierNAPI) {
@@ -43,21 +44,27 @@ export function valueToDynamicValue(value) {
43
44
  return new dppProvider.dpp.DynamicValue(value);
44
45
  }
45
46
  }
46
- export function valueFromDynamicValue(dynamicValue) {
47
+ export function valueFromDynamicValue(dynamicValue, jsonLike = false) {
47
48
  if (dynamicValue.value instanceof dppProvider.dpp.DynamicValue) {
48
- return valueToDynamicValue(dynamicValue.value);
49
+ return valueFromDynamicValue(dynamicValue.value, jsonLike);
49
50
  }
50
51
  else if (dynamicValue.isBigInt()) {
51
- return BigInt(dynamicValue.value);
52
+ const num = BigInt(dynamicValue.value);
53
+ if (jsonLike && num < BigInt(Number.MAX_SAFE_INTEGER) && num > BigInt(Number.MIN_SAFE_INTEGER)) {
54
+ return Number(dynamicValue.value);
55
+ }
56
+ else {
57
+ return num;
58
+ }
52
59
  }
53
60
  else if (Array.isArray(dynamicValue.value)) {
54
- return dynamicValue.value.map(valueFromDynamicValue);
61
+ return dynamicValue.value.map(v => valueFromDynamicValue(v, jsonLike));
55
62
  }
56
63
  else if (typeof dynamicValue.value === 'object' && !(dynamicValue.value instanceof Uint8Array) && dynamicValue.value !== null) {
57
64
  const obj = {};
58
65
  const keys = Object.keys(dynamicValue.value);
59
66
  for (const key of keys) {
60
- obj[key] = valueFromDynamicValue(dynamicValue.value[key]);
67
+ obj[key] = valueFromDynamicValue(dynamicValue.value[key], jsonLike);
61
68
  }
62
69
  return obj;
63
70
  }
@@ -76,3 +83,14 @@ export function prepareIdentifierValue(identifier) {
76
83
  return new dppProvider.dpp.DynamicValue(identifier);
77
84
  }
78
85
  }
86
+ export function preparePlatformAddressValue(address) {
87
+ if (address instanceof PlatformAddressWASM) {
88
+ return address._rawPlatformAddress;
89
+ }
90
+ else if (address instanceof dppProvider.dpp.PlatformAddressNAPI) {
91
+ return address;
92
+ }
93
+ else {
94
+ return new dppProvider.dpp.DynamicValue(address);
95
+ }
96
+ }
@@ -1,3 +1,3 @@
1
1
  import { PlatformVersionLike, StartAt, VerifiedVoteState, VoteStateResultTypeLike } from '../../types.js';
2
2
  import { DataContractWASM } from '../../structs/DataContract.js';
3
- export declare function verifyVotePollVoteStateProof(proof: Uint8Array, contract: DataContractWASM, documentTypeName: string, indexName: string, indexValues: Uint8Array[], resultType: VoteStateResultTypeLike, allowIncludeLockedAndAbstainingVoteTally: boolean, count: number | undefined, startAt: StartAt | undefined, platformVersion: PlatformVersionLike): VerifiedVoteState;
3
+ export declare function verifyVotePollVoteStateProof(proof: Uint8Array, contract: DataContractWASM, documentTypeName: string, indexName: string, indexValues: Uint8Array[], resultType: VoteStateResultTypeLike, allowIncludeLockedAndAbstainingVoteTally: boolean | undefined, count: number | undefined, startAt: StartAt | undefined, platformVersion: PlatformVersionLike): VerifiedVoteState;
@@ -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 ?? false, 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
@@ -0,0 +1,2 @@
1
+ import { PlatformAddressLike, PlatformVersionLike, VerifiedPlatformAddressInfoWithRootHash } from '../../types.js';
2
+ export declare function verifyPlatformAddressInfo(proof: Uint8Array, platformAddress: PlatformAddressLike, verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedPlatformAddressInfoWithRootHash;
@@ -0,0 +1,12 @@
1
+ import { dppProvider } from '../../provider.js';
2
+ import { preparePlatformAddressValue, valueToDynamicValue } from '../../utils.js';
3
+ import { PlatformAddressWASM } from '../../structs/PlatformAddress/PlatformAddress.js';
4
+ export function verifyPlatformAddressInfo(proof, platformAddress, verifySubsetOfProof, platformVersion) {
5
+ const result = dppProvider.dpp.verifyAddressInfo(proof, preparePlatformAddressValue(platformAddress), verifySubsetOfProof, valueToDynamicValue(platformVersion));
6
+ return {
7
+ rootHash: result.rootHash,
8
+ address: result.address != null ? PlatformAddressWASM.createFromRawInstance(result.address) : undefined,
9
+ balance: result.balance != null ? BigInt(result.balance) : undefined,
10
+ nonce: result.nonce
11
+ };
12
+ }
@@ -0,0 +1,2 @@
1
+ import { PlatformAddressLike, PlatformVersionLike, VerifiedPlatformAddressesInfosWithRootHash } from '../../types.js';
2
+ export declare function verifyPlatformAddressesInfos(proof: Uint8Array, platformAddresses: PlatformAddressLike[], verifySubsetOfProof: boolean, platformVersion: PlatformVersionLike): VerifiedPlatformAddressesInfosWithRootHash;
@@ -0,0 +1,14 @@
1
+ import { dppProvider } from '../../provider.js';
2
+ import { preparePlatformAddressValue, valueToDynamicValue } from '../../utils.js';
3
+ import { PlatformAddressWASM } from '../../structs/PlatformAddress/PlatformAddress.js';
4
+ export function verifyPlatformAddressesInfos(proof, platformAddresses, verifySubsetOfProof, platformVersion) {
5
+ const result = dppProvider.dpp.verifyAddressesInfos(proof, platformAddresses.map(preparePlatformAddressValue), verifySubsetOfProof, valueToDynamicValue(platformVersion));
6
+ return {
7
+ rootHash: result.rootHash,
8
+ infos: result.infos.map(({ nonce, credits, address }) => ({
9
+ nonce,
10
+ balance: credits != null ? BigInt(credits) : undefined,
11
+ address: PlatformAddressWASM.createFromRawInstance(address)
12
+ }))
13
+ };
14
+ }