pshenmic-dpp 1.0.4 → 1.0.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 (152) hide show
  1. package/.github/workflows/build.yml +9 -1
  2. package/.github/workflows/publish.yml +9 -1
  3. package/Cargo.lock +222 -76
  4. package/Cargo.toml +28 -19
  5. package/README.md +75 -23
  6. package/babel.config.json +19 -0
  7. package/dist/wasm/index.d.ts +52 -0
  8. package/dist/wasm/pshenmic_dpp.d.ts +962 -0
  9. package/dist/wasm/pshenmic_dpp.js +5565 -966
  10. package/dist/wasm/pshenmic_dpp_bg.js +1 -1
  11. package/dist/wasm/pshenmic_dpp_bg.wasm.d.ts +440 -0
  12. package/docs/AssetLockProof.md +107 -0
  13. package/docs/Building.md +50 -0
  14. package/docs/ChainLockProof.md +63 -0
  15. package/docs/CoreScript.md +17 -0
  16. package/docs/DataContract.md +192 -0
  17. package/docs/DataContractCreateTransition.md +84 -0
  18. package/docs/DataContractUpdateTransition.md +84 -0
  19. package/docs/Document.md +396 -0
  20. package/docs/DocumentBaseTransition.md +111 -0
  21. package/docs/DocumentCreateTransition.md +132 -0
  22. package/docs/DocumentDeleteTransition.md +82 -0
  23. package/docs/DocumentPurchaseTransition.md +109 -0
  24. package/docs/DocumentReplaceTransition.md +112 -0
  25. package/docs/DocumentTransferTransition.md +96 -0
  26. package/docs/DocumentTransition.md +125 -0
  27. package/docs/DocumentUpdatePriceTransition.md +109 -0
  28. package/docs/DocumentsBatch.md +133 -0
  29. package/docs/Enums.md +103 -0
  30. package/docs/Home.md +28 -0
  31. package/docs/Identifier.md +37 -0
  32. package/docs/Identity.md +140 -0
  33. package/docs/IdentityCreateTransition.md +155 -0
  34. package/docs/IdentityCreditTransfer.md +187 -0
  35. package/docs/IdentityCreditWithdrawalTransition.md +244 -0
  36. package/docs/IdentityPublicKey.md +348 -0
  37. package/docs/IdentityPublicKeyInCreation.md +141 -0
  38. package/docs/IdentityTopUpTransition.md +166 -0
  39. package/docs/IdentityUpdateTransition.md +234 -0
  40. package/docs/InstantAssetLockProof.md +117 -0
  41. package/docs/InstantLock.md +100 -0
  42. package/docs/OutPoint.md +80 -0
  43. package/docs/PrefundedVotingBalance.md +48 -0
  44. package/docs/PrivateKey.md +112 -0
  45. package/docs/TxOut.md +93 -0
  46. package/package.json +15 -8
  47. package/packages/asset_lock_proof/Cargo.toml +19 -0
  48. package/packages/asset_lock_proof/src/chain/mod.rs +79 -0
  49. package/packages/asset_lock_proof/src/instant/instant_lock.rs +111 -0
  50. package/packages/asset_lock_proof/src/instant/mod.rs +115 -0
  51. package/packages/asset_lock_proof/src/lib.rs +133 -0
  52. package/packages/asset_lock_proof/src/outpoint/mod.rs +79 -0
  53. package/packages/asset_lock_proof/src/tx_out/mod.rs +80 -0
  54. package/packages/cbor_conversation/Cargo.toml +2 -2
  55. package/packages/core_script/Cargo.toml +13 -0
  56. package/packages/core_script/src/lib.rs +69 -0
  57. package/packages/data_contract/Cargo.toml +4 -3
  58. package/packages/data_contract/src/lib.rs +209 -33
  59. package/packages/data_contract_transitions/Cargo.toml +2 -2
  60. package/packages/data_contract_transitions/src/create/mod.rs +23 -16
  61. package/packages/data_contract_transitions/src/update/mod.rs +21 -12
  62. package/packages/document/Cargo.toml +3 -2
  63. package/packages/document/src/lib.rs +14 -13
  64. package/packages/document/src/methods/mod.rs +373 -2
  65. package/packages/{document_batch → documents_batch}/Cargo.toml +7 -4
  66. package/packages/documents_batch/src/document_base_transition/mod.rs +88 -0
  67. package/packages/documents_batch/src/document_transition/mod.rs +166 -0
  68. package/packages/documents_batch/src/generators.rs +122 -0
  69. package/packages/documents_batch/src/lib.rs +195 -0
  70. package/packages/documents_batch/src/prefunded_voting_balance/mod.rs +45 -0
  71. package/packages/documents_batch/src/transitions/create/mod.rs +126 -0
  72. package/packages/documents_batch/src/transitions/delete/mod.rs +67 -0
  73. package/packages/documents_batch/src/transitions/mod.rs +6 -0
  74. package/packages/documents_batch/src/transitions/purchase/mod.rs +91 -0
  75. package/packages/documents_batch/src/transitions/replace/mod.rs +93 -0
  76. package/packages/documents_batch/src/transitions/transfer/mod.rs +84 -0
  77. package/packages/documents_batch/src/transitions/update_price/mod.rs +75 -0
  78. package/packages/enums/Cargo.toml +4 -4
  79. package/packages/enums/src/batch/batch_enum.rs +75 -10
  80. package/packages/enums/src/keys/key_type.rs +46 -0
  81. package/packages/enums/src/keys/purpose.rs +55 -0
  82. package/packages/enums/src/keys/security_level.rs +46 -0
  83. package/packages/enums/src/lib.rs +3 -0
  84. package/packages/enums/src/lock_types/mod.rs +65 -0
  85. package/packages/enums/src/network/mod.rs +67 -0
  86. package/packages/enums/src/platform/mod.rs +68 -8
  87. package/packages/enums/src/withdrawal/mod.rs +72 -0
  88. package/packages/identifier/Cargo.toml +9 -0
  89. package/packages/identifier/src/lib.rs +105 -0
  90. package/packages/identity/Cargo.toml +5 -5
  91. package/packages/identity/src/lib.rs +31 -25
  92. package/packages/{public_key → identity_public_key}/Cargo.toml +2 -2
  93. package/packages/{public_key → identity_public_key}/src/lib.rs +74 -27
  94. package/packages/identity_transitions/Cargo.toml +8 -4
  95. package/packages/identity_transitions/src/create_transition/mod.rs +102 -37
  96. package/packages/identity_transitions/src/credit_withdrawal_transition/mod.rs +212 -0
  97. package/packages/identity_transitions/src/identity_credit_transfer_transition/mod.rs +169 -0
  98. package/packages/identity_transitions/src/lib.rs +6 -1
  99. package/packages/identity_transitions/src/public_key_in_creation/mod.rs +197 -0
  100. package/packages/identity_transitions/src/top_up_transition/mod.rs +141 -0
  101. package/packages/identity_transitions/src/update_transition/mod.rs +213 -0
  102. package/packages/mock_bls/Cargo.toml +1 -1
  103. package/packages/private_key/Cargo.toml +4 -3
  104. package/packages/private_key/src/lib.rs +44 -6
  105. package/packages/state_transition/Cargo.toml +6 -4
  106. package/packages/state_transition/src/lib.rs +102 -36
  107. package/packages/utils/Cargo.toml +3 -4
  108. package/packages/utils/src/lib.rs +17 -18
  109. package/scripts/build-js.sh +22 -5
  110. package/scripts/build.sh +27 -2
  111. package/src/lib.rs +8 -1
  112. package/tests/AssetLockProof.spec.js +80 -0
  113. package/tests/ChainLockProof.spec.js +69 -0
  114. package/tests/CoreScript.spec.js +37 -0
  115. package/tests/DataContract.spec.js +178 -0
  116. package/tests/DataContractCreateStateTransition.spec.js +109 -0
  117. package/tests/DataContractUpdateStateTransition.spec.js +109 -0
  118. package/tests/Document.spec.js +238 -0
  119. package/tests/DocumentBatchTransition.spec.js +109 -0
  120. package/tests/DocumentTransition.spec.js +97 -0
  121. package/tests/DocumentsTransitions.spec.js +705 -0
  122. package/tests/Identifier.spec.js +84 -0
  123. package/tests/Identity.spec.js +113 -0
  124. package/tests/IdentityCreateTransition.spec.js +93 -0
  125. package/tests/IdentityCreditTransferTransition.spec.js +146 -0
  126. package/tests/IdentityCreditWithdrawalTransition.spec.js +192 -0
  127. package/tests/IdentityPublicKey.spec.js +132 -0
  128. package/tests/IdentityTopUpTransition.spec.js +131 -0
  129. package/tests/IdentityUpdateTransition.spec.js +147 -0
  130. package/tests/InstantLockProof.spec.js +97 -0
  131. package/tests/OutPoint.spec.js +55 -0
  132. package/tests/PrivateKey.spec.js +73 -0
  133. package/tests/PublicKeyInCreation.spec.js +258 -0
  134. package/tests/TxOut.spec.js +76 -0
  135. package/tests/mocks/DataContract/DataContract.json +153 -0
  136. package/tests/mocks/DataContract/index.js +6 -0
  137. package/tests/mocks/Document/DataContract.json +23 -0
  138. package/tests/mocks/Document/document.json +3 -0
  139. package/tests/mocks/Document/document2.json +3 -0
  140. package/tests/mocks/Document/index.js +11 -0
  141. package/tests/mocks/Identity/index.js +7 -0
  142. package/tests/mocks/Locks/index.js +5 -0
  143. package/tests/mocks/PrivateKey/index.js +5 -0
  144. package/tests/mocks/PublicKey/index.js +14 -0
  145. package/tests/utils/hex.js +15 -0
  146. package/tests/utils/wasm.js +14 -0
  147. package/typings/index.d.ts +52 -0
  148. package/packages/document/src/methods/js.rs +0 -260
  149. package/packages/document/src/methods/rust.rs +0 -92
  150. package/packages/document_batch/src/generators.rs +0 -63
  151. package/packages/document_batch/src/lib.rs +0 -228
  152. package/packages/identity_transitions/src/create_transition/public_key_in_creation/mod.rs +0 -146
