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
@@ -5,7 +5,7 @@ import { TokenPricingScheduleWASM } from '../../structs/Batch/TokenPricingSchedu
5
5
  import { PartialIdentityWASM } from '../../structs/PartialIdentity.js';
6
6
  import { VoteWASM } from '../../structs/MasternodeVote/Vote.js';
7
7
  import { DocumentWASM } from '../../structs/Document.js';
8
- import { PlatformAddressWASM } from '../../structs/Address/PlatformAddress.js';
8
+ import { PlatformAddressWASM } from '../../structs/PlatformAddress/PlatformAddress.js';
9
9
  import { dppProvider } from '../../provider.js';
10
10
  const converters = () => {
11
11
  return new Map([
@@ -62,7 +62,7 @@ const converters = () => {
62
62
  infos: v.infos.map(info => ({
63
63
  nonce: info.nonce,
64
64
  address: PlatformAddressWASM.createFromRawInstance(info.address),
65
- credits: info.credits != null ? BigInt(info.credits) : undefined
65
+ balance: info.credits != null ? BigInt(info.credits) : undefined
66
66
  }))
67
67
  })],
68
68
  [dppProvider.dpp.VerifiedIdentityWithAddressInfosNAPI, (v) => ({
@@ -70,11 +70,40 @@ const converters = () => {
70
70
  infos: v.infos.map(info => ({
71
71
  nonce: info.nonce,
72
72
  address: PlatformAddressWASM.createFromRawInstance(info.address),
73
- credits: info.credits != null ? BigInt(info.credits) : undefined
73
+ balance: info.credits != null ? BigInt(info.credits) : undefined
74
74
  }))
75
75
  })]
76
76
  ]);
77
77
  };
78
+ function convertPlatformAddressInfos(infos) {
79
+ return infos.map(info => ({
80
+ nonce: info.nonce,
81
+ address: PlatformAddressWASM.createFromRawInstance(info.address),
82
+ balance: info.credits != null ? BigInt(info.credits) : undefined
83
+ }));
84
+ }
85
+ function convertVerifiedDocuments(docs) {
86
+ return docs.map(item => ({
87
+ id: IdentifierWASM.createFromRawInstance(item.id),
88
+ document: item.document != null
89
+ ? DocumentWASM.createFromRawInstance(item.document)
90
+ : undefined
91
+ }));
92
+ }
93
+ function convertAssetLockValue(v) {
94
+ return {
95
+ initialCreditValue: BigInt(v.initialCreditValue),
96
+ txOutScript: v.txOutScript,
97
+ remainingCreditValue: BigInt(v.remainingCreditValue),
98
+ usedTags: v.usedTags
99
+ };
100
+ }
101
+ function convertStoredAssetLockInfo(v) {
102
+ return {
103
+ type: v.type,
104
+ value: v.value != null ? convertAssetLockValue(v.value) : undefined
105
+ };
106
+ }
78
107
  function convertArray(result) {
79
108
  const [first] = result;
80
109
  if (first == null)
@@ -86,26 +115,62 @@ function convertArray(result) {
86
115
  }));
87
116
  }
88
117
  if (first instanceof dppProvider.dpp.VerifiedDocumentNAPI) {
89
- return result.map(item => ({
90
- id: IdentifierWASM.createFromRawInstance(item.id),
91
- document: item.document != null
92
- ? DocumentWASM.createFromRawInstance(item.document)
93
- : undefined
94
- }));
118
+ return convertVerifiedDocuments(result);
95
119
  }
96
- if (first instanceof dppProvider.dpp.VerifiedAddressInfosNAPI) {
97
- return result.map(item => ({
98
- nonce: item.nonce,
99
- address: PlatformAddressWASM.createFromRawInstance(item.address),
100
- credits: item.credits != null ? BigInt(item.credits) : undefined
101
- }));
120
+ if (first instanceof dppProvider.dpp.PlatformAddressInfoNAPI) {
121
+ return convertPlatformAddressInfos(result);
102
122
  }
103
123
  throw new Error('Unknown array type');
104
124
  }
