pshenmic-dpp 1.0.5 → 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 (118) hide show
  1. package/.github/workflows/build.yml +1 -1
  2. package/.github/workflows/publish.yml +1 -1
  3. package/Cargo.lock +147 -49
  4. package/Cargo.toml +13 -7
  5. package/README.md +10 -1
  6. package/dist/wasm/index.d.ts +52 -0
  7. package/dist/wasm/pshenmic_dpp.d.ts +962 -0
  8. package/dist/wasm/pshenmic_dpp.js +3342 -875
  9. package/dist/wasm/pshenmic_dpp_bg.js +1 -1
  10. package/dist/wasm/pshenmic_dpp_bg.wasm.d.ts +440 -0
  11. package/docs/AssetLockProof.md +107 -0
  12. package/docs/Building.md +50 -0
  13. package/docs/ChainLockProof.md +63 -0
  14. package/docs/CoreScript.md +17 -0
  15. package/docs/DataContract.md +192 -0
  16. package/docs/DataContractCreateTransition.md +84 -0
  17. package/docs/DataContractUpdateTransition.md +84 -0
  18. package/docs/Document.md +396 -0
  19. package/docs/DocumentBaseTransition.md +111 -0
  20. package/docs/DocumentCreateTransition.md +132 -0
  21. package/docs/DocumentDeleteTransition.md +82 -0
  22. package/docs/DocumentPurchaseTransition.md +109 -0
  23. package/docs/DocumentReplaceTransition.md +112 -0
  24. package/docs/DocumentTransferTransition.md +96 -0
  25. package/docs/DocumentTransition.md +125 -0
  26. package/docs/DocumentUpdatePriceTransition.md +109 -0
  27. package/docs/DocumentsBatch.md +133 -0
  28. package/docs/Enums.md +103 -0
  29. package/docs/Home.md +28 -0
  30. package/docs/Identifier.md +37 -0
  31. package/docs/Identity.md +140 -0
  32. package/docs/IdentityCreateTransition.md +155 -0
  33. package/docs/IdentityCreditTransfer.md +187 -0
  34. package/docs/IdentityCreditWithdrawalTransition.md +244 -0
  35. package/docs/IdentityPublicKey.md +348 -0
  36. package/docs/IdentityPublicKeyInCreation.md +141 -0
  37. package/docs/IdentityTopUpTransition.md +166 -0
  38. package/docs/IdentityUpdateTransition.md +234 -0
  39. package/docs/InstantAssetLockProof.md +117 -0
  40. package/docs/InstantLock.md +100 -0
  41. package/docs/OutPoint.md +80 -0
  42. package/docs/PrefundedVotingBalance.md +48 -0
  43. package/docs/PrivateKey.md +112 -0
  44. package/docs/TxOut.md +93 -0
  45. package/package.json +3 -3
  46. package/packages/asset_lock_proof/Cargo.toml +19 -0
  47. package/packages/asset_lock_proof/src/chain/mod.rs +79 -0
  48. package/packages/asset_lock_proof/src/instant/instant_lock.rs +111 -0
  49. package/packages/asset_lock_proof/src/instant/mod.rs +115 -0
  50. package/packages/asset_lock_proof/src/lib.rs +133 -0
  51. package/packages/asset_lock_proof/src/outpoint/mod.rs +79 -0
  52. package/packages/asset_lock_proof/src/tx_out/mod.rs +80 -0
  53. package/packages/cbor_conversation/Cargo.toml +1 -1
  54. package/packages/core_script/Cargo.toml +13 -0
  55. package/packages/core_script/src/lib.rs +69 -0
  56. package/packages/data_contract/Cargo.toml +2 -1
  57. package/packages/data_contract/src/lib.rs +34 -30
  58. package/packages/data_contract_transitions/Cargo.toml +1 -1
  59. package/packages/data_contract_transitions/src/create/mod.rs +3 -3
  60. package/packages/data_contract_transitions/src/update/mod.rs +3 -3
  61. package/packages/document/Cargo.toml +2 -1
  62. package/packages/document/src/lib.rs +13 -12
  63. package/packages/document/src/methods/mod.rs +41 -38
  64. package/packages/documents_batch/Cargo.toml +2 -1
  65. package/packages/documents_batch/src/document_base_transition/mod.rs +16 -20
  66. package/packages/documents_batch/src/document_transition/mod.rs +9 -9
  67. package/packages/documents_batch/src/lib.rs +23 -16
  68. package/packages/documents_batch/src/transitions/create/mod.rs +5 -2
  69. package/packages/documents_batch/src/transitions/transfer/mod.rs +9 -11
  70. package/packages/enums/Cargo.toml +1 -1
  71. package/packages/enums/src/batch/batch_enum.rs +2 -2
  72. package/packages/enums/src/lib.rs +2 -0
  73. package/packages/enums/src/lock_types/mod.rs +65 -0
  74. package/packages/enums/src/platform/mod.rs +2 -0
  75. package/packages/enums/src/withdrawal/mod.rs +72 -0
  76. package/packages/identifier/Cargo.toml +9 -0
  77. package/packages/identifier/src/lib.rs +105 -0
  78. package/packages/identity/Cargo.toml +2 -1
  79. package/packages/identity/src/lib.rs +13 -18
  80. package/packages/identity_public_key/Cargo.toml +1 -1
  81. package/packages/identity_transitions/Cargo.toml +7 -3
  82. package/packages/identity_transitions/src/create_transition/mod.rs +99 -36
  83. package/packages/identity_transitions/src/credit_withdrawal_transition/mod.rs +212 -0
  84. package/packages/identity_transitions/src/identity_credit_transfer_transition/mod.rs +169 -0
  85. package/packages/identity_transitions/src/lib.rs +6 -1
  86. package/packages/identity_transitions/src/{create_transition/public_key_in_creation → public_key_in_creation}/mod.rs +67 -20
  87. package/packages/identity_transitions/src/top_up_transition/mod.rs +141 -0
  88. package/packages/identity_transitions/src/update_transition/mod.rs +213 -0
  89. package/packages/private_key/Cargo.toml +1 -1
  90. package/packages/state_transition/Cargo.toml +2 -1
  91. package/packages/state_transition/src/lib.rs +3 -2
  92. package/packages/utils/Cargo.toml +2 -2
  93. package/packages/utils/src/lib.rs +0 -3
  94. package/scripts/build-js.sh +16 -0
  95. package/scripts/build.sh +5 -1
  96. package/src/lib.rs +1 -0
  97. package/tests/AssetLockProof.spec.js +80 -0
  98. package/tests/ChainLockProof.spec.js +69 -0
  99. package/tests/CoreScript.spec.js +37 -0
  100. package/tests/DataContract.spec.js +17 -14
  101. package/tests/Document.spec.js +14 -8
  102. package/tests/DocumentBatchTransition.spec.js +11 -11
  103. package/tests/DocumentTransition.spec.js +4 -4
  104. package/tests/DocumentsTransitions.spec.js +22 -22
  105. package/tests/Identifier.spec.js +84 -0
  106. package/tests/Identity.spec.js +1 -1
  107. package/tests/IdentityCreateTransition.spec.js +93 -0
  108. package/tests/IdentityCreditTransferTransition.spec.js +146 -0
  109. package/tests/IdentityCreditWithdrawalTransition.spec.js +192 -0
  110. package/tests/IdentityTopUpTransition.spec.js +131 -0
  111. package/tests/IdentityUpdateTransition.spec.js +147 -0
  112. package/tests/InstantLockProof.spec.js +97 -0
  113. package/tests/OutPoint.spec.js +55 -0
  114. package/tests/PublicKeyInCreation.spec.js +258 -0
  115. package/tests/TxOut.spec.js +76 -0
  116. package/tests/mocks/Locks/index.js +5 -0
  117. package/tests/mocks/PublicKey/index.js +1 -1
  118. package/typings/index.d.ts +52 -0
