@dashevo/wasm-dpp 0.24.0-dev.11 → 0.24.0-dev.13
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 +3 -0
- package/README.md +5 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +9 -0
- package/dist/lib/dpp.d.ts +9 -0
- package/dist/lib/errors/AbstractConsensusError.d.ts +10 -0
- package/dist/lib/errors/DPPError.d.ts +5 -0
- package/dist/lib/errors/patchConsensusErrors.d.ts +1 -0
- package/dist/lib/{patchIdentifier.d.ts → identifier/patchIdentifier.d.ts} +1 -1
- package/dist/{index.d.ts → lib/index.d.ts} +1 -1
- package/dist/lib/utils/extend.d.ts +1 -0
- package/dist/wasm/wasm_dpp.d.ts +1595 -518
- package/karma.conf.js +5 -0
- package/lib/dpp.ts +24 -0
- package/lib/errors/AbstractConsensusError.ts +13 -0
- package/lib/errors/DPPError.ts +15 -0
- package/lib/errors/patchConsensusErrors.ts +175 -0
- package/lib/{patchIdentifier.ts → identifier/patchIdentifier.ts} +6 -5
- package/{index.ts → lib/index.ts} +5 -4
- package/lib/test/bootstrap.js +5 -0
- package/lib/test/expect/expectError.js +4 -2
- package/lib/test/mocks/getBlsAdapterMock.js +36 -0
- package/lib/test/utils/newDocumentsContainer.js +36 -0
- package/lib/utils/extend.ts +6 -0
- package/package.json +9 -6
- package/src/bls_adapter.rs +16 -1
- package/src/data_contract/data_contract.rs +35 -7
- package/src/data_contract/errors/invalid_data_contract.rs +21 -0
- package/src/data_contract/errors/invalid_document_type.rs +1 -1
- package/src/data_contract/index.rs +56 -1
- package/src/data_contract/mod.rs +1 -0
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +6 -8
- package/src/data_contract/state_transition/data_contract_create_transition/validation.rs +4 -4
- package/src/data_contract/state_transition/data_contract_update_transition/apply.rs +44 -0
- package/src/data_contract/state_transition/data_contract_update_transition/mod.rs +145 -0
- package/src/data_contract/state_transition/data_contract_update_transition/validation.rs +49 -0
- package/src/data_contract/state_transition/mod.rs +2 -0
- package/src/data_contract_factory/data_contract_factory.rs +25 -12
- package/src/document/errors/invalid_document_error.rs +10 -9
- package/src/document/errors/invalid_initial_revision_error.rs +1 -1
- package/src/document/errors/mismatch_owners_ids_error.rs +14 -4
- package/src/document/errors/mod.rs +17 -13
- package/src/document/errors/no_documents_supplied_error.rs +4 -4
- package/src/document/factory.rs +192 -0
- package/src/document/mod.rs +222 -30
- package/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs +47 -1
- package/src/document/state_transition/document_batch_transition/document_transition/document_delete_transition.rs +25 -1
- package/src/document/state_transition/document_batch_transition/document_transition/document_replace_transition.rs +65 -0
- package/src/document/state_transition/document_batch_transition/document_transition/mod.rs +123 -3
- package/src/document/state_transition/document_batch_transition/mod.rs +378 -0
- package/src/document/validator.rs +30 -0
- package/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs +5 -5
- package/src/errors/consensus/basic/document/duplicate_document_transitions_with_ids_error.rs +4 -4
- package/src/errors/consensus/basic/document/duplicate_document_transitions_with_indices_error.rs +36 -0
- package/src/errors/consensus/basic/document/missing_document_transition_type_error.rs +20 -0
- package/src/errors/consensus/basic/document/mod.rs +4 -0
- package/src/errors/consensus/basic/identity/duplicated_identity_public_key_error.rs +2 -2
- package/src/errors/consensus/basic/identity/duplicated_identity_public_key_id_error.rs +2 -2
- package/src/errors/consensus/basic/identity/identity_asset_lock_proof_locked_transaction_mismatch_error.rs +6 -2
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs +5 -2
- package/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs +3 -3
- package/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs +2 -2
- package/src/errors/consensus/basic/json_schema_error.rs +1 -1
- package/src/errors/consensus_error.rs +15 -8
- package/src/errors/dpp_error.rs +17 -0
- package/src/errors/from.rs +6 -1
- package/src/errors/js_conversion.rs +19 -4
- package/src/errors/mod.rs +3 -0
- package/src/errors/protocol_error.rs +15 -0
- package/src/{identifier.rs → identifier/mod.rs} +48 -3
- package/src/identity/errors/asset_lock_output_not_found_error.rs +11 -0
- package/src/identity/errors/asset_lock_transaction_is_not_found_error.rs +20 -0
- package/src/identity/errors/mod.rs +7 -0
- package/src/identity/errors/unknown_asset_lock_proof_type_error.rs +26 -0
- package/src/{identity_facade.rs → identity/identity_facade.rs} +3 -5
- package/src/{identity_public_key → identity/identity_public_key}/key_type.rs +0 -0
- package/src/{identity_public_key → identity/identity_public_key}/mod.rs +41 -10
- package/src/{identity_public_key → identity/identity_public_key}/purpose.rs +0 -0
- package/src/{identity_public_key → identity/identity_public_key}/security_level.rs +0 -0
- package/src/{identity.rs → identity/mod.rs} +20 -12
- package/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof.rs +132 -0
- package/src/identity/state_transition/asset_lock_proof/chain/chain_asset_lock_proof_structure_validator.rs +72 -0
- package/src/identity/state_transition/asset_lock_proof/chain/mod.rs +4 -0
- package/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof.rs +177 -0
- package/src/identity/state_transition/asset_lock_proof/instant/instant_asset_lock_proof_structure_validator.rs +72 -0
- package/src/identity/state_transition/asset_lock_proof/instant/mod.rs +4 -0
- package/src/identity/state_transition/asset_lock_proof/mod.rs +269 -0
- package/src/identity/state_transition/identity_create_transition/apply_identity_create_transition.rs +26 -0
- package/src/identity/state_transition/identity_create_transition/identity_create_transition.rs +335 -0
- package/src/identity/state_transition/identity_create_transition/identity_create_transition_basic_validator.rs +153 -0
- package/src/identity/state_transition/identity_create_transition/identity_create_transition_state_validator.rs +37 -0
- package/src/identity/state_transition/identity_create_transition/mod.rs +8 -0
- package/src/identity/state_transition/identity_create_transition/to_object.rs +46 -0
- package/src/identity/state_transition/identity_topup_transition/apply_identity_topup_transition.rs +31 -0
- package/src/identity/state_transition/identity_topup_transition/identity_topup_transition.rs +280 -0
- package/src/identity/state_transition/identity_topup_transition/identity_topup_transition_basic_validator.rs +113 -0
- package/src/identity/state_transition/identity_topup_transition/identity_topup_transition_state_validator.rs +37 -0
- package/src/identity/state_transition/identity_topup_transition/mod.rs +8 -0
- package/src/identity/state_transition/identity_topup_transition/to_object.rs +42 -0
- package/src/identity/state_transition/mod.rs +9 -0
- package/src/identity/state_transition/validate_public_key_signatures.rs +59 -0
- package/src/identity/validation/mod.rs +3 -0
- package/src/identity/validation/public_keys_validator.rs +76 -0
- package/src/identity_public_key/public_keys_validator.rs +1 -1
- package/src/lib.rs +3 -6
- package/src/lodash.rs +7 -0
- package/src/state_repository.rs +188 -36
- package/src/state_transition/mod.rs +12 -0
- package/src/utils.rs +102 -7
- package/src/validation/json_schema_validator.rs +41 -0
- package/src/validation/mod.rs +5 -0
- package/src/{validation_result.rs → validation/validation_result.rs} +23 -5
- package/src/version/mod.rs +2 -0
- package/src/version/protocol_version.rs +26 -0
- package/test/integration/dataContract/validation/validateDataContractFactory.spec.js +579 -502
- package/test/integration/identity/stateTransition/IdentityCreateTransition/validation/basic/validateIdentityCreateTransitionBasicFactory.spec.js +175 -165
- package/test/integration/identity/stateTransition/IdentityTopUpTransition/validation/basic/validateIdentityTopUpTransitionBasicFactory.spec.js +83 -114
- package/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js +1 -1
- package/test/integration/identity/stateTransition/assetLockProof/chain/validateChainAssetLockProofStructureFactory.spec.js +82 -91
- package/test/integration/identity/stateTransition/assetLockProof/fetchAssetLockTransactionOutputFactory.spec.js +75 -31
- package/test/integration/identity/stateTransition/assetLockProof/instant/validateInstantAssetLockProofStructureFactory.spec.js +93 -148
- package/test/integration/identity/stateTransition/assetLockProof/validateAssetLockTransactionFactory.spec.js +63 -75
- package/test/integration/identity/stateTransition/validatePublicKeySignaturesFactory.spec.js +48 -19
- package/test/integration/identity/validation/validatePublicKeysFactory.spec.js +79 -114
- package/test/integration/stateTransition/AbstractStateTransitionIdentitySigned.spec.js +0 -11
- package/test/integration/stateTransition/StateTransitionFacade.spec.js +1 -1
- package/test/integration/stateTransition/calculateStateTransitionFeeFactory.spec.js +135 -0
- package/test/unit/dataContract/DataContract.spec.js +5 -9
- package/test/unit/dataContract/DataContractFactory.spec.js +13 -6
- package/test/unit/dataContract/createDataContract.spec.js +0 -1
- package/test/unit/dataContract/errors/InvalidDataContractError.spec.js +11 -3
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js +3 -3
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/validation/state/validateDataContractCreateTransitionStateFactory.spec.js +20 -16
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js +24 -60
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/applyDataContractUpdateTransitionFactory.spec.js +27 -23
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/basic/validateIndicesAreBackwardCompatible.spec.js +29 -12
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/state/validateDataContractUpdateTransitionStateFactory.spec.js +66 -49
- package/test/unit/dataContract/validation/validateDataContractPatterns.spec.js +73 -0
- package/test/unit/decodeProtocolEntityFactory.spec.js +2 -2
- package/test/unit/document/Document.spec.js +147 -155
- package/test/unit/document/DocumentFactory.spec.js +325 -91
- package/test/unit/document/stateTransition/DocumetsBatchTransition/DocumentsBatchTransition.spec.js +142 -64
- package/test/unit/document/stateTransition/DocumetsBatchTransition/applyDocumentsBatchTransitionFactory.spec.js +1 -1
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsBatchTransitionStateFactory.spec.js +1 -1
- package/test/unit/identity/Identity.spec.js +2 -2
- package/test/unit/identity/IdentityPublicKey.spec.js +25 -31
- package/test/unit/identity/stateTransition/IdentityCreateTransition/IdentityCreateTransition.spec.js +69 -30
- package/test/unit/identity/stateTransition/IdentityCreateTransition/applyIdentityCreateTransitionFactory.spec.js +32 -32
- package/test/unit/identity/stateTransition/IdentityCreateTransition/validation/state/validateIdentityCreateTransitionStateFactory.spec.js +56 -25
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/IdentityTopUpTransition.spec.js +36 -16
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/applyIdentityTopUpTransitionFactory.spec.js +48 -46
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/validation/state/validateIdentityTopUpTransitionStateFactory.spec.js +24 -6
- package/test/unit/identity/stateTransition/assetLockProof/ChainAssetLockProof.spec.js +63 -0
- package/test/unit/identity/stateTransition/assetLockProof/InstantAssetLockProof.spec.js +90 -0
- package/test/unit/identity/stateTransition/assetLockProof/createAssetLockProofInstance.spec.js +18 -3
- package/test/unit/identity/stateTransition/assetLockProof/fetchAssetLockPublicKeyHashFactory.spec.js +38 -11
- package/tsconfig.json +1 -1
- package/wasm/package.json +5 -0
- package/wasm/wasm_dpp.d.ts +1595 -518
- package/wasm/wasm_dpp.js +5007 -2172
- package/wasm/wasm_dpp_bg.js +1 -1
- package/wasm/wasm_dpp_bg.wasm +0 -0
- package/wasm/wasm_dpp_bg.wasm.d.ts +566 -365
- package/webpack.config.js +10 -1
- package/test/integration/stateTransition/calculateStateTransitionFee.spec.js +0 -32
- package/test/unit/dataContract/validation/validateDataContractMaxDepthFactory.spec.js +0 -93
- package/test/unit/dataContract/validation/validateDataContractPatternsFactory.spec.js +0 -64
|
@@ -16,12 +16,12 @@ impl From<&DuplicatedIdentityPublicKeyIdError> for DuplicatedIdentityPublicKeyId
|
|
|
16
16
|
#[wasm_bindgen(js_class=DuplicatedIdentityPublicKeyIdError)]
|
|
17
17
|
impl DuplicatedIdentityPublicKeyIdErrorWasm {
|
|
18
18
|
#[wasm_bindgen(js_name=getDuplicatedIds)]
|
|
19
|
-
pub fn duplicated_ids(&self) ->
|
|
19
|
+
pub fn duplicated_ids(&self) -> js_sys::Array {
|
|
20
20
|
// TODO: key ids probably should be u32
|
|
21
21
|
self.inner
|
|
22
22
|
.duplicated_ids()
|
|
23
23
|
.iter()
|
|
24
|
-
.map(|id| *id as u32)
|
|
24
|
+
.map(|id| JsValue::from(*id as u32))
|
|
25
25
|
.collect()
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
use dpp::consensus::basic::identity::IdentityAssetLockProofLockedTransactionMismatchError;
|
|
2
2
|
use dpp::consensus::ConsensusError;
|
|
3
|
+
use dpp::dashcore::hashes::Hash;
|
|
3
4
|
use wasm_bindgen::prelude::*;
|
|
4
5
|
|
|
5
6
|
use crate::buffer::Buffer;
|
|
@@ -22,13 +23,16 @@ impl IdentityAssetLockProofLockedTransactionMismatchErrorWasm {
|
|
|
22
23
|
#[wasm_bindgen(js_name=getInstantLockTransactionId)]
|
|
23
24
|
pub fn instant_lock_transaction_id(&self) -> Buffer {
|
|
24
25
|
let tx_id = self.inner.instant_lock_transaction_id();
|
|
25
|
-
Buffer::from_bytes(tx_id
|
|
26
|
+
Buffer::from_bytes(&tx_id)
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
#[wasm_bindgen(js_name=getAssetLockTransactionId)]
|
|
29
30
|
pub fn asset_lock_transaction_id(&self) -> Buffer {
|
|
30
31
|
let tx_id = self.inner.asset_lock_transaction_id();
|
|
31
|
-
|
|
32
|
+
let mut hash_bytes = tx_id.as_hash().into_inner();
|
|
33
|
+
hash_bytes.reverse();
|
|
34
|
+
|
|
35
|
+
Buffer::from_bytes(&hash_bytes)
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
#[wasm_bindgen(js_name=getCode)]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
use dpp::consensus::basic::identity::IdentityAssetLockTransactionOutPointAlreadyExistsError;
|
|
2
2
|
use dpp::consensus::ConsensusError;
|
|
3
|
+
use dpp::dashcore::hashes::Hash;
|
|
3
4
|
use wasm_bindgen::prelude::*;
|
|
4
5
|
|
|
5
6
|
use crate::buffer::Buffer;
|
|
@@ -19,7 +20,7 @@ impl From<&IdentityAssetLockTransactionOutPointAlreadyExistsError>
|
|
|
19
20
|
|
|
20
21
|
#[wasm_bindgen(js_class=IdentityAssetLockTransactionOutPointAlreadyExistsError)]
|
|
21
22
|
impl IdentityAssetLockTransactionOutPointAlreadyExistsErrorWasm {
|
|
22
|
-
#[wasm_bindgen(js_name=
|
|
23
|
+
#[wasm_bindgen(js_name=getOutputIndex)]
|
|
23
24
|
pub fn output_index(&self) -> usize {
|
|
24
25
|
self.inner.output_index()
|
|
25
26
|
}
|
|
@@ -27,7 +28,9 @@ impl IdentityAssetLockTransactionOutPointAlreadyExistsErrorWasm {
|
|
|
27
28
|
#[wasm_bindgen(js_name=getTransactionId)]
|
|
28
29
|
pub fn transaction_id(&self) -> Buffer {
|
|
29
30
|
let tx_id = self.inner.transaction_id();
|
|
30
|
-
|
|
31
|
+
let mut tx_id_bytes = tx_id.as_hash().into_inner();
|
|
32
|
+
tx_id_bytes.reverse();
|
|
33
|
+
Buffer::from_bytes(&tx_id_bytes)
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
#[wasm_bindgen(js_name=getCode)]
|
package/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs
CHANGED
|
@@ -22,9 +22,9 @@ impl InvalidAssetLockProofTransactionHeightErrorWasm {
|
|
|
22
22
|
self.inner.proof_core_chain_locked_height()
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
#[wasm_bindgen(js_name=
|
|
26
|
-
pub fn
|
|
27
|
-
self.inner.
|
|
25
|
+
#[wasm_bindgen(js_name=getTransactionHeight)]
|
|
26
|
+
pub fn transaction_height(&self) -> Option<u32> {
|
|
27
|
+
self.inner.transaction_height()
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
#[wasm_bindgen(js_name=getCode)]
|
package/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs
CHANGED
|
@@ -25,12 +25,12 @@ impl InvalidIdentityPublicKeySecurityLevelErrorWasm {
|
|
|
25
25
|
self.inner.public_key_id() as u32
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
#[wasm_bindgen(js_name=
|
|
28
|
+
#[wasm_bindgen(js_name=getPublicKeyPurpose)]
|
|
29
29
|
pub fn purpose(&self) -> u8 {
|
|
30
30
|
self.inner.purpose() as u8
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
#[wasm_bindgen(js_name=
|
|
33
|
+
#[wasm_bindgen(js_name=getPublicKeySecurityLevel)]
|
|
34
34
|
pub fn security_level(&self) -> u8 {
|
|
35
35
|
self.inner.security_level() as u8
|
|
36
36
|
}
|
|
@@ -141,7 +141,7 @@ impl From<&ValidationErrorKind> for Params {
|
|
|
141
141
|
.build(),
|
|
142
142
|
ValidationErrorKind::MinItems { limit } => ParamsBuilder::new()
|
|
143
143
|
.set_keyword("minItems")
|
|
144
|
-
.add_param("
|
|
144
|
+
.add_param("minItems", Value::from(*limit))
|
|
145
145
|
.build(),
|
|
146
146
|
ValidationErrorKind::Minimum { limit } => ParamsBuilder::new()
|
|
147
147
|
.set_keyword("minimum")
|
|
@@ -36,8 +36,9 @@ use crate::errors::consensus::basic::data_contract::{
|
|
|
36
36
|
IncompatibleDataContractSchemaErrorWasm, InvalidDataContractIdErrorWasm,
|
|
37
37
|
};
|
|
38
38
|
use crate::errors::consensus::basic::document::{
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
DuplicateDocumentTransitionsWithIdsErrorWasm, DuplicateDocumentTransitionsWithIndicesErrorWasm,
|
|
40
|
+
InvalidDocumentTransitionActionErrorWasm, InvalidDocumentTransitionIdErrorWasm,
|
|
41
|
+
MissingDataContractIdErrorWasm, MissingDocumentTypeErrorWasm,
|
|
41
42
|
};
|
|
42
43
|
use crate::errors::consensus::basic::state_transition::{
|
|
43
44
|
InvalidStateTransitionTypeErrorWasm, MissingStateTransitionTypeErrorWasm,
|
|
@@ -62,7 +63,7 @@ use crate::errors::consensus::state::identity::{
|
|
|
62
63
|
use dpp::errors::DataTriggerError;
|
|
63
64
|
|
|
64
65
|
use super::consensus::basic::data_contract::{
|
|
65
|
-
|
|
66
|
+
DataContractMaxDepthExceedErrorWasm, DuplicateIndexErrorWasm, DuplicateIndexNameErrorWasm,
|
|
66
67
|
IncompatibleRe2PatternErrorWasm, InvalidCompoundIndexErrorWasm,
|
|
67
68
|
InvalidDataContractVersionErrorWasm, InvalidIndexPropertyTypeErrorWasm,
|
|
68
69
|
InvalidIndexedPropertyConstraintErrorWasm, InvalidJsonSchemaRefErrorWasm,
|
|
@@ -75,7 +76,7 @@ use super::consensus::basic::decode::{
|
|
|
75
76
|
use super::consensus::basic::document::{
|
|
76
77
|
DataContractNotPresentErrorWasm, InconsistentCompoundIndexDataErrorWasm,
|
|
77
78
|
InvalidDocumentTypeErrorWasm, MissingDocumentTransitionActionErrorWasm,
|
|
78
|
-
|
|
79
|
+
MissingDocumentTransitionTypeErrorWasm,
|
|
79
80
|
};
|
|
80
81
|
use super::consensus::basic::identity::{
|
|
81
82
|
InvalidIdentityPublicKeyTypeErrorWasm, MissingPublicKeyErrorWasm,
|
|
@@ -99,7 +100,7 @@ pub fn from_consensus_error_ref(e: &DPPConsensusError) -> JsValue {
|
|
|
99
100
|
DPPConsensusError::IncompatibleProtocolVersionError(e) => {
|
|
100
101
|
IncompatibleProtocolVersionErrorWasm::from(e).into()
|
|
101
102
|
}
|
|
102
|
-
DPPConsensusError::
|
|
103
|
+
DPPConsensusError::DuplicatedIdentityPublicKeyBasicIdError(e) => {
|
|
103
104
|
DuplicatedIdentityPublicKeyIdErrorWasm::from(e).into()
|
|
104
105
|
}
|
|
105
106
|
DPPConsensusError::InvalidIdentityPublicKeyDataError(e) => {
|
|
@@ -108,7 +109,7 @@ pub fn from_consensus_error_ref(e: &DPPConsensusError) -> JsValue {
|
|
|
108
109
|
DPPConsensusError::InvalidIdentityPublicKeySecurityLevelError(e) => {
|
|
109
110
|
InvalidIdentityPublicKeySecurityLevelErrorWasm::from(e).into()
|
|
110
111
|
}
|
|
111
|
-
DPPConsensusError::
|
|
112
|
+
DPPConsensusError::DuplicatedIdentityPublicKeyBasicError(e) => {
|
|
112
113
|
DuplicatedIdentityPublicKeyErrorWasm::from(e).into()
|
|
113
114
|
}
|
|
114
115
|
DPPConsensusError::MissingMasterPublicKeyError(e) => {
|
|
@@ -351,7 +352,7 @@ fn from_basic_error(basic_error: &Box<BasicError>) -> JsValue {
|
|
|
351
352
|
version,
|
|
352
353
|
} => InvalidDataContractVersionErrorWasm::new(*expected_version, *version, code).into(),
|
|
353
354
|
BasicError::DataContractMaxDepthExceedError(depth) => {
|
|
354
|
-
|
|
355
|
+
DataContractMaxDepthExceedErrorWasm::new(*depth, code).into()
|
|
355
356
|
}
|
|
356
357
|
BasicError::InvalidDocumentTypeError {
|
|
357
358
|
document_type,
|
|
@@ -457,6 +458,9 @@ fn from_basic_error(basic_error: &Box<BasicError>) -> JsValue {
|
|
|
457
458
|
code,
|
|
458
459
|
)
|
|
459
460
|
.into(),
|
|
461
|
+
BasicError::MissingDocumentTransitionTypeError => {
|
|
462
|
+
MissingDocumentTransitionTypeErrorWasm::new(code).into()
|
|
463
|
+
}
|
|
460
464
|
BasicError::MissingDocumentTypeError => MissingDocumentTypeErrorWasm::new(code).into(),
|
|
461
465
|
BasicError::MissingDocumentTransitionActionError => {
|
|
462
466
|
MissingDocumentTransitionActionErrorWasm::new(code).into()
|
|
@@ -472,8 +476,11 @@ fn from_basic_error(basic_error: &Box<BasicError>) -> JsValue {
|
|
|
472
476
|
InvalidDocumentTransitionIdErrorWasm::new(expected_id.clone(), invalid_id.clone(), code)
|
|
473
477
|
.into()
|
|
474
478
|
}
|
|
479
|
+
BasicError::DuplicateDocumentTransitionsWithIndicesError { references } => {
|
|
480
|
+
DuplicateDocumentTransitionsWithIndicesErrorWasm::new(references.clone(), code).into()
|
|
481
|
+
}
|
|
475
482
|
BasicError::DuplicateDocumentTransitionsWithIdsError { references } => {
|
|
476
|
-
|
|
483
|
+
DuplicateDocumentTransitionsWithIdsErrorWasm::new(references.clone(), code).into()
|
|
477
484
|
}
|
|
478
485
|
BasicError::MissingDataContractIdError => MissingDataContractIdErrorWasm::new(code).into(),
|
|
479
486
|
BasicError::InvalidIdentifierError {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
use crate::identity::errors::{
|
|
2
|
+
AssetLockOutputNotFoundErrorWasm, AssetLockTransactionIsNotFoundErrorWasm,
|
|
3
|
+
};
|
|
4
|
+
use dpp::DPPError;
|
|
5
|
+
use wasm_bindgen::JsValue;
|
|
6
|
+
|
|
7
|
+
pub fn from_dpp_error_ref(e: &DPPError) -> JsValue {
|
|
8
|
+
match e {
|
|
9
|
+
DPPError::AssetLockOutputNotFoundError(e) => {
|
|
10
|
+
AssetLockOutputNotFoundErrorWasm::from(e).into()
|
|
11
|
+
}
|
|
12
|
+
DPPError::AssetLockTransactionIsNotFoundError(e) => {
|
|
13
|
+
AssetLockTransactionIsNotFoundErrorWasm::from(e).into()
|
|
14
|
+
}
|
|
15
|
+
_ => unimplemented!(),
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/errors/from.rs
CHANGED
|
@@ -5,8 +5,13 @@ use dpp::errors::ProtocolError;
|
|
|
5
5
|
use crate::data_contract::errors::from_data_contract_to_js_error;
|
|
6
6
|
use crate::document::errors::from_document_to_js_error;
|
|
7
7
|
|
|
8
|
+
use super::consensus_error::from_consensus_error;
|
|
9
|
+
|
|
8
10
|
pub fn from_dpp_err(pe: ProtocolError) -> JsValue {
|
|
9
11
|
match pe {
|
|
12
|
+
ProtocolError::AbstractConsensusError(consensus_error) => {
|
|
13
|
+
from_consensus_error(*consensus_error)
|
|
14
|
+
}
|
|
10
15
|
ProtocolError::DataContractError(e) => from_data_contract_to_js_error(e),
|
|
11
16
|
|
|
12
17
|
ProtocolError::Document(e) => from_document_to_js_error(*e),
|
|
@@ -19,6 +24,6 @@ pub fn from_dpp_err(pe: ProtocolError) -> JsValue {
|
|
|
19
24
|
)
|
|
20
25
|
.into(),
|
|
21
26
|
|
|
22
|
-
_ => JsValue::from_str(&format!("
|
|
27
|
+
_ => JsValue::from_str(&format!("Error conversion not implemented: {pe:#}",)),
|
|
23
28
|
}
|
|
24
29
|
}
|
|
@@ -41,23 +41,38 @@ impl From<serde_wasm_bindgen::Error> for RustConversionError {
|
|
|
41
41
|
#[macro_export]
|
|
42
42
|
macro_rules! with_js_error {
|
|
43
43
|
($o:expr) => {
|
|
44
|
-
$o.map_err(|e| RustConversionError::from(e).to_js_value())
|
|
44
|
+
$o.map_err(|e| $crate::errors::RustConversionError::from(e).to_js_value())
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
#[macro_export]
|
|
49
49
|
macro_rules! bail_js {
|
|
50
50
|
($msg:literal) => ({
|
|
51
|
-
return Err(RustConversionError::from(String::from($msg)).to_js_value())
|
|
51
|
+
return Err($crate::errors::RustConversionError::from(String::from($msg)).to_js_value())
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
($err:expr $(,)?) => ({
|
|
55
55
|
use $crate::private::kind::*;
|
|
56
|
-
return Err(RustConversionError::from($err).to_js_value())
|
|
56
|
+
return Err($crate::errors::RustConversionError::from($err).to_js_value())
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
($fmt:expr, $($arg:tt)*) => {
|
|
60
|
-
return Err(RustConversionError::from(format!($fmt, $($arg)*)).to_js_value())
|
|
60
|
+
return Err($crate::errors::RustConversionError::from(format!($fmt, $($arg)*)).to_js_value())
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
#[macro_export]
|
|
66
|
+
macro_rules! console_log {
|
|
67
|
+
($msg:literal) => {{
|
|
68
|
+
web_sys::console::log_1(&format!($msg).into())
|
|
69
|
+
}};
|
|
70
|
+
|
|
71
|
+
($msg:expr $(,)?) => {{
|
|
72
|
+
web_sys::console::log_1(&format!("{}", $msg).into())
|
|
73
|
+
}};
|
|
74
|
+
|
|
75
|
+
($fmt:expr, $($arg:tt)*) => {
|
|
76
|
+
web_sys::console::log_1(&format!($fmt, $($arg)*).into())
|
|
77
|
+
};
|
|
78
|
+
}
|
package/src/errors/mod.rs
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
use wasm_bindgen::{JsError, JsValue};
|
|
2
|
+
|
|
3
|
+
use super::consensus_error::from_consensus_error;
|
|
4
|
+
|
|
5
|
+
pub fn from_protocol_error(protocol_error: dpp::ProtocolError) -> JsValue {
|
|
6
|
+
match protocol_error {
|
|
7
|
+
dpp::ProtocolError::AbstractConsensusError(consensus_error) => {
|
|
8
|
+
from_consensus_error(*consensus_error)
|
|
9
|
+
}
|
|
10
|
+
dpp::ProtocolError::Error(anyhow_error) => {
|
|
11
|
+
format!("Non-protocol error: {}", anyhow_error).into()
|
|
12
|
+
}
|
|
13
|
+
_ => todo!("Implement protocol error conversions"),
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
use dpp::prelude::Identifier;
|
|
2
|
+
use dpp::util::string_encoding::Encoding;
|
|
3
|
+
use itertools::Itertools;
|
|
1
4
|
pub use serde::{Deserialize, Serialize};
|
|
5
|
+
use serde_json::Value;
|
|
2
6
|
use wasm_bindgen::prelude::*;
|
|
3
7
|
use wasm_bindgen::JsCast;
|
|
4
8
|
|
|
9
|
+
use crate::bail_js;
|
|
5
10
|
use crate::buffer::Buffer;
|
|
6
11
|
use crate::errors::from_dpp_err;
|
|
12
|
+
use crate::utils::ToSerdeJSONExt;
|
|
13
|
+
use crate::utils::WithJsError;
|
|
7
14
|
use dpp::identifier;
|
|
8
15
|
|
|
9
16
|
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
|
@@ -35,7 +42,6 @@ impl std::convert::From<identifier::Identifier> for IdentifierWrapper {
|
|
|
35
42
|
impl IdentifierWrapper {
|
|
36
43
|
#[wasm_bindgen(constructor)]
|
|
37
44
|
pub fn new(buffer: Vec<u8>) -> Result<IdentifierWrapper, JsValue> {
|
|
38
|
-
// TODO: remove unwrap
|
|
39
45
|
let identifier = identifier::Identifier::from_bytes(&buffer).map_err(from_dpp_err)?;
|
|
40
46
|
|
|
41
47
|
Ok(IdentifierWrapper {
|
|
@@ -73,7 +79,7 @@ impl IdentifierWrapper {
|
|
|
73
79
|
|
|
74
80
|
#[wasm_bindgen(js_name=toBuffer)]
|
|
75
81
|
pub fn to_buffer(&self) -> Buffer {
|
|
76
|
-
Buffer::from_bytes(self.wrapped.buffer
|
|
82
|
+
Buffer::from_bytes(&self.wrapped.buffer)
|
|
77
83
|
}
|
|
78
84
|
|
|
79
85
|
#[wasm_bindgen(js_name=toJSON)]
|
|
@@ -97,7 +103,46 @@ impl IdentifierWrapper {
|
|
|
97
103
|
self.wrapped.buffer.len()
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
|
|
106
|
+
#[wasm_bindgen(js_name=toBytes)]
|
|
107
|
+
pub fn to_bytes(&self) -> Vec<u8> {
|
|
101
108
|
self.wrapped.buffer.to_vec()
|
|
102
109
|
}
|
|
110
|
+
|
|
111
|
+
#[wasm_bindgen(js_name=clone)]
|
|
112
|
+
pub fn deep_clone(&self) -> IdentifierWrapper {
|
|
113
|
+
IdentifierWrapper {
|
|
114
|
+
wrapped: self.wrapped.clone(),
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
impl IdentifierWrapper {
|
|
120
|
+
pub fn inner(self) -> Identifier {
|
|
121
|
+
self.wrapped
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/// tries to create identifier from
|
|
126
|
+
pub fn identifier_from_js_value(js_value: &JsValue) -> Result<Identifier, JsValue> {
|
|
127
|
+
let value = js_value.with_serde_to_json_value()?;
|
|
128
|
+
match value {
|
|
129
|
+
Value::Array(arr) => {
|
|
130
|
+
let bytes: Vec<u8> = arr.into_iter().map(value_to_u8).try_collect()?;
|
|
131
|
+
Identifier::from_bytes(&bytes).with_js_error()
|
|
132
|
+
}
|
|
133
|
+
Value::String(string) => Identifier::from_string(&string, Encoding::Base58).with_js_error(),
|
|
134
|
+
_ => {
|
|
135
|
+
bail_js!("Invalid ID. Expected array or string")
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
fn value_to_u8(v: Value) -> Result<u8, JsValue> {
|
|
141
|
+
let number = v
|
|
142
|
+
.as_u64()
|
|
143
|
+
.ok_or_else(|| format!("failed converting {} into u64", v))?;
|
|
144
|
+
if number > u8::MAX as u64 {
|
|
145
|
+
bail_js!("the integer in the array isn't a byte: {}", number);
|
|
146
|
+
}
|
|
147
|
+
Ok(number as u8)
|
|
103
148
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
use dpp::identity::errors::AssetLockOutputNotFoundError;
|
|
2
|
+
use wasm_bindgen::prelude::*;
|
|
3
|
+
|
|
4
|
+
#[wasm_bindgen(js_name=AssetLockOutputNotFoundError)]
|
|
5
|
+
pub struct AssetLockOutputNotFoundErrorWasm(AssetLockOutputNotFoundError);
|
|
6
|
+
|
|
7
|
+
impl From<&AssetLockOutputNotFoundError> for AssetLockOutputNotFoundErrorWasm {
|
|
8
|
+
fn from(e: &AssetLockOutputNotFoundError) -> Self {
|
|
9
|
+
Self(e.clone())
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
use dpp::dashcore::hashes::hex::ToHex;
|
|
2
|
+
use dpp::identity::errors::AssetLockTransactionIsNotFoundError;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=AssetLockTransactionIsNotFoundError)]
|
|
6
|
+
pub struct AssetLockTransactionIsNotFoundErrorWasm(AssetLockTransactionIsNotFoundError);
|
|
7
|
+
|
|
8
|
+
impl From<&AssetLockTransactionIsNotFoundError> for AssetLockTransactionIsNotFoundErrorWasm {
|
|
9
|
+
fn from(e: &AssetLockTransactionIsNotFoundError) -> Self {
|
|
10
|
+
Self(e.clone())
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[wasm_bindgen(js_class=AssetLockTransactionIsNotFoundError)]
|
|
15
|
+
impl AssetLockTransactionIsNotFoundErrorWasm {
|
|
16
|
+
#[wasm_bindgen(js_name=getTransactionId)]
|
|
17
|
+
pub fn transaction_id(&self) -> JsValue {
|
|
18
|
+
self.0.transaction_id().to_hex().into()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
pub use asset_lock_output_not_found_error::*;
|
|
2
|
+
pub use asset_lock_transaction_is_not_found_error::*;
|
|
3
|
+
pub use unknown_asset_lock_proof_type_error::*;
|
|
4
|
+
|
|
5
|
+
mod asset_lock_output_not_found_error;
|
|
6
|
+
mod asset_lock_transaction_is_not_found_error;
|
|
7
|
+
mod unknown_asset_lock_proof_type_error;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
use dpp::identity::errors::UnknownAssetLockProofTypeError;
|
|
2
|
+
use wasm_bindgen::prelude::*;
|
|
3
|
+
|
|
4
|
+
#[derive(Clone)]
|
|
5
|
+
#[wasm_bindgen(js_name=UnknownAssetLockProofTypeError)]
|
|
6
|
+
pub struct UnknownAssetLockProofTypeErrorWasm(UnknownAssetLockProofTypeError);
|
|
7
|
+
|
|
8
|
+
impl From<&UnknownAssetLockProofTypeError> for UnknownAssetLockProofTypeErrorWasm {
|
|
9
|
+
fn from(e: &UnknownAssetLockProofTypeError) -> Self {
|
|
10
|
+
Self(e.clone())
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
impl From<UnknownAssetLockProofTypeError> for UnknownAssetLockProofTypeErrorWasm {
|
|
15
|
+
fn from(e: UnknownAssetLockProofTypeError) -> Self {
|
|
16
|
+
Self(e)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#[wasm_bindgen(js_class=UnknownAssetLockProofTypeError)]
|
|
21
|
+
impl UnknownAssetLockProofTypeErrorWasm {
|
|
22
|
+
#[wasm_bindgen(js_name=getType)]
|
|
23
|
+
pub fn get_type(&self) -> Option<u8> {
|
|
24
|
+
self.0.asset_lock_type()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -6,7 +6,7 @@ use dpp::identity::validation::PublicKeysValidator;
|
|
|
6
6
|
use dpp::identity::IdentityFacade;
|
|
7
7
|
|
|
8
8
|
use crate::bls_adapter::{BlsAdapter, JsBlsAdapter};
|
|
9
|
-
use crate::
|
|
9
|
+
use crate::validation::ValidationResultWasm;
|
|
10
10
|
use dpp::version::ProtocolVersionValidator;
|
|
11
11
|
use dpp::NonConsensusError;
|
|
12
12
|
|
|
@@ -38,10 +38,8 @@ impl IdentityFacadeWasm {
|
|
|
38
38
|
let identity_json = serde_wasm_bindgen::from_value(raw_identity_object)
|
|
39
39
|
.expect("unable to serialize identity");
|
|
40
40
|
// TODO: handle the case when
|
|
41
|
-
self.0
|
|
42
|
-
|
|
43
|
-
.map(|res| res.into())
|
|
44
|
-
.map_err(|err| err.into())
|
|
41
|
+
let validation_result = self.0.validate(&identity_json)?;
|
|
42
|
+
Ok(validation_result.map(|_| JsValue::undefined()).into())
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
|
|
File without changes
|
|
@@ -14,9 +14,6 @@ mod security_level;
|
|
|
14
14
|
pub use security_level::*;
|
|
15
15
|
|
|
16
16
|
mod key_type;
|
|
17
|
-
mod public_keys_validator;
|
|
18
|
-
|
|
19
|
-
pub use public_keys_validator::*;
|
|
20
17
|
|
|
21
18
|
pub use key_type::*;
|
|
22
19
|
|
|
@@ -139,32 +136,66 @@ impl IdentityPublicKeyWasm {
|
|
|
139
136
|
}
|
|
140
137
|
|
|
141
138
|
#[wasm_bindgen(js_name=toObject)]
|
|
142
|
-
pub fn to_object(&self,
|
|
139
|
+
pub fn to_object(&self, skip_signatures: Option<bool>) -> Result<JsValue, JsValue> {
|
|
143
140
|
let val = self
|
|
144
141
|
.0
|
|
145
|
-
.to_raw_json_object(
|
|
142
|
+
.to_raw_json_object(skip_signatures.unwrap_or(false))
|
|
146
143
|
.map_err(|e| from_dpp_err(e.into()))?;
|
|
147
144
|
|
|
148
145
|
let data_buffer = Buffer::from_bytes(self.0.get_data());
|
|
149
|
-
let signature_buffer = Buffer::from_bytes(self.0.get_signature());
|
|
150
146
|
|
|
151
147
|
let json = val.to_string();
|
|
152
148
|
let js_object = js_sys::JSON::parse(&json)?;
|
|
153
149
|
|
|
154
150
|
js_sys::Reflect::set(
|
|
155
151
|
&js_object,
|
|
156
|
-
&"
|
|
157
|
-
&JsValue::from(
|
|
152
|
+
&JsValue::from_str("type"),
|
|
153
|
+
&JsValue::from(self.get_type()),
|
|
158
154
|
)?;
|
|
159
155
|
|
|
160
156
|
js_sys::Reflect::set(
|
|
161
157
|
&js_object,
|
|
162
|
-
&"
|
|
163
|
-
&JsValue::from(
|
|
158
|
+
&"data".to_owned().into(),
|
|
159
|
+
&JsValue::from(data_buffer),
|
|
164
160
|
)?;
|
|
165
161
|
|
|
162
|
+
if !skip_signatures.unwrap_or(false) {
|
|
163
|
+
let signature = self.0.get_signature();
|
|
164
|
+
if !signature.is_empty() {
|
|
165
|
+
js_sys::Reflect::set(
|
|
166
|
+
&js_object,
|
|
167
|
+
&"signature".to_owned().into(),
|
|
168
|
+
&JsValue::from(Buffer::from_bytes(signature)),
|
|
169
|
+
)?;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
166
173
|
Ok(js_object)
|
|
167
174
|
}
|
|
175
|
+
|
|
176
|
+
#[wasm_bindgen(js_name=setSignature)]
|
|
177
|
+
pub fn set_signature(&mut self, signature: Vec<u8>) {
|
|
178
|
+
self.0.set_signature(signature);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
#[wasm_bindgen(js_name=getSignature)]
|
|
182
|
+
pub fn get_signature(&mut self) -> Buffer {
|
|
183
|
+
Buffer::from_bytes(self.0.get_signature())
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
impl IdentityPublicKeyWasm {
|
|
188
|
+
pub fn into_inner(self) -> IdentityPublicKey {
|
|
189
|
+
self.0
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
pub fn inner(&self) -> &IdentityPublicKey {
|
|
193
|
+
&self.0
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
pub fn inner_mut(&mut self) -> &mut IdentityPublicKey {
|
|
197
|
+
&mut self.0
|
|
198
|
+
}
|
|
168
199
|
}
|
|
169
200
|
|
|
170
201
|
impl From<IdentityPublicKey> for IdentityPublicKeyWasm {
|
|
File without changes
|
|
File without changes
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
pub mod identity_facade;
|
|
2
|
+
mod identity_public_key;
|
|
3
|
+
mod validation;
|
|
4
|
+
|
|
1
5
|
use js_sys::Array;
|
|
2
6
|
use serde_json::Value;
|
|
3
7
|
use wasm_bindgen::prelude::*;
|
|
@@ -12,18 +16,27 @@ use crate::errors::from_dpp_err;
|
|
|
12
16
|
use crate::identifier::IdentifierWrapper;
|
|
13
17
|
use crate::utils;
|
|
14
18
|
use crate::utils::to_vec_of_serde_values;
|
|
15
|
-
use crate::IdentityPublicKeyWasm;
|
|
16
19
|
use crate::MetadataWasm;
|
|
20
|
+
pub use identity_public_key::*;
|
|
21
|
+
|
|
22
|
+
pub use state_transition::*;
|
|
23
|
+
|
|
24
|
+
pub mod errors;
|
|
25
|
+
pub mod state_transition;
|
|
17
26
|
|
|
18
27
|
#[wasm_bindgen(js_name=Identity)]
|
|
19
28
|
#[derive(Clone)]
|
|
20
29
|
pub struct IdentityWasm(Identity);
|
|
21
30
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
impl From<IdentityWasm> for Identity {
|
|
32
|
+
fn from(identity: IdentityWasm) -> Self {
|
|
33
|
+
identity.0
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
impl From<Identity> for IdentityWasm {
|
|
38
|
+
fn from(identity: Identity) -> Self {
|
|
39
|
+
Self(identity)
|
|
27
40
|
}
|
|
28
41
|
}
|
|
29
42
|
|
|
@@ -60,12 +73,7 @@ impl IdentityWasm {
|
|
|
60
73
|
.into_iter()
|
|
61
74
|
.map(IdentityPublicKey::from_json_object)
|
|
62
75
|
.collect::<Result<_, _>>()
|
|
63
|
-
.map_err(|e| {
|
|
64
|
-
format!(
|
|
65
|
-
"converting to collection of IdentityPublicKeys failed: {:#}",
|
|
66
|
-
e
|
|
67
|
-
)
|
|
68
|
-
})?;
|
|
76
|
+
.map_err(|e| format!("converting to collection of IdentityPublicKeys failed: {e:#}"))?;
|
|
69
77
|
|
|
70
78
|
self.0.set_public_keys(public_keys);
|
|
71
79
|
|