@dashevo/wasm-dpp 4.0.0-rc.2 → 4.1.0-beta.1
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/Cargo.toml +0 -4
- package/dist/wasm/wasm_dpp.d.ts +964 -953
- package/dist/wasm/wasm_dpp.js +60 -57
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/wasm/wasm_dpp.d.ts +964 -953
- package/package.json +2 -2
- package/src/data_contract/data_contract.rs +11 -14
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +40 -13
- package/src/data_contract/state_transition/data_contract_update_transition/mod.rs +40 -13
- package/src/document/extended_document.rs +17 -60
- package/src/document/mod.rs +22 -5
- package/src/errors/consensus/consensus_error.rs +4 -1
- package/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs +4 -1
- package/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs +5 -1
- package/src/utils.rs +51 -1
- package/test/integration/document/Document.spec.js +0 -60
- package/test/unit/dataContract/DataContract.spec.js +22 -2
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js +1 -1
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js +3 -2
- package/test/unit/document/Document.spec.js +0 -22
- package/test/unit/document/DocumentFactory.spec.js +2 -4
- package/test/unit/document/errors/InvalidDocumentError.spec.js +5 -4
- package/test/unit/identity/Identity.spec.js +0 -2
|
@@ -397,28 +397,6 @@ describe('Document', () => {
|
|
|
397
397
|
});
|
|
398
398
|
});
|
|
399
399
|
|
|
400
|
-
describe('#toJSON', () => {
|
|
401
|
-
it('should return Document as plain JS object', () => {
|
|
402
|
-
const jsonDocument = {
|
|
403
|
-
...rawDocument,
|
|
404
|
-
$dataContractId: document.getDataContractId().toString(),
|
|
405
|
-
$dataContract: document.getDataContract().toJSON(),
|
|
406
|
-
$id: document.getId().toString(),
|
|
407
|
-
$ownerId: document.getOwnerId().toString(),
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
expect(document.toJSON()).to.deep.equal(jsonDocument);
|
|
411
|
-
});
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
describe('#toObject', () => {
|
|
415
|
-
it('should return Document as object', () => {
|
|
416
|
-
const result = document.toObject();
|
|
417
|
-
|
|
418
|
-
expect(rawDocumentWithBuffers).to.deep.equal(result);
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
|
|
422
400
|
describe('#toBuffer', () => {
|
|
423
401
|
it('should return serialized Document', () => {
|
|
424
402
|
const buffer = document.toBuffer();
|
|
@@ -49,7 +49,6 @@ describe('DocumentFactory', () => {
|
|
|
49
49
|
ownerId = documents[0].getOwnerId();
|
|
50
50
|
|
|
51
51
|
([, , , document] = documents);
|
|
52
|
-
rawDocument = document.toObject();
|
|
53
52
|
|
|
54
53
|
factory = new DocumentFactory(1, { generate: () => crypto.randomBytes(32) });
|
|
55
54
|
});
|
|
@@ -62,7 +61,6 @@ describe('DocumentFactory', () => {
|
|
|
62
61
|
// the mocked DataContract validator always returned true.
|
|
63
62
|
const [niceDocument] = documents;
|
|
64
63
|
|
|
65
|
-
const newRawDocument = niceDocument.toObject();
|
|
66
64
|
const contractId = bs58.decode('FQco85WbwNgb5ix8QQAH6wurMcgEC5ENSCv5ixG9cj12');
|
|
67
65
|
const name = 'Cutie';
|
|
68
66
|
|
|
@@ -74,13 +72,13 @@ describe('DocumentFactory', () => {
|
|
|
74
72
|
const newDocument = factory.create(
|
|
75
73
|
dataContract,
|
|
76
74
|
ownerIdJs,
|
|
77
|
-
|
|
75
|
+
niceDocument.getType(),
|
|
78
76
|
{ name },
|
|
79
77
|
);
|
|
80
78
|
|
|
81
79
|
expect(newDocument).to.be.an.instanceOf(ExtendedDocument);
|
|
82
80
|
|
|
83
|
-
expect(newDocument.getType()).to.equal(
|
|
81
|
+
expect(newDocument.getType()).to.equal(niceDocument.getType());
|
|
84
82
|
|
|
85
83
|
expect(newDocument.get('name')).to.equal(name);
|
|
86
84
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
const { InvalidDocumentError } = require('../../../..');
|
|
2
|
-
const getDocumentsFixture = require('../../../../lib/test/fixtures/getDocumentsFixture');
|
|
3
2
|
|
|
4
3
|
describe('InvalidDocumentError', () => {
|
|
5
4
|
let rawDocument;
|
|
6
5
|
let error;
|
|
7
6
|
|
|
8
|
-
beforeEach(
|
|
7
|
+
beforeEach(() => {
|
|
9
8
|
error = new Error('Some error');
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// ExtendedDocument no longer exposes toObject(); InvalidDocumentError stores
|
|
11
|
+
// the raw document opaquely (round-tripped as a JsValue), so a representative
|
|
12
|
+
// plain object is sufficient for these wrapper tests.
|
|
13
|
+
rawDocument = { $type: 'niceDocument', name: 'someName' };
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
it('should return errors', () => {
|
|
@@ -72,7 +72,6 @@ describe('Identity', () => {
|
|
|
72
72
|
purpose: KeyPurpose.AUTHENTICATION,
|
|
73
73
|
securityLevel: KeySecurityLevel.HIGH,
|
|
74
74
|
readOnly: false,
|
|
75
|
-
disabledAt: null,
|
|
76
75
|
contractBounds: null,
|
|
77
76
|
};
|
|
78
77
|
|
|
@@ -151,7 +150,6 @@ describe('Identity', () => {
|
|
|
151
150
|
purpose: KeyPurpose.AUTHENTICATION,
|
|
152
151
|
securityLevel: KeySecurityLevel.HIGH,
|
|
153
152
|
readOnly: false,
|
|
154
|
-
disabledAt: null,
|
|
155
153
|
contractBounds: null,
|
|
156
154
|
},
|
|
157
155
|
],
|