@@ -0,0 +1,93 @@
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('IdentityCreateTransition', function () {
8
+ before(async function () {
9
+ wasm = initWasm()
10
+ })
11
+
12
+ describe('serialization / deserialization', function () {
13
+ it('should allow to create transition', function () {
14
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
15
+
16
+ assert.notEqual(transition.__wbg_ptr, 0)
17
+ })
18
+
19
+ it('should allow to serialize to bytes', function () {
20
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
21
+
22
+ const bytes = transition.toBytes()
23
+
24
+ assert.equal(bytes.length > 0, true)
25
+ })
26
+
27
+ it('should allow to deserialize to bytes', function () {
28
+ const bytes = [0, 0, 0, 162, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 255, 255, 255, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
29
+
30
+ const transition = wasm.IdentityCreateTransitionWASM.fromBytes(bytes)
31
+
32
+ assert.notEqual(transition.__wbg_ptr, 0)
33
+ })
34
+ })
35
+
36
+ describe('getters', function () {
37
+ it('should allow to get userFeeIncrease', function () {
38
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
39
+
40
+ assert.equal(transition.userFeeIncrease, 0)
41
+ })
42
+
43
+ it('should allow to get AssetLock', function () {
44
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
45
+
46
+ assert.notEqual(transition.assetLock.__wbg_ptr, 0)
47
+ })
48
+
49
+ it('should allow to get Identifier', function () {
50
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
51
+
52
+ assert.equal(transition.getIdentifier().base58(), '11111111111111111111111111111111')
53
+ })
54
+
55
+ it('should allow to get PublicKeys', function () {
56
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
57
+
58
+ assert.equal(transition.publicKeys.length, 0)
59
+ })
60
+
61
+ it('should allow to get signature', function () {
62
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
63
+
64
+ assert.deepEqual(transition.getSignature(), Uint8Array.from([]))
65
+ })
66
+
67
+ it('should allow to get signable bytes', function () {
68
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
69
+
70
+ assert.equal(transition.getSignableBytes().length, 229)
71
+ })
72
+ })
73
+
74
+ describe('setters', function () {
75
+ it('should allow to set the userFeeIncrease', function () {
76
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
77
+
78
+ transition.userFeeIncrease = 100
79
+
80
+ assert.equal(transition.userFeeIncrease, 100)
81
+ })
82
+
83
+ // TODO: Implement publickeys in creation setter
84
+ // it('should allow to set the publicKeys', function () {
85
+ //
86
+ // })
87
+
88
+ // TODO: Implement asset lock setter
89
+ // it('should allow to set the asset lock', function () {
90
+ //
91
+ // })
92
+ })
93
+ })
@@ -0,0 +1,146 @@
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('IdentityCreditTransferTransition', function () {
8
+ before(async function () {
9
+ wasm = initWasm()
10
+ })
11
+
12
+ describe('serialization / deserialization', function () {
13
+ it('Should create IdentityCreditTransferTransition with empty platform version', async function () {
14
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
15
+
16
+ assert.notEqual(transition.__wbg_ptr, 0)
17
+ })
18
+
19
+ it('Should create IdentityCreditTransferTransition with non empty platform version', async function () {
20
+ const sender = new wasm.IdentifierWASM('11111111111111111111111111111111')
21
+ const recipient = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
22
+
23
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), sender, recipient, BigInt(199), 'platform_v1')
24
+
25
+ assert.notEqual(transition.__wbg_ptr, 0)
26
+ assert.notEqual(sender.__wbg_ptr, 0)
27
+ assert.notEqual(recipient.__wbg_ptr, 0)
28
+ })
29
+ })
30
+
31
+ describe('getters', function () {
32
+ it('Should return recipientId', async function () {
33
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
34
+
35
+ assert.deepEqual(transition.recipientId.base58(), 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
36
+ })
37
+
38
+ it('Should return senderId', async function () {
39
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
40
+
41
+ assert.deepEqual(transition.senderId.base58(), '11111111111111111111111111111111')
42
+ })
43
+
44
+ it('Should return amount', async function () {
45
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
46
+
47
+ assert.deepEqual(transition.amount, BigInt(100))
48
+ })
49
+
50
+ it('Should return nonce', async function () {
51
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
52
+
53
+ assert.deepEqual(transition.nonce, BigInt(199))
54
+ })
55
+
56
+ it('Should return signature', async function () {
57
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
58
+
59
+ assert.deepEqual(transition.signature, Uint8Array.from([]))
60
+ })
61
+
62
+ it('Should return signaturePublicKeyId', async function () {
63
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
64
+
65
+ assert.deepEqual(transition.signaturePublicKeyId, 0)
66
+ })
67
+
68
+ it('Should return userFeeIncrease', async function () {
69
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
70
+
71
+ assert.deepEqual(transition.userFeeIncrease, 0)
72
+ })
73
+ })
74
+
75
+ describe('setters', function () {
76
+ it('Should allow to set recipientId', async function () {
77
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
78
+
79
+ const recipient = new wasm.IdentifierWASM('11111111111111111111111111111111')
80
+
81
+ transition.recipientId = recipient
82
+
83
+ assert.deepEqual(transition.recipientId.base58(), '11111111111111111111111111111111')
84
+
85
+ transition.recipientId = 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec'
86
+
87
+ assert.deepEqual(transition.recipientId.base58(), 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
88
+ assert.notEqual(recipient.__wbg_ptr, 0)
89
+ })
90
+
91
+ it('Should return senderId', async function () {
92
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
93
+
94
+ const sender = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
95
+
96
+ transition.senderId = sender
97
+
98
+ assert.deepEqual(transition.senderId.base58(), 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
99
+
100
+ transition.senderId = '11111111111111111111111111111111'
101
+
102
+ assert.notEqual(sender.__wbg_ptr, 0)
103
+ assert.deepEqual(transition.senderId.base58(), '11111111111111111111111111111111')
104
+ })
105
+
106
+ it('Should return amount', async function () {
107
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
108
+
109
+ transition.amount = BigInt(199)
110
+
111
+ assert.deepEqual(transition.amount, BigInt(199))
112
+ })
113
+
114
+ it('Should return nonce', async function () {
115
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
116
+
117
+ transition.nonce = BigInt(1)
118
+
119
+ assert.deepEqual(transition.nonce, BigInt(1))
120
+ })
121
+
122
+ it('Should return signature', async function () {
123
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
124
+
125
+ transition.signature = [1, 1]
126
+
127
+ assert.deepEqual(transition.signature, Uint8Array.from([1, 1]))
128
+ })
129
+
130
+ it('Should return signaturePublicKeyId', async function () {
131
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
132
+
133
+ transition.signaturePublicKeyId = 11
134
+
135
+ assert.deepEqual(transition.signaturePublicKeyId, 11)
136
+ })
137
+
138
+ it('Should return userFeeIncrease', async function () {
139
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
140
+
141
+ transition.userFeeIncrease = 11
142
+
143
+ assert.deepEqual(transition.userFeeIncrease, 11)
144
+ })
145
+ })
146
+ })
@@ -0,0 +1,192 @@
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('IdentityCreditWithdrawalTransition', function () {
8
+ before(async function () {
9
+ wasm = initWasm()
10
+ })
11
+
12
+ describe('serialization / deserialization', function () {
13
+ it('Should allow to create IdentityCreditWithdrawalTransition', function () {
14
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
15
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
16
+
17
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
18
+
19
+ assert.notEqual(identifier.__wbg_ptr, 0)
20
+ assert.notEqual(script.__wbg_ptr, 0)
21
+ assert.notEqual(transition.__wbg_ptr, 0)
22
+ })
23
+ })
24
+
25
+ describe('getters', function () {
26
+ it('Should allow to get outputScript', function () {
27
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
28
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
29
+
30
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
31
+
32
+ assert.deepEqual(transition.outputScript.toString(), 'dqkUAQEBAQEBAQEBAQEBAQEBAQEBAQGIrA==')
33
+ })
34
+
35
+ it('Should allow to get pooling', function () {
36
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
37
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
38
+
39
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
40
+
41
+ assert.deepEqual(transition.pooling, 'Never')
42
+ })
43
+
44
+ it('Should allow to get identityId', function () {
45
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
46
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
47
+
48
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
49
+
50
+ assert.deepEqual(transition.identityId.base58(), identifier.base58())
51
+ })
52
+
53
+ it('Should allow to get userFeeIncrease', function () {
54
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
55
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
56
+
57
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
58
+
59
+ assert.deepEqual(transition.userFeeIncrease, 1)
60
+ })
61
+
62
+ it('Should allow to get nonce', function () {
63
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
64
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
65
+
66
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
67
+
68
+ assert.deepEqual(transition.nonce, BigInt(1))
69
+ })
70
+
71
+ it('Should allow to get amount', function () {
72
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
73
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
74
+
75
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
76
+
77
+ assert.deepEqual(transition.amount, BigInt(111))
78
+ })
79
+
80
+ it('Should allow to get signature', function () {
81
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
82
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
83
+
84
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
85
+
86
+ assert.deepEqual(transition.signature, Uint8Array.from([]))
87
+ })
88
+
89
+ it('Should allow to get signaturePublicKeyId', function () {
90
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
91
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
92
+
93
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
94
+
95
+ assert.deepEqual(transition.signaturePublicKeyId, 0)
96
+ })
97
+ })
98
+
99
+ describe('setters', function () {
100
+ it('Should allow to set outputScript', function () {
101
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
102
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
103
+
104
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
105
+
106
+ const script2 = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
107
+
108
+ transition.outputScript = script2
109
+
110
+ assert.deepEqual(transition.outputScript.toString(), script2.toString())
111
+ })
112
+
113
+ it('Should allow to set pooling', function () {
114
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
115
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
116
+
117
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
118
+
119
+ transition.pooling = 'Standard'
120
+
121
+ assert.deepEqual(transition.pooling, 'Standard')
122
+ })
123
+
124
+ it('Should allow to set identityId', function () {
125
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
126
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
127
+
128
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
129
+
130
+ const identifier2 = new wasm.IdentifierWASM('11SAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
131
+
132
+ transition.identityId = identifier2
133
+
134
+ assert.deepEqual(transition.identityId.base58(), identifier2.base58())
135
+ })
136
+
137
+ it('Should allow to set userFeeIncrease', function () {
138
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
139
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
140
+
141
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
142
+
143
+ transition.userFeeIncrease = 999
144
+
145
+ assert.deepEqual(transition.userFeeIncrease, 999)
146
+ })
147
+
148
+ it('Should allow to set nonce', function () {
149
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
150
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
151
+
152
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
153
+
154
+ transition.nonce = BigInt(1111)
155
+
156
+ assert.deepEqual(transition.nonce, BigInt(1111))
157
+ })
158
+
159
+ it('Should allow to get amount', function () {
160
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
161
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
162
+
163
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
164
+
165
+ transition.amount = BigInt(2222)
166
+
167
+ assert.deepEqual(transition.amount, BigInt(2222))
168
+ })
169
+
170
+ it('Should allow to get signature', function () {
171
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
172
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
173
+
174
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
175
+
176
+ transition.signature = Uint8Array.from([1, 2, 3])
177
+
178
+ assert.deepEqual(transition.signature, Uint8Array.from([1, 2, 3]))
179
+ })
180
+
181
+ it('Should allow to get signaturePublicKeyId', function () {
182
+ const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
183
+ const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
184
+
185
+ const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
186
+
187
+ transition.signaturePublicKeyId = 11
188
+
189
+ assert.deepEqual(transition.signaturePublicKeyId, 11)
190
+ })
191
+ })
192
+ })
@@ -0,0 +1,131 @@
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('IdentityTopUpTransition', function () {
8
+ before(async function () {
9
+ wasm = initWasm()
10
+ })
11
+
12
+ describe('serialization / deserialization', function () {
13
+ it('should allow to create IdentityTopUpTransition', function () {
14
+ const assetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
15
+ // instant lock
16
+ [1, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 177, 215, 65, 96, 204, 228, 86, 13, 14, 185, 46, 65, 241, 38, 226, 172, 59, 96, 158, 15, 126, 90, 225, 3, 140, 221, 96, 131, 254, 12, 236, 26, 48, 124, 31, 23, 184, 202, 122, 231, 123, 59, 43, 118, 27, 214, 225, 58, 44, 191, 232, 10, 33, 35, 8, 113, 145, 159, 158, 88, 80, 0, 0, 0, 173, 103, 128, 160, 29, 226, 161, 219, 167, 194, 158, 38, 19, 51, 143, 248, 161, 87, 126, 32, 143, 209, 152, 44, 174, 6, 25, 210, 101, 127, 131, 65, 202, 241, 47, 166, 132, 10, 199, 15, 187, 136, 11, 217, 237, 13, 173, 64, 11, 6, 112, 188, 234, 239, 204, 29, 3, 6, 35, 154, 44, 106, 44, 183, 171, 126, 146, 240, 153, 210, 187, 56, 133, 161, 11, 4, 151, 63, 89, 20, 44, 66, 153, 242, 97, 207, 44, 110, 208, 51, 198, 113, 104, 79, 154, 19],
17
+ // transaction
18
+ [3, 0, 8, 0, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 106, 71, 48, 68, 2, 32, 2, 146, 73, 163, 223, 124, 140, 225, 109, 126, 239, 87, 105, 184, 118, 87, 182, 100, 182, 6, 15, 200, 26, 44, 33, 215, 165, 110, 211, 232, 245, 233, 2, 32, 69, 161, 168, 128, 101, 26, 171, 20, 63, 30, 219, 87, 23, 4, 142, 115, 73, 73, 170, 203, 46, 187, 149, 32, 210, 171, 46, 136, 253, 188, 36, 12, 1, 33, 2, 144, 231, 28, 153, 30, 92, 52, 10, 111, 47, 107, 74, 225, 237, 151, 33, 188, 184, 247, 121, 70, 135, 174, 31, 160, 16, 216, 239, 225, 103, 88, 112, 255, 255, 255, 255, 2, 64, 66, 15, 0, 0, 0, 0, 0, 2, 106, 0, 216, 154, 230, 5, 0, 0, 0, 0, 25, 118, 169, 20, 229, 154, 45, 140, 145, 114, 18, 52, 205, 13, 179, 84, 94, 174, 149, 207, 101, 115, 51, 240, 136, 172, 0, 0, 0, 0, 36, 1, 1, 64, 66, 15, 0, 0, 0, 0, 0, 25, 118, 169, 20, 176, 213, 107, 82, 203, 147, 209, 128, 255, 63, 69, 219, 41, 250, 232, 254, 185, 168, 85, 184, 136, 172],
19
+ // output index
20
+ 0
21
+ )
22
+
23
+ const transition = new wasm.IdentityTopUpTransitionWASM(assetLockProof, 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH', 11)
24
+
25
+ assert.notEqual(transition.__wbg_ptr, 0)
26
+ assert.notEqual(assetLockProof.__wbg_ptr, 0)
27
+ })
28
+ })
29
+
30
+ describe('getters', function () {
31
+ it('should allow to return userFeeIncrease', function () {
32
+ const assetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
33
+ // instant lock
34
+ [1, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 177, 215, 65, 96, 204, 228, 86, 13, 14, 185, 46, 65, 241, 38, 226, 172, 59, 96, 158, 15, 126, 90, 225, 3, 140, 221, 96, 131, 254, 12, 236, 26, 48, 124, 31, 23, 184, 202, 122, 231, 123, 59, 43, 118, 27, 214, 225, 58, 44, 191, 232, 10, 33, 35, 8, 113, 145, 159, 158, 88, 80, 0, 0, 0, 173, 103, 128, 160, 29, 226, 161, 219, 167, 194, 158, 38, 19, 51, 143, 248, 161, 87, 126, 32, 143, 209, 152, 44, 174, 6, 25, 210, 101, 127, 131, 65, 202, 241, 47, 166, 132, 10, 199, 15, 187, 136, 11, 217, 237, 13, 173, 64, 11, 6, 112, 188, 234, 239, 204, 29, 3, 6, 35, 154, 44, 106, 44, 183, 171, 126, 146, 240, 153, 210, 187, 56, 133, 161, 11, 4, 151, 63, 89, 20, 44, 66, 153, 242, 97, 207, 44, 110, 208, 51, 198, 113, 104, 79, 154, 19],
35
+ // transaction
36
+ [3, 0, 8, 0, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 106, 71, 48, 68, 2, 32, 2, 146, 73, 163, 223, 124, 140, 225, 109, 126, 239, 87, 105, 184, 118, 87, 182, 100, 182, 6, 15, 200, 26, 44, 33, 215, 165, 110, 211, 232, 245, 233, 2, 32, 69, 161, 168, 128, 101, 26, 171, 20, 63, 30, 219, 87, 23, 4, 142, 115, 73, 73, 170, 203, 46, 187, 149, 32, 210, 171, 46, 136, 253, 188, 36, 12, 1, 33, 2, 144, 231, 28, 153, 30, 92, 52, 10, 111, 47, 107, 74, 225, 237, 151, 33, 188, 184, 247, 121, 70, 135, 174, 31, 160, 16, 216, 239, 225, 103, 88, 112, 255, 255, 255, 255, 2, 64, 66, 15, 0, 0, 0, 0, 0, 2, 106, 0, 216, 154, 230, 5, 0, 0, 0, 0, 25, 118, 169, 20, 229, 154, 45, 140, 145, 114, 18, 52, 205, 13, 179, 84, 94, 174, 149, 207, 101, 115, 51, 240, 136, 172, 0, 0, 0, 0, 36, 1, 1, 64, 66, 15, 0, 0, 0, 0, 0, 25, 118, 169, 20, 176, 213, 107, 82, 203, 147, 209, 128, 255, 63, 69, 219, 41, 250, 232, 254, 185, 168, 85, 184, 136, 172],
37
+ // output index
38
+ 0
39
+ )
40
+
41
+ const transition = new wasm.IdentityTopUpTransitionWASM(assetLockProof, 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH', 11)
42
+
43
+ assert.deepEqual(transition.userFeeIncrease, 11)
44
+ })
45
+
46
+ it('should allow to return identityIdentifier', function () {
47
+ const assetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
48
+ // instant lock
49
+ [1, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 177, 215, 65, 96, 204, 228, 86, 13, 14, 185, 46, 65, 241, 38, 226, 172, 59, 96, 158, 15, 126, 90, 225, 3, 140, 221, 96, 131, 254, 12, 236, 26, 48, 124, 31, 23, 184, 202, 122, 231, 123, 59, 43, 118, 27, 214, 225, 58, 44, 191, 232, 10, 33, 35, 8, 113, 145, 159, 158, 88, 80, 0, 0, 0, 173, 103, 128, 160, 29, 226, 161, 219, 167, 194, 158, 38, 19, 51, 143, 248, 161, 87, 126, 32, 143, 209, 152, 44, 174, 6, 25, 210, 101, 127, 131, 65, 202, 241, 47, 166, 132, 10, 199, 15, 187, 136, 11, 217, 237, 13, 173, 64, 11, 6, 112, 188, 234, 239, 204, 29, 3, 6, 35, 154, 44, 106, 44, 183, 171, 126, 146, 240, 153, 210, 187, 56, 133, 161, 11, 4, 151, 63, 89, 20, 44, 66, 153, 242, 97, 207, 44, 110, 208, 51, 198, 113, 104, 79, 154, 19],
50
+ // transaction
51
+ [3, 0, 8, 0, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 106, 71, 48, 68, 2, 32, 2, 146, 73, 163, 223, 124, 140, 225, 109, 126, 239, 87, 105, 184, 118, 87, 182, 100, 182, 6, 15, 200, 26, 44, 33, 215, 165, 110, 211, 232, 245, 233, 2, 32, 69, 161, 168, 128, 101, 26, 171, 20, 63, 30, 219, 87, 23, 4, 142, 115, 73, 73, 170, 203, 46, 187, 149, 32, 210, 171, 46, 136, 253, 188, 36, 12, 1, 33, 2, 144, 231, 28, 153, 30, 92, 52, 10, 111, 47, 107, 74, 225, 237, 151, 33, 188, 184, 247, 121, 70, 135, 174, 31, 160, 16, 216, 239, 225, 103, 88, 112, 255, 255, 255, 255, 2, 64, 66, 15, 0, 0, 0, 0, 0, 2, 106, 0, 216, 154, 230, 5, 0, 0, 0, 0, 25, 118, 169, 20, 229, 154, 45, 140, 145, 114, 18, 52, 205, 13, 179, 84, 94, 174, 149, 207, 101, 115, 51, 240, 136, 172, 0, 0, 0, 0, 36, 1, 1, 64, 66, 15, 0, 0, 0, 0, 0, 25, 118, 169, 20, 176, 213, 107, 82, 203, 147, 209, 128, 255, 63, 69, 219, 41, 250, 232, 254, 185, 168, 85, 184, 136, 172],
52
+ // output index
53
+ 0
54
+ )
55
+
56
+ const transition = new wasm.IdentityTopUpTransitionWASM(assetLockProof, 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH', 11)
57
+
58
+ assert.deepEqual(transition.identityIdentifier.base58(), 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH')
59
+ })
60
+
61
+ it('should allow to return signature', function () {
62
+ const assetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
63
+ // instant lock
64
+ [1, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 177, 215, 65, 96, 204, 228, 86, 13, 14, 185, 46, 65, 241, 38, 226, 172, 59, 96, 158, 15, 126, 90, 225, 3, 140, 221, 96, 131, 254, 12, 236, 26, 48, 124, 31, 23, 184, 202, 122, 231, 123, 59, 43, 118, 27, 214, 225, 58, 44, 191, 232, 10, 33, 35, 8, 113, 145, 159, 158, 88, 80, 0, 0, 0, 173, 103, 128, 160, 29, 226, 161, 219, 167, 194, 158, 38, 19, 51, 143, 248, 161, 87, 126, 32, 143, 209, 152, 44, 174, 6, 25, 210, 101, 127, 131, 65, 202, 241, 47, 166, 132, 10, 199, 15, 187, 136, 11, 217, 237, 13, 173, 64, 11, 6, 112, 188, 234, 239, 204, 29, 3, 6, 35, 154, 44, 106, 44, 183, 171, 126, 146, 240, 153, 210, 187, 56, 133, 161, 11, 4, 151, 63, 89, 20, 44, 66, 153, 242, 97, 207, 44, 110, 208, 51, 198, 113, 104, 79, 154, 19],
65
+ // transaction
66
+ [3, 0, 8, 0, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 106, 71, 48, 68, 2, 32, 2, 146, 73, 163, 223, 124, 140, 225, 109, 126, 239, 87, 105, 184, 118, 87, 182, 100, 182, 6, 15, 200, 26, 44, 33, 215, 165, 110, 211, 232, 245, 233, 2, 32, 69, 161, 168, 128, 101, 26, 171, 20, 63, 30, 219, 87, 23, 4, 142, 115, 73, 73, 170, 203, 46, 187, 149, 32, 210, 171, 46, 136, 253, 188, 36, 12, 1, 33, 2, 144, 231, 28, 153, 30, 92, 52, 10, 111, 47, 107, 74, 225, 237, 151, 33, 188, 184, 247, 121, 70, 135, 174, 31, 160, 16, 216, 239, 225, 103, 88, 112, 255, 255, 255, 255, 2, 64, 66, 15, 0, 0, 0, 0, 0, 2, 106, 0, 216, 154, 230, 5, 0, 0, 0, 0, 25, 118, 169, 20, 229, 154, 45, 140, 145, 114, 18, 52, 205, 13, 179, 84, 94, 174, 149, 207, 101, 115, 51, 240, 136, 172, 0, 0, 0, 0, 36, 1, 1, 64, 66, 15, 0, 0, 0, 0, 0, 25, 118, 169, 20, 176, 213, 107, 82, 203, 147, 209, 128, 255, 63, 69, 219, 41, 250, 232, 254, 185, 168, 85, 184, 136, 172],
67
+ // output index
68
+ 0
69
+ )
70
+
71
+ const transition = new wasm.IdentityTopUpTransitionWASM(assetLockProof, 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH', 11)
72
+
73
+ assert.deepEqual(transition.signature, Uint8Array.from([]))
74
+ })
75
+ })
76
+
77
+ describe('setters', function () {
78
+ it('should allow to set userFeeIncrease', function () {
79
+ const assetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
80
+ // instant lock
81
+ [1, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 177, 215, 65, 96, 204, 228, 86, 13, 14, 185, 46, 65, 241, 38, 226, 172, 59, 96, 158, 15, 126, 90, 225, 3, 140, 221, 96, 131, 254, 12, 236, 26, 48, 124, 31, 23, 184, 202, 122, 231, 123, 59, 43, 118, 27, 214, 225, 58, 44, 191, 232, 10, 33, 35, 8, 113, 145, 159, 158, 88, 80, 0, 0, 0, 173, 103, 128, 160, 29, 226, 161, 219, 167, 194, 158, 38, 19, 51, 143, 248, 161, 87, 126, 32, 143, 209, 152, 44, 174, 6, 25, 210, 101, 127, 131, 65, 202, 241, 47, 166, 132, 10, 199, 15, 187, 136, 11, 217, 237, 13, 173, 64, 11, 6, 112, 188, 234, 239, 204, 29, 3, 6, 35, 154, 44, 106, 44, 183, 171, 126, 146, 240, 153, 210, 187, 56, 133, 161, 11, 4, 151, 63, 89, 20, 44, 66, 153, 242, 97, 207, 44, 110, 208, 51, 198, 113, 104, 79, 154, 19],
82
+ // transaction
83
+ [3, 0, 8, 0, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 106, 71, 48, 68, 2, 32, 2, 146, 73, 163, 223, 124, 140, 225, 109, 126, 239, 87, 105, 184, 118, 87, 182, 100, 182, 6, 15, 200, 26, 44, 33, 215, 165, 110, 211, 232, 245, 233, 2, 32, 69, 161, 168, 128, 101, 26, 171, 20, 63, 30, 219, 87, 23, 4, 142, 115, 73, 73, 170, 203, 46, 187, 149, 32, 210, 171, 46, 136, 253, 188, 36, 12, 1, 33, 2, 144, 231, 28, 153, 30, 92, 52, 10, 111, 47, 107, 74, 225, 237, 151, 33, 188, 184, 247, 121, 70, 135, 174, 31, 160, 16, 216, 239, 225, 103, 88, 112, 255, 255, 255, 255, 2, 64, 66, 15, 0, 0, 0, 0, 0, 2, 106, 0, 216, 154, 230, 5, 0, 0, 0, 0, 25, 118, 169, 20, 229, 154, 45, 140, 145, 114, 18, 52, 205, 13, 179, 84, 94, 174, 149, 207, 101, 115, 51, 240, 136, 172, 0, 0, 0, 0, 36, 1, 1, 64, 66, 15, 0, 0, 0, 0, 0, 25, 118, 169, 20, 176, 213, 107, 82, 203, 147, 209, 128, 255, 63, 69, 219, 41, 250, 232, 254, 185, 168, 85, 184, 136, 172],
84
+ // output index
85
+ 0
86
+ )
87
+
88
+ const transition = new wasm.IdentityTopUpTransitionWASM(assetLockProof, 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH', 11)
89
+
90
+ transition.userFeeIncrease = 21
91
+
92
+ assert.deepEqual(transition.userFeeIncrease, 21)
93
+ })
94
+
95
+ it('should allow to set identityIdentifier', function () {
96
+ const assetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
97
+ // instant lock
98
+ [1, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 177, 215, 65, 96, 204, 228, 86, 13, 14, 185, 46, 65, 241, 38, 226, 172, 59, 96, 158, 15, 126, 90, 225, 3, 140, 221, 96, 131, 254, 12, 236, 26, 48, 124, 31, 23, 184, 202, 122, 231, 123, 59, 43, 118, 27, 214, 225, 58, 44, 191, 232, 10, 33, 35, 8, 113, 145, 159, 158, 88, 80, 0, 0, 0, 173, 103, 128, 160, 29, 226, 161, 219, 167, 194, 158, 38, 19, 51, 143, 248, 161, 87, 126, 32, 143, 209, 152, 44, 174, 6, 25, 210, 101, 127, 131, 65, 202, 241, 47, 166, 132, 10, 199, 15, 187, 136, 11, 217, 237, 13, 173, 64, 11, 6, 112, 188, 234, 239, 204, 29, 3, 6, 35, 154, 44, 106, 44, 183, 171, 126, 146, 240, 153, 210, 187, 56, 133, 161, 11, 4, 151, 63, 89, 20, 44, 66, 153, 242, 97, 207, 44, 110, 208, 51, 198, 113, 104, 79, 154, 19],
99
+ // transaction
100
+ [3, 0, 8, 0, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 106, 71, 48, 68, 2, 32, 2, 146, 73, 163, 223, 124, 140, 225, 109, 126, 239, 87, 105, 184, 118, 87, 182, 100, 182, 6, 15, 200, 26, 44, 33, 215, 165, 110, 211, 232, 245, 233, 2, 32, 69, 161, 168, 128, 101, 26, 171, 20, 63, 30, 219, 87, 23, 4, 142, 115, 73, 73, 170, 203, 46, 187, 149, 32, 210, 171, 46, 136, 253, 188, 36, 12, 1, 33, 2, 144, 231, 28, 153, 30, 92, 52, 10, 111, 47, 107, 74, 225, 237, 151, 33, 188, 184, 247, 121, 70, 135, 174, 31, 160, 16, 216, 239, 225, 103, 88, 112, 255, 255, 255, 255, 2, 64, 66, 15, 0, 0, 0, 0, 0, 2, 106, 0, 216, 154, 230, 5, 0, 0, 0, 0, 25, 118, 169, 20, 229, 154, 45, 140, 145, 114, 18, 52, 205, 13, 179, 84, 94, 174, 149, 207, 101, 115, 51, 240, 136, 172, 0, 0, 0, 0, 36, 1, 1, 64, 66, 15, 0, 0, 0, 0, 0, 25, 118, 169, 20, 176, 213, 107, 82, 203, 147, 209, 128, 255, 63, 69, 219, 41, 250, 232, 254, 185, 168, 85, 184, 136, 172],
101
+ // output index
102
+ 0
103
+ )
104
+
105
+ const transition = new wasm.IdentityTopUpTransitionWASM(assetLockProof, 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH', 11)
106
+
107
+ const identifier = new wasm.IdentifierWASM('777cE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH')
108
+
109
+ transition.identityIdentifier = identifier
110
+
111
+ assert.deepEqual(transition.identityIdentifier.base58(), '777cE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH')
112
+ })
113
+
114
+ it('should allow to set signature', function () {
115
+ const assetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
116
+ // instant lock
117
+ [1, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 177, 215, 65, 96, 204, 228, 86, 13, 14, 185, 46, 65, 241, 38, 226, 172, 59, 96, 158, 15, 126, 90, 225, 3, 140, 221, 96, 131, 254, 12, 236, 26, 48, 124, 31, 23, 184, 202, 122, 231, 123, 59, 43, 118, 27, 214, 225, 58, 44, 191, 232, 10, 33, 35, 8, 113, 145, 159, 158, 88, 80, 0, 0, 0, 173, 103, 128, 160, 29, 226, 161, 219, 167, 194, 158, 38, 19, 51, 143, 248, 161, 87, 126, 32, 143, 209, 152, 44, 174, 6, 25, 210, 101, 127, 131, 65, 202, 241, 47, 166, 132, 10, 199, 15, 187, 136, 11, 217, 237, 13, 173, 64, 11, 6, 112, 188, 234, 239, 204, 29, 3, 6, 35, 154, 44, 106, 44, 183, 171, 126, 146, 240, 153, 210, 187, 56, 133, 161, 11, 4, 151, 63, 89, 20, 44, 66, 153, 242, 97, 207, 44, 110, 208, 51, 198, 113, 104, 79, 154, 19],
118
+ // transaction
119
+ [3, 0, 8, 0, 1, 193, 219, 244, 102, 77, 20, 251, 187, 201, 109, 168, 125, 7, 244, 118, 119, 210, 53, 238, 105, 138, 31, 7, 73, 30, 128, 131, 175, 114, 76, 187, 37, 0, 0, 0, 0, 106, 71, 48, 68, 2, 32, 2, 146, 73, 163, 223, 124, 140, 225, 109, 126, 239, 87, 105, 184, 118, 87, 182, 100, 182, 6, 15, 200, 26, 44, 33, 215, 165, 110, 211, 232, 245, 233, 2, 32, 69, 161, 168, 128, 101, 26, 171, 20, 63, 30, 219, 87, 23, 4, 142, 115, 73, 73, 170, 203, 46, 187, 149, 32, 210, 171, 46, 136, 253, 188, 36, 12, 1, 33, 2, 144, 231, 28, 153, 30, 92, 52, 10, 111, 47, 107, 74, 225, 237, 151, 33, 188, 184, 247, 121, 70, 135, 174, 31, 160, 16, 216, 239, 225, 103, 88, 112, 255, 255, 255, 255, 2, 64, 66, 15, 0, 0, 0, 0, 0, 2, 106, 0, 216, 154, 230, 5, 0, 0, 0, 0, 25, 118, 169, 20, 229, 154, 45, 140, 145, 114, 18, 52, 205, 13, 179, 84, 94, 174, 149, 207, 101, 115, 51, 240, 136, 172, 0, 0, 0, 0, 36, 1, 1, 64, 66, 15, 0, 0, 0, 0, 0, 25, 118, 169, 20, 176, 213, 107, 82, 203, 147, 209, 128, 255, 63, 69, 219, 41, 250, 232, 254, 185, 168, 85, 184, 136, 172],
120
+ // output index
121
+ 0
122
+ )
123
+
124
+ const transition = new wasm.IdentityTopUpTransitionWASM(assetLockProof, 'B7kcE1juMBWEWkuYRJhVdAE2e6RaevrGxRsa1DrLCpQH', 11)
125
+
126
+ transition.signature = Uint8Array.from([1, 1, 1])
127
+
128
+ assert.deepEqual(transition.signature, Uint8Array.from([1, 1, 1]))
129
+ })
130
+ })
131
+ })