@@ -0,0 +1,258 @@
1
+ const assert = require('assert')
2
+ const { describe, it, before } = require('mocha')
3
+ const initWasm = require('./utils/wasm')
4
+
5
+ let wasm
6
+
7
+ describe('InstantLock', function () {
8
+ before(async function () {
9
+ wasm = initWasm()
10
+ })
11
+
12
+ describe('serialization / deserialization', function () {
13
+ it('should allow to create from values', () => {
14
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
15
+ 0,
16
+ 'AUTHENTICATION',
17
+ 'master',
18
+ 'ECDSA_SECP256K1',
19
+ false,
20
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
21
+ []
22
+ )
23
+
24
+ assert.notEqual(publicKeyInCreation.__wbg_ptr, 0)
25
+ })
26
+
27
+ it('should allow to create from values and convert to identity public key', () => {
28
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
29
+ 0,
30
+ 'AUTHENTICATION',
31
+ 'master',
32
+ 'ECDSA_SECP256K1',
33
+ false,
34
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
35
+ []
36
+ )
37
+
38
+ const publicKey = publicKeyInCreation.toIdentityPublicKey()
39
+
40
+ assert.notEqual(publicKeyInCreation.__wbg_ptr, 0)
41
+ assert.equal(publicKey.constructor.name, 'IdentityPublicKeyWASM')
42
+ })
43
+ })
44
+
45
+ describe('getters', function () {
46
+ it('should allow to get key id', () => {
47
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
48
+ 0,
49
+ 'AUTHENTICATION',
50
+ 'master',
51
+ 'ECDSA_SECP256K1',
52
+ false,
53
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
54
+ []
55
+ )
56
+
57
+ assert.equal(publicKeyInCreation.keyId, 0)
58
+ })
59
+
60
+ it('should allow to get purpose', () => {
61
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
62
+ 0,
63
+ 'AUTHENTICATION',
64
+ 'master',
65
+ 'ECDSA_SECP256K1',
66
+ false,
67
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
68
+ []
69
+ )
70
+
71
+ assert.equal(publicKeyInCreation.purpose, 'AUTHENTICATION')
72
+ })
73
+
74
+ it('should allow to get security level', () => {
75
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
76
+ 0,
77
+ 'AUTHENTICATION',
78
+ 'master',
79
+ 'ECDSA_SECP256K1',
80
+ false,
81
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
82
+ []
83
+ )
84
+
85
+ assert.equal(publicKeyInCreation.securityLevel, 'MASTER')
86
+ })
87
+
88
+ it('should allow to get key type', () => {
89
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
90
+ 0,
91
+ 'AUTHENTICATION',
92
+ 'master',
93
+ 'ECDSA_SECP256K1',
94
+ false,
95
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
96
+ []
97
+ )
98
+
99
+ assert.equal(publicKeyInCreation.keyType, 'ECDSA_SECP256K1')
100
+ })
101
+
102
+ it('should allow to get read only', () => {
103
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
104
+ 0,
105
+ 'AUTHENTICATION',
106
+ 'master',
107
+ 'ECDSA_SECP256K1',
108
+ false,
109
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
110
+ []
111
+ )
112
+
113
+ assert.equal(publicKeyInCreation.readOnly, false)
114
+ })
115
+
116
+ it('should allow to get data', () => {
117
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
118
+ 0,
119
+ 'AUTHENTICATION',
120
+ 'master',
121
+ 'ECDSA_SECP256K1',
122
+ false,
123
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
124
+ []
125
+ )
126
+
127
+ assert.deepEqual(Buffer.from(publicKeyInCreation.data), Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'))
128
+ })
129
+
130
+ it('should allow to get signature', () => {
131
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
132
+ 0,
133
+ 'AUTHENTICATION',
134
+ 'master',
135
+ 'ECDSA_SECP256K1',
136
+ false,
137
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
138
+ []
139
+ )
140
+
141
+ assert.deepEqual([...publicKeyInCreation.signature], [])
142
+ })
143
+ })
144
+
145
+ describe('setters', function () {
146
+ it('should allow to set key id', () => {
147
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
148
+ 0,
149
+ 'AUTHENTICATION',
150
+ 'master',
151
+ 'ECDSA_SECP256K1',
152
+ false,
153
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
154
+ []
155
+ )
156
+
157
+ publicKeyInCreation.keyId = 123
158
+
159
+ assert.equal(publicKeyInCreation.keyId, 123)
160
+ })
161
+
162
+ it('should allow to set purpose', () => {
163
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
164
+ 0,
165
+ 'AUTHENTICATION',
166
+ 'master',
167
+ 'ECDSA_SECP256K1',
168
+ false,
169
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
170
+ []
171
+ )
172
+
173
+ publicKeyInCreation.purpose = 'OWNER'
174
+
175
+ assert.equal(publicKeyInCreation.purpose, 'OWNER')
176
+ })
177
+
178
+ it('should allow to set security level', () => {
179
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
180
+ 0,
181
+ 'AUTHENTICATION',
182
+ 'master',
183
+ 'ECDSA_SECP256K1',
184
+ false,
185
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
186
+ []
187
+ )
188
+
189
+ publicKeyInCreation.securityLevel = 'critical'
190
+
191
+ assert.equal(publicKeyInCreation.securityLevel, 'CRITICAL')
192
+ })
193
+
194
+ it('should allow to set key type', () => {
195
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
196
+ 0,
197
+ 'AUTHENTICATION',
198
+ 'master',
199
+ 'ECDSA_SECP256K1',
200
+ false,
201
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
202
+ []
203
+ )
204
+
205
+ publicKeyInCreation.keyType = 'ECDSA_HASH160'
206
+
207
+ assert.equal(publicKeyInCreation.keyType, 'ECDSA_HASH160')
208
+ })
209
+
210
+ it('should allow to set read only', () => {
211
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
212
+ 0,
213
+ 'AUTHENTICATION',
214
+ 'master',
215
+ 'ECDSA_SECP256K1',
216
+ false,
217
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
218
+ []
219
+ )
220
+
221
+ publicKeyInCreation.readOnly = true
222
+
223
+ assert.equal(publicKeyInCreation.readOnly, true)
224
+ })
225
+
226
+ it('should allow to set data', () => {
227
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
228
+ 0,
229
+ 'AUTHENTICATION',
230
+ 'master',
231
+ 'ECDSA_SECP256K1',
232
+ false,
233
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
234
+ []
235
+ )
236
+
237
+ publicKeyInCreation.data = Buffer.from('333333333334001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex')
238
+
239
+ assert.deepEqual(Buffer.from(publicKeyInCreation.data), Buffer.from('333333333334001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'))
240
+ })
241
+
242
+ it('should allow to set signature', () => {
243
+ const publicKeyInCreation = new wasm.IdentityPublicKeyInCreationWASM(
244
+ 0,
245
+ 'AUTHENTICATION',
246
+ 'master',
247
+ 'ECDSA_SECP256K1',
248
+ false,
249
+ Buffer.from('0333d5cf3674001d2f64c55617b7b11a2e8fc62aab09708b49355e30c7205bdb2e', 'hex'),
250
+ []
251
+ )
252
+
253
+ publicKeyInCreation.signature = [1, 2, 3, 4, 5, 6]
254
+
255
+ assert.deepEqual([...publicKeyInCreation.signature], [1, 2, 3, 4, 5, 6])
256
+ })
257
+ })
258
+ })
@@ -0,0 +1,76 @@
1
+ const assert = require('assert')
2
+ const { describe, it, before } = require('mocha')
3
+ const initWasm = require('./utils/wasm')
4
+
5
+ let wasm
6
+
7
+ describe('TxOut', function () {
8
+ before(async function () {
9
+ wasm = initWasm()
10
+ })
11
+
12
+ describe('serialization / deserialization', function () {
13
+ it('should allow to create from values with pubkey hex', function () {
14
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
15
+ assert.notEqual(out.__wbg_ptr, 0)
16
+ })
17
+
18
+ it('should allow to create from values with pubkey array', function () {
19
+ const out = new wasm.TxOutWASM(BigInt(100), Array.from(Buffer.from('76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac', 'hex')))
20
+
21
+ assert.notEqual(out.__wbg_ptr, 0)
22
+ })
23
+ })
24
+
25
+ describe('getters', function () {
26
+ it('should allow to get value', function () {
27
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
28
+
29
+ assert.equal(out.value, BigInt(100))
30
+ })
31
+
32
+ it('should allow to get script hex', function () {
33
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
34
+
35
+ assert.equal(out.scriptPubKeyHex, '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
36
+ })
37
+
38
+ it('should allow to get script bytes', function () {
39
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
40
+
41
+ assert.deepEqual(out.scriptPubKeyBytes, Uint8Array.from(Buffer.from('76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac', 'hex')))
42
+ })
43
+
44
+ it('should allow to get script asm', function () {
45
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
46
+
47
+ assert.deepEqual(out.getScriptPubKeyASM(), 'OP_DUP OP_HASH160 OP_PUSHBYTES_20 1a486a3855e6dc6dd02874424f53a6f2197b3d45 OP_EQUALVERIFY OP_CHECKSIG')
48
+ })
49
+ })
50
+
51
+ describe('setters', function () {
52
+ it('should allow to set value', function () {
53
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
54
+
55
+ out.value = BigInt(101)
56
+
57
+ assert.equal(out.value, BigInt(101))
58
+ })
59
+
60
+ it('should allow to set script hex', function () {
61
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
62
+
63
+ out.scriptPubKeyHex = '16a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac'
64
+
65
+ assert.equal(out.scriptPubKeyHex, '16a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
66
+ })
67
+
68
+ it('should allow to set script bytes', function () {
69
+ const out = new wasm.TxOutWASM(BigInt(100), '76a9141a486a3855e6dc6dd02874424f53a6f2197b3d4588ac')
70
+
71
+ out.scriptPubKeyBytes = Array.from(Buffer.from('76a914f995e42d1aa7a31b0106b63e1b896fe9aeeccc9988ac', 'hex'))
72
+
73
+ assert.deepEqual(out.scriptPubKeyBytes, Uint8Array.from(Buffer.from('76a914f995e42d1aa7a31b0106b63e1b896fe9aeeccc9988ac', 'hex')))
74
+ })
75
+ })
76
+ })
@@ -0,0 +1,153 @@
1
+ {
2
+ "$format_version": "0",
3
+ "id": "4fJLR2GYTPFdomuTVvNy3VRrvWgvkKPzqehEBpNf2nk6",
4
+ "config": {
5
+ "$format_version": "0",
6
+ "canBeDeleted": false,
7
+ "readonly": false,
8
+ "keepsHistory": false,
9
+ "documentsKeepHistoryContractDefault": false,
10
+ "documentsMutableContractDefault": true,
11
+ "documentsCanBeDeletedContractDefault": true,
12
+ "requiresIdentityEncryptionBoundedKey": null,
13
+ "requiresIdentityDecryptionBoundedKey": null
14
+ },
15
+ "version": 1,
16
+ "ownerId": "11111111111111111111111111111111",
17
+ "schemaDefs": null,
18
+ "documentSchemas": {
19
+ "withdrawal": {
20
+ "description": "Withdrawal document to track underlying withdrawal transactions. Withdrawals should be created with IdentityWithdrawalTransition",
21
+ "creationRestrictionMode": 2,
22
+ "type": "object",
23
+ "indices": [
24
+ {
25
+ "name": "identityStatus",
26
+ "properties": [
27
+ {
28
+ "$ownerId": "asc"
29
+ },
30
+ {
31
+ "status": "asc"
32
+ },
33
+ {
34
+ "$createdAt": "asc"
35
+ }
36
+ ],
37
+ "unique": false
38
+ },
39
+ {
40
+ "name": "identityRecent",
41
+ "properties": [
42
+ {
43
+ "$ownerId": "asc"
44
+ },
45
+ {
46
+ "$updatedAt": "asc"
47
+ },
48
+ {
49
+ "status": "asc"
50
+ }
51
+ ],
52
+ "unique": false
53
+ },
54
+ {
55
+ "name": "pooling",
56
+ "properties": [
57
+ {
58
+ "status": "asc"
59
+ },
60
+ {
61
+ "pooling": "asc"
62
+ },
63
+ {
64
+ "coreFeePerByte": "asc"
65
+ },
66
+ {
67
+ "$updatedAt": "asc"
68
+ }
69
+ ],
70
+ "unique": false
71
+ },
72
+ {
73
+ "name": "transaction",
74
+ "properties": [
75
+ {
76
+ "status": "asc"
77
+ },
78
+ {
79
+ "transactionIndex": "asc"
80
+ }
81
+ ],
82
+ "unique": false
83
+ }
84
+ ],
85
+ "properties": {
86
+ "transactionIndex": {
87
+ "type": "integer",
88
+ "description": "Sequential index of asset unlock (withdrawal) transaction. Populated when a withdrawal pooled into withdrawal transaction",
89
+ "minimum": 1,
90
+ "position": 0
91
+ },
92
+ "transactionSignHeight": {
93
+ "type": "integer",
94
+ "description": "The Core height on which transaction was signed",
95
+ "minimum": 1,
96
+ "position": 1
97
+ },
98
+ "amount": {
99
+ "type": "integer",
100
+ "description": "The amount to be withdrawn",
101
+ "minimum": 1000,
102
+ "position": 2
103
+ },
104
+ "coreFeePerByte": {
105
+ "type": "integer",
106
+ "description": "This is the fee that you are willing to spend for this transaction in Duffs/Byte",
107
+ "minimum": 1,
108
+ "maximum": 4294967295,
109
+ "position": 3
110
+ },
111
+ "pooling": {
112
+ "type": "integer",
113
+ "description": "This indicated the level at which Platform should try to pool this transaction",
114
+ "enum": [
115
+ 0,
116
+ 1,
117
+ 2
118
+ ],
119
+ "position": 4
120
+ },
121
+ "outputScript": {
122
+ "type": "array",
123
+ "byteArray": true,
124
+ "minItems": 23,
125
+ "maxItems": 25,
126
+ "position": 5
127
+ },
128
+ "status": {
129
+ "type": "integer",
130
+ "enum": [
131
+ 0,
132
+ 1,
133
+ 2,
134
+ 3,
135
+ 4
136
+ ],
137
+ "description": "0 - Pending, 1 - Signed, 2 - Broadcasted, 3 - Complete, 4 - Expired",
138
+ "position": 6
139
+ }
140
+ },
141
+ "additionalProperties": false,
142
+ "required": [
143
+ "$createdAt",
144
+ "$updatedAt",
145
+ "amount",
146
+ "coreFeePerByte",
147
+ "pooling",
148
+ "outputScript",
149
+ "status"
150
+ ]
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ value: require('./DataContract.json'),
3
+ id: '4fJLR2GYTPFdomuTVvNy3VRrvWgvkKPzqehEBpNf2nk6',
4
+ ownerId: '11111111111111111111111111111111',
5
+ dataContractsBytes: ['00ea8920edea52fa400de2ccc43052b2821f45585241a2875d4250e35d4ce937c800000000000101000001ab321b19457b1c16b12762509276d47d952f582d978cbd8b50bbfc2fd8a7767d0001046e6f7465160312047479706512066f626a656374120a70726f70657274696573160112076d65737361676516021204747970651206737472696e671208706f736974696f6e030012146164646974696f6e616c50726f706572746965731300']
6
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$format_version": "0",
3
+ "version": 1,
4
+ "ownerId": "11111111111111111111111111111111",
5
+ "schemaDefs": null,
6
+ "id": "4fJLR2GYTPFdomuTVvNy3VRrvWgvkKPzqehEBpNf2nk6",
7
+ "documentSchemas": {
8
+ "note": {
9
+ "type": "object",
10
+ "properties": {
11
+ "author": {
12
+ "type": "string",
13
+ "position": 1
14
+ },
15
+ "message": {
16
+ "type": "string",
17
+ "position": 0
18
+ }
19
+ },
20
+ "additionalProperties": false
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "message": "bb"
3
+ }
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ document: require('./document.json'),
3
+ document2: require('./document2.json'),
4
+ dataContractValue: require('./DataContract.json'),
5
+ documentTypeName: 'note',
6
+ revision: BigInt(1),
7
+ dataContractId: 'GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X',
8
+ ownerId: 'CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i',
9
+ id: '9tSsCqKHTZ8ro16MydChSxgHBukFW36eMLJKKRtebJEn',
10
+ documentBytes: '00840b5cec9f0401b1950610e85dcb26829122ac8853464e1e2c7e38ed22b48903ab321b19457b1c16b12762509276d47d952f582d978cbd8b50bbfc2fd8a7767d01000001305475746f7269616c20434920546573742040205475652c203037204a616e20323032352031353a32373a353020474d5400'
11
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ identifier: 'H2pb35GtKpjLinncBYeMsXkdDYXCbsFzzVmssce6pSJ1',
3
+ identifierBytes: [238, 50, 96, 211, 63, 140, 169, 225, 76, 97, 8, 6, 212, 109, 184, 253, 51, 67, 82, 42, 208, 228, 72, 192, 215, 137, 161, 88, 144, 55, 244, 230],
4
+ balance: BigInt(100),
5
+ revision: BigInt(99111),
6
+ identityBytesWithoutKeys: [0, 238, 50, 96, 211, 63, 140, 169, 225, 76, 97, 8, 6, 212, 109, 184, 253, 51, 67, 82, 42, 208, 228, 72, 192, 215, 137, 161, 88, 144, 55, 244, 230, 0, 0, 0]
7
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ instantLockBytes: [1, 1, 89, 68, 206, 254, 139, 111, 183, 115, 169, 122, 19, 26, 29, 175, 97, 14, 156, 207, 215, 16, 92, 152, 110, 29, 167, 34, 91, 149, 243, 48, 250, 217, 0, 0, 0, 0, 61, 111, 50, 237, 225, 255, 25, 159, 133, 89, 244, 234, 150, 19, 61, 198, 218, 144, 144, 44, 45, 189, 109, 187, 247, 117, 93, 95, 156, 46, 12, 216, 1, 49, 33, 55, 67, 236, 100, 131, 20, 54, 98, 71, 159, 60, 21, 2, 116, 197, 18, 154, 171, 227, 15, 30, 21, 0, 0, 0, 0, 0, 0, 0, 169, 241, 49, 98, 108, 73, 162, 241, 131, 183, 162, 245, 99, 173, 29, 197, 10, 200, 34, 1, 144, 219, 237, 184, 5, 32, 155, 96, 142, 184, 100, 224, 29, 98, 241, 139, 201, 250, 166, 10, 139, 138, 39, 245, 160, 199, 200, 185, 20, 250, 58, 20, 54, 10, 47, 37, 85, 142, 224, 224, 166, 147, 177, 143, 172, 203, 181, 158, 195, 155, 155, 60, 174, 67, 14, 11, 118, 235, 8, 7, 82, 206, 16, 61, 247, 101, 55, 161, 165, 131, 104, 10, 89, 20, 82, 157],
3
+ transactionBytes: [3, 0, 8, 0, 1, 89, 68, 206, 254, 139, 111, 183, 115, 169, 122, 19, 26, 29, 175, 97, 14, 156, 207, 215, 16, 92, 152, 110, 29, 167, 34, 91, 149, 243, 48, 250, 217, 0, 0, 0, 0, 107, 72, 48, 69, 2, 33, 0, 157, 215, 234, 11, 75, 36, 23, 153, 82, 143, 163, 76, 75, 118, 142, 19, 6, 13, 64, 50, 24, 199, 141, 199, 163, 14, 86, 81, 67, 150, 240, 28, 2, 32, 105, 238, 106, 123, 228, 237, 166, 210, 251, 103, 249, 36, 15, 233, 177, 30, 40, 125, 67, 108, 224, 183, 4, 5, 18, 239, 231, 185, 223, 195, 92, 240, 1, 33, 3, 238, 76, 67, 141, 205, 25, 38, 200, 164, 105, 53, 55, 189, 36, 52, 232, 121, 166, 108, 186, 227, 161, 55, 7, 105, 135, 102, 219, 224, 117, 213, 70, 255, 255, 255, 255, 2, 128, 29, 44, 4, 0, 0, 0, 0, 2, 106, 0, 48, 232, 38, 1, 0, 0, 0, 0, 25, 118, 169, 20, 232, 101, 217, 39, 144, 120, 74, 135, 230, 203, 134, 239, 207, 15, 238, 152, 16, 172, 45, 177, 136, 172, 0, 0, 0, 0, 36, 1, 1, 128, 29, 44, 4, 0, 0, 0, 0, 25, 118, 169, 20, 12, 182, 70, 130, 142, 161, 106, 83, 94, 200, 33, 4, 251, 5, 50, 93, 28, 107, 159, 168, 136, 172]
4
+
5
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ wif: 'cR4EZ2nAvCmn2cFepKn7UgSSQFgFTjkySAchvcoiEVdm48eWjQGn',
3
+ bytes: '67ad1669d882da256b6fa05e1b0ae384a6ac8aed146ea53602b8ff0e1e9c18e9',
4
+ publicKeyHash: '622fd260c35f0d826d05983d1f0524b02dec27a0'
5
+ }
@@ -0,0 +1,14 @@
1
+ const { Purpose, SecurityLevel, KeyType } = require('../../../dist/cjs/wasm/pshenmic_dpp')
2
+
3
+ module.exports = {
4
+ keyId: 2,
5
+ purpose: 'AUTHENTICATION',
6
+ securityLevel: SecurityLevel.CRITICAL,
7
+ keyType: KeyType.ECDSA_SECP256K1,
8
+ binaryData: '036a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48',
9
+ keyIdSet: 3,
10
+ purposeSet: Purpose.ENCRYPTION,
11
+ securityLevelSet: SecurityLevel.HIGH,
12
+ keyTypeSet: KeyType.ECDSA_HASH160,
13
+ binaryDataSet: '0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
14
+ }
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ toHexString: (byteArray) => {
3
+ return Array.prototype.map.call(byteArray, function (byte) {
4
+ return ('0' + (byte & 0xFF).toString(16)).slice(-2)
5
+ }).join('')
6
+ },
7
+ fromHexString: (str) => {
8
+ const bytes = []
9
+ for (let i = 0; i < str.length; i += 2) {
10
+ bytes.push(parseInt(str.slice(i, i + 2), 16))
11
+ }
12
+
13
+ return Uint8Array.from(bytes)
14
+ }
15
+ }
@@ -0,0 +1,14 @@
1
+ const wasm = require('../../dist/cjs/wasm/pshenmic_dpp')
2
+ const { default: wasmBytes } = require('../../dist/cjs/wasm/pshenmic_dpp_bg')
3
+
4
+ module.exports = () => {
5
+ const binaryString = atob(wasmBytes)
6
+ const bytes = new Uint8Array(binaryString.length)
7
+ for (let i = 0; i < binaryString.length; i++) {
8
+ bytes[i] = binaryString.charCodeAt(i)
9
+ }
10
+
11
+ wasm.initSync({ module: bytes.buffer })
12
+
13
+ return wasm
14
+ }
@@ -0,0 +1,52 @@
1
+ import * as DPP from './pshenmic_dpp';
2
+
3
+ export * from './pshenmic_dpp';
4
+
5
+ export class DashPlatformProtocolWASM {
6
+ // CLASSES
7
+ AssetLockProofWASM: typeof DPP.AssetLockProofWASM
8
+ ChainAssetLockProofWASM: typeof DPP.ChainAssetLockProofWASM
9
+ CoreScriptWASM: typeof DPP.CoreScriptWASM
10
+ DataContractCreateTransitionWASM: typeof DPP.DataContractCreateTransitionWASM
11
+ DataContractUpdateTransitionWASM: typeof DPP.DataContractUpdateTransitionWASM
12
+ DataContractWASM: typeof DPP.DataContractWASM
13
+ DocumentBaseTransitionWASM: typeof DPP.DocumentBaseTransitionWASM
14
+ DocumentCreateTransitionWASM: typeof DPP.DocumentCreateTransitionWASM
15
+ DocumentDeleteTransitionWASM: typeof DPP.DocumentDeleteTransitionWASM
16
+ DocumentPurchaseTransitionWASM: typeof DPP.DocumentPurchaseTransitionWASM
17
+ DocumentReplaceTransitionWASM: typeof DPP.DocumentReplaceTransitionWASM
18
+ DocumentTransferTransitionWASM: typeof DPP.DocumentTransferTransitionWASM
19
+ DocumentTransitionWASM: typeof DPP.DocumentTransitionWASM
20
+ DocumentUpdatePriceTransitionWASM: typeof DPP.DocumentUpdatePriceTransitionWASM
21
+ DocumentWASM: typeof DPP.DocumentWASM
22
+ DocumentsBatchWASM: typeof DPP.DocumentsBatchWASM
23
+ IdentifierWASM: typeof DPP.IdentifierWASM
24
+ IdentityCreateTransitionWASM: typeof DPP.IdentityCreateTransitionWASM
25
+ IdentityCreditTransferWASM: typeof DPP.IdentityCreditTransferWASM
26
+ IdentityCreditWithdrawalTransitionWASM: typeof DPP.IdentityCreditWithdrawalTransitionWASM
27
+ IdentityPublicKeyInCreationWASM: typeof DPP.IdentityPublicKeyInCreationWASM
28
+ IdentityPublicKeyWASM: typeof DPP.IdentityPublicKeyWASM
29
+ IdentityTopUpTransitionWASM: typeof DPP.IdentityTopUpTransitionWASM
30
+ IdentityUpdateTransitionWASM: typeof DPP.IdentityUpdateTransitionWASM
31
+ IdentityWASM: typeof DPP.IdentityWASM
32
+ InstantAssetLockProofWASM: typeof DPP.InstantAssetLockProofWASM
33
+ InstantLockWASM: typeof DPP.InstantLockWASM
34
+ OutPointWASM: typeof DPP.OutPointWASM
35
+ PrefundedVotingBalanceWASM: typeof DPP.PrefundedVotingBalanceWASM
36
+ PrivateKeyWASM: typeof DPP.PrivateKeyWASM
37
+ StateTransitionWASM: typeof DPP.StateTransitionWASM
38
+ TxOutWASM: typeof DPP.TxOutWASM
39
+ // ENUMS
40
+ AssetLockProofTypeWASM: typeof DPP.AssetLockProofTypeWASM
41
+ BatchType: typeof DPP.BatchType
42
+ KeyType: typeof DPP.KeyType
43
+ NetworkWASM: typeof DPP.NetworkWASM
44
+ PlatformVersionWASM: typeof DPP.PlatformVersionWASM
45
+ PoolingWASM: typeof DPP.PoolingWASM
46
+ Purpose: typeof DPP.Purpose
47
+ SecurityLevel: typeof DPP.SecurityLevel
48
+ // METHODS
49
+ cborToObject: typeof DPP.cborToObject
50
+ objectToCbor: typeof DPP.objectToCbor
51
+ initSync: typeof DPP.initSync
52
+ }