@dashevo/dashpay-contract 1.0.0-dev.1 → 1.0.0-dev.11
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/.eslintrc +2 -1
- package/Cargo.toml +4 -2
- package/package.json +2 -2
- package/src/error.rs +17 -0
- package/src/lib.rs +24 -15
- package/src/v1/mod.rs +19 -0
- package/test/unit/schema.spec.js +252 -77
- /package/schema/{dashpay.schema.json → v1/dashpay.schema.json} +0 -0
package/.eslintrc
CHANGED
package/Cargo.toml
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "dashpay-contract"
|
|
3
3
|
description = "DashPay data contract schema and tools"
|
|
4
|
-
version = "1.0.0-dev.
|
|
4
|
+
version = "1.0.0-dev.11"
|
|
5
5
|
edition = "2021"
|
|
6
|
-
rust-version = "1.
|
|
6
|
+
rust-version = "1.76"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
|
|
9
9
|
[dependencies]
|
|
10
|
+
platform-version = { path = "../rs-platform-version" }
|
|
11
|
+
thiserror = "1.0.58"
|
|
10
12
|
serde_json = { version = "1.0" }
|
|
11
13
|
platform-value = { path = "../rs-platform-value" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dashpay-contract",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.11",
|
|
4
4
|
"description": "Reference contract of the DashPay DPA on Dash Evolution",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "eslint .",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/dashevo/dashpay-contract#readme",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@dashevo/wasm-dpp": "1.0.0-dev.
|
|
28
|
+
"@dashevo/wasm-dpp": "1.0.0-dev.11",
|
|
29
29
|
"chai": "^4.3.10",
|
|
30
30
|
"dirty-chai": "^2.0.1",
|
|
31
31
|
"eslint": "^8.53.0",
|
package/src/error.rs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
use platform_version::version::FeatureVersion;
|
|
2
|
+
|
|
3
|
+
#[derive(thiserror::Error, Debug)]
|
|
4
|
+
pub enum Error {
|
|
5
|
+
/// Platform expected some specific versions
|
|
6
|
+
#[error("platform unknown version on {method}, received: {received}")]
|
|
7
|
+
UnknownVersionMismatch {
|
|
8
|
+
/// method
|
|
9
|
+
method: String,
|
|
10
|
+
/// the allowed versions for this method
|
|
11
|
+
known_versions: Vec<FeatureVersion>,
|
|
12
|
+
/// requested core height
|
|
13
|
+
received: FeatureVersion,
|
|
14
|
+
},
|
|
15
|
+
#[error("schema deserialize error: {0}")]
|
|
16
|
+
InvalidSchemaJson(#[from] serde_json::Error),
|
|
17
|
+
}
|
package/src/lib.rs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
mod error;
|
|
2
|
+
pub mod v1;
|
|
3
|
+
|
|
4
|
+
pub use crate::error::Error;
|
|
1
5
|
use platform_value::{Identifier, IdentifierBytes32};
|
|
2
|
-
use
|
|
6
|
+
use platform_version::version::PlatformVersion;
|
|
3
7
|
use serde_json::Value;
|
|
4
8
|
|
|
5
9
|
pub const ID_BYTES: [u8; 32] = [
|
|
@@ -12,21 +16,26 @@ pub const OWNER_ID_BYTES: [u8; 32] = [
|
|
|
12
16
|
215, 90, 101, 229, 15, 115, 5, 44, 117, 182, 217,
|
|
13
17
|
];
|
|
14
18
|
|
|
15
|
-
pub mod document_types {
|
|
16
|
-
pub mod contact_request {
|
|
17
|
-
pub const NAME: &str = "contactRequest";
|
|
18
|
-
|
|
19
|
-
pub mod properties {
|
|
20
|
-
pub const TO_USER_ID: &str = "toUserId";
|
|
21
|
-
pub const CORE_HEIGHT_CREATED_AT: &str = "coreHeightCreatedAt";
|
|
22
|
-
pub const CORE_CHAIN_LOCKED_HEIGHT: &str = "coreChainLockedHeight";
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
19
|
pub const ID: Identifier = Identifier(IdentifierBytes32(ID_BYTES));
|
|
28
20
|
pub const OWNER_ID: Identifier = Identifier(IdentifierBytes32(OWNER_ID_BYTES));
|
|
29
21
|
|
|
30
|
-
pub fn
|
|
31
|
-
|
|
22
|
+
pub fn load_definitions(platform_version: &PlatformVersion) -> Result<Option<Value>, Error> {
|
|
23
|
+
match platform_version.system_data_contracts.dashpay {
|
|
24
|
+
1 => Ok(None),
|
|
25
|
+
version => Err(Error::UnknownVersionMismatch {
|
|
26
|
+
method: "dashpay_contract::load_definitions".to_string(),
|
|
27
|
+
known_versions: vec![1],
|
|
28
|
+
received: version,
|
|
29
|
+
}),
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
pub fn load_documents_schemas(platform_version: &PlatformVersion) -> Result<Value, Error> {
|
|
33
|
+
match platform_version.system_data_contracts.dashpay {
|
|
34
|
+
1 => v1::load_documents_schemas(),
|
|
35
|
+
version => Err(Error::UnknownVersionMismatch {
|
|
36
|
+
method: "dashpay_contract::load_documents_schemas".to_string(),
|
|
37
|
+
known_versions: vec![1],
|
|
38
|
+
received: version,
|
|
39
|
+
}),
|
|
40
|
+
}
|
|
32
41
|
}
|
package/src/v1/mod.rs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
use crate::error::Error;
|
|
2
|
+
use serde_json::Value;
|
|
3
|
+
|
|
4
|
+
pub mod document_types {
|
|
5
|
+
pub mod contact_request {
|
|
6
|
+
pub const NAME: &str = "contactRequest";
|
|
7
|
+
|
|
8
|
+
pub mod properties {
|
|
9
|
+
pub const TO_USER_ID: &str = "toUserId";
|
|
10
|
+
pub const CORE_HEIGHT_CREATED_AT: &str = "coreHeightCreatedAt";
|
|
11
|
+
pub const CORE_CHAIN_LOCKED_HEIGHT: &str = "coreChainLockedHeight";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
pub fn load_documents_schemas() -> Result<Value, Error> {
|
|
17
|
+
serde_json::from_str(include_str!("../../schema/v1/dashpay.schema.json"))
|
|
18
|
+
.map_err(Error::InvalidSchemaJson)
|
|
19
|
+
}
|
package/test/unit/schema.spec.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
const { expect } = require('chai');
|
|
2
2
|
const crypto = require('crypto');
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
DashPlatformProtocol,
|
|
5
|
+
JsonSchemaError,
|
|
6
|
+
} = require('@dashevo/wasm-dpp');
|
|
4
7
|
const generateRandomIdentifier = require('@dashevo/wasm-dpp/lib/test/utils/generateRandomIdentifierAsync');
|
|
5
|
-
const schema = require('../../schema/dashpay.schema.json');
|
|
8
|
+
const schema = require('../../schema/v1/dashpay.schema.json');
|
|
6
9
|
|
|
7
10
|
const whitepaperMasternodeText = 'Full nodes are servers running on a P2P network that allow peers to use them to receive updates about the events on the network. These nodes utilize significant amounts of traffic and other resources that incur a substantial cost. As a result, a steady decrease in the amount of these nodes has been observed for some time on the Bitcoin network and as a result, block propagation times have been upwards of 40 seconds. Many solutions have been proposed such as a new reward scheme by Microsoft Research and the Bitnodes incentive program';
|
|
8
11
|
const encoded32Chars = '4fafc98bbfe597f7ba2c9f767d52036d';
|
|
@@ -10,10 +13,16 @@ const encoded64Chars = '4fafc98bbfe597f7ba2c9f767d52036d2226175960a908e355e5c575
|
|
|
10
13
|
|
|
11
14
|
const expectJsonSchemaError = (validationResult) => {
|
|
12
15
|
const errors = validationResult.getErrors();
|
|
13
|
-
expect(errors)
|
|
16
|
+
expect(errors)
|
|
17
|
+
.to
|
|
18
|
+
.have
|
|
19
|
+
.length(1);
|
|
14
20
|
|
|
15
21
|
const error = validationResult.getErrors()[0];
|
|
16
|
-
expect(error)
|
|
22
|
+
expect(error)
|
|
23
|
+
.to
|
|
24
|
+
.be
|
|
25
|
+
.instanceof(JsonSchemaError);
|
|
17
26
|
|
|
18
27
|
return error;
|
|
19
28
|
};
|
|
@@ -29,11 +38,14 @@ describe('Dashpay Contract', () => {
|
|
|
29
38
|
);
|
|
30
39
|
|
|
31
40
|
identityId = await generateRandomIdentifier();
|
|
32
|
-
contract = dpp.dataContract.create(identityId, schema);
|
|
41
|
+
contract = dpp.dataContract.create(identityId, BigInt(1), schema);
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
it('should have a valid contract definition', async () => {
|
|
36
|
-
expect(() => dpp.dataContract.create(identityId, schema))
|
|
45
|
+
expect(() => dpp.dataContract.create(identityId, BigInt(1), schema))
|
|
46
|
+
.to
|
|
47
|
+
.not
|
|
48
|
+
.throw();
|
|
37
49
|
});
|
|
38
50
|
|
|
39
51
|
describe('Documents', () => {
|
|
@@ -55,8 +67,13 @@ describe('Dashpay Contract', () => {
|
|
|
55
67
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
56
68
|
const error = expectJsonSchemaError(validationResult);
|
|
57
69
|
|
|
58
|
-
expect(error.keyword)
|
|
59
|
-
|
|
70
|
+
expect(error.keyword)
|
|
71
|
+
.to
|
|
72
|
+
.equal('maxLength');
|
|
73
|
+
expect(error.instancePath)
|
|
74
|
+
.to
|
|
75
|
+
.deep
|
|
76
|
+
.equal('/displayName');
|
|
60
77
|
});
|
|
61
78
|
});
|
|
62
79
|
|
|
@@ -68,8 +85,13 @@ describe('Dashpay Contract', () => {
|
|
|
68
85
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
69
86
|
const error = expectJsonSchemaError(validationResult);
|
|
70
87
|
|
|
71
|
-
expect(error.keyword)
|
|
72
|
-
|
|
88
|
+
expect(error.keyword)
|
|
89
|
+
.to
|
|
90
|
+
.equal('maxLength');
|
|
91
|
+
expect(error.instancePath)
|
|
92
|
+
.to
|
|
93
|
+
.deep
|
|
94
|
+
.equal('/publicMessage');
|
|
73
95
|
});
|
|
74
96
|
});
|
|
75
97
|
|
|
@@ -81,8 +103,13 @@ describe('Dashpay Contract', () => {
|
|
|
81
103
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
82
104
|
const error = expectJsonSchemaError(validationResult);
|
|
83
105
|
|
|
84
|
-
expect(error.keyword)
|
|
85
|
-
|
|
106
|
+
expect(error.keyword)
|
|
107
|
+
.to
|
|
108
|
+
.equal('format');
|
|
109
|
+
expect(error.instancePath)
|
|
110
|
+
.to
|
|
111
|
+
.deep
|
|
112
|
+
.equal('/avatarUrl');
|
|
86
113
|
});
|
|
87
114
|
|
|
88
115
|
it('should have less than 2048 chars length', async () => {
|
|
@@ -92,8 +119,13 @@ describe('Dashpay Contract', () => {
|
|
|
92
119
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
93
120
|
const error = expectJsonSchemaError(validationResult);
|
|
94
121
|
|
|
95
|
-
expect(error.keyword)
|
|
96
|
-
|
|
122
|
+
expect(error.keyword)
|
|
123
|
+
.to
|
|
124
|
+
.equal('maxLength');
|
|
125
|
+
expect(error.instancePath)
|
|
126
|
+
.to
|
|
127
|
+
.deep
|
|
128
|
+
.equal('/avatarUrl');
|
|
97
129
|
});
|
|
98
130
|
|
|
99
131
|
it('should be of type URL', async () => {
|
|
@@ -103,8 +135,13 @@ describe('Dashpay Contract', () => {
|
|
|
103
135
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
104
136
|
const error = expectJsonSchemaError(validationResult);
|
|
105
137
|
|
|
106
|
-
expect(error.keyword)
|
|
107
|
-
|
|
138
|
+
expect(error.keyword)
|
|
139
|
+
.to
|
|
140
|
+
.equal('format');
|
|
141
|
+
expect(error.instancePath)
|
|
142
|
+
.to
|
|
143
|
+
.deep
|
|
144
|
+
.equal('/avatarUrl');
|
|
108
145
|
});
|
|
109
146
|
});
|
|
110
147
|
|
|
@@ -116,8 +153,13 @@ describe('Dashpay Contract', () => {
|
|
|
116
153
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
117
154
|
const error = expectJsonSchemaError(validationResult);
|
|
118
155
|
|
|
119
|
-
expect(error.keyword)
|
|
120
|
-
|
|
156
|
+
expect(error.keyword)
|
|
157
|
+
.to
|
|
158
|
+
.equal('minItems');
|
|
159
|
+
expect(error.instancePath)
|
|
160
|
+
.to
|
|
161
|
+
.deep
|
|
162
|
+
.equal('/avatarHash');
|
|
121
163
|
});
|
|
122
164
|
|
|
123
165
|
it('should have maximum length of 32', async () => {
|
|
@@ -127,8 +169,13 @@ describe('Dashpay Contract', () => {
|
|
|
127
169
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
128
170
|
const error = expectJsonSchemaError(validationResult);
|
|
129
171
|
|
|
130
|
-
expect(error.keyword)
|
|
131
|
-
|
|
172
|
+
expect(error.keyword)
|
|
173
|
+
.to
|
|
174
|
+
.equal('maxItems');
|
|
175
|
+
expect(error.instancePath)
|
|
176
|
+
.to
|
|
177
|
+
.deep
|
|
178
|
+
.equal('/avatarHash');
|
|
132
179
|
});
|
|
133
180
|
|
|
134
181
|
it('should be of type array', async () => {
|
|
@@ -138,8 +185,13 @@ describe('Dashpay Contract', () => {
|
|
|
138
185
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
139
186
|
const error = expectJsonSchemaError(validationResult);
|
|
140
187
|
|
|
141
|
-
expect(error.keyword)
|
|
142
|
-
|
|
188
|
+
expect(error.keyword)
|
|
189
|
+
.to
|
|
190
|
+
.equal('type');
|
|
191
|
+
expect(error.instancePath)
|
|
192
|
+
.to
|
|
193
|
+
.deep
|
|
194
|
+
.equal('/avatarHash');
|
|
143
195
|
});
|
|
144
196
|
});
|
|
145
197
|
|
|
@@ -151,8 +203,13 @@ describe('Dashpay Contract', () => {
|
|
|
151
203
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
152
204
|
const error = expectJsonSchemaError(validationResult);
|
|
153
205
|
|
|
154
|
-
expect(error.keyword)
|
|
155
|
-
|
|
206
|
+
expect(error.keyword)
|
|
207
|
+
.to
|
|
208
|
+
.equal('minItems');
|
|
209
|
+
expect(error.instancePath)
|
|
210
|
+
.to
|
|
211
|
+
.deep
|
|
212
|
+
.equal('/avatarFingerprint');
|
|
156
213
|
});
|
|
157
214
|
|
|
158
215
|
it('should have maximum length of 8', async () => {
|
|
@@ -162,8 +219,13 @@ describe('Dashpay Contract', () => {
|
|
|
162
219
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
163
220
|
const error = expectJsonSchemaError(validationResult);
|
|
164
221
|
|
|
165
|
-
expect(error.keyword)
|
|
166
|
-
|
|
222
|
+
expect(error.keyword)
|
|
223
|
+
.to
|
|
224
|
+
.equal('maxItems');
|
|
225
|
+
expect(error.instancePath)
|
|
226
|
+
.to
|
|
227
|
+
.deep
|
|
228
|
+
.equal('/avatarFingerprint');
|
|
167
229
|
});
|
|
168
230
|
|
|
169
231
|
it('should be of type array', async () => {
|
|
@@ -173,8 +235,13 @@ describe('Dashpay Contract', () => {
|
|
|
173
235
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
174
236
|
const error = expectJsonSchemaError(validationResult);
|
|
175
237
|
|
|
176
|
-
expect(error.keyword)
|
|
177
|
-
|
|
238
|
+
expect(error.keyword)
|
|
239
|
+
.to
|
|
240
|
+
.equal('type');
|
|
241
|
+
expect(error.instancePath)
|
|
242
|
+
.to
|
|
243
|
+
.deep
|
|
244
|
+
.equal('/avatarFingerprint');
|
|
178
245
|
});
|
|
179
246
|
});
|
|
180
247
|
|
|
@@ -185,8 +252,13 @@ describe('Dashpay Contract', () => {
|
|
|
185
252
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
186
253
|
const error = expectJsonSchemaError(validationResult);
|
|
187
254
|
|
|
188
|
-
expect(error.keyword)
|
|
189
|
-
|
|
255
|
+
expect(error.keyword)
|
|
256
|
+
.to
|
|
257
|
+
.equal('additionalProperties');
|
|
258
|
+
expect(error.params.additionalProperties)
|
|
259
|
+
.to
|
|
260
|
+
.deep
|
|
261
|
+
.equal(['someOtherProperty']);
|
|
190
262
|
});
|
|
191
263
|
|
|
192
264
|
it('should be valid', async () => {
|
|
@@ -194,7 +266,10 @@ describe('Dashpay Contract', () => {
|
|
|
194
266
|
|
|
195
267
|
const result = profile.validate(dpp.protocolVersion);
|
|
196
268
|
|
|
197
|
-
expect(result.isValid())
|
|
269
|
+
expect(result.isValid())
|
|
270
|
+
.to
|
|
271
|
+
.be
|
|
272
|
+
.true();
|
|
198
273
|
});
|
|
199
274
|
});
|
|
200
275
|
|
|
@@ -218,8 +293,12 @@ describe('Dashpay Contract', () => {
|
|
|
218
293
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
219
294
|
const error = expectJsonSchemaError(validationResult);
|
|
220
295
|
|
|
221
|
-
expect(error.keyword)
|
|
222
|
-
|
|
296
|
+
expect(error.keyword)
|
|
297
|
+
.to
|
|
298
|
+
.equal('required');
|
|
299
|
+
expect(error.params.missingProperty)
|
|
300
|
+
.to
|
|
301
|
+
.equal('encToUserId');
|
|
223
302
|
});
|
|
224
303
|
|
|
225
304
|
it('should have exactly 32 chars length', async () => {
|
|
@@ -229,8 +308,12 @@ describe('Dashpay Contract', () => {
|
|
|
229
308
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
230
309
|
const error = expectJsonSchemaError(validationResult);
|
|
231
310
|
|
|
232
|
-
expect(error.keyword)
|
|
233
|
-
|
|
311
|
+
expect(error.keyword)
|
|
312
|
+
.to
|
|
313
|
+
.equal('maxItems');
|
|
314
|
+
expect(error.instancePath)
|
|
315
|
+
.to
|
|
316
|
+
.equal('/encToUserId');
|
|
234
317
|
});
|
|
235
318
|
|
|
236
319
|
it('should have more or 32 chars length', async () => {
|
|
@@ -240,8 +323,12 @@ describe('Dashpay Contract', () => {
|
|
|
240
323
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
241
324
|
const error = expectJsonSchemaError(validationResult);
|
|
242
325
|
|
|
243
|
-
expect(error.keyword)
|
|
244
|
-
|
|
326
|
+
expect(error.keyword)
|
|
327
|
+
.to
|
|
328
|
+
.equal('minItems');
|
|
329
|
+
expect(error.instancePath)
|
|
330
|
+
.to
|
|
331
|
+
.equal('/encToUserId');
|
|
245
332
|
});
|
|
246
333
|
});
|
|
247
334
|
|
|
@@ -253,8 +340,12 @@ describe('Dashpay Contract', () => {
|
|
|
253
340
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
254
341
|
const error = expectJsonSchemaError(validationResult);
|
|
255
342
|
|
|
256
|
-
expect(error.keyword)
|
|
257
|
-
|
|
343
|
+
expect(error.keyword)
|
|
344
|
+
.to
|
|
345
|
+
.equal('required');
|
|
346
|
+
expect(error.params.missingProperty)
|
|
347
|
+
.to
|
|
348
|
+
.equal('rootEncryptionKeyIndex');
|
|
258
349
|
});
|
|
259
350
|
|
|
260
351
|
it('should not be less than 0', async () => {
|
|
@@ -264,8 +355,12 @@ describe('Dashpay Contract', () => {
|
|
|
264
355
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
265
356
|
const error = expectJsonSchemaError(validationResult);
|
|
266
357
|
|
|
267
|
-
expect(error.keyword)
|
|
268
|
-
|
|
358
|
+
expect(error.keyword)
|
|
359
|
+
.to
|
|
360
|
+
.equal('minimum');
|
|
361
|
+
expect(error.instancePath)
|
|
362
|
+
.to
|
|
363
|
+
.equal('/rootEncryptionKeyIndex');
|
|
269
364
|
});
|
|
270
365
|
});
|
|
271
366
|
|
|
@@ -277,8 +372,12 @@ describe('Dashpay Contract', () => {
|
|
|
277
372
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
278
373
|
const error = expectJsonSchemaError(validationResult);
|
|
279
374
|
|
|
280
|
-
expect(error.keyword)
|
|
281
|
-
|
|
375
|
+
expect(error.keyword)
|
|
376
|
+
.to
|
|
377
|
+
.equal('required');
|
|
378
|
+
expect(error.params.missingProperty)
|
|
379
|
+
.to
|
|
380
|
+
.equal('privateData');
|
|
282
381
|
});
|
|
283
382
|
});
|
|
284
383
|
|
|
@@ -289,8 +388,13 @@ describe('Dashpay Contract', () => {
|
|
|
289
388
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
290
389
|
const error = expectJsonSchemaError(validationResult);
|
|
291
390
|
|
|
292
|
-
expect(error.keyword)
|
|
293
|
-
|
|
391
|
+
expect(error.keyword)
|
|
392
|
+
.to
|
|
393
|
+
.equal('additionalProperties');
|
|
394
|
+
expect(error.params.additionalProperties)
|
|
395
|
+
.to
|
|
396
|
+
.deep
|
|
397
|
+
.equal(['someOtherProperty']);
|
|
294
398
|
});
|
|
295
399
|
});
|
|
296
400
|
|
|
@@ -315,8 +419,12 @@ describe('Dashpay Contract', () => {
|
|
|
315
419
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
316
420
|
const error = expectJsonSchemaError(validationResult);
|
|
317
421
|
|
|
318
|
-
expect(error.keyword)
|
|
319
|
-
|
|
422
|
+
expect(error.keyword)
|
|
423
|
+
.to
|
|
424
|
+
.equal('required');
|
|
425
|
+
expect(error.params.missingProperty)
|
|
426
|
+
.to
|
|
427
|
+
.equal('toUserId');
|
|
320
428
|
});
|
|
321
429
|
});
|
|
322
430
|
|
|
@@ -328,8 +436,12 @@ describe('Dashpay Contract', () => {
|
|
|
328
436
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
329
437
|
const error = expectJsonSchemaError(validationResult);
|
|
330
438
|
|
|
331
|
-
expect(error.keyword)
|
|
332
|
-
|
|
439
|
+
expect(error.keyword)
|
|
440
|
+
.to
|
|
441
|
+
.equal('required');
|
|
442
|
+
expect(error.params.missingProperty)
|
|
443
|
+
.to
|
|
444
|
+
.equal('encryptedPublicKey');
|
|
333
445
|
});
|
|
334
446
|
});
|
|
335
447
|
|
|
@@ -341,8 +453,12 @@ describe('Dashpay Contract', () => {
|
|
|
341
453
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
342
454
|
const error = expectJsonSchemaError(validationResult);
|
|
343
455
|
|
|
344
|
-
expect(error.keyword)
|
|
345
|
-
|
|
456
|
+
expect(error.keyword)
|
|
457
|
+
.to
|
|
458
|
+
.equal('required');
|
|
459
|
+
expect(error.params.missingProperty)
|
|
460
|
+
.to
|
|
461
|
+
.equal('senderKeyIndex');
|
|
346
462
|
});
|
|
347
463
|
|
|
348
464
|
it('should not be less than 0', async () => {
|
|
@@ -352,8 +468,12 @@ describe('Dashpay Contract', () => {
|
|
|
352
468
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
353
469
|
const error = expectJsonSchemaError(validationResult);
|
|
354
470
|
|
|
355
|
-
expect(error.keyword)
|
|
356
|
-
|
|
471
|
+
expect(error.keyword)
|
|
472
|
+
.to
|
|
473
|
+
.equal('minimum');
|
|
474
|
+
expect(error.instancePath)
|
|
475
|
+
.to
|
|
476
|
+
.equal('/senderKeyIndex');
|
|
357
477
|
});
|
|
358
478
|
});
|
|
359
479
|
|
|
@@ -365,8 +485,12 @@ describe('Dashpay Contract', () => {
|
|
|
365
485
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
366
486
|
const error = expectJsonSchemaError(validationResult);
|
|
367
487
|
|
|
368
|
-
expect(error.keyword)
|
|
369
|
-
|
|
488
|
+
expect(error.keyword)
|
|
489
|
+
.to
|
|
490
|
+
.equal('required');
|
|
491
|
+
expect(error.params.missingProperty)
|
|
492
|
+
.to
|
|
493
|
+
.equal('recipientKeyIndex');
|
|
370
494
|
});
|
|
371
495
|
|
|
372
496
|
it('should not be less than 0', async () => {
|
|
@@ -376,8 +500,12 @@ describe('Dashpay Contract', () => {
|
|
|
376
500
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
377
501
|
const error = expectJsonSchemaError(validationResult);
|
|
378
502
|
|
|
379
|
-
expect(error.keyword)
|
|
380
|
-
|
|
503
|
+
expect(error.keyword)
|
|
504
|
+
.to
|
|
505
|
+
.equal('minimum');
|
|
506
|
+
expect(error.instancePath)
|
|
507
|
+
.to
|
|
508
|
+
.equal('/recipientKeyIndex');
|
|
381
509
|
});
|
|
382
510
|
});
|
|
383
511
|
|
|
@@ -389,8 +517,13 @@ describe('Dashpay Contract', () => {
|
|
|
389
517
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
390
518
|
const error = expectJsonSchemaError(validationResult);
|
|
391
519
|
|
|
392
|
-
expect(error.keyword)
|
|
393
|
-
|
|
520
|
+
expect(error.keyword)
|
|
521
|
+
.to
|
|
522
|
+
.equal('minItems');
|
|
523
|
+
expect(error.instancePath)
|
|
524
|
+
.to
|
|
525
|
+
.deep
|
|
526
|
+
.equal('/encryptedAccountLabel');
|
|
394
527
|
});
|
|
395
528
|
|
|
396
529
|
it('should have maximum length of 80', async () => {
|
|
@@ -400,8 +533,13 @@ describe('Dashpay Contract', () => {
|
|
|
400
533
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
401
534
|
const error = expectJsonSchemaError(validationResult);
|
|
402
535
|
|
|
403
|
-
expect(error.keyword)
|
|
404
|
-
|
|
536
|
+
expect(error.keyword)
|
|
537
|
+
.to
|
|
538
|
+
.equal('maxItems');
|
|
539
|
+
expect(error.instancePath)
|
|
540
|
+
.to
|
|
541
|
+
.deep
|
|
542
|
+
.equal('/encryptedAccountLabel');
|
|
405
543
|
});
|
|
406
544
|
|
|
407
545
|
it('should be of type array', async () => {
|
|
@@ -411,8 +549,13 @@ describe('Dashpay Contract', () => {
|
|
|
411
549
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
412
550
|
const error = expectJsonSchemaError(validationResult);
|
|
413
551
|
|
|
414
|
-
expect(error.keyword)
|
|
415
|
-
|
|
552
|
+
expect(error.keyword)
|
|
553
|
+
.to
|
|
554
|
+
.equal('type');
|
|
555
|
+
expect(error.instancePath)
|
|
556
|
+
.to
|
|
557
|
+
.deep
|
|
558
|
+
.equal('/encryptedAccountLabel');
|
|
416
559
|
});
|
|
417
560
|
});
|
|
418
561
|
|
|
@@ -424,8 +567,13 @@ describe('Dashpay Contract', () => {
|
|
|
424
567
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
425
568
|
const error = expectJsonSchemaError(validationResult);
|
|
426
569
|
|
|
427
|
-
expect(error.keyword)
|
|
428
|
-
|
|
570
|
+
expect(error.keyword)
|
|
571
|
+
.to
|
|
572
|
+
.equal('minItems');
|
|
573
|
+
expect(error.instancePath)
|
|
574
|
+
.to
|
|
575
|
+
.deep
|
|
576
|
+
.equal('/autoAcceptProof');
|
|
429
577
|
});
|
|
430
578
|
|
|
431
579
|
it('should have maximum length of 102', async () => {
|
|
@@ -435,8 +583,13 @@ describe('Dashpay Contract', () => {
|
|
|
435
583
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
436
584
|
const error = expectJsonSchemaError(validationResult);
|
|
437
585
|
|
|
438
|
-
expect(error.keyword)
|
|
439
|
-
|
|
586
|
+
expect(error.keyword)
|
|
587
|
+
.to
|
|
588
|
+
.equal('maxItems');
|
|
589
|
+
expect(error.instancePath)
|
|
590
|
+
.to
|
|
591
|
+
.deep
|
|
592
|
+
.equal('/autoAcceptProof');
|
|
440
593
|
});
|
|
441
594
|
|
|
442
595
|
it('should be of type array', async () => {
|
|
@@ -446,8 +599,13 @@ describe('Dashpay Contract', () => {
|
|
|
446
599
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
447
600
|
const error = expectJsonSchemaError(validationResult);
|
|
448
601
|
|
|
449
|
-
expect(error.keyword)
|
|
450
|
-
|
|
602
|
+
expect(error.keyword)
|
|
603
|
+
.to
|
|
604
|
+
.equal('type');
|
|
605
|
+
expect(error.instancePath)
|
|
606
|
+
.to
|
|
607
|
+
.deep
|
|
608
|
+
.equal('/autoAcceptProof');
|
|
451
609
|
});
|
|
452
610
|
});
|
|
453
611
|
|
|
@@ -459,8 +617,12 @@ describe('Dashpay Contract', () => {
|
|
|
459
617
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
460
618
|
const error = expectJsonSchemaError(validationResult);
|
|
461
619
|
|
|
462
|
-
expect(error.keyword)
|
|
463
|
-
|
|
620
|
+
expect(error.keyword)
|
|
621
|
+
.to
|
|
622
|
+
.equal('required');
|
|
623
|
+
expect(error.params.missingProperty)
|
|
624
|
+
.to
|
|
625
|
+
.equal('accountReference');
|
|
464
626
|
});
|
|
465
627
|
|
|
466
628
|
it('should not be less than 0', async () => {
|
|
@@ -470,8 +632,12 @@ describe('Dashpay Contract', () => {
|
|
|
470
632
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
471
633
|
const error = expectJsonSchemaError(validationResult);
|
|
472
634
|
|
|
473
|
-
expect(error.keyword)
|
|
474
|
-
|
|
635
|
+
expect(error.keyword)
|
|
636
|
+
.to
|
|
637
|
+
.equal('minimum');
|
|
638
|
+
expect(error.instancePath)
|
|
639
|
+
.to
|
|
640
|
+
.equal('/accountReference');
|
|
475
641
|
});
|
|
476
642
|
});
|
|
477
643
|
|
|
@@ -483,8 +649,12 @@ describe('Dashpay Contract', () => {
|
|
|
483
649
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
484
650
|
const error = expectJsonSchemaError(validationResult);
|
|
485
651
|
|
|
486
|
-
expect(error.keyword)
|
|
487
|
-
|
|
652
|
+
expect(error.keyword)
|
|
653
|
+
.to
|
|
654
|
+
.equal('minimum');
|
|
655
|
+
expect(error.instancePath)
|
|
656
|
+
.to
|
|
657
|
+
.equal('/coreHeightCreatedAt');
|
|
488
658
|
});
|
|
489
659
|
});
|
|
490
660
|
|
|
@@ -495,8 +665,13 @@ describe('Dashpay Contract', () => {
|
|
|
495
665
|
const validationResult = document.validate(dpp.protocolVersion);
|
|
496
666
|
const error = expectJsonSchemaError(validationResult);
|
|
497
667
|
|
|
498
|
-
expect(error.keyword)
|
|
499
|
-
|
|
668
|
+
expect(error.keyword)
|
|
669
|
+
.to
|
|
670
|
+
.equal('additionalProperties');
|
|
671
|
+
expect(error.params.additionalProperties)
|
|
672
|
+
.to
|
|
673
|
+
.deep
|
|
674
|
+
.equal(['someOtherProperty']);
|
|
500
675
|
});
|
|
501
676
|
});
|
|
502
677
|
});
|
|
File without changes
|