125
+ function convertTuple(result) {
126
+ const [first, second] = result;
127
+ if (first instanceof dppProvider.dpp.StoredAssetLockInfoNAPI) {
128
+ return {
129
+ storedAssetLockInfo: convertStoredAssetLockInfo(first),
130
+ infos: convertPlatformAddressInfos(second)
131
+ };
132
+ }
133
+ if (first instanceof dppProvider.dpp.IdentityNAPI) {
134
+ return {
135
+ identity: IdentityWASM.createFromRawInstance(first),
136
+ nullifiers: second
137
+ };
138
+ }
139
+ if (Array.isArray(first) && Array.isArray(second)) {
140
+ const secondFirst = second[0];
141
+ if (secondFirst != null && secondFirst instanceof dppProvider.dpp.VerifiedDocumentNAPI) {
142
+ return {
143
+ nullifiers: first,
144
+ documents: convertVerifiedDocuments(second)
145
+ };
146
+ }
147
+ return {
148
+ nullifiers: first,
149
+ infos: secondFirst != null ? convertPlatformAddressInfos(second) : []
150
+ };
151
+ }
152
+ throw new Error('Unknown tuple type');
153
+ }
105
154
  export function convertResult(result) {
106
155
  if (Array.isArray(result)) {
156
+ if (result.length === 2) {
157
+ const [first] = result;
158
+ if (first instanceof dppProvider.dpp.StoredAssetLockInfoNAPI || first instanceof dppProvider.dpp.IdentityNAPI) {
159
+ return convertTuple(result);
160
+ }
161
+ if (Array.isArray(first) && (first.length === 0 || Array.isArray(first[0]))) {
162
+ return convertTuple(result);
163
+ }
164
+ }
165
+ const [first] = result;
166
+ if (first != null && Array.isArray(first) && first[0] instanceof Uint8Array) {
167
+ return result;
168
+ }
107
169
  return convertArray(result);
108
170
  }
171
+ if (result instanceof dppProvider.dpp.StoredAssetLockInfoNAPI) {
172
+ return convertStoredAssetLockInfo(result);
173
+ }
109
174
  for (const [Type, handler] of converters()) {
110
175
  if (result instanceof Type) {
111
176
  return handler(result);
@@ -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
  };
@@ -0,0 +1,3 @@
1
+ export * from './dpp/enums.js';
2
+ export * from './dpp/dpp.js';
3
+ export * from './dpp/types.js';
@@ -0,0 +1,8 @@
1
+ // @ts-ignore
2
+ import protocol from '../binaries/node.cjs';
3
+ import { dppProvider } from './dpp/provider.js';
4
+ // @ts-ignore
5
+ dppProvider.setDpp(protocol);
6
+ export * from './dpp/enums.js';
7
+ export * from './dpp/dpp.js';
8
+ export * from './dpp/types.js';
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  // Original code: https://github.com/kevinAlbs/Base122
2
3
  // Provides functions for encoding/decoding data to and from base-122.
3
4
  const kIllegals = [
@@ -15,7 +16,7 @@ const kShortened = 0b111; // Uses the illegal index to signify the last two-byte
15
16
  * with raw data bytes or a string of bytes (i.e. the type of argument to btoa())
16
17
  * @returns {Uint8Array} The data in a regular array representing byte values.
17
18
  */
18
- export function decode(base122Data) {
19
+ function decode(base122Data) {
19
20
  const strData = typeof (base122Data) === 'string' ? base122Data : utf8DataToString(base122Data);
20
21
  const decoded = [];
21
22
  let curByte = 0;
@@ -61,3 +62,4 @@ export function decode(base122Data) {
61
62
  function utf8DataToString(data) {
62
63
  return new TextDecoder().decode(data);
63
64
  }
65
+ module.exports = { decode };
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "pshenmic-dpp",
3
- "version": "2.0.0-dev.2",
3
+ "version": "2.0.0-dev.20",
4
4
  "main": "dist/src/wasm.js",
5
5
  "types": "dist/src/wasm.d.ts",
6
6
  "react-native": "./dist/src/react-native.js",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/owl352/pshenmic-dpp"
10
+ "url": "git+https://github.com/owl352/pshenmic-dpp.git"
11
11
  },
12
12
  "scripts": {
13
13
  "build:bin": "node build.cjs",
14
- "build:ts": "tsc && cp -R pkg/**/*.*.node dist/binaries/",
14
+ "build:ts": "tsc && cp -R pkg/**/*.*.node dist/binaries/ && cp -R pkg/binaries/native dist/binaries/",
15
15
  "build:full": "npm run build:bin && npm run build:ts",
16
16
  "ferric:build": "ferric build",
17
17
  "bundle": "rollup -c",
@@ -20,40 +20,30 @@
20
20
  "lint:rust": "cargo fmt",
21
21
  "lint:src": "ts-standard --fix ./pkg/src",
22
22
  "lint:tests": "ts-standard --fix ./pkg/src",
23
- "lint": "npm run lint:rust && npm run lint:src && npm run lint:tests"
23
+ "lint": "npm run lint:rust && npm run lint:src && npm run lint:tests",
24
+ "prepack": "npm pkg delete devDependencies"
24
25
  },
25
26
  "files": [
26
27
  "dist/",
27
28
  "tests/"
28
29
  ],
30
+ "exports": {
31
+ ".": {
32
+ "browser": "./dist/src/wasm.js",
33
+ "node": "./dist/src/native.js",
34
+ "react-native": "./dist/src/react-native.js",
35
+ "default": "./dist/src/wasm.js"
36
+ },
37
+ "./wasm": "./dist/src/wasm.js",
38
+ "./wasm/utils": "./dist/src/dpp/utils.js",
39
+ "./native": "./dist/src/native.js"
40
+ },
29
41
  "author": "owl352",
30
42
  "license": "ISC",
31
43
  "description": "",
32
- "devDependencies": {
33
- "@babel/core": "^7.28.5",
34
- "@babel/preset-env": "^7.28.5",
35
- "@babel/preset-typescript": "^7.28.5",
36
- "@scure/base": "^1.2.4",
37
- "@types/jest": "^30.0.0",
38
- "@types/node": "^24.0.13",
39
- "babel": "^6.23.0",
40
- "babel-jest": "^30.2.0",
41
- "core-js": "^3.41.0",
42
- "ferric-cli": "0.3.9",
43
- "jest": "^30.2.0",
44
- "mocha": "^11.1.0",
45
- "node-addon-api": "^8.5.0",
46
- "path": "^0.12.7",
47
- "toml": "^3.0.0",
48
- "ts-morph": "^26.0.0",
49
- "tsx": "^4.20.6",
50
- "typedoc": "^0.28.7",
51
- "typescript": "^5.8.3",
52
- "ts-standard": "^12.0.2"
53
- },
54
44
  "dependencies": {
55
- "@emnapi/core": "^1.7.0",
56
- "@emnapi/runtime": "^1.7.0",
45
+ "@emnapi/core": "1.9.0",
46
+ "@emnapi/runtime": "1.9.0",
57
47
  "@tybys/wasm-util": "^0.10.1",
58
48
  "fflate": "^0.8.2"
59
49
  }
@@ -0,0 +1,281 @@
1
+ import {AuthorizedActionTakersWASM, ChangeControlRulesWASM, DataContractWASM,
2
+ DistributionFunctionWASM, IdentifierWASM, PlatformVersionWASM,
3
+ RewardDistributionTypeWASM, TokenConfigurationConventionWASM, TokenConfigurationLocalizationWASM,
4
+ TokenConfigurationWASM,
5
+ TokenDistributionRecipientWASM, TokenDistributionRulesWASM, TokenKeepsHistoryRulesWASM,
6
+ TokenMarketplaceRulesWASM, TokenPerpetualDistributionWASM,
7
+ TokenTradeModeWASM} from 'pshenmic-dpp'
8
+ import {buildTokenConfiguration} from './utils/buildTokenConfiguration.js'
9
+
10
+ const OWNER_ID_BASE58 = 'HEAmUtC72dPcZ59yyLUgfS8pfrEWqzYfDPzTofgWxXRr'
11
+
12
+ const DOCUMENT_SCHEMA = {
13
+ note: {
14
+ type: 'object',
15
+ properties: {
16
+ message: {
17
+ type: 'string',
18
+ position: 0
19
+ }
20
+ },
21
+ additionalProperties: false
22
+ }
23
+ }
24
+
25
+ describe('DataContract', function () {
26
+ describe('constructor', function () {
27
+ test('should create a contract with document schemas only', function () {
28
+ const contract = new DataContractWASM(
29
+ OWNER_ID_BASE58,
30
+ BigInt(1),
31
+ DOCUMENT_SCHEMA,
32
+ undefined,
33
+ undefined,
34
+ true,
35
+ PlatformVersionWASM.PLATFORM_V10
36
+ )
37
+
38
+ expect(contract).toBeInstanceOf(DataContractWASM)
39
+ expect(contract.ownerId.base58()).toEqual(OWNER_ID_BASE58)
40
+ expect(contract.tokens.length).toEqual(0)
41
+ expect(Object.keys(contract.getSchemas())).toEqual(['note'])
42
+ })
43
+
44
+ test('should create a tokens-only contract (no document schemas)', function () {
45
+ const tokenConfig = buildTokenConfiguration()
46
+
47
+ const contract = new DataContractWASM(
48
+ OWNER_ID_BASE58,
49
+ BigInt(1),
50
+ {},
51
+ undefined,
52
+ [{position: 0, tokenConfiguration: tokenConfig}],
53
+ true,
54
+ PlatformVersionWASM.PLATFORM_V10
55
+ )
56
+
57
+ expect(contract).toBeInstanceOf(DataContractWASM)
58
+ expect(contract.tokens.length).toEqual(1)
59
+ expect(contract.tokens[0].position).toEqual(0)
60
+ expect(contract.tokens[0].tokenConfiguration.baseSupply).toEqual(BigInt(100000))
61
+ })
62
+
63
+ test('should fail to create a contract with neither documents nor tokens', function () {
64
+ expect(() => new DataContractWASM(
65
+ OWNER_ID_BASE58,
66
+ BigInt(1),
67
+ {},
68
+ undefined,
69
+ undefined,
70
+ true,
71
+ PlatformVersionWASM.PLATFORM_V10
72
+ )).toThrow()
73
+ })
74
+
75
+ test('should create a contract with both documents and tokens', function () {
76
+ const tokenConfig = buildTokenConfiguration({baseSupply: BigInt(50)})
77
+
78
+ const contract = new DataContractWASM(
79
+ OWNER_ID_BASE58,
80
+ BigInt(1),
81
+ DOCUMENT_SCHEMA,
82
+ undefined,
83
+ [{position: 0, tokenConfiguration: tokenConfig}],
84
+ true,
85
+ PlatformVersionWASM.PLATFORM_V10
86
+ )
87
+
88
+ expect(contract.tokens.length).toEqual(1)
89
+ expect(Object.keys(contract.getSchemas())).toEqual(['note'])
90
+ })
91
+
92
+ test('should generate a deterministic id from owner id and nonce', function () {
93
+ const contract = new DataContractWASM(
94
+ OWNER_ID_BASE58,
95
+ BigInt(42),
96
+ DOCUMENT_SCHEMA,
97
+ undefined,
98
+ undefined,
99
+ true,
100
+ PlatformVersionWASM.PLATFORM_V10
101
+ )
102
+
103
+ const expectedId = DataContractWASM.generateId(OWNER_ID_BASE58, BigInt(42))
104
+
105
+ expect(contract.id.base58()).toEqual(expectedId.base58())
106
+ })
107
+ })
108
+
109
+ describe('serialization', function () {
110
+ test('should serialize / deserialize via bytes', function () {
111
+ const contract = new DataContractWASM(
112
+ OWNER_ID_BASE58,
113
+ BigInt(1),
114
+ DOCUMENT_SCHEMA,
115
+ undefined,
116
+ undefined,
117
+ true,
118
+ PlatformVersionWASM.PLATFORM_V10
119
+ )
120
+
121
+ const bytes = contract.bytes(PlatformVersionWASM.PLATFORM_V10)
122
+ const restored = DataContractWASM.fromBytes(bytes, true, PlatformVersionWASM.PLATFORM_V10)
123
+
124
+ expect(restored.id.base58()).toEqual(contract.id.base58())
125
+ expect(restored.ownerId.base58()).toEqual(contract.ownerId.base58())
126
+ })
127
+
128
+ test('should serialize / deserialize a tokens-only contract via bytes', function () {
129
+ const tokenConfig = buildTokenConfiguration()
130
+
131
+ const contract = new DataContractWASM(
132
+ OWNER_ID_BASE58,
133
+ BigInt(1),
134
+ {},
135
+ undefined,
136
+ [{position: 0, tokenConfiguration: tokenConfig}],
137
+ true,
138
+ PlatformVersionWASM.PLATFORM_V10
139
+ )
140
+
141
+ const bytes = contract.bytes(PlatformVersionWASM.PLATFORM_V10)
142
+ const restored = DataContractWASM.fromBytes(bytes, true, PlatformVersionWASM.PLATFORM_V10)
143
+
144
+ expect(restored.tokens.length).toEqual(1)
145
+ expect(restored.tokens[0].tokenConfiguration.baseSupply).toEqual(tokenConfig.baseSupply)
146
+ })
147
+
148
+ test('should round-trip via hex', function () {
149
+ const contract = new DataContractWASM(
150
+ OWNER_ID_BASE58,
151
+ BigInt(1),
152
+ DOCUMENT_SCHEMA,
153
+ undefined,
154
+ undefined,
155
+ true,
156
+ PlatformVersionWASM.PLATFORM_V10
157
+ )
158
+
159
+ const hex = contract.hex(PlatformVersionWASM.PLATFORM_V10)
160
+ const restored = DataContractWASM.fromHex(hex, true, PlatformVersionWASM.PLATFORM_V10)
161
+
162
+ expect(restored.id.base58()).toEqual(contract.id.base58())
163
+ })
164
+
165
+ test('should round-trip via base64', function () {
166
+ const contract = new DataContractWASM(
167
+ OWNER_ID_BASE58,
168
+ BigInt(1),
169
+ DOCUMENT_SCHEMA,
170
+ undefined,
171
+ undefined,
172
+ true,
173
+ PlatformVersionWASM.PLATFORM_V10
174
+ )
175
+
176
+ const b64 = contract.base64(PlatformVersionWASM.PLATFORM_V10)
177
+ const restored = DataContractWASM.fromBase64(b64, true, PlatformVersionWASM.PLATFORM_V10)
178
+
179
+ expect(restored.id.base58()).toEqual(contract.id.base58())
180
+ })
181
+ })
182
+
183
+ describe('mutators', function () {
184
+ test('should allow setting tokens after construction', function () {
185
+ const contract = new DataContractWASM(
186
+ OWNER_ID_BASE58,
187
+ BigInt(1),
188
+ DOCUMENT_SCHEMA,
189
+ undefined,
190
+ undefined,
191
+ true,
192
+ PlatformVersionWASM.PLATFORM_V10
193
+ )
194
+
195
+ expect(contract.tokens.length).toEqual(0)
196
+
197
+ contract.tokens = [{position: 0, tokenConfiguration: buildTokenConfiguration()}]
198
+
199
+ expect(contract.tokens.length).toEqual(1)
200
+ })
201
+
202
+ test('should allow setting and reading description / keywords', function () {
203
+ const contract = new DataContractWASM(
204
+ OWNER_ID_BASE58,
205
+ BigInt(1),
206
+ DOCUMENT_SCHEMA,
207
+ undefined,
208
+ undefined,
209
+ true,
210
+ PlatformVersionWASM.PLATFORM_V10
211
+ )
212
+
213
+ contract.description = 'test contract'
214
+ contract.keywords = ['alpha', 'beta']
215
+
216
+ expect(contract.description).toEqual('test contract')
217
+ expect(contract.keywords).toEqual(['alpha', 'beta'])
218
+ })
219
+
220
+ test('should allow changing the owner id', function () {
221
+ const contract = new DataContractWASM(
222
+ OWNER_ID_BASE58,
223
+ BigInt(1),
224
+ DOCUMENT_SCHEMA,
225
+ undefined,
226
+ undefined,
227
+ true,
228
+ PlatformVersionWASM.PLATFORM_V10
229
+ )
230
+
231
+ const newOwner = new IdentifierWASM('ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U')
232
+
233
+ contract.ownerId = newOwner
234
+
235
+ expect(contract.ownerId.base58()).toEqual(newOwner.base58())
236
+ })
237
+ })
238
+
239
+ describe('tokens', function () {
240
+ test('should allow setting tokens after construction', function () {
241
+ const owner = '8J8k9aQ5Hotx8oLdnYAhYpyBJJGg4wZALptKLuDE9Df6'
242
+ const taker = () => AuthorizedActionTakersWASM.ContractOwner()
243
+ const rule = () => new ChangeControlRulesWASM(taker(), taker(), false, false, false)
244
+
245
+ const conventions = new TokenConfigurationConventionWASM(
246
+ {en: new TokenConfigurationLocalizationWASM(true, 'Tok', 'Toks')}, 8)
247
+
248
+ const perpetual = new TokenPerpetualDistributionWASM(
249
+ RewardDistributionTypeWASM.EpochBasedDistribution(1, DistributionFunctionWASM.FixedAmountDistribution(1n)),
250
+ TokenDistributionRecipientWASM.Identity(IdentifierWASM.fromBase58(owner))) // <- swap to .ContractOwner() => passes
251
+
252
+ const distributionRules = new TokenDistributionRulesWASM(
253
+ rule(), rule(), true, rule(), rule(), perpetual, undefined, undefined)
254
+
255
+ const tokenConfiguration = new TokenConfigurationWASM(
256
+ conventions, rule(), 100n,
257
+ new TokenKeepsHistoryRulesWASM(true, true, true, true, true, true),
258
+ false, false, rule(), distributionRules,
259
+ new TokenMarketplaceRulesWASM(TokenTradeModeWASM.NotTradeable(), rule()),
260
+ rule(), rule(), rule(), rule(), rule(), rule(),
261
+ taker(), undefined, undefined, undefined)
262
+
263
+ const contract = new DataContractWASM(owner, 1n, {note: {}}, undefined,
264
+ [{position: 0, tokenConfiguration}], true, undefined)
265
+
266
+ expect(contract).toBeInstanceOf(DataContractWASM)
267
+ expect(contract.tokens.length).toEqual(1)
268
+ expect(contract.tokens[0].position).toEqual(0)
269
+
270
+ const perpetualDistribution = contract.tokens[0].tokenConfiguration
271
+ .distributionRules.perpetualDistribution
272
+
273
+ expect(perpetualDistribution).toBeDefined()
274
+
275
+ const recipient = perpetualDistribution!.distributionRecipient
276
+
277
+ expect(recipient.getType()).toEqual(`Identity(${owner})`)
278
+ expect(recipient.getValue()?.base58()).toEqual(owner)
279
+ })
280
+ })
281
+ })
@@ -1,5 +1,5 @@
1
- import * as dpp from "../../pkg/src/wasm.js";
2
- import {valueFromDynamicValue, valueToDynamicValue} from "../../pkg/src/dpp/utils.js"
1
+ import * as dpp from "pshenmic-dpp";
2
+ import {valueFromDynamicValue, valueToDynamicValue} from "pshenmic-dpp/wasm/utils"
3
3
 
4
4
  describe('DynamicValue', () => {
5
5
  beforeAll(()=>{
@@ -83,4 +83,44 @@ describe('DynamicValue', () => {
83
83
  expect(valueFromDynamicValue(extendedArrayDynamicValue)).toStrictEqual(extendedArrayValue)
84
84
  })
85
85
  })
86
+
87
+ describe('number values in object', function () {
88
+ const mock = {
89
+ uint: 1999,
90
+ int: -293,
91
+ float: 2222.11231,
92
+ smallBigInt: BigInt(2),
93
+ bigBigInt: BigInt(2000000000000),
94
+ stringUint: '11',
95
+ stringInt: '-11',
96
+ stringFloat: '11.2',
97
+ bigStringNumber: '11111111111111111111111111111111'
98
+ }
99
+
100
+ const dynValue = valueToDynamicValue(mock)
101
+
102
+ const result = valueFromDynamicValue(dynValue)
103
+
104
+ expect(valueFromDynamicValue(dynValue)).toStrictEqual(mock)
105
+ expect(dynValue.value.uint.getType()).toStrictEqual('u32')
106
+ expect(dynValue.value.int.getType()).toStrictEqual('i64')
107
+ expect(dynValue.value.float.getType()).toStrictEqual('f64')
108
+ expect(dynValue.value.smallBigInt.getType()).toStrictEqual('BigIntString')
109
+ expect(dynValue.value.bigBigInt.getType()).toStrictEqual('BigIntString')
110
+ expect(dynValue.value.stringUint.getType()).toStrictEqual('String')
111
+ expect(dynValue.value.stringInt.getType()).toStrictEqual('String')
112
+ expect(dynValue.value.stringFloat.getType()).toStrictEqual('String')
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
+ })
86
126
  })
@@ -1,4 +1,4 @@
1
- import { IdentifierWASM } from "../../dist/src/wasm.js";
1
+ import { IdentifierWASM } from "pshenmic-dpp";
2
2
 
3
3
  let identifierBytes: Uint8Array;
4
4
 
@@ -1,4 +1,4 @@
1
- import {IdentifierWASM, IdentityWASM, PlatformVersionWASM, IdentityPublicKeyWASM} from '../../dist/src/wasm.js'
1
+ import {IdentifierWASM, IdentityWASM, PlatformVersionWASM, IdentityPublicKeyWASM} from 'pshenmic-dpp'
2
2
 
3
3
  let identifierBytes: Uint8Array
4
4
  let identifier: IdentifierWASM
@@ -1,4 +1,4 @@
1
- import {IdentityPublicKeyWASM, Purpose, SecurityLevel, KeyType} from '../../dist/src/wasm.js'
1
+ import {IdentityPublicKeyWASM, Purpose, SecurityLevel, KeyType} from 'pshenmic-dpp'
2
2
 
3
3
  let keyId: number
4
4
  let purpose: Purpose
@@ -0,0 +1,49 @@
1
+ import * as dpp from "pshenmic-dpp/native";
2
+ import {IdentifierWASM} from "pshenmic-dpp/native";
3
+
4
+ let identifierBytes: Uint8Array;
5
+
6
+ describe("dpp", function () {
7
+ beforeAll(async function () {
8
+ identifierBytes = Uint8Array.from([
9
+ 9, 40, 40, 237, 192, 129, 211, 186, 26, 84, 240, 67, 37, 155, 148, 19,
10
+ 104, 242, 199, 24, 136, 27, 6, 169, 211, 71, 136, 59, 33, 191, 227, 19,
11
+ ]);
12
+ });
13
+
14
+ it('dpp object shouldn\'t be undefined or empty', () => {
15
+ expect(dpp).toBeDefined();
16
+ });
17
+
18
+ describe('classes accesibles', function () {
19
+ test("should allows to create Identifier from base58 via dpp object", function () {
20
+ const identifier = dpp.IdentifierWASM.fromBase58(
21
+ "ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U",
22
+ );
23
+
24
+ expect(identifier.bytes()).toEqual(identifierBytes);
25
+ });
26
+
27
+ test("should allows to create Identifier from base64 via IdentifierWASM import", function () {
28
+ const identifier = IdentifierWASM.fromBase64(
29
+ "CSgo7cCB07oaVPBDJZuUE2jyxxiIGwap00eIOyG/4xM=",
30
+ );
31
+
32
+ expect(identifier.bytes()).toEqual(identifierBytes);
33
+ });
34
+
35
+ test("should allows to create Identifier from hex", function () {
36
+ const identifier = IdentifierWASM.fromHex(
37
+ "092828edc081d3ba1a54f043259b941368f2c718881b06a9d347883b21bfe313",
38
+ );
39
+
40
+ expect(identifier.bytes()).toEqual(identifierBytes);
41
+ });
42
+
43
+ test("should allows to create Identifier from bytes", function () {
44
+ const identifier = IdentifierWASM.fromBytes(identifierBytes);
45
+
46
+ expect(identifier.bytes()).toEqual(identifierBytes);
47
+ });
48
+ })
49
+ });