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
package/docs/Enums.md ADDED
@@ -0,0 +1,103 @@
1
+ # Enums
2
+
3
+ `pshenmic-dpp` contains some enums, which also used in `rs-dpp`
4
+
5
+ Currently available enums:
6
+
7
+ - `BatchTypeWASM`
8
+ - `KeyTypeWASM`
9
+ - `PurposeWASM`
10
+ - `SecurityLevelWASM`
11
+ - `NetworkWASM`
12
+ - `PlatformVersionWASM`
13
+ - `AssetLockProofTypeWASM`
14
+ - `PoolingWASM`
15
+
16
+ Every enum can be passed in multiple formats:
17
+
18
+ - `KeyTypeWASM.ECDSA_SECP256K1`
19
+ - `'ECDSA_SECP256K1'`
20
+ - `'ecdsa_secp256k1'`
21
+ - `KeyTypeWASM[0]`
22
+ - `0`
23
+
24
+ ___
25
+
26
+ ## Enums Values
27
+
28
+ ### `BatchTypeWASM`
29
+
30
+ - `Create`
31
+ - `Replace`
32
+ - `Delete`
33
+ - `Transfer`
34
+ - `Purchase`
35
+ - `UpdatePrice`
36
+
37
+ ___
38
+
39
+ ### `KeyTypeWASM`
40
+
41
+ - `ECDSA_SECP256K1`
42
+ - `BLS12_381`
43
+ - `ECDSA_HASH160`
44
+ - `BIP13_SCRIPT_HASH`
45
+ - `EDDSA_25519_HASH160`
46
+
47
+ ___
48
+
49
+ ### `PurposeWASM`
50
+
51
+ - `AUTHENTICATION`
52
+ - `ENCRYPTION`
53
+ - `DECRYPTION`
54
+ - `TRANSFER`
55
+ - `SYSTEM`
56
+ - `VOTING`
57
+ - `OWNER`
58
+
59
+ ___
60
+
61
+ ### `SecurityLevelWASM`
62
+
63
+ - `MASTER`
64
+ - `CRITICAL`
65
+ - `HIGH`
66
+ - `MEDIUM`
67
+
68
+ ___
69
+
70
+ ### `NetworkWASM`
71
+
72
+ - `Mainnet`
73
+ - `Testnet`
74
+ - `Devnet`
75
+ - `Regtest`
76
+
77
+ ___
78
+
79
+ ### `PlatformVersionWASM`
80
+
81
+ - `PLATFORM_V1`
82
+ - `PLATFORM_V2`
83
+ - `PLATFORM_V3`
84
+ - `PLATFORM_V4`
85
+ - `PLATFORM_V5`
86
+ - `PLATFORM_V6`
87
+ - `PLATFORM_V7`
88
+ - `PLATFORM_V8`
89
+
90
+ ___
91
+
92
+ ### `AssetLockProofTypeWASM`
93
+
94
+ - `Chain`
95
+ - `Instant`
96
+
97
+ ___
98
+
99
+ ### `PoolingWASM`
100
+
101
+ - `Never`
102
+ - `IfAvailable`
103
+ - `Standard`
package/docs/Home.md ADDED
@@ -0,0 +1,28 @@
1
+ # Welcome to the pshenmic-dpp wiki!
2
+
3
+ pshenmic-dpp is a JavaScript module that provides lightweight bindings for rs-dpp, enabling the use of the Dash Platform
4
+ Protocol in any web application or service.
5
+
6
+ A key feature of this module is that if you only need a small part of it,
7
+ you don't have to include all the bindings — you can manually [build](./Building) the module by editing only `lib.rs`, pulling in just
8
+ the components you need along with their minimal dependencies. The module also preserves the structure of rs-dpp as much
9
+ as possible.
10
+
11
+ ## Basic Usage
12
+ ```js
13
+ const wasm = require('path/to/pshenmic_dpp.js')
14
+ const { default: wasmBytes } = require('path/to/pshenmic_dpp_bg.js')
15
+
16
+ const binaryString = atob(wasmBytes)
17
+ const bytes = new Uint8Array(binaryString.length)
18
+ for (let i = 0; i < binaryString.length; i++) {
19
+ bytes[i] = binaryString.charCodeAt(i)
20
+ }
21
+
22
+ wasm.initSync({ module: bytes.buffer })
23
+
24
+ const identifier = wasm.IdentifierWASM.fromBase58('ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U')
25
+
26
+ // Output: 'ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U'
27
+ console.log(identifier.base58())
28
+ ```
@@ -0,0 +1,37 @@
1
+ # IdentifierWASM
2
+
3
+ This class allows to store identifiers.
4
+
5
+ Can be created via constructor from:
6
+ - `base58`
7
+ - `IdentifierWASM`
8
+ - `ArrayLike`
9
+
10
+ This class also allows to create `IdentifierWASM` via static methods:
11
+ - `fromBase58("...")`
12
+ - `fromBase64("...")`
13
+ - `fromHex("...")`
14
+ - `fromBytes([...])`
15
+
16
+ Allow to get Identifier in multiple formats by these methods:
17
+ - `base58() -> String`
18
+ - `base64() -> String`
19
+ - `hex() -> String`
20
+ - `bytes() -> Uint8Array`
21
+
22
+ Usage:
23
+ ```js
24
+ const identifier = IdentifierWASM.fromBase58('ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U')
25
+
26
+ // Output: 'ckBqfQe7LU7vwrwXopyCB4n5phZShjA16BGhNGpsD5U'
27
+ console.log(identifier.base58())
28
+
29
+ // Output: 'CSgo7cCB07oaVPBDJZuUE2jyxxiIGwap00eIOyG/4xM='
30
+ console.log(identifier.base64())
31
+
32
+ // Output: '092828edc081d3ba1a54f043259b941368f2c718881b06a9d347883b21bfe313'
33
+ console.log(identifier.hex())
34
+
35
+ // Output: Uint8Array <...>
36
+ console.log(identifier.bytes())
37
+ ```
@@ -0,0 +1,140 @@
1
+ # IdentityWASM
2
+
3
+ This class allows to create Identity instance and interact
4
+
5
+ You can create `IdentityWASM` via constructor and bytes
6
+
7
+ Arguments:
8
+
9
+ - `identifier -> IdentifierWASM | String | ArrayLike`
10
+
11
+ If you want to create Document from bytes,
12
+ you need to use serialized to bytes Document from `rs-dpp` or `pshenmic-dpp`
13
+
14
+ ___
15
+
16
+ ## Navigation
17
+
18
+ - [Example](#example)
19
+ - [Getters methods](#getters-methods)
20
+ - [getId](#getid)
21
+ - [getBalance](#getbalance)
22
+ - [getRevision](#getrevision)
23
+ - [getPublicKeyById](#getpublickeybyid)
24
+ - [getPublicKeys](#getpublickeys)
25
+ - [Setters methods](#setters-methods)
26
+ - [setId](#setid)
27
+ - [setBalance](#setbalance)
28
+ - [setRevision](#setrevision)
29
+ - [addPublicKey](#addpublickey)
30
+
31
+ ___
32
+
33
+ ## Example
34
+
35
+ ```js
36
+ const identity = new IdentityWASM('H2pb35GtKpjLinncBYeMsXkdDYXCbsFzzVmssce6pSJ1')
37
+ ```
38
+
39
+ ___
40
+
41
+ ## Getters methods
42
+
43
+ ### `getId`
44
+
45
+ Returns Identity identifier in `IdentifierWASM`
46
+
47
+ ```js
48
+ identityInstance.getId() // -> IdentifierWASM
49
+ ```
50
+
51
+ ___
52
+
53
+ ### `getBalance`
54
+
55
+ Returns Identity balance in `BigInt`
56
+
57
+ ```js
58
+ identityInstance.getBalance() // -> BigInt
59
+ ```
60
+
61
+ ___
62
+
63
+ ### `getRevision`
64
+
65
+ Returns Identity revision in `BigInt`
66
+
67
+ ```js
68
+ identityInstance.getRevision() // -> BigInt
69
+ ```
70
+
71
+ ___
72
+
73
+ ### `getPublicKeyById`
74
+
75
+ Returns Identity public key with selected id in `IdentityPublicKeyWASM`
76
+
77
+ ```js
78
+ identityInstance.getPublicKeyById(1) // -> IdentityPublicKeyWASM
79
+ ```
80
+
81
+ ___
82
+
83
+ ### `getPublicKeys`
84
+
85
+ Returns Identity all public keys in `[IdentityPublicKeyWASM]`
86
+
87
+ ```js
88
+ identityInstance.getPublicKeys() // -> [IdentityPublicKeyWASM]
89
+ ```
90
+
91
+ ___
92
+
93
+ ## Setters methods
94
+
95
+ ### `setId`
96
+
97
+ Allows to set Identity identifier in `IdentifierWASM | String | ArrayLike`
98
+
99
+ ```js
100
+ identityInstance.getId('GgZekwh38XcWQTyWWWvmw6CEYFnLU7yiZFPWZEjqKHit')
101
+ ```
102
+
103
+ ___
104
+
105
+ ### `setBalance`
106
+
107
+ Allows to set Identity balance in `BigInt`
108
+
109
+ ```js
110
+ identityInstance.setBalance(BigInt(1))
111
+ ```
112
+
113
+ ___
114
+
115
+ ### `setRevision`
116
+
117
+ Allows to set Identity revision in `BigInt`
118
+
119
+ ```js
120
+ identityInstance.setRevision(BigInt(21))
121
+ ```
122
+
123
+ ___
124
+
125
+ ### `addPublicKey`
126
+
127
+ Allows to add Identity public key with selected id in `IdentityPublicKeyWASM`
128
+
129
+ ```js
130
+ const publicKey = new IdentityPublicKeyWASM(
131
+ 2,
132
+ 'AUTHENTICATION',
133
+ 'CRITICAL',
134
+ 'ECDSA_SECP256K1',
135
+ false,
136
+ '036a394312e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
137
+ )
138
+
139
+ identityInstance.addPublicKey(publicKey)
140
+ ```
@@ -0,0 +1,155 @@
1
+ # IdentityCreateTransitionWASM
2
+
3
+ This class allows to create instance of IdentityCreateTransition struct
4
+
5
+ `IdentityCreateTransitionWASM` can be created via constructor, `default()`, bytes and state transition
6
+
7
+ Constructor params:
8
+
9
+ - `publicKeys -> [IdentityPublicKeyInCreationWASM]`
10
+ - `assetLock -> AssetLockProofWASM`
11
+ - `userFeeIncrease -> Number`
12
+ - `signature -> ?ArrayLike`
13
+ - `identityId -> IdentifierWASM | String | ArrayLike`
14
+
15
+ ___
16
+
17
+ ## Navigation
18
+
19
+ - [Example](#Example)
20
+ - [Fields](#fields)
21
+ - [userFeeIncrease](#userfeeincrease)
22
+ - [assetLock](#assetlock)
23
+ - [Getters](#getters)
24
+ - [getSignableBytes](#getsignablebytes)
25
+ - [toBytes](#tobytes)
26
+ - [toStateTransition](#tostatetransition)
27
+
28
+ ___
29
+
30
+ ### Example
31
+
32
+ ```js
33
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
34
+ // or
35
+ 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]
36
+ const transition = wasm.IdentityCreateTransitionWASM.fromBytes(bytes)
37
+ ```
38
+
39
+ ___
40
+
41
+ ## Fields
42
+
43
+ All fields are readable and writable.
44
+
45
+ ### `userFeeIncrease`
46
+
47
+ Contains userFeeIncrease in `Number`
48
+
49
+ ```js
50
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
51
+
52
+ transition.userFeeIncrease = 99
53
+
54
+ transition.userFeeIncrease // -> Number
55
+ ```
56
+
57
+ ___
58
+
59
+ ### `assetLock`
60
+
61
+ Contains asset lock proof in `AssetLockProofWASM`
62
+
63
+ ```js
64
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
65
+
66
+ const anotherAssetLockProof = wasm.AssetLockProofWASM.createInstantAssetLockProof(
67
+ // instant lock
68
+ [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],
69
+ // transaction
70
+ [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],
71
+ // output index
72
+ 0
73
+ )
74
+
75
+ transition.assetLockProof = anotherAssetLockProof
76
+
77
+ transition.assetLockProof // -> AssetLockProofWASM
78
+ ```
79
+
80
+ ___
81
+
82
+ ### `publicKeys`
83
+
84
+ Contains public keys in `[IdentityPublicKeyInCreationWASM]`
85
+
86
+ ```js
87
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
88
+
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
+ transition.publicKeys = [publicKeyInCreation]
100
+
101
+ transition.publicKeys // -> [IdentityPublicKeyInCreationWASM]
102
+ ```
103
+
104
+ ___
105
+
106
+ ## Getters
107
+
108
+ ### `getSignableBytes`
109
+
110
+ Returns bytes for sign in `Uint8Array`
111
+
112
+ ```js
113
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
114
+
115
+ transition.getSignableBytes() // -> Uint8Array
116
+
117
+ ```
118
+
119
+ ___
120
+
121
+ ### `toBytes`
122
+
123
+ Returns transition in `Uint8Array`
124
+
125
+ ```js
126
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
127
+
128
+ transition.toBytes() // -> Uint8Array
129
+
130
+ ```
131
+
132
+ ___
133
+
134
+ ### `toStateTransition`
135
+
136
+ Returns `StateTransitionWASM`
137
+
138
+ ```js
139
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
140
+
141
+ transition.toStateTransition() // -> StateTransitionWASM
142
+
143
+ ```
144
+
145
+ ___
146
+
147
+ ### `getIdentifier`
148
+
149
+ Allows to get identity Identifier in `IdentifierWASM`
150
+
151
+ ```js
152
+ const transition = wasm.IdentityCreateTransitionWASM.default(0)
153
+
154
+ transition.getIdentifier() // -> IdentifierWASM
155
+ ```
@@ -0,0 +1,187 @@
1
+ # IdentityCreditTransferWASM
2
+
3
+ This class allows to create instance of IdentityCreditTransfer struct
4
+
5
+ `IdentityCreditTransferWASM` can be created via constructor, bytes and state transition
6
+
7
+ Constructor params:
8
+
9
+ - `amount -> BigInt`
10
+ - `sender -> IdentifierWASM | String | ArrayLike`
11
+ - `recipient -> IdentifierWASM | String | ArrayLike`
12
+ - `nonce -> BigInt`
13
+ - `platformVersion -> ?PlatformVersionEnum`
14
+
15
+ ___
16
+
17
+ ## Navigation
18
+
19
+ - [Example](#Example)
20
+ - [Fields](#fields)
21
+ - [userFeeIncrease](#userfeeincrease)
22
+ - [senderId](#senderid)
23
+ - [recipientId](#recipientid)
24
+ - [amount](#amount)
25
+ - [nonce](#nonce)
26
+ - [signature](#signature)
27
+ - [signaturePublicKeyId](#signaturepublickeyid)
28
+ - [Getters](#getters)
29
+ - [getSignableBytes](#getsignablebytes)
30
+ - [toBytes](#tobytes)
31
+ - [toStateTransition](#tostatetransition)
32
+
33
+ ___
34
+
35
+ ### Example
36
+
37
+ ```js
38
+ const transition = new wasm.IdentityCreditTransferWASM(
39
+ BigInt(100),
40
+ '11111111111111111111111111111111',
41
+ 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec',
42
+ BigInt(199)
43
+ )
44
+ ```
45
+
46
+ ___
47
+
48
+ ## Fields
49
+
50
+ All fields are readable and writable.
51
+
52
+ ### `userFeeIncrease`
53
+
54
+ Contains userFeeIncrease in `Number`
55
+
56
+ ```js
57
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
58
+
59
+ transition.userFeeIncrease = 99
60
+
61
+ transition.userFeeIncrease // -> Number
62
+ ```
63
+
64
+ ___
65
+
66
+ ### `senderId`
67
+
68
+ Contains sender identifier in `IdentifierWASM`
69
+
70
+ ```js
71
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
72
+
73
+ transition.senderId = '12FRq8L3VuBEQfCAZykmUaiXXrsd1Bwub2gcaMmtNbn3'
74
+
75
+ transition.senderId // -> IdentifierWASM
76
+ ```
77
+
78
+ ___
79
+
80
+ ### `recipientId`
81
+
82
+ Contains recipient identifier in `IdentifierWASM`
83
+
84
+ ```js
85
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
86
+
87
+ transition.recipientId = '12FRq8L3VuBEQfCAZykmUaiXXrsd1Bwub2gcaMmtNbn3'
88
+
89
+ transition.recipientId // -> IdentifierWASM
90
+ ```
91
+
92
+ ___
93
+
94
+ ### `amount`
95
+
96
+ Contains credits amount for transfer in `BigInt`
97
+
98
+ ```js
99
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
100
+
101
+ transition.amount = BigInt(999999999)
102
+
103
+ transition.amount // -> BigInt
104
+ ```
105
+
106
+ ___
107
+
108
+ ### `nonce`
109
+
110
+ Contains nonce in `BigInt`
111
+
112
+ ```js
113
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
114
+
115
+ transition.nonce = BigInt(999999999)
116
+
117
+ transition.nonce // -> BigInt
118
+ ```
119
+
120
+ ___
121
+
122
+ ### `signature`
123
+
124
+ Contains signature in `Uint8Array`
125
+
126
+ ```js
127
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
128
+
129
+ transition.signature = Uint8Array.from([1, 2, 3, 4, 5])
130
+
131
+ transition.signature // -> Uint8Array
132
+ ```
133
+
134
+ ___
135
+
136
+ ### `signaturePublicKeyId`
137
+
138
+ Contains signature public key id in `Number`
139
+
140
+ ```js
141
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
142
+
143
+ transition.signaturePublicKeyId = 12
144
+
145
+ transition.signaturePublicKeyId // -> Number
146
+ ```
147
+
148
+ ___
149
+
150
+ ## Getters
151
+
152
+ ### `getSignableBytes`
153
+
154
+ Returns bytes for sign in `Uint8Array`
155
+
156
+ ```js
157
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
158
+
159
+ transition.getSignableBytes() // -> Uint8Array
160
+
161
+ ```
162
+
163
+ ___
164
+
165
+ ### `toBytes`
166
+
167
+ Returns transition in `Uint8Array`
168
+
169
+ ```js
170
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
171
+
172
+ transition.toBytes() // -> Uint8Array
173
+
174
+ ```
175
+
176
+ ___
177
+
178
+ ### `toStateTransition`
179
+
180
+ Returns `StateTransitionWASM`
181
+
182
+ ```js
183
+ const transition = new wasm.IdentityCreditTransferWASM(BigInt(100), '11111111111111111111111111111111', 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', BigInt(199))
184
+
185
+ transition.toStateTransition() // -> StateTransitionWASM
186
+
187
+ ```