@dashevo/wasm-dpp 0.24.0-dev.33 → 0.25.0-dev.10
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 +2 -2
- package/dist/wasm/wasm_dpp.d.ts +600 -454
- package/dist/wasm/wasm_dpp.js +178 -120
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/test/fixtures/getDocumentsFixture.js +5 -1
- package/lib/wasm/wasm_dpp.d.ts +600 -454
- package/package.json +4 -4
- package/src/dash_platform_protocol.rs +1 -1
- package/src/data_contract/data_contract.rs +2 -1
- package/src/data_contract/data_contract_facade.rs +2 -2
- package/src/data_contract/state_transition/data_contract_create_transition/apply.rs +1 -1
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +7 -16
- package/src/data_contract/state_transition/data_contract_create_transition/validation.rs +5 -3
- package/src/data_contract/state_transition/data_contract_update_transition/apply.rs +6 -2
- package/src/data_contract/state_transition/data_contract_update_transition/mod.rs +7 -18
- package/src/data_contract/state_transition/data_contract_update_transition/validation.rs +6 -4
- package/src/decode_protocol_entity.rs +19 -19
- package/src/document/extended_document.rs +5 -2
- package/src/document/fetch_and_validate_data_contract.rs +2 -2
- package/src/document/mod.rs +5 -3
- package/src/document/state_transition/document_batch_transition/apply_document_batch_transition.rs +9 -6
- package/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs +1 -1
- package/src/document/state_transition/document_batch_transition/document_transition/document_replace_transition.rs +1 -1
- package/src/document/state_transition/document_batch_transition/document_transition/mod.rs +1 -2
- package/src/document/state_transition/document_batch_transition/mod.rs +18 -25
- package/src/document/state_transition/document_batch_transition/validation/basic/validate_documents_batch_transition_basic.rs +4 -4
- package/src/document/state_transition/document_batch_transition/validation/state/validate_documents_batch_transitions_state.rs +3 -1
- package/src/errors/consensus/basic/data_contract/data_contract_have_new_unique_index_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs +3 -3
- package/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/data_contract_unique_indices_changed_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/duplicate_index_name_error.rs +3 -3
- package/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs +3 -3
- package/src/errors/consensus/basic/data_contract/incompatible_re2_pattern_error.rs +4 -4
- package/src/errors/consensus/basic/data_contract/index_error/duplicate_index_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/index_error/invalid_compound_index_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/index_error/invalid_index_property_type_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/index_error/invalid_indexed_property_constraint_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/index_error/system_property_index_already_present_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/index_error/undefined_index_property_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/index_error/unique_indices_limit_reached_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/invalid_data_contract_id_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs +1 -1
- package/src/errors/consensus/basic/data_contract/invalid_json_schema_ref_error.rs +2 -2
- package/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs +1 -1
- package/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs +1 -1
- package/src/errors/consensus/basic/document/data_contract_not_present_error.rs +1 -1
- package/src/errors/consensus/basic/document/duplicate_document_transitions_with_ids_error.rs +1 -1
- package/src/errors/consensus/basic/document/duplicate_document_transitions_with_indices_error.rs +1 -1
- package/src/errors/consensus/basic/document/inconsistent_compound_index_data_error.rs +2 -2
- package/src/errors/consensus/basic/document/invalid_document_transition_action_error.rs +1 -1
- package/src/errors/consensus/basic/document/invalid_document_transition_id_error.rs +1 -1
- package/src/errors/consensus/basic/document/invalid_document_type_error.rs +2 -2
- package/src/errors/consensus/basic/document/missing_data_contract_id_error.rs +1 -1
- package/src/errors/consensus/basic/document/missing_document_transition_action_error.rs +1 -1
- package/src/errors/consensus/basic/document/missing_document_transition_type_error.rs +1 -1
- package/src/errors/consensus/basic/document/missing_document_type_error.rs +1 -1
- package/src/errors/consensus/basic/identity/duplicated_identity_public_key_error.rs +1 -1
- package/src/errors/consensus/basic/identity/duplicated_identity_public_key_id_error.rs +1 -1
- package/src/errors/consensus/basic/identity/identity_asset_lock_proof_locked_transaction_mismatch_error.rs +1 -1
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_is_not_found_error.rs +1 -1
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs +1 -1
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_output_not_found_error.rs +1 -1
- package/src/errors/consensus/basic/identity/identity_insufficient_balance_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_asset_lock_proof_core_chain_height_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_asset_lock_transaction_output_return_size_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_asset_lock_proof_chain_lock_validation_error.rs +35 -0
- package/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_output_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_output_script_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_pooling_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_key_signature_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_public_key_data_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_public_key_type_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_error.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs +1 -1
- package/src/errors/consensus/basic/identity/missing_master_public_key_error.rs +1 -1
- package/src/errors/consensus/basic/identity/missing_public_key_error.rs +1 -1
- package/src/errors/consensus/basic/identity/mod.rs +2 -0
- package/src/errors/consensus/basic/incompatible_protocol_version_error.rs +2 -2
- package/src/errors/consensus/basic/invalid_identifier_error.rs +1 -1
- package/src/errors/consensus/basic/invalid_signature_public_key_security_level_error.rs +7 -3
- package/src/errors/consensus/basic/invalid_state_transition_signature_error.rs +1 -1
- package/src/errors/consensus/basic/json_schema_compilation_error.rs +1 -1
- package/src/errors/consensus/basic/json_schema_error.rs +1 -3
- package/src/errors/consensus/basic/public_key_is_disabled_error.rs +1 -1
- package/src/errors/consensus/basic/public_key_security_level_not_met_error.rs +2 -2
- package/src/errors/consensus/basic/state_transition/invalid_state_transition_type_error.rs +1 -1
- package/src/errors/consensus/basic/state_transition/missing_state_transition_type_error.rs +1 -1
- package/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs +1 -1
- package/src/errors/consensus/basic/unsupported_protocol_version_error.rs +1 -1
- package/src/errors/consensus/basic/wrong_public_key_purpose_error.rs +1 -1
- package/src/errors/consensus/consensus_error.rs +24 -4
- package/src/errors/consensus/deserialize.rs +1 -1
- package/src/errors/consensus/fee/balance_is_not_enough_error.rs +1 -1
- package/src/errors/consensus/signature/basic_bls_error.rs +38 -0
- package/src/errors/consensus/signature/basic_ecdsa_error.rs +38 -0
- package/src/errors/consensus/signature/mod.rs +6 -0
- package/src/errors/consensus/signature/signature_should_not_be_present_error.rs +38 -0
- package/src/errors/consensus/state/data_contract/data_contract_already_present_error.rs +2 -2
- package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_condition_error.rs +58 -1
- package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_execution_error.rs +66 -1
- package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_invalid_result_error.rs +50 -1
- package/src/errors/consensus/state/document/document_already_present_error.rs +1 -1
- package/src/errors/consensus/state/document/document_not_found_error.rs +1 -1
- package/src/errors/consensus/state/document/document_owner_id_mismatch_error.rs +1 -1
- package/src/errors/consensus/state/document/document_timestamp_window_violation_error.rs +2 -2
- package/src/errors/consensus/state/document/document_timestamps_mismatch_error.rs +1 -1
- package/src/errors/consensus/state/document/duplicate_unique_index_error.rs +1 -1
- package/src/errors/consensus/state/document/invalid_document_revision_error.rs +1 -1
- package/src/errors/consensus/state/identity/duplicated_identity_public_key_id_state_error.rs +1 -1
- package/src/errors/consensus/state/identity/duplicated_identity_public_key_state_error.rs +1 -1
- package/src/errors/consensus/state/identity/identity_already_exists_error.rs +1 -1
- package/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs +1 -1
- package/src/errors/consensus/state/identity/identity_public_key_is_disabled_error.rs +1 -1
- package/src/errors/consensus/state/identity/identity_public_key_is_read_only_error.rs +1 -1
- package/src/errors/consensus/state/identity/invalid_identity_public_key_id_error.rs +1 -1
- package/src/errors/consensus/state/identity/invalid_identity_revision_error.rs +1 -1
- package/src/errors/consensus/state/identity/max_identity_public_key_limit_reached_error.rs +1 -1
- package/src/errors/consensus/state/identity/missing_identity_public_key_ids_error.rs +26 -0
- package/src/errors/consensus/state/identity/mod.rs +2 -0
- package/src/errors/consensus/value_error.rs +1 -1
- package/src/errors/from.rs +0 -1
- package/src/generate_temporary_ecdsa_private_key.rs +2 -6
- package/src/identity/factory_utils.rs +4 -4
- package/src/identity/identity_public_key/key_type.rs +2 -0
- package/src/identity/identity_public_key/purpose.rs +7 -0
- package/src/identity/mod.rs +4 -2
- package/src/identity/state_transition/identity_create_transition/apply_identity_create_transition.rs +6 -2
- package/src/identity/state_transition/identity_create_transition/identity_create_transition.rs +14 -32
- package/src/identity/state_transition/identity_create_transition/identity_create_transition_state_validator.rs +3 -1
- package/src/identity/state_transition/identity_create_transition/to_object.rs +2 -2
- package/src/identity/state_transition/identity_public_key_transitions.rs +11 -11
- package/src/identity/state_transition/identity_topup_transition/apply_identity_topup_transition.rs +6 -2
- package/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs +7 -26
- package/src/identity/state_transition/identity_topup_transition/identity_topup_transition_state_validator.rs +3 -1
- package/src/identity/state_transition/identity_update_transition/apply_identity_update_transition.rs +3 -1
- package/src/identity/state_transition/identity_update_transition/identity_update_public_keys_validator.rs +2 -2
- package/src/identity/state_transition/identity_update_transition/identity_update_transition.rs +11 -32
- package/src/identity/state_transition/identity_update_transition/identity_update_transition_state_validator.rs +3 -2
- package/src/identity/state_transition/identity_update_transition/to_object.rs +2 -2
- package/src/identity/state_transition/validate_public_key_signatures.rs +2 -2
- package/src/state_repository.rs +3 -2
- package/src/state_transition/fee/calculate_state_transition_fee.rs +8 -5
- package/src/state_transition/state_transition_facade.rs +18 -21
- package/src/state_transition/validation/state_transition_fee_validator.rs +3 -1
- package/src/state_transition/validation/validate_state_transition_identity_signature.rs +22 -6
- package/src/state_transition/validation/validate_state_transition_key_signature.rs +7 -1
- package/src/utils.rs +2 -4
- package/src/validation/validation_result.rs +12 -7
- package/test/integration/dataContract/DataContractFacade.spec.js +17 -20
- package/test/integration/dataContract/stateTransition/DataContractUpdateTransition/validation/basic/validateDataContractUpdateTransitionBasicFactory.spec.js +5 -4
- package/test/integration/dataContract/validation/validateDataContractFactory.spec.js +0 -17
- package/test/integration/document/stateTransition/DocumentsBatchTransition/DocumentBatchTransition.spec.js +10 -3
- package/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js +4 -7
- package/test/integration/stateTransition/StateTransitionFacade.spec.js +21 -8
- package/test/unit/dataContract/DataContract.spec.js +9 -21
- package/test/unit/dataContract/DataContractFactory.spec.js +19 -28
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js +2 -4
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/applyDataContractCreateTransitionFactory.spec.js +0 -7
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/validation/state/validateDataContractCreateTransitionStateFactory.spec.js +10 -8
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js +3 -5
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/applyDataContractUpdateTransitionFactory.spec.js +1 -3
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/state/validateDataContractUpdateTransitionStateFactory.spec.js +8 -6
- package/test/unit/decodeProtocolEntityFactory.spec.js +4 -1
- package/test/unit/document/Document.spec.js +9 -7
- package/test/unit/document/DocumentFactory.spec.js +38 -90
- package/test/unit/document/stateTransition/DocumetsBatchTransition/DocumentsBatchTransition.spec.js +2 -3
- package/test/unit/document/stateTransition/DocumetsBatchTransition/applyDocumentsBatchTransitionFactory.spec.js +5 -6
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsBatchTransitionStateFactory.spec.js +20 -18
- package/test/unit/identity/Identity.spec.js +3 -8
- package/test/unit/identity/IdentityFactory.spec.js +3 -4
- package/test/unit/identity/stateTransition/IdentityCreateTransition/applyIdentityCreateTransitionFactory.spec.js +1 -2
- package/test/unit/identity/stateTransition/IdentityCreateTransition/validation/state/validateIdentityCreateTransitionStateFactory.spec.js +7 -3
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/applyIdentityTopUpTransitionFactory.spec.js +1 -2
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/validation/state/validateIdentityTopUpTransitionStateFactory.spec.js +5 -1
- package/test/unit/identity/stateTransition/IdentityUpdateTransition/applyIdentityUpdateTransitionFactory.spec.js +3 -3
- package/test/unit/stateTransition/validation/validateStateTransitionBasicFactory.spec.js +12 -6
- package/test/unit/stateTransition/validation/validateStateTransitionFeeFactory.spec.js +4 -16
- package/test/unit/stateTransition/validation/validateStateTransitionIdentitySignatureFactory.spec.js +8 -4
- package/test/unit/stateTransition/validation/validateStateTransitionKeySignatureFactory.spec.js +3 -1
- package/test/unit/stateTransition/validation/validateStateTransitionStateFactory.spec.js +7 -3
|
@@ -8,6 +8,7 @@ mod identity_insufficient_balance_error;
|
|
|
8
8
|
mod invalid_asset_lock_proof_core_chain_height_error;
|
|
9
9
|
mod invalid_asset_lock_proof_transaction_height_error;
|
|
10
10
|
mod invalid_asset_lock_transaction_output_return_size_error;
|
|
11
|
+
mod invalid_identity_asset_lock_proof_chain_lock_validation_error;
|
|
11
12
|
mod invalid_identity_asset_lock_transaction_error;
|
|
12
13
|
mod invalid_identity_asset_lock_transaction_output_error;
|
|
13
14
|
mod invalid_identity_credit_withdrawal_transition_core_fee_error;
|
|
@@ -32,6 +33,7 @@ pub use identity_insufficient_balance_error::*;
|
|
|
32
33
|
pub use invalid_asset_lock_proof_core_chain_height_error::*;
|
|
33
34
|
pub use invalid_asset_lock_proof_transaction_height_error::*;
|
|
34
35
|
pub use invalid_asset_lock_transaction_output_return_size_error::*;
|
|
36
|
+
pub use invalid_identity_asset_lock_proof_chain_lock_validation_error::*;
|
|
35
37
|
pub use invalid_identity_asset_lock_transaction_error::*;
|
|
36
38
|
pub use invalid_identity_asset_lock_transaction_output_error::*;
|
|
37
39
|
pub use invalid_identity_credit_withdrawal_transition_core_fee_error::*;
|
|
@@ -2,7 +2,7 @@ use crate::buffer::Buffer;
|
|
|
2
2
|
use dpp::consensus::basic::IncompatibleProtocolVersionError;
|
|
3
3
|
use dpp::consensus::codes::ErrorWithCode;
|
|
4
4
|
use dpp::consensus::ConsensusError;
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
use wasm_bindgen::prelude::*;
|
|
7
7
|
|
|
8
8
|
#[wasm_bindgen(js_name=IncompatibleProtocolVersionError)]
|
|
@@ -42,7 +42,7 @@ impl IncompatibleProtocolVersionErrorWasm {
|
|
|
42
42
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
43
43
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
44
44
|
.serialize()
|
|
45
|
-
.map_err(
|
|
45
|
+
.map_err(JsError::from)?;
|
|
46
46
|
|
|
47
47
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
48
48
|
}
|
|
@@ -41,7 +41,7 @@ impl InvalidIdentifierErrorWasm {
|
|
|
41
41
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
42
42
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
43
43
|
.serialize()
|
|
44
|
-
.map_err(
|
|
44
|
+
.map_err(JsError::from)?;
|
|
45
45
|
|
|
46
46
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
47
47
|
}
|
|
@@ -25,8 +25,12 @@ impl InvalidSignaturePublicKeySecurityLevelErrorWasm {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
#[wasm_bindgen(js_name=getKeySecurityLevelRequirement)]
|
|
28
|
-
pub fn
|
|
29
|
-
|
|
28
|
+
pub fn get_allowed_key_security_levels(&self) -> js_sys::Array {
|
|
29
|
+
let array = js_sys::Array::new();
|
|
30
|
+
for security_level in self.inner.allowed_key_security_levels() {
|
|
31
|
+
array.push(&JsValue::from(security_level as u32));
|
|
32
|
+
}
|
|
33
|
+
array
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
#[wasm_bindgen(js_name=getCode)]
|
|
@@ -43,7 +47,7 @@ impl InvalidSignaturePublicKeySecurityLevelErrorWasm {
|
|
|
43
47
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
44
48
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
45
49
|
.serialize()
|
|
46
|
-
.map_err(
|
|
50
|
+
.map_err(JsError::from)?;
|
|
47
51
|
|
|
48
52
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
49
53
|
}
|
|
@@ -31,7 +31,7 @@ impl InvalidStateTransitionSignatureErrorWasm {
|
|
|
31
31
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
32
32
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
33
33
|
.serialize()
|
|
34
|
-
.map_err(
|
|
34
|
+
.map_err(JsError::from)?;
|
|
35
35
|
|
|
36
36
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
37
37
|
}
|
|
@@ -36,7 +36,7 @@ impl JsonSchemaCompilationErrorWasm {
|
|
|
36
36
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
37
37
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
38
38
|
.serialize()
|
|
39
|
-
.map_err(
|
|
39
|
+
.map_err(JsError::from)?;
|
|
40
40
|
|
|
41
41
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
42
42
|
}
|
|
@@ -5,8 +5,6 @@ use dpp::errors::consensus::codes::ErrorWithCode;
|
|
|
5
5
|
|
|
6
6
|
use dpp::errors::consensus::ConsensusError;
|
|
7
7
|
|
|
8
|
-
use serde_json::Value;
|
|
9
|
-
|
|
10
8
|
use crate::buffer::Buffer;
|
|
11
9
|
use wasm_bindgen::prelude::*;
|
|
12
10
|
|
|
@@ -70,7 +68,7 @@ impl JsonSchemaErrorWasm {
|
|
|
70
68
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
71
69
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
72
70
|
.serialize()
|
|
73
|
-
.map_err(
|
|
71
|
+
.map_err(JsError::from)?;
|
|
74
72
|
|
|
75
73
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
76
74
|
}
|
|
@@ -37,7 +37,7 @@ impl PublicKeyIsDisabledErrorWasm {
|
|
|
37
37
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
38
38
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
39
39
|
.serialize()
|
|
40
|
-
.map_err(
|
|
40
|
+
.map_err(JsError::from)?;
|
|
41
41
|
|
|
42
42
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
43
43
|
}
|
|
@@ -3,7 +3,7 @@ use crate::Serialize;
|
|
|
3
3
|
use dpp::consensus::codes::ErrorWithCode;
|
|
4
4
|
use dpp::consensus::signature::PublicKeySecurityLevelNotMetError;
|
|
5
5
|
use dpp::consensus::ConsensusError;
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
use wasm_bindgen::prelude::*;
|
|
8
8
|
|
|
9
9
|
#[derive(Serialize)]
|
|
@@ -44,7 +44,7 @@ impl PublicKeySecurityLevelNotMetErrorWasm {
|
|
|
44
44
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
45
45
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
46
46
|
.serialize()
|
|
47
|
-
.map_err(
|
|
47
|
+
.map_err(JsError::from)?;
|
|
48
48
|
|
|
49
49
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
50
50
|
}
|
|
@@ -43,7 +43,7 @@ impl InvalidStateTransitionTypeErrorWasm {
|
|
|
43
43
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
44
44
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
45
45
|
.serialize()
|
|
46
|
-
.map_err(
|
|
46
|
+
.map_err(JsError::from)?;
|
|
47
47
|
|
|
48
48
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
49
49
|
}
|
|
@@ -38,7 +38,7 @@ impl MissingStateTransitionTypeErrorWasm {
|
|
|
38
38
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
39
39
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
40
40
|
.serialize()
|
|
41
|
-
.map_err(
|
|
41
|
+
.map_err(JsError::from)?;
|
|
42
42
|
|
|
43
43
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
44
44
|
}
|
package/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs
CHANGED
|
@@ -41,7 +41,7 @@ impl StateTransitionMaxSizeExceededErrorWasm {
|
|
|
41
41
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
42
42
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
43
43
|
.serialize()
|
|
44
|
-
.map_err(
|
|
44
|
+
.map_err(JsError::from)?;
|
|
45
45
|
|
|
46
46
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
47
47
|
}
|
|
@@ -41,7 +41,7 @@ impl UnsupportedProtocolVersionErrorWasm {
|
|
|
41
41
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
42
42
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
43
43
|
.serialize()
|
|
44
|
-
.map_err(
|
|
44
|
+
.map_err(JsError::from)?;
|
|
45
45
|
|
|
46
46
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
47
47
|
}
|
|
@@ -41,7 +41,7 @@ impl WrongPublicKeyPurposeErrorWasm {
|
|
|
41
41
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
42
42
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
43
43
|
.serialize()
|
|
44
|
-
.map_err(
|
|
44
|
+
.map_err(JsError::from)?;
|
|
45
45
|
|
|
46
46
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
47
47
|
}
|
|
@@ -13,6 +13,7 @@ use crate::errors::consensus::basic::identity::{
|
|
|
13
13
|
IdentityAssetLockTransactionOutputNotFoundErrorWasm, IdentityInsufficientBalanceErrorWasm,
|
|
14
14
|
InvalidAssetLockProofCoreChainHeightErrorWasm, InvalidAssetLockProofTransactionHeightErrorWasm,
|
|
15
15
|
InvalidAssetLockTransactionOutputReturnSizeErrorWasm,
|
|
16
|
+
InvalidIdentityAssetLockProofChainLockValidationErrorWasm,
|
|
16
17
|
InvalidIdentityAssetLockTransactionErrorWasm,
|
|
17
18
|
InvalidIdentityAssetLockTransactionOutputErrorWasm,
|
|
18
19
|
InvalidIdentityCreditWithdrawalTransitionCoreFeeErrorWasm,
|
|
@@ -24,6 +25,7 @@ use crate::errors::consensus::basic::identity::{
|
|
|
24
25
|
};
|
|
25
26
|
use crate::errors::consensus::state::identity::{
|
|
26
27
|
DuplicatedIdentityPublicKeyIdStateErrorWasm, DuplicatedIdentityPublicKeyStateErrorWasm,
|
|
28
|
+
MissingIdentityPublicKeyIdsErrorWasm,
|
|
27
29
|
};
|
|
28
30
|
use dpp::consensus::basic::BasicError;
|
|
29
31
|
use dpp::consensus::basic::BasicError::{
|
|
@@ -34,6 +36,7 @@ use dpp::consensus::basic::BasicError::{
|
|
|
34
36
|
IdentityAssetLockTransactionOutputNotFoundError, IncompatibleProtocolVersionError,
|
|
35
37
|
IncompatibleRe2PatternError, InvalidAssetLockProofCoreChainHeightError,
|
|
36
38
|
InvalidAssetLockProofTransactionHeightError, InvalidAssetLockTransactionOutputReturnSizeError,
|
|
39
|
+
InvalidIdentityAssetLockProofChainLockValidationError,
|
|
37
40
|
InvalidIdentityAssetLockTransactionError, InvalidIdentityAssetLockTransactionOutputError,
|
|
38
41
|
InvalidIdentityCreditWithdrawalTransitionCoreFeeError,
|
|
39
42
|
InvalidIdentityCreditWithdrawalTransitionOutputScriptError, InvalidIdentityPublicKeyDataError,
|
|
@@ -44,10 +47,11 @@ use dpp::consensus::basic::BasicError::{
|
|
|
44
47
|
};
|
|
45
48
|
use dpp::consensus::fee::fee_error::FeeError;
|
|
46
49
|
use dpp::consensus::signature::SignatureError;
|
|
50
|
+
|
|
47
51
|
use dpp::consensus::state::data_trigger::data_trigger_error::DataTriggerError;
|
|
48
52
|
use dpp::consensus::state::state_error::StateError;
|
|
49
|
-
|
|
50
|
-
use wasm_bindgen::JsValue;
|
|
53
|
+
|
|
54
|
+
use wasm_bindgen::{JsError, JsValue};
|
|
51
55
|
|
|
52
56
|
use crate::errors::consensus::basic::data_contract::{
|
|
53
57
|
DataContractHaveNewUniqueIndexErrorWasm, DataContractImmutablePropertiesUpdateErrorWasm,
|
|
@@ -63,7 +67,10 @@ use crate::errors::consensus::basic::state_transition::{
|
|
|
63
67
|
InvalidStateTransitionTypeErrorWasm, MissingStateTransitionTypeErrorWasm,
|
|
64
68
|
StateTransitionMaxSizeExceededErrorWasm,
|
|
65
69
|
};
|
|
66
|
-
use crate::errors::consensus::signature::
|
|
70
|
+
use crate::errors::consensus::signature::{
|
|
71
|
+
BasicBLSErrorWasm, BasicECDSAErrorWasm, IdentityNotFoundErrorWasm,
|
|
72
|
+
SignatureShouldNotBePresentErrorWasm,
|
|
73
|
+
};
|
|
67
74
|
use crate::errors::consensus::state::data_contract::data_trigger::{
|
|
68
75
|
DataTriggerConditionErrorWasm, DataTriggerExecutionErrorWasm,
|
|
69
76
|
};
|
|
@@ -79,7 +86,6 @@ use crate::errors::consensus::state::identity::{
|
|
|
79
86
|
InvalidIdentityPublicKeyIdErrorWasm, InvalidIdentityRevisionErrorWasm,
|
|
80
87
|
MaxIdentityPublicKeyLimitReachedErrorWasm,
|
|
81
88
|
};
|
|
82
|
-
use crate::errors::value_error::PlatformValueErrorWasm;
|
|
83
89
|
|
|
84
90
|
use crate::errors::consensus::basic::data_contract::{
|
|
85
91
|
DataContractMaxDepthExceedErrorWasm, DuplicateIndexErrorWasm, DuplicateIndexNameErrorWasm,
|
|
@@ -117,6 +123,7 @@ pub fn from_consensus_error_ref(e: &DPPConsensusError) -> JsValue {
|
|
|
117
123
|
DPPConsensusError::SignatureError(e) => from_signature_error(e),
|
|
118
124
|
DPPConsensusError::StateError(state_error) => from_state_error(state_error),
|
|
119
125
|
DPPConsensusError::BasicError(basic_error) => from_basic_error(basic_error),
|
|
126
|
+
DPPConsensusError::DefaultError => JsError::new("DefaultError").into(),
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
129
|
|
|
@@ -166,6 +173,9 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
|
|
|
166
173
|
StateError::IdentityPublicKeyIsDisabledError(e) => {
|
|
167
174
|
IdentityPublicKeyIsDisabledErrorWasm::from(e).into()
|
|
168
175
|
}
|
|
176
|
+
StateError::MissingIdentityPublicKeyIdsError(e) => {
|
|
177
|
+
MissingIdentityPublicKeyIdsErrorWasm::from(e).into()
|
|
178
|
+
}
|
|
169
179
|
StateError::DataTriggerError(data_trigger_error) => match data_trigger_error.deref() {
|
|
170
180
|
DataTriggerError::DataTriggerConditionError(e) => {
|
|
171
181
|
DataTriggerConditionErrorWasm::from(e).into()
|
|
@@ -177,6 +187,8 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
|
|
|
177
187
|
DataTriggerInvalidResultErrorWasm::from(e).into()
|
|
178
188
|
}
|
|
179
189
|
},
|
|
190
|
+
// TODO(v0.24-backport): this error seems to be used only in drive executor. Do we need binding for it?
|
|
191
|
+
StateError::DataTriggerActionError(_) => JsError::new("Data Trigger action error").into(),
|
|
180
192
|
StateError::IdentityAlreadyExistsError(e) => {
|
|
181
193
|
let wasm_error: IdentityAlreadyExistsErrorWasm = e.into();
|
|
182
194
|
wasm_error.into()
|
|
@@ -323,6 +335,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
|
|
|
323
335
|
InvalidInstantAssetLockProofSignatureError(e) => {
|
|
324
336
|
InvalidInstantAssetLockProofSignatureErrorWasm::from(e).into()
|
|
325
337
|
}
|
|
338
|
+
InvalidIdentityAssetLockProofChainLockValidationError(e) => {
|
|
339
|
+
InvalidIdentityAssetLockProofChainLockValidationErrorWasm::from(e).into()
|
|
340
|
+
}
|
|
326
341
|
IdentityAssetLockProofLockedTransactionMismatchError(e) => {
|
|
327
342
|
IdentityAssetLockProofLockedTransactionMismatchErrorWasm::from(e).into()
|
|
328
343
|
}
|
|
@@ -370,6 +385,11 @@ fn from_signature_error(signature_error: &SignatureError) -> JsValue {
|
|
|
370
385
|
SignatureError::WrongPublicKeyPurposeError(err) => {
|
|
371
386
|
WrongPublicKeyPurposeErrorWasm::from(err).into()
|
|
372
387
|
}
|
|
388
|
+
SignatureError::SignatureShouldNotBePresentError(err) => {
|
|
389
|
+
SignatureShouldNotBePresentErrorWasm::from(err).into()
|
|
390
|
+
}
|
|
391
|
+
SignatureError::BasicECDSAError(err) => BasicECDSAErrorWasm::from(err).into(),
|
|
392
|
+
SignatureError::BasicBLSError(err) => BasicBLSErrorWasm::from(err).into(),
|
|
373
393
|
}
|
|
374
394
|
}
|
|
375
395
|
|
|
@@ -6,6 +6,6 @@ use wasm_bindgen::{JsError, JsValue};
|
|
|
6
6
|
#[wasm_bindgen(js_name=deserializeConsensusError)]
|
|
7
7
|
pub fn deserialize_consensus_error(bytes: Vec<u8>) -> Result<JsValue, JsError> {
|
|
8
8
|
ConsensusError::deserialize(bytes.as_slice())
|
|
9
|
-
.
|
|
9
|
+
.map(from_consensus_error)
|
|
10
10
|
.map_err(|e| e.into())
|
|
11
11
|
}
|
|
@@ -49,7 +49,7 @@ impl BalanceIsNotEnoughErrorWasm {
|
|
|
49
49
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
50
50
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
51
51
|
.serialize()
|
|
52
|
-
.map_err(
|
|
52
|
+
.map_err(JsError::from)?;
|
|
53
53
|
|
|
54
54
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
55
55
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
+
use dpp::consensus::signature::BasicBLSError;
|
|
4
|
+
use dpp::consensus::ConsensusError;
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=BasicBLSError)]
|
|
8
|
+
pub struct BasicBLSErrorWasm {
|
|
9
|
+
inner: BasicBLSError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&BasicBLSError> for BasicBLSErrorWasm {
|
|
13
|
+
fn from(e: &BasicBLSError) -> Self {
|
|
14
|
+
Self { inner: e.clone() }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=BasicBLSError)]
|
|
19
|
+
impl BasicBLSErrorWasm {
|
|
20
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
21
|
+
pub fn get_code(&self) -> u32 {
|
|
22
|
+
ConsensusError::from(self.inner.clone()).code()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[wasm_bindgen(getter)]
|
|
26
|
+
pub fn message(&self) -> String {
|
|
27
|
+
self.inner.to_string()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[wasm_bindgen(js_name=serialize)]
|
|
31
|
+
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
32
|
+
let bytes = ConsensusError::from(self.inner.clone())
|
|
33
|
+
.serialize()
|
|
34
|
+
.map_err(JsError::from)?;
|
|
35
|
+
|
|
36
|
+
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
+
use dpp::consensus::signature::BasicECDSAError;
|
|
4
|
+
use dpp::consensus::ConsensusError;
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=BasicECDSAError)]
|
|
8
|
+
pub struct BasicECDSAErrorWasm {
|
|
9
|
+
inner: BasicECDSAError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&BasicECDSAError> for BasicECDSAErrorWasm {
|
|
13
|
+
fn from(e: &BasicECDSAError) -> Self {
|
|
14
|
+
Self { inner: e.clone() }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=BasicECDSAError)]
|
|
19
|
+
impl BasicECDSAErrorWasm {
|
|
20
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
21
|
+
pub fn get_code(&self) -> u32 {
|
|
22
|
+
ConsensusError::from(self.inner.clone()).code()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[wasm_bindgen(getter)]
|
|
26
|
+
pub fn message(&self) -> String {
|
|
27
|
+
self.inner.to_string()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[wasm_bindgen(js_name=serialize)]
|
|
31
|
+
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
32
|
+
let bytes = ConsensusError::from(self.inner.clone())
|
|
33
|
+
.serialize()
|
|
34
|
+
.map_err(JsError::from)?;
|
|
35
|
+
|
|
36
|
+
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
mod basic_bls_error;
|
|
2
|
+
mod basic_ecdsa_error;
|
|
1
3
|
mod identity_not_found_error;
|
|
4
|
+
mod signature_should_not_be_present_error;
|
|
2
5
|
|
|
6
|
+
pub use basic_bls_error::*;
|
|
7
|
+
pub use basic_ecdsa_error::*;
|
|
3
8
|
pub use identity_not_found_error::*;
|
|
9
|
+
pub use signature_should_not_be_present_error::*;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
+
use dpp::consensus::signature::SignatureShouldNotBePresentError;
|
|
4
|
+
use dpp::consensus::ConsensusError;
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=SignatureShouldNotBePresentError)]
|
|
8
|
+
pub struct SignatureShouldNotBePresentErrorWasm {
|
|
9
|
+
inner: SignatureShouldNotBePresentError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&SignatureShouldNotBePresentError> for SignatureShouldNotBePresentErrorWasm {
|
|
13
|
+
fn from(e: &SignatureShouldNotBePresentError) -> Self {
|
|
14
|
+
Self { inner: e.clone() }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=SignatureShouldNotBePresentError)]
|
|
19
|
+
impl SignatureShouldNotBePresentErrorWasm {
|
|
20
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
21
|
+
pub fn get_code(&self) -> u32 {
|
|
22
|
+
ConsensusError::from(self.inner.clone()).code()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[wasm_bindgen(getter)]
|
|
26
|
+
pub fn message(&self) -> String {
|
|
27
|
+
self.inner.to_string()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[wasm_bindgen(js_name=serialize)]
|
|
31
|
+
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
32
|
+
let bytes = ConsensusError::from(self.inner.clone())
|
|
33
|
+
.serialize()
|
|
34
|
+
.map_err(JsError::from)?;
|
|
35
|
+
|
|
36
|
+
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -3,7 +3,7 @@ use crate::identifier::IdentifierWrapper;
|
|
|
3
3
|
use dpp::consensus::codes::ErrorWithCode;
|
|
4
4
|
use dpp::consensus::state::data_contract::data_contract_already_present_error::DataContractAlreadyPresentError;
|
|
5
5
|
use dpp::consensus::ConsensusError;
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
use wasm_bindgen::prelude::*;
|
|
8
8
|
|
|
9
9
|
#[wasm_bindgen(js_name=DataContractAlreadyPresentError)]
|
|
@@ -45,7 +45,7 @@ impl DataContractAlreadyPresentErrorWasm {
|
|
|
45
45
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
46
46
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
47
47
|
.serialize()
|
|
48
|
-
.map_err(
|
|
48
|
+
.map_err(JsError::from)?;
|
|
49
49
|
|
|
50
50
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
51
51
|
}
|
package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_condition_error.rs
CHANGED
|
@@ -3,6 +3,7 @@ use crate::buffer::Buffer;
|
|
|
3
3
|
use dpp::consensus::codes::ErrorWithCode;
|
|
4
4
|
use dpp::consensus::state::data_trigger::data_trigger_condition_error::DataTriggerConditionError;
|
|
5
5
|
use dpp::consensus::ConsensusError;
|
|
6
|
+
use dpp::identifier::Identifier;
|
|
6
7
|
use wasm_bindgen::prelude::*;
|
|
7
8
|
|
|
8
9
|
#[wasm_bindgen(js_name=DataTriggerConditionError)]
|
|
@@ -47,8 +48,64 @@ impl DataTriggerConditionErrorWasm {
|
|
|
47
48
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
48
49
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
49
50
|
.serialize()
|
|
50
|
-
.map_err(
|
|
51
|
+
.map_err(JsError::from)?;
|
|
51
52
|
|
|
52
53
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
53
54
|
}
|
|
54
55
|
}
|
|
56
|
+
|
|
57
|
+
#[wasm_bindgen(js_name=DataTriggerActionConditionError)]
|
|
58
|
+
pub struct DataTriggerActionConditionErrorWasm {
|
|
59
|
+
data_contract_id: Identifier,
|
|
60
|
+
document_transition_id: Identifier,
|
|
61
|
+
message: String,
|
|
62
|
+
owner_id: Option<Identifier>,
|
|
63
|
+
code: u32,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#[wasm_bindgen(js_class=DataTriggerActionConditionError)]
|
|
67
|
+
impl DataTriggerActionConditionErrorWasm {
|
|
68
|
+
#[wasm_bindgen(js_name=getDataContractId)]
|
|
69
|
+
pub fn data_contract_id(&self) -> Buffer {
|
|
70
|
+
Buffer::from_bytes(self.data_contract_id.as_bytes())
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#[wasm_bindgen(js_name=getDocumentTransitionId)]
|
|
74
|
+
pub fn document_transition_id(&self) -> Buffer {
|
|
75
|
+
Buffer::from_bytes(self.document_transition_id.as_bytes())
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#[wasm_bindgen(js_name=getMessage)]
|
|
79
|
+
pub fn message(&self) -> String {
|
|
80
|
+
self.message.clone()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#[wasm_bindgen(js_name=getOwnerId)]
|
|
84
|
+
pub fn owner_id(&self) -> Option<Buffer> {
|
|
85
|
+
let owner_id = self.owner_id.as_ref()?;
|
|
86
|
+
Some(Buffer::from_bytes(owner_id.as_bytes()))
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
90
|
+
pub fn get_code(&self) -> u32 {
|
|
91
|
+
self.code
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
impl DataTriggerActionConditionErrorWasm {
|
|
96
|
+
pub fn new(
|
|
97
|
+
data_contract_id: Identifier,
|
|
98
|
+
document_transition_id: Identifier,
|
|
99
|
+
message: String,
|
|
100
|
+
owner_id: Option<Identifier>,
|
|
101
|
+
code: u32,
|
|
102
|
+
) -> Self {
|
|
103
|
+
Self {
|
|
104
|
+
data_contract_id,
|
|
105
|
+
document_transition_id,
|
|
106
|
+
message,
|
|
107
|
+
owner_id,
|
|
108
|
+
code,
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_execution_error.rs
CHANGED
|
@@ -2,6 +2,7 @@ use crate::buffer::Buffer;
|
|
|
2
2
|
use dpp::consensus::codes::ErrorWithCode;
|
|
3
3
|
use dpp::consensus::state::data_trigger::data_trigger_execution_error::DataTriggerExecutionError;
|
|
4
4
|
use dpp::consensus::ConsensusError;
|
|
5
|
+
use dpp::identifier::Identifier;
|
|
5
6
|
use wasm_bindgen::prelude::*;
|
|
6
7
|
|
|
7
8
|
#[wasm_bindgen(js_name=DataTriggerExecutionError)]
|
|
@@ -46,8 +47,72 @@ impl DataTriggerExecutionErrorWasm {
|
|
|
46
47
|
pub fn serialize(&self) -> Result<Buffer, JsError> {
|
|
47
48
|
let bytes = ConsensusError::from(self.inner.clone())
|
|
48
49
|
.serialize()
|
|
49
|
-
.map_err(
|
|
50
|
+
.map_err(JsError::from)?;
|
|
50
51
|
|
|
51
52
|
Ok(Buffer::from_bytes(bytes.as_slice()))
|
|
52
53
|
}
|
|
53
54
|
}
|
|
55
|
+
|
|
56
|
+
#[wasm_bindgen(js_name=DataTriggerActionExecutionError)]
|
|
57
|
+
pub struct DataTriggerActionExecutionErrorWasm {
|
|
58
|
+
data_contract_id: Identifier,
|
|
59
|
+
document_transition_id: Identifier,
|
|
60
|
+
message: String,
|
|
61
|
+
execution_error: JsError,
|
|
62
|
+
owner_id: Option<Identifier>,
|
|
63
|
+
code: u32,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#[wasm_bindgen(js_class=DataTriggerActionExecutionError)]
|
|
67
|
+
impl DataTriggerActionExecutionErrorWasm {
|
|
68
|
+
#[wasm_bindgen(js_name=getDataContractId)]
|
|
69
|
+
pub fn data_contract_id(&self) -> Buffer {
|
|
70
|
+
Buffer::from_bytes(self.data_contract_id.as_bytes())
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#[wasm_bindgen(js_name=getExecutionError)]
|
|
74
|
+
pub fn data_execution_error(&self) -> JsError {
|
|
75
|
+
self.execution_error.clone()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#[wasm_bindgen(js_name=getDocumentTransitionId)]
|
|
79
|
+
pub fn document_transition_id(&self) -> Buffer {
|
|
80
|
+
Buffer::from_bytes(self.document_transition_id.as_bytes())
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#[wasm_bindgen(js_name=getMessage)]
|
|
84
|
+
pub fn message(&self) -> String {
|
|
85
|
+
self.message.clone()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#[wasm_bindgen(js_name=getOwnerId)]
|
|
89
|
+
pub fn owner_id(&self) -> Option<Buffer> {
|
|
90
|
+
let owner_id = self.owner_id.as_ref()?;
|
|
91
|
+
Some(Buffer::from_bytes(owner_id.as_bytes()))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
95
|
+
pub fn get_code(&self) -> u32 {
|
|
96
|
+
self.code
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
impl DataTriggerActionExecutionErrorWasm {
|
|
101
|
+
pub fn new(
|
|
102
|
+
data_contract_id: Identifier,
|
|
103
|
+
document_transition_id: Identifier,
|
|
104
|
+
message: String,
|
|
105
|
+
execution_error: wasm_bindgen::JsError,
|
|
106
|
+
owner_id: Option<Identifier>,
|
|
107
|
+
code: u32,
|
|
108
|
+
) -> Self {
|
|
109
|
+
Self {
|
|
110
|
+
data_contract_id,
|
|
111
|
+
document_transition_id,
|
|
112
|
+
message,
|
|
113
|
+
execution_error,
|
|
114
|
+
owner_id,
|
|
115
|
+
code,
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|