@dashevo/wasm-dpp 4.2.0-dev.9 → 5.0.0-beta.2
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/wasm_dpp.d.ts +3845 -2470
- package/dist/wasm/wasm_dpp.js +707 -79
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/wasm/wasm_dpp.d.ts +3845 -2470
- package/package.json +2 -2
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +8 -3
- package/src/data_contract/state_transition/data_contract_update_transition/mod.rs +8 -3
- package/src/document/factory.rs +1 -1
- package/src/document/state_transition/batch_transition/mod.rs +6 -1
- package/src/document/state_transition/batch_transition/token_transition/claim.rs +1 -0
- package/src/document/state_transition/batch_transition/token_transition/mod.rs +41 -14
- package/src/errors/consensus/basic/identity/contract_group_bound_key_not_allowed_in_shielded_identity_creation_error.rs +36 -0
- package/src/errors/consensus/basic/identity/mod.rs +2 -0
- package/src/errors/consensus/consensus_error.rs +403 -4
- package/src/errors/consensus/deserialize.rs +2 -2
- package/src/errors/consensus/signature/contract_bounded_key_non_batch_error.rs +29 -0
- package/src/errors/consensus/signature/contract_bounded_key_out_of_bounds_error.rs +29 -0
- package/src/errors/consensus/signature/mod.rs +6 -0
- package/src/identity/identity.rs +3 -2
- package/src/identity/identity_public_key/mod.rs +3 -2
- package/src/identity/mod.rs +1 -1
- package/src/identity/state_transition/identity_update_transition/transition.rs +5 -1
- package/src/state_transition/state_transition_factory.rs +12 -0
- package/src/utils.rs +2 -2
- package/src/validation/validation_result.rs +0 -8
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js +3 -1
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js +3 -1
package/src/identity/mod.rs
CHANGED
|
@@ -12,7 +12,7 @@ mod identity_public_key;
|
|
|
12
12
|
// use dpp::identity::IdentityPublicKey;
|
|
13
13
|
// use dpp::identity::{Identity, KeyID};
|
|
14
14
|
// use dpp::metadata::Metadata;
|
|
15
|
-
// use dpp::serialization::serialization_traits::{
|
|
15
|
+
// use dpp::serialization::serialization_traits::{PlatformDeserializableUntrusted, PlatformSerializable};
|
|
16
16
|
// use dpp::{ ProtocolError};
|
|
17
17
|
//
|
|
18
18
|
// use crate::identifier::IdentifierWrapper;
|
|
@@ -482,7 +482,11 @@ impl IdentityUpdateTransitionWasm {
|
|
|
482
482
|
let bls_adapter = BlsAdapter(bls);
|
|
483
483
|
|
|
484
484
|
let verification_result = StateTransition::IdentityUpdate(self.0.clone())
|
|
485
|
-
.verify_identity_signed_signature(
|
|
485
|
+
.verify_identity_signed_signature(
|
|
486
|
+
&identity_public_key.to_owned().into(),
|
|
487
|
+
&bls_adapter,
|
|
488
|
+
PlatformVersion::latest(),
|
|
489
|
+
);
|
|
486
490
|
|
|
487
491
|
match verification_result {
|
|
488
492
|
Ok(()) => Ok(true),
|
|
@@ -86,9 +86,21 @@ impl StateTransitionFactoryWasm {
|
|
|
86
86
|
| StateTransition::ShieldedWithdrawal(_)
|
|
87
87
|
| StateTransition::IdentityCreateFromShieldedPool(_)
|
|
88
88
|
| StateTransition::ShieldFromIdentity(_)
|
|
89
|
+
| StateTransition::TokenShieldedTransferWithShieldedFee(_)
|
|
90
|
+
| StateTransition::TokenUnshieldWithShieldedFee(_)
|
|
91
|
+
| StateTransition::TokenPurchaseFromShieldedPool(_)
|
|
89
92
|
| StateTransition::IdentityTopUpFromShieldedPool(_) => Err(JsValue::from_str(
|
|
90
93
|
"shielded transitions are not yet supported in wasm-dpp StateTransitionFactory",
|
|
91
94
|
)),
|
|
95
|
+
StateTransition::IdentityKeyLimitsUpdate(_) => Err(JsValue::from_str(
|
|
96
|
+
"identity key limits update transitions are not supported in wasm-dpp StateTransitionFactory; use wasm-dpp2",
|
|
97
|
+
)),
|
|
98
|
+
StateTransition::ContractUserModeration(_) => Err(JsValue::from_str(
|
|
99
|
+
"contract user moderation transitions are not supported in wasm-dpp StateTransitionFactory; use wasm-dpp2",
|
|
100
|
+
)),
|
|
101
|
+
StateTransition::ContractFeeClaim(_) => Err(JsValue::from_str(
|
|
102
|
+
"contract fee claim transitions are not supported in wasm-dpp StateTransitionFactory; use wasm-dpp2",
|
|
103
|
+
)),
|
|
92
104
|
},
|
|
93
105
|
Err(dpp::ProtocolError::StateTransitionError(e)) => match e {
|
|
94
106
|
StateTransitionError::InvalidStateTransitionError {
|
package/src/utils.rs
CHANGED
|
@@ -5,7 +5,7 @@ use anyhow::{anyhow, bail, Context};
|
|
|
5
5
|
use dpp::{consensus::ConsensusError, ProtocolError};
|
|
6
6
|
|
|
7
7
|
use dpp::platform_value::Value;
|
|
8
|
-
use dpp::serialization::
|
|
8
|
+
use dpp::serialization::PlatformDeserializableUntrusted;
|
|
9
9
|
use js_sys::{Function, Uint8Array};
|
|
10
10
|
use serde::de::DeserializeOwned;
|
|
11
11
|
use serde_json::Value as JsonValue;
|
|
@@ -355,7 +355,7 @@ pub(crate) fn consensus_errors_from_buffers(
|
|
|
355
355
|
.to_vec()
|
|
356
356
|
})
|
|
357
357
|
.map(|error_bytes| {
|
|
358
|
-
ConsensusError::
|
|
358
|
+
ConsensusError::deserialize_from_bytes_untrusted(&error_bytes.to_vec()).with_js_error()
|
|
359
359
|
})
|
|
360
360
|
.collect::<Result<Vec<ConsensusError>, JsValue>>()
|
|
361
361
|
}
|
|
@@ -4,7 +4,6 @@ use crate::{
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
use dpp::{consensus::ConsensusError, validation::ConsensusValidationResult};
|
|
7
|
-
use js_sys::JsString;
|
|
8
7
|
use wasm_bindgen::prelude::*;
|
|
9
8
|
|
|
10
9
|
#[wasm_bindgen(js_name=ValidationResult)]
|
|
@@ -35,13 +34,6 @@ impl ValidationResultWasm {
|
|
|
35
34
|
Ok(Self(ConsensusValidationResult::new_with_errors(vec![])))
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
/// This is just a test method - doesn't need to be in the resulted binding. Please
|
|
39
|
-
/// remove before shipping
|
|
40
|
-
#[wasm_bindgen(js_name=errorsText)]
|
|
41
|
-
pub fn errors_text(&self) -> Vec<JsString> {
|
|
42
|
-
self.0.errors.iter().map(|e| e.to_string().into()).collect()
|
|
43
|
-
}
|
|
44
|
-
|
|
45
37
|
#[wasm_bindgen(js_name=isValid)]
|
|
46
38
|
pub fn is_valid(&self) -> bool {
|
|
47
39
|
self.0.is_valid()
|
|
@@ -72,7 +72,9 @@ describe('DataContractCreateTransition', () => {
|
|
|
72
72
|
it('should return serialized State Transition', () => {
|
|
73
73
|
const result = stateTransition.toBuffer();
|
|
74
74
|
expect(result).to.be.instanceOf(Buffer);
|
|
75
|
-
|
|
75
|
+
// The fixture contract carries a V2 config (protocol version 14), whose optional
|
|
76
|
+
// moderation declaration is one more bincode byte than a V1 config.
|
|
77
|
+
expect(result).to.have.lengthOf(2371);
|
|
76
78
|
});
|
|
77
79
|
|
|
78
80
|
it('should be able to restore contract config from bytes', () => {
|
|
@@ -66,7 +66,9 @@ describe('DataContractUpdateTransition', () => {
|
|
|
66
66
|
it('should return serialized State Transition', () => {
|
|
67
67
|
const result = stateTransition.toBuffer();
|
|
68
68
|
expect(result).to.be.instanceOf(Buffer);
|
|
69
|
-
|
|
69
|
+
// The fixture contract carries a V2 config (protocol version 14), whose optional
|
|
70
|
+
// moderation declaration is one more bincode byte than a V1 config.
|
|
71
|
+
expect(result).to.have.lengthOf(2371);
|
|
70
72
|
});
|
|
71
73
|
|
|
72
74
|
it('should be able to restore contract config from bytes', () => {
|