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.
- package/.github/workflows/build.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/Cargo.lock +147 -49
- package/Cargo.toml +13 -7
- package/README.md +10 -1
- package/dist/wasm/index.d.ts +52 -0
- package/dist/wasm/pshenmic_dpp.d.ts +962 -0
- package/dist/wasm/pshenmic_dpp.js +3342 -875
- package/dist/wasm/pshenmic_dpp_bg.js +1 -1
- package/dist/wasm/pshenmic_dpp_bg.wasm.d.ts +440 -0
- package/docs/AssetLockProof.md +107 -0
- package/docs/Building.md +50 -0
- package/docs/ChainLockProof.md +63 -0
- package/docs/CoreScript.md +17 -0
- package/docs/DataContract.md +192 -0
- package/docs/DataContractCreateTransition.md +84 -0
- package/docs/DataContractUpdateTransition.md +84 -0
- package/docs/Document.md +396 -0
- package/docs/DocumentBaseTransition.md +111 -0
- package/docs/DocumentCreateTransition.md +132 -0
- package/docs/DocumentDeleteTransition.md +82 -0
- package/docs/DocumentPurchaseTransition.md +109 -0
- package/docs/DocumentReplaceTransition.md +112 -0
- package/docs/DocumentTransferTransition.md +96 -0
- package/docs/DocumentTransition.md +125 -0
- package/docs/DocumentUpdatePriceTransition.md +109 -0
- package/docs/DocumentsBatch.md +133 -0
- package/docs/Enums.md +103 -0
- package/docs/Home.md +28 -0
- package/docs/Identifier.md +37 -0
- package/docs/Identity.md +140 -0
- package/docs/IdentityCreateTransition.md +155 -0
- package/docs/IdentityCreditTransfer.md +187 -0
- package/docs/IdentityCreditWithdrawalTransition.md +244 -0
- package/docs/IdentityPublicKey.md +348 -0
- package/docs/IdentityPublicKeyInCreation.md +141 -0
- package/docs/IdentityTopUpTransition.md +166 -0
- package/docs/IdentityUpdateTransition.md +234 -0
- package/docs/InstantAssetLockProof.md +117 -0
- package/docs/InstantLock.md +100 -0
- package/docs/OutPoint.md +80 -0
- package/docs/PrefundedVotingBalance.md +48 -0
- package/docs/PrivateKey.md +112 -0
- package/docs/TxOut.md +93 -0
- package/package.json +3 -3
- package/packages/asset_lock_proof/Cargo.toml +19 -0
- package/packages/asset_lock_proof/src/chain/mod.rs +79 -0
- package/packages/asset_lock_proof/src/instant/instant_lock.rs +111 -0
- package/packages/asset_lock_proof/src/instant/mod.rs +115 -0
- package/packages/asset_lock_proof/src/lib.rs +133 -0
- package/packages/asset_lock_proof/src/outpoint/mod.rs +79 -0
- package/packages/asset_lock_proof/src/tx_out/mod.rs +80 -0
- package/packages/cbor_conversation/Cargo.toml +1 -1
- package/packages/core_script/Cargo.toml +13 -0
- package/packages/core_script/src/lib.rs +69 -0
- package/packages/data_contract/Cargo.toml +2 -1
- package/packages/data_contract/src/lib.rs +34 -30
- package/packages/data_contract_transitions/Cargo.toml +1 -1
- package/packages/data_contract_transitions/src/create/mod.rs +3 -3
- package/packages/data_contract_transitions/src/update/mod.rs +3 -3
- package/packages/document/Cargo.toml +2 -1
- package/packages/document/src/lib.rs +13 -12
- package/packages/document/src/methods/mod.rs +41 -38
- package/packages/documents_batch/Cargo.toml +2 -1
- package/packages/documents_batch/src/document_base_transition/mod.rs +16 -20
- package/packages/documents_batch/src/document_transition/mod.rs +9 -9
- package/packages/documents_batch/src/lib.rs +23 -16
- package/packages/documents_batch/src/transitions/create/mod.rs +5 -2
- package/packages/documents_batch/src/transitions/transfer/mod.rs +9 -11
- package/packages/enums/Cargo.toml +1 -1
- package/packages/enums/src/batch/batch_enum.rs +2 -2
- package/packages/enums/src/lib.rs +2 -0
- package/packages/enums/src/lock_types/mod.rs +65 -0
- package/packages/enums/src/platform/mod.rs +2 -0
- package/packages/enums/src/withdrawal/mod.rs +72 -0
- package/packages/identifier/Cargo.toml +9 -0
- package/packages/identifier/src/lib.rs +105 -0
- package/packages/identity/Cargo.toml +2 -1
- package/packages/identity/src/lib.rs +13 -18
- package/packages/identity_public_key/Cargo.toml +1 -1
- package/packages/identity_transitions/Cargo.toml +7 -3
- package/packages/identity_transitions/src/create_transition/mod.rs +99 -36
- package/packages/identity_transitions/src/credit_withdrawal_transition/mod.rs +212 -0
- package/packages/identity_transitions/src/identity_credit_transfer_transition/mod.rs +169 -0
- package/packages/identity_transitions/src/lib.rs +6 -1
- package/packages/identity_transitions/src/{create_transition/public_key_in_creation → public_key_in_creation}/mod.rs +67 -20
- package/packages/identity_transitions/src/top_up_transition/mod.rs +141 -0
- package/packages/identity_transitions/src/update_transition/mod.rs +213 -0
- package/packages/private_key/Cargo.toml +1 -1
- package/packages/state_transition/Cargo.toml +2 -1
- package/packages/state_transition/src/lib.rs +3 -2
- package/packages/utils/Cargo.toml +2 -2
- package/packages/utils/src/lib.rs +0 -3
- package/scripts/build-js.sh +16 -0
- package/scripts/build.sh +5 -1
- package/src/lib.rs +1 -0
- package/tests/AssetLockProof.spec.js +80 -0
- package/tests/ChainLockProof.spec.js +69 -0
- package/tests/CoreScript.spec.js +37 -0
- package/tests/DataContract.spec.js +17 -14
- package/tests/Document.spec.js +14 -8
- package/tests/DocumentBatchTransition.spec.js +11 -11
- package/tests/DocumentTransition.spec.js +4 -4
- package/tests/DocumentsTransitions.spec.js +22 -22
- package/tests/Identifier.spec.js +84 -0
- package/tests/Identity.spec.js +1 -1
- package/tests/IdentityCreateTransition.spec.js +93 -0
- package/tests/IdentityCreditTransferTransition.spec.js +146 -0
- package/tests/IdentityCreditWithdrawalTransition.spec.js +192 -0
- package/tests/IdentityTopUpTransition.spec.js +131 -0
- package/tests/IdentityUpdateTransition.spec.js +147 -0
- package/tests/InstantLockProof.spec.js +97 -0
- package/tests/OutPoint.spec.js +55 -0
- package/tests/PublicKeyInCreation.spec.js +258 -0
- package/tests/TxOut.spec.js +76 -0
- package/tests/mocks/Locks/index.js +5 -0
- package/tests/mocks/PublicKey/index.js +1 -1
- package/typings/index.d.ts +52 -0
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
|
+
```
|
package/docs/Identity.md
ADDED
|
@@ -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
|
+
```
|