pshenmic-dpp 1.1.2-dev.4 → 1.1.2-dev.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/dist/wasm/pshenmic_dpp.d.ts +71 -58
- package/dist/wasm/pshenmic_dpp.js +93 -22
- package/dist/wasm/pshenmic_dpp_bg.js +1 -1
- package/dist/wasm/pshenmic_dpp_bg.wasm.d.ts +50 -46
- package/dist/wasm/pshenmic_dpp_zipped.js +1 -1
- package/package.json +1 -1
- package/tests/AsyncImportTest.spec.cjs +2 -2
- package/tests/DataContract.spec.cjs +1 -1
- package/tests/DataContractCreateStateTransition.spec.cjs +9 -10
- package/tests/DataContractUpdateStateTransition.spec.cjs +9 -9
- package/tests/IdentityCreateTransition.spec.cjs +0 -1
- package/tests/IdentityPublicKey.spec.cjs +40 -0
- package/tests/mocks/DataContract/DataContract.json +16 -5
- package/tests/mocks/DataContract/index.js +1 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
const assert = require('assert')
|
|
2
2
|
const { describe, it } = require('mocha')
|
|
3
3
|
const { value, dataContractsBytes } = require('./mocks/DataContract/index.js')
|
|
4
|
-
const { PlatformVersionWASM } = require('..')
|
|
5
4
|
const { fromHexString } = require('./utils/hex')
|
|
6
5
|
const { default: wasm } = require('..')
|
|
7
6
|
|
|
8
7
|
describe('DataContract Create Transition', function () {
|
|
9
8
|
describe('serialization / deserialization', function () {
|
|
10
9
|
it('should allow to create document_transitions from data contract', () => {
|
|
11
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
10
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
12
11
|
|
|
13
12
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
14
13
|
|
|
@@ -17,7 +16,7 @@ describe('DataContract Create Transition', function () {
|
|
|
17
16
|
})
|
|
18
17
|
|
|
19
18
|
it('should allow to convert document_transitions to bytes and create from bytes', () => {
|
|
20
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
19
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
21
20
|
|
|
22
21
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
23
22
|
|
|
@@ -32,7 +31,7 @@ describe('DataContract Create Transition', function () {
|
|
|
32
31
|
})
|
|
33
32
|
|
|
34
33
|
it('should allow to convert data contract transition to state document_transitions and create data contract transition from state transition', () => {
|
|
35
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
34
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
36
35
|
|
|
37
36
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
38
37
|
|
|
@@ -46,7 +45,7 @@ describe('DataContract Create Transition', function () {
|
|
|
46
45
|
|
|
47
46
|
describe('getters', function () {
|
|
48
47
|
it('should allow to get feature version', () => {
|
|
49
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
48
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
50
49
|
|
|
51
50
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
52
51
|
|
|
@@ -54,7 +53,7 @@ describe('DataContract Create Transition', function () {
|
|
|
54
53
|
})
|
|
55
54
|
|
|
56
55
|
it('should allow to verify protocol version', () => {
|
|
57
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
56
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
58
57
|
|
|
59
58
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
60
59
|
|
|
@@ -62,7 +61,7 @@ describe('DataContract Create Transition', function () {
|
|
|
62
61
|
})
|
|
63
62
|
|
|
64
63
|
it('should allow to verify incorrect protocol version', () => {
|
|
65
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
64
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
66
65
|
|
|
67
66
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
68
67
|
|
|
@@ -75,7 +74,7 @@ describe('DataContract Create Transition', function () {
|
|
|
75
74
|
})
|
|
76
75
|
|
|
77
76
|
it('should allow to get data contract', () => {
|
|
78
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
77
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
79
78
|
|
|
80
79
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
81
80
|
|
|
@@ -89,11 +88,11 @@ describe('DataContract Create Transition', function () {
|
|
|
89
88
|
it('should allow to set the data contract', () => {
|
|
90
89
|
const [dataContractBytes] = dataContractsBytes
|
|
91
90
|
|
|
92
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
91
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
93
92
|
|
|
94
93
|
const dataContractTransition = new wasm.DataContractCreateTransitionWASM(dataContract, BigInt(1))
|
|
95
94
|
|
|
96
|
-
const newDataContract = wasm.DataContractWASM.fromBytes(fromHexString(dataContractBytes), false
|
|
95
|
+
const newDataContract = wasm.DataContractWASM.fromBytes(fromHexString(dataContractBytes), false)
|
|
97
96
|
|
|
98
97
|
dataContractTransition.setDataContract(newDataContract)
|
|
99
98
|
|
|
@@ -8,7 +8,7 @@ const { default: wasm } = require('..')
|
|
|
8
8
|
describe('DataContract Updatet Transition', function () {
|
|
9
9
|
describe('serialization / deserialization', function () {
|
|
10
10
|
it('should allow to create document_transitions from data contract', () => {
|
|
11
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
11
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
12
12
|
|
|
13
13
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
14
14
|
|
|
@@ -17,7 +17,7 @@ describe('DataContract Updatet Transition', function () {
|
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
it('should allow to convert document_transitions to bytes and create from bytes', () => {
|
|
20
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
20
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
21
21
|
|
|
22
22
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
23
23
|
|
|
@@ -32,7 +32,7 @@ describe('DataContract Updatet Transition', function () {
|
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
it('should allow to convert data contract transition to state document_transitions and create data contract transition from state transition', () => {
|
|
35
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
35
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
36
36
|
|
|
37
37
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
38
38
|
|
|
@@ -46,7 +46,7 @@ describe('DataContract Updatet Transition', function () {
|
|
|
46
46
|
|
|
47
47
|
describe('getters', function () {
|
|
48
48
|
it('should allow to get feature version', () => {
|
|
49
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
49
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
50
50
|
|
|
51
51
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
52
52
|
|
|
@@ -54,7 +54,7 @@ describe('DataContract Updatet Transition', function () {
|
|
|
54
54
|
})
|
|
55
55
|
|
|
56
56
|
it('should allow to verify protocol version', () => {
|
|
57
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
57
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
58
58
|
|
|
59
59
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ describe('DataContract Updatet Transition', function () {
|
|
|
62
62
|
})
|
|
63
63
|
|
|
64
64
|
it('should allow to verify incorrect protocol version', () => {
|
|
65
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
65
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
66
66
|
|
|
67
67
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
68
68
|
|
|
@@ -75,7 +75,7 @@ describe('DataContract Updatet Transition', function () {
|
|
|
75
75
|
})
|
|
76
76
|
|
|
77
77
|
it('should allow to get data contract', () => {
|
|
78
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
78
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
79
79
|
|
|
80
80
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
81
81
|
|
|
@@ -89,11 +89,11 @@ describe('DataContract Updatet Transition', function () {
|
|
|
89
89
|
it('should allow to set the data contract', () => {
|
|
90
90
|
const [dataContractBytes] = dataContractsBytes
|
|
91
91
|
|
|
92
|
-
const dataContract = wasm.DataContractWASM.fromValue(value, false
|
|
92
|
+
const dataContract = wasm.DataContractWASM.fromValue(value, false)
|
|
93
93
|
|
|
94
94
|
const dataContractTransition = new wasm.DataContractUpdateTransitionWASM(dataContract, BigInt(1))
|
|
95
95
|
|
|
96
|
-
const newDataContract = wasm.DataContractWASM.fromBytes(fromHexString(dataContractBytes), false
|
|
96
|
+
const newDataContract = wasm.DataContractWASM.fromBytes(fromHexString(dataContractBytes), false)
|
|
97
97
|
|
|
98
98
|
dataContractTransition.setDataContract(newDataContract)
|
|
99
99
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const assert = require('assert')
|
|
2
2
|
const { describe, it } = require('mocha')
|
|
3
3
|
const { default: wasm } = require('..')
|
|
4
|
-
const {fromHexString} = require("./utils/hex");
|
|
5
4
|
|
|
6
5
|
describe('IdentityCreateTransition', function () {
|
|
7
6
|
describe('serialization / deserialization', function () {
|
|
@@ -94,8 +94,48 @@ describe('PublicKey', function () {
|
|
|
94
94
|
|
|
95
95
|
const privateKey = wasm.PrivateKeyWASM.fromWIF(wif)
|
|
96
96
|
|
|
97
|
+
assert.equal(pubKey.validatePrivateKey(privateKey), false)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it('should allow to validate private key bytes', function () {
|
|
101
|
+
const pubKey = new wasm.IdentityPublicKeyWASM(
|
|
102
|
+
keyId,
|
|
103
|
+
purpose,
|
|
104
|
+
securityLevel,
|
|
105
|
+
keyType,
|
|
106
|
+
false,
|
|
107
|
+
binaryData)
|
|
108
|
+
|
|
109
|
+
const privateKey = wasm.PrivateKeyWASM.fromWIF(wif)
|
|
110
|
+
|
|
97
111
|
assert.equal(pubKey.validatePrivateKey(privateKey.bytes(), wasm.NetworkWASM.Mainnet), false)
|
|
98
112
|
})
|
|
113
|
+
|
|
114
|
+
it('should allow to validate private key hex', function () {
|
|
115
|
+
const pubKey = new wasm.IdentityPublicKeyWASM(
|
|
116
|
+
keyId,
|
|
117
|
+
purpose,
|
|
118
|
+
securityLevel,
|
|
119
|
+
keyType,
|
|
120
|
+
false,
|
|
121
|
+
binaryData)
|
|
122
|
+
|
|
123
|
+
const privateKey = wasm.PrivateKeyWASM.fromWIF(wif)
|
|
124
|
+
|
|
125
|
+
assert.equal(pubKey.validatePrivateKey(privateKey.hex(), wasm.NetworkWASM.Mainnet), false)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('should allow to validate private key wif', function () {
|
|
129
|
+
const pubKey = new wasm.IdentityPublicKeyWASM(
|
|
130
|
+
keyId,
|
|
131
|
+
purpose,
|
|
132
|
+
securityLevel,
|
|
133
|
+
keyType,
|
|
134
|
+
false,
|
|
135
|
+
binaryData)
|
|
136
|
+
|
|
137
|
+
assert.equal(pubKey.validatePrivateKey(wif), false)
|
|
138
|
+
})
|
|
99
139
|
})
|
|
100
140
|
|
|
101
141
|
describe('setters', function () {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$format_version": "
|
|
2
|
+
"$format_version": "1",
|
|
3
3
|
"id": "4fJLR2GYTPFdomuTVvNy3VRrvWgvkKPzqehEBpNf2nk6",
|
|
4
4
|
"config": {
|
|
5
|
-
"$format_version": "
|
|
5
|
+
"$format_version": "1",
|
|
6
6
|
"canBeDeleted": false,
|
|
7
7
|
"readonly": false,
|
|
8
8
|
"keepsHistory": false,
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"documentsMutableContractDefault": true,
|
|
11
11
|
"documentsCanBeDeletedContractDefault": true,
|
|
12
12
|
"requiresIdentityEncryptionBoundedKey": null,
|
|
13
|
-
"requiresIdentityDecryptionBoundedKey": null
|
|
13
|
+
"requiresIdentityDecryptionBoundedKey": null,
|
|
14
|
+
"sizedIntegerTypes": true
|
|
14
15
|
},
|
|
15
16
|
"version": 1,
|
|
16
17
|
"ownerId": "11111111111111111111111111111111",
|
|
@@ -149,5 +150,15 @@
|
|
|
149
150
|
"status"
|
|
150
151
|
]
|
|
151
152
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
153
|
+
},
|
|
154
|
+
"createdAt": null,
|
|
155
|
+
"updatedAt": null,
|
|
156
|
+
"createdAtBlockHeight": null,
|
|
157
|
+
"updatedAtBlockHeight": null,
|
|
158
|
+
"createdAtEpoch": null,
|
|
159
|
+
"updatedAtEpoch": null,
|
|
160
|
+
"groups": {},
|
|
161
|
+
"tokens": {},
|
|
162
|
+
"keywords": [],
|
|
163
|
+
"description": null
|
|
164
|
+
}
|
|
@@ -3,4 +3,4 @@ import value from "./DataContract.json" with {type: 'json'}
|
|
|
3
3
|
export {value}
|
|
4
4
|
export const id = '4fJLR2GYTPFdomuTVvNy3VRrvWgvkKPzqehEBpNf2nk6'
|
|
5
5
|
export const ownerId = '11111111111111111111111111111111'
|
|
6
|
-
export const dataContractsBytes = ['
|
|
6
|
+
export const dataContractsBytes = ['01ea8920edea52fa400de2ccc43052b2821f45585241a2875d4250e35d4ce937c800000000000101000001ab321b19457b1c16b12762509276d47d952f582d978cbd8b50bbfc2fd8a7767d0001046e6f7465160312047479706512066f626a656374120a70726f70657274696573160112076d65737361676516021204747970651206737472696e671208706f736974696f6e030012146164646974696f6e616c50726f70657274696573130000000000000000000000']
|