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.
- package/.github/workflows/build.yml +9 -1
- package/.github/workflows/publish.yml +9 -1
- package/Cargo.lock +222 -76
- package/Cargo.toml +28 -19
- package/README.md +75 -23
- package/babel.config.json +19 -0
- package/dist/wasm/index.d.ts +52 -0
- package/dist/wasm/pshenmic_dpp.d.ts +962 -0
- package/dist/wasm/pshenmic_dpp.js +5565 -966
- 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 +15 -8
- 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 +2 -2
- package/packages/core_script/Cargo.toml +13 -0
- package/packages/core_script/src/lib.rs +69 -0
- package/packages/data_contract/Cargo.toml +4 -3
- package/packages/data_contract/src/lib.rs +209 -33
- package/packages/data_contract_transitions/Cargo.toml +2 -2
- package/packages/data_contract_transitions/src/create/mod.rs +23 -16
- package/packages/data_contract_transitions/src/update/mod.rs +21 -12
- package/packages/document/Cargo.toml +3 -2
- package/packages/document/src/lib.rs +14 -13
- package/packages/document/src/methods/mod.rs +373 -2
- package/packages/{document_batch → documents_batch}/Cargo.toml +7 -4
- package/packages/documents_batch/src/document_base_transition/mod.rs +88 -0
- package/packages/documents_batch/src/document_transition/mod.rs +166 -0
- package/packages/documents_batch/src/generators.rs +122 -0
- package/packages/documents_batch/src/lib.rs +195 -0
- package/packages/documents_batch/src/prefunded_voting_balance/mod.rs +45 -0
- package/packages/documents_batch/src/transitions/create/mod.rs +126 -0
- package/packages/documents_batch/src/transitions/delete/mod.rs +67 -0
- package/packages/documents_batch/src/transitions/mod.rs +6 -0
- package/packages/documents_batch/src/transitions/purchase/mod.rs +91 -0
- package/packages/documents_batch/src/transitions/replace/mod.rs +93 -0
- package/packages/documents_batch/src/transitions/transfer/mod.rs +84 -0
- package/packages/documents_batch/src/transitions/update_price/mod.rs +75 -0
- package/packages/enums/Cargo.toml +4 -4
- package/packages/enums/src/batch/batch_enum.rs +75 -10
- package/packages/enums/src/keys/key_type.rs +46 -0
- package/packages/enums/src/keys/purpose.rs +55 -0
- package/packages/enums/src/keys/security_level.rs +46 -0
- package/packages/enums/src/lib.rs +3 -0
- package/packages/enums/src/lock_types/mod.rs +65 -0
- package/packages/enums/src/network/mod.rs +67 -0
- package/packages/enums/src/platform/mod.rs +68 -8
- 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 +5 -5
- package/packages/identity/src/lib.rs +31 -25
- package/packages/{public_key → identity_public_key}/Cargo.toml +2 -2
- package/packages/{public_key → identity_public_key}/src/lib.rs +74 -27
- package/packages/identity_transitions/Cargo.toml +8 -4
- package/packages/identity_transitions/src/create_transition/mod.rs +102 -37
- 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/public_key_in_creation/mod.rs +197 -0
- 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/mock_bls/Cargo.toml +1 -1
- package/packages/private_key/Cargo.toml +4 -3
- package/packages/private_key/src/lib.rs +44 -6
- package/packages/state_transition/Cargo.toml +6 -4
- package/packages/state_transition/src/lib.rs +102 -36
- package/packages/utils/Cargo.toml +3 -4
- package/packages/utils/src/lib.rs +17 -18
- package/scripts/build-js.sh +22 -5
- package/scripts/build.sh +27 -2
- package/src/lib.rs +8 -1
- 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 +178 -0
- package/tests/DataContractCreateStateTransition.spec.js +109 -0
- package/tests/DataContractUpdateStateTransition.spec.js +109 -0
- package/tests/Document.spec.js +238 -0
- package/tests/DocumentBatchTransition.spec.js +109 -0
- package/tests/DocumentTransition.spec.js +97 -0
- package/tests/DocumentsTransitions.spec.js +705 -0
- package/tests/Identifier.spec.js +84 -0
- package/tests/Identity.spec.js +113 -0
- package/tests/IdentityCreateTransition.spec.js +93 -0
- package/tests/IdentityCreditTransferTransition.spec.js +146 -0
- package/tests/IdentityCreditWithdrawalTransition.spec.js +192 -0
- package/tests/IdentityPublicKey.spec.js +132 -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/PrivateKey.spec.js +73 -0
- package/tests/PublicKeyInCreation.spec.js +258 -0
- package/tests/TxOut.spec.js +76 -0
- package/tests/mocks/DataContract/DataContract.json +153 -0
- package/tests/mocks/DataContract/index.js +6 -0
- package/tests/mocks/Document/DataContract.json +23 -0
- package/tests/mocks/Document/document.json +3 -0
- package/tests/mocks/Document/document2.json +3 -0
- package/tests/mocks/Document/index.js +11 -0
- package/tests/mocks/Identity/index.js +7 -0
- package/tests/mocks/Locks/index.js +5 -0
- package/tests/mocks/PrivateKey/index.js +5 -0
- package/tests/mocks/PublicKey/index.js +14 -0
- package/tests/utils/hex.js +15 -0
- package/tests/utils/wasm.js +14 -0
- package/typings/index.d.ts +52 -0
- package/packages/document/src/methods/js.rs +0 -260
- package/packages/document/src/methods/rust.rs +0 -92
- package/packages/document_batch/src/generators.rs +0 -63
- package/packages/document_batch/src/lib.rs +0 -228
- package/packages/identity_transitions/src/create_transition/public_key_in_creation/mod.rs +0 -146
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# DocumentPurchaseTransitionWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create DocumentPurchaseTransition and interact
|
|
4
|
+
|
|
5
|
+
`DocumentPurchaseTransitionWASM` can be created via constructor and document transition `fromDocumentTransition()`
|
|
6
|
+
|
|
7
|
+
Constructor arguments:
|
|
8
|
+
|
|
9
|
+
- `document -> DocumentWASM`
|
|
10
|
+
- `identityContractNonce -> BigInt`
|
|
11
|
+
- `documentTypeName -> String`
|
|
12
|
+
- `price -> BigInt`
|
|
13
|
+
|
|
14
|
+
___
|
|
15
|
+
|
|
16
|
+
## Navigation
|
|
17
|
+
|
|
18
|
+
- [Example](#example)
|
|
19
|
+
- [Fields](#fields)
|
|
20
|
+
- [base](#base)
|
|
21
|
+
- [price](#price)
|
|
22
|
+
- [revision](#revision)
|
|
23
|
+
- [Getters methods](#getters-methods)
|
|
24
|
+
- [toDocumentTransition](#todocumenttransition)
|
|
25
|
+
|
|
26
|
+
___
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
32
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
33
|
+
|
|
34
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
35
|
+
|
|
36
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
37
|
+
|
|
38
|
+
const purchaseTransition = new DocumentPurchaseTransitionWASM(documentInstance, BigInt(1), 'preorder', BigInt(100))
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
___
|
|
42
|
+
|
|
43
|
+
## Fields
|
|
44
|
+
|
|
45
|
+
All fields are readable and writable.
|
|
46
|
+
|
|
47
|
+
### `base`
|
|
48
|
+
|
|
49
|
+
Contains document base transition `DocumentBaseTransitionWASM`
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const purchaseTransition = new DocumentPurchaseTransitionWASM(documentInstance, BigInt(1), 'preorder', BigInt(100))
|
|
53
|
+
|
|
54
|
+
const base = new DocumentBaseTransitionWASM(
|
|
55
|
+
'9tSsCqKHTZ8ro16MydChSxgHBukFW36eMLJKKRtebJEn',
|
|
56
|
+
BigInt(12350),
|
|
57
|
+
'note',
|
|
58
|
+
'CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i'
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
purchaseTransition.base // -> DocumentBaseTransitionWASM
|
|
62
|
+
|
|
63
|
+
purchaseTransition.base = base
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
___
|
|
67
|
+
|
|
68
|
+
### `price`
|
|
69
|
+
|
|
70
|
+
Contains price for purchase in `BigInt`
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
purchaseTransition.price // -> BigInt
|
|
74
|
+
|
|
75
|
+
purchaseTransition.price = BigInt(213)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
___
|
|
79
|
+
|
|
80
|
+
### `revision`
|
|
81
|
+
|
|
82
|
+
Contains document revision in `BigInt`
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
purchaseTransition.revision // -> BigInt
|
|
86
|
+
|
|
87
|
+
purchaseTransition.revision = BigInt(213)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
___
|
|
91
|
+
|
|
92
|
+
## Getters methods
|
|
93
|
+
|
|
94
|
+
### `toDocumentTransition`
|
|
95
|
+
|
|
96
|
+
Returns document create transition in `DocumentCreateTransitionWASM`
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
100
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
101
|
+
|
|
102
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
103
|
+
|
|
104
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
105
|
+
|
|
106
|
+
const purchaseTransition = new DocumentPurchaseTransitionWASM(documentInstance, BigInt(1), 'preorder', BigInt(100))
|
|
107
|
+
|
|
108
|
+
purchaseTransition.toDocumentTransition() // -> DocumentTransitionWASM
|
|
109
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# DocumentReplaceTransitionWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create DocumentReplaceTransition and interact
|
|
4
|
+
|
|
5
|
+
`DocumentReplaceTransitionWASM` can be created via constructor and document transition `fromDocumentTransition()`
|
|
6
|
+
|
|
7
|
+
Constructor arguments:
|
|
8
|
+
|
|
9
|
+
- `document -> DocumentWASM`
|
|
10
|
+
- `identityContractNonce -> BigInt`
|
|
11
|
+
- `documentTypeName -> String`
|
|
12
|
+
|
|
13
|
+
___
|
|
14
|
+
|
|
15
|
+
## Navigation
|
|
16
|
+
|
|
17
|
+
- [Example](#example)
|
|
18
|
+
- [Fields](#fields)
|
|
19
|
+
- [base](#base)
|
|
20
|
+
- [data](#data)
|
|
21
|
+
- [revision](#revision)
|
|
22
|
+
- [Getters methods](#getters-methods)
|
|
23
|
+
- [toDocumentTransition](#todocumenttransition)
|
|
24
|
+
|
|
25
|
+
___
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
31
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
32
|
+
|
|
33
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
34
|
+
|
|
35
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
36
|
+
|
|
37
|
+
const replaceTransition = new DocumentReplaceTransitionWASM(documentInstance, BigInt(1), 'preorder')
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
___
|
|
41
|
+
|
|
42
|
+
## Fields
|
|
43
|
+
|
|
44
|
+
All fields are readable and writable.
|
|
45
|
+
|
|
46
|
+
### `base`
|
|
47
|
+
|
|
48
|
+
Contains document base transition `DocumentBaseTransitionWASM`
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
const replaceTransition = new DocumentReplaceTransitionWASM(documentInstance, BigInt(1), 'preorder')
|
|
52
|
+
|
|
53
|
+
const base = new DocumentBaseTransitionWASM(
|
|
54
|
+
'9tSsCqKHTZ8ro16MydChSxgHBukFW36eMLJKKRtebJEn',
|
|
55
|
+
BigInt(12350),
|
|
56
|
+
'note',
|
|
57
|
+
'CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i'
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
replaceTransition.base // -> DocumentBaseTransitionWASM
|
|
61
|
+
|
|
62
|
+
replaceTransition.base = base
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
___
|
|
66
|
+
|
|
67
|
+
### `data`
|
|
68
|
+
|
|
69
|
+
Contains document data in `Object`
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
const replaceTransition = new DocumentReplaceTransitionWASM(documentInstance, BigInt(1), 'preorder')
|
|
73
|
+
|
|
74
|
+
replaceTransition.data // -> Object
|
|
75
|
+
|
|
76
|
+
replaceTransition.data = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
___
|
|
80
|
+
|
|
81
|
+
### `revision`
|
|
82
|
+
|
|
83
|
+
Contains document revision in `BigInt`
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
const replaceTransition = new DocumentReplaceTransitionWASM(documentInstance, BigInt(1), 'preorder')
|
|
87
|
+
|
|
88
|
+
replaceTransition.revision // -> BigInt
|
|
89
|
+
|
|
90
|
+
replaceTransition.revision = BigInt(213)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
___
|
|
94
|
+
|
|
95
|
+
## Getters methods
|
|
96
|
+
|
|
97
|
+
### `toDocumentTransition`
|
|
98
|
+
|
|
99
|
+
Returns document create transition in `DocumentCreateTransitionWASM`
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
103
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
104
|
+
|
|
105
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
106
|
+
|
|
107
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
108
|
+
|
|
109
|
+
const deleteTransition = new DocumentDeleteTransitionWASM(documentInstance, BigInt(1), 'preorder')
|
|
110
|
+
|
|
111
|
+
deleteTransition.toDocumentTransition() // -> DocumentTransitionWASM
|
|
112
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# DocumentTransferTransitionWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create DocumentTransferTransition and interact
|
|
4
|
+
|
|
5
|
+
`DocumentTransferTransitionWASM` can be created via constructor and document transition `fromDocumentTransition()`
|
|
6
|
+
|
|
7
|
+
Constructor arguments:
|
|
8
|
+
|
|
9
|
+
- `document -> DocumentWASM`
|
|
10
|
+
- `identityContractNonce -> BigInt`
|
|
11
|
+
- `documentTypeName -> String`
|
|
12
|
+
- `recipientId -> IdentifierWASM | String | ArrayLike`
|
|
13
|
+
___
|
|
14
|
+
|
|
15
|
+
## Navigation
|
|
16
|
+
|
|
17
|
+
- [Example](#example)
|
|
18
|
+
- [Fields](#fields)
|
|
19
|
+
- [base](#base)
|
|
20
|
+
- [recipientId](#recipientid)
|
|
21
|
+
- [Getters methods](#getters-methods)
|
|
22
|
+
- [toDocumentTransition](#todocumenttransition)
|
|
23
|
+
|
|
24
|
+
___
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
30
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
31
|
+
const recipientIdentifier = new IdentifierWASM('HzHXSQcBkU9Ve5YAxhGd8NgA72xFcG9nCZKKxhayn1NW')
|
|
32
|
+
|
|
33
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
34
|
+
|
|
35
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
36
|
+
|
|
37
|
+
const transferTransition = new DocumentTransferTransitionWASM(documentInstance, BigInt(1), 'preorder', recipientIdentifier)
|
|
38
|
+
```
|
|
39
|
+
___
|
|
40
|
+
## Fields
|
|
41
|
+
All fields are readable and writable.
|
|
42
|
+
|
|
43
|
+
### `base`
|
|
44
|
+
|
|
45
|
+
Contains document base transition `DocumentBaseTransitionWASM`
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
const transferTransition = new DocumentTransferTransitionWASM(documentInstance, BigInt(1), 'preorder', recipientIdentifier)
|
|
49
|
+
|
|
50
|
+
const base = new DocumentBaseTransitionWASM(
|
|
51
|
+
'9tSsCqKHTZ8ro16MydChSxgHBukFW36eMLJKKRtebJEn',
|
|
52
|
+
BigInt(12350),
|
|
53
|
+
'note',
|
|
54
|
+
'CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i'
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
transferTransition.base // -> DocumentBaseTransitionWASM
|
|
58
|
+
|
|
59
|
+
transferTransition.base = base
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
___
|
|
63
|
+
|
|
64
|
+
### `recipientId`
|
|
65
|
+
|
|
66
|
+
Contains recipient identifier in `IdentifierWASM`
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
const transferTransition = new DocumentTransferTransitionWASM(documentInstance, BigInt(1), 'preorder', recipientIdentifier)
|
|
70
|
+
|
|
71
|
+
transferTransition.recipientId // -> IdentifierWASM
|
|
72
|
+
|
|
73
|
+
transferTransition.recipientId = 'CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i'
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
___
|
|
77
|
+
|
|
78
|
+
## Getters methods
|
|
79
|
+
|
|
80
|
+
### `toDocumentTransition`
|
|
81
|
+
|
|
82
|
+
Returns document create transition in `DocumentCreateTransitionWASM`
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
86
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
87
|
+
const recipientIdentifier = new IdentifierWASM('HzHXSQcBkU9Ve5YAxhGd8NgA72xFcG9nCZKKxhayn1NW')
|
|
88
|
+
|
|
89
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
90
|
+
|
|
91
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
92
|
+
|
|
93
|
+
const transferTransition = new DocumentTransferTransitionWASM(documentInstance, BigInt(1), 'preorder', recipientIdentifier)
|
|
94
|
+
|
|
95
|
+
transferTransition.toDocumentTransition() // -> DocumentTransitionWASM
|
|
96
|
+
```
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# DocumentTransitionWASM
|
|
2
|
+
|
|
3
|
+
This class allows to crate DocumentTransitions and interact
|
|
4
|
+
|
|
5
|
+
`DocumentTransitionWASM` can't be created via constructor
|
|
6
|
+
or any other methods for deserialization
|
|
7
|
+
|
|
8
|
+
Instance of `DocumentTransitionWASM` can be returned from getters
|
|
9
|
+
of other instances, like `DocumentBatchWASM` or any DocumentTransition
|
|
10
|
+
___
|
|
11
|
+
|
|
12
|
+
## Navigation
|
|
13
|
+
|
|
14
|
+
- [Fields](#fields)
|
|
15
|
+
- [actionType](#actiontype)
|
|
16
|
+
- [dataContractId](#datacontractid)
|
|
17
|
+
- [revision](#revision)
|
|
18
|
+
- [identityContractNonce](#identitycontractnonce)
|
|
19
|
+
- [id](#id)
|
|
20
|
+
- [documentTypeName](#documenttypename)
|
|
21
|
+
- [entropy](#entropy)
|
|
22
|
+
- [Transition conversions](#transition-conversions)
|
|
23
|
+
|
|
24
|
+
___
|
|
25
|
+
|
|
26
|
+
## Fields
|
|
27
|
+
|
|
28
|
+
All fields are read-only, exception: `dataContractId`, `revision`, `identityContractNonce`
|
|
29
|
+
|
|
30
|
+
### `actionType`
|
|
31
|
+
|
|
32
|
+
Contains action `String` from `BatchTypeEnum`
|
|
33
|
+
|
|
34
|
+
````js
|
|
35
|
+
transitionInstance.actionType // -> String
|
|
36
|
+
````
|
|
37
|
+
|
|
38
|
+
___
|
|
39
|
+
|
|
40
|
+
### `dataContractId`
|
|
41
|
+
|
|
42
|
+
Contains DataContract identifier in `IdentifierWASM`
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
transitionInstance.dataContractId // -> IdentifierWASM
|
|
46
|
+
|
|
47
|
+
transitionInstance.dataContractId = 'GgZekwh38XcWQTyWWWvmw6CEYFnLU7yiZFPWZEjqKHit'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
___
|
|
51
|
+
|
|
52
|
+
### `revision`
|
|
53
|
+
|
|
54
|
+
Contains revision in `BigInt`
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
transitionInstance.revision // -> BigInt
|
|
58
|
+
|
|
59
|
+
transitionInstance.revision = BigInt(1)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
___
|
|
63
|
+
|
|
64
|
+
### `identityContractNonce`
|
|
65
|
+
|
|
66
|
+
Contains identity contract nonce in `BigInt`
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
transitionInstance.identityContractNonce // -> BigInt
|
|
70
|
+
|
|
71
|
+
transitionInstance.identityContractNonce = BigInt(12)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
___
|
|
75
|
+
|
|
76
|
+
### `id`
|
|
77
|
+
|
|
78
|
+
Contains document identity in `IdentifierWASM`
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
transitionInstance.id // -> IdentifierWASM
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
___
|
|
85
|
+
|
|
86
|
+
### `documentTypeName`
|
|
87
|
+
|
|
88
|
+
Contains document type name in `String`
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
transitionInstance.documentTypeName // -> String
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
___
|
|
95
|
+
|
|
96
|
+
### `entropy`
|
|
97
|
+
|
|
98
|
+
Contains entropy in `Uint8Array` for transition with entropy
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
transitionInstance.entropy // -> Uint8Array
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
___
|
|
105
|
+
|
|
106
|
+
### Transition conversions
|
|
107
|
+
|
|
108
|
+
Every DocumentTransition contains one of available Document Transition.
|
|
109
|
+
You can get one of they by these fields:
|
|
110
|
+
|
|
111
|
+
- `createTransition`
|
|
112
|
+
- `replaceTransition`
|
|
113
|
+
- `deleteTransition`
|
|
114
|
+
- `purchaseTransition`
|
|
115
|
+
- `transferTransition`
|
|
116
|
+
- `updatePriceTransition`
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
transitionInstance.createTransition // -> DocumentCreateTransitionWASM
|
|
120
|
+
transitionInstance.replaceTransition // -> DocumentReplaceTransitionWASM
|
|
121
|
+
transitionInstance.deleteTransition // -> DocumentDeleteTransitionWASM
|
|
122
|
+
transitionInstance.purchaseTransition // -> DocumentPurchaseTransitionWASM
|
|
123
|
+
transitionInstance.transferTransition // -> DocumentTransferTransitionWASM
|
|
124
|
+
transitionInstance.updatePriceTransition // -> DocumentUpdatePriceTransitionWASM
|
|
125
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# DocumentUpdatePriceTransitionWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create DocumentUpdatePriceTransition and interact
|
|
4
|
+
|
|
5
|
+
`DocumentUpdatePriceTransitionWASM` can be created via constructor and document transition `fromDocumentTransition()`
|
|
6
|
+
|
|
7
|
+
Constructor arguments:
|
|
8
|
+
|
|
9
|
+
- `document -> DocumentWASM`
|
|
10
|
+
- `identityContractNonce -> BigInt`
|
|
11
|
+
- `documentTypeName -> String`
|
|
12
|
+
- `price -> BigInt`
|
|
13
|
+
|
|
14
|
+
___
|
|
15
|
+
|
|
16
|
+
## Navigation
|
|
17
|
+
|
|
18
|
+
- [Example](#example)
|
|
19
|
+
- [Fields](#fields)
|
|
20
|
+
- [base](#base)
|
|
21
|
+
- [price](#price)
|
|
22
|
+
- [revision](#revision)
|
|
23
|
+
- [Getters methods](#getters-methods)
|
|
24
|
+
- [toDocumentTransition](#todocumenttransition)
|
|
25
|
+
|
|
26
|
+
___
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
32
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
33
|
+
|
|
34
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
35
|
+
|
|
36
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
37
|
+
|
|
38
|
+
const updatePriceTransition = new DocumentUpdatePriceTransitionWASM(documentInstance, BigInt(1), 'preorder', BigInt(100))
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
___
|
|
42
|
+
|
|
43
|
+
## Fields
|
|
44
|
+
|
|
45
|
+
All fields are readable and writable.
|
|
46
|
+
|
|
47
|
+
### `base`
|
|
48
|
+
|
|
49
|
+
Contains document base transition `DocumentBaseTransitionWASM`
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const updatePriceTransition = new DocumentUpdatePriceTransitionWASM(documentInstance, BigInt(1), 'preorder', BigInt(100))
|
|
53
|
+
|
|
54
|
+
const base = new DocumentBaseTransitionWASM(
|
|
55
|
+
'9tSsCqKHTZ8ro16MydChSxgHBukFW36eMLJKKRtebJEn',
|
|
56
|
+
BigInt(12350),
|
|
57
|
+
'note',
|
|
58
|
+
'CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i'
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
updatePriceTransition.base // -> DocumentBaseTransitionWASM
|
|
62
|
+
|
|
63
|
+
updatePriceTransition.base = base
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
___
|
|
67
|
+
|
|
68
|
+
### `price`
|
|
69
|
+
|
|
70
|
+
Contains price for purchase in `BigInt`
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
updatePriceTransition.price // -> BigInt
|
|
74
|
+
|
|
75
|
+
updatePriceTransition.price = BigInt(213)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
___
|
|
79
|
+
|
|
80
|
+
### `revision`
|
|
81
|
+
|
|
82
|
+
Contains document revision in `BigInt`
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
updatePriceTransition.revision // -> BigInt
|
|
86
|
+
|
|
87
|
+
updatePriceTransition.revision = BigInt(213)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
___
|
|
91
|
+
|
|
92
|
+
## Getters methods
|
|
93
|
+
|
|
94
|
+
### `toDocumentTransition`
|
|
95
|
+
|
|
96
|
+
Returns document create transition in `DocumentCreateTransitionWASM`
|
|
97
|
+
|
|
98
|
+
```js
|
|
99
|
+
const dataContractIdentifier = new IdentifierWASM('GnXgMaiqAwTxh44ccQe8AoCgFvcseHK5CncH3sUorW4X')
|
|
100
|
+
const ownerIdentifier = new IdentifierWASM('CXH2kZCATjvDTnQAPVg28EgPg9WySUvwvnR5ZkmNqY5i')
|
|
101
|
+
|
|
102
|
+
const properties = {"message": "Tutorial CI Test @ Tue, 07 Jan 2025 15:27:50 GMT"}
|
|
103
|
+
|
|
104
|
+
const documentInstance = new DocumentWASM(properties, "note", BigInt(1), dataContractIdentifier, ownerIdentifier)
|
|
105
|
+
|
|
106
|
+
const updatePriceTransition = new DocumentUpdatePriceTransitionWASM(documentInstance, BigInt(1), 'preorder', BigInt(100))
|
|
107
|
+
|
|
108
|
+
updatePriceTransition.toDocumentTransition() // -> DocumentTransitionWASM
|
|
109
|
+
```
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# DocumentsBatchWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create DocumentBatch from transitions and interact
|
|
4
|
+
|
|
5
|
+
`DocumentsBatchWASM` can be created from constructor, bytes and state transition
|
|
6
|
+
|
|
7
|
+
Constructor arguments:
|
|
8
|
+
|
|
9
|
+
- `documentTransitions -> [DocumentTransitionWASM]`
|
|
10
|
+
- `ownerId -> IdentifierWASM | String | ArrayLike`
|
|
11
|
+
- `userFeeIncrease -> Number`
|
|
12
|
+
- `publicKeyId -> ?Number`
|
|
13
|
+
- `signature -> ?ArrayLike`
|
|
14
|
+
|
|
15
|
+
If you want to create instance from bytes,
|
|
16
|
+
use `fromBytes()` with `ArrayLike` as argument.
|
|
17
|
+
Also, you can use `fromStateTransition` with
|
|
18
|
+
`StateTransitionWASM` instance as argument
|
|
19
|
+
|
|
20
|
+
___
|
|
21
|
+
|
|
22
|
+
## Navigation
|
|
23
|
+
|
|
24
|
+
- [Example](#example)
|
|
25
|
+
- [Fields](#fields)
|
|
26
|
+
- [transitions](#transitions)
|
|
27
|
+
- [signature](#signature)
|
|
28
|
+
- [signaturePublicKeyId](#signaturepublickeyid)
|
|
29
|
+
- [allPurchasesAmount](#allpurchasesamount)
|
|
30
|
+
- [ownerId](#ownerid)
|
|
31
|
+
- [modifiedDataIds](#modifieddataids)
|
|
32
|
+
- [allConflictingIndexCollateralVotingFunds](#allconflictingindexcollateralvotingfunds)
|
|
33
|
+
|
|
34
|
+
___
|
|
35
|
+
|
|
36
|
+
## Example
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const documentInstance = new DocumentWASM(document, documentTypeName, revision, dataContractId, ownerId, id)
|
|
40
|
+
const createTransition = new DocumentCreateTransitionWASM(documentInstance, BigInt(1), 'preorder')
|
|
41
|
+
|
|
42
|
+
const documentTransition = createTransition.toDocumentTransition()
|
|
43
|
+
|
|
44
|
+
const batchTransition = new DocumentsBatchWASM([documentTransition], documentInstance.getOwnerId(), 1)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
___
|
|
48
|
+
|
|
49
|
+
## Fields
|
|
50
|
+
|
|
51
|
+
Not all fields are readable and writable.
|
|
52
|
+
|
|
53
|
+
### `transitions`
|
|
54
|
+
|
|
55
|
+
Contains array of `DocumentTransitionWASM` in `[DocumentTransitionWASM]`
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
batchTransition.transitions // -> [DocumentTransitionWASM]
|
|
59
|
+
|
|
60
|
+
batchTransition.transitions = [documentTransition1, documentTransition2]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
___
|
|
64
|
+
|
|
65
|
+
### `signature`
|
|
66
|
+
|
|
67
|
+
Contains array of bytes in `Uint8Array`
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
batchTransition.signature // -> Uint8Array
|
|
71
|
+
|
|
72
|
+
batchTransition.signature = [1, 2, 3]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
___
|
|
76
|
+
|
|
77
|
+
### `signaturePublicKeyId`
|
|
78
|
+
|
|
79
|
+
Contains key id for signature in `Number`
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
batchTransition.signaturePublicKeyId // -> Number
|
|
83
|
+
|
|
84
|
+
batchTransition.signaturePublicKeyId = 3
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
___
|
|
88
|
+
|
|
89
|
+
### `allPurchasesAmount`
|
|
90
|
+
|
|
91
|
+
Contains amount of credits for purchase in `BigInt`
|
|
92
|
+
|
|
93
|
+
**ONLY READ**
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
batchTransition.allPurchasesAmount // -> BigInt
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
___
|
|
100
|
+
|
|
101
|
+
### `ownerId`
|
|
102
|
+
|
|
103
|
+
Contains owner id in `IdentifierWASM`
|
|
104
|
+
|
|
105
|
+
**ONLY READ**
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
batchTransition.ownerId // -> IdentifierWASM
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
___
|
|
112
|
+
|
|
113
|
+
### `modifiedDataIds`
|
|
114
|
+
|
|
115
|
+
Contains array of ids for modifier data in `[IdentifierWASM]`
|
|
116
|
+
|
|
117
|
+
**ONLY READ**
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
batchTransition.ownerId // -> IdentifierWASM
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
___
|
|
124
|
+
|
|
125
|
+
### `allConflictingIndexCollateralVotingFunds`
|
|
126
|
+
|
|
127
|
+
Contains array conflicting funds in `BigInt`
|
|
128
|
+
|
|
129
|
+
**ONLY READ**
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
batchTransition.allConflictingIndexCollateralVotingFunds // -> BigInt
|
|
133
|
+
```
|