@dashevo/wasm-dpp 4.1.0 → 4.2.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 +2 -2
- package/dist/wasm/wasm_dpp.d.ts +1405 -976
- package/dist/wasm/wasm_dpp.js +258 -60
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/wasm/wasm_dpp.d.ts +1405 -976
- package/package.json +2 -2
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +3 -2
- package/src/data_contract/state_transition/data_contract_update_transition/mod.rs +3 -2
- package/src/document/factory.rs +1 -1
- package/src/document/state_transition/batch_transition/document_transition/mod.rs +9 -0
- 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 +137 -2
- 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/errors/consensus/state/document/mod.rs +2 -0
- package/src/errors/consensus/state/document/referenced_entity_not_found_error.rs +44 -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/lib.rs +4 -0
- package/src/state_transition/state_transition_factory.rs +3 -1
- package/src/utils.rs +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/wasm-dpp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0-beta.1",
|
|
4
4
|
"description": "The JavaScript implementation of the Dash Platform Protocol",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/core": "^7.26.10",
|
|
45
45
|
"@babel/preset-env": "^7.26.9",
|
|
46
46
|
"@dashevo/dashcore-lib": "~0.22.0",
|
|
47
|
-
"@dashevo/dpns-contract": "4.
|
|
47
|
+
"@dashevo/dpns-contract": "4.2.0-beta.1",
|
|
48
48
|
"@types/bs58": "^4.0.1",
|
|
49
49
|
"@types/node": "^20.10.0",
|
|
50
50
|
"@yarnpkg/pnpify": "^4.0.0-rc.42",
|
|
@@ -7,7 +7,7 @@ use crate::errors::protocol_error::from_protocol_error;
|
|
|
7
7
|
use dpp::errors::consensus::signature::SignatureError;
|
|
8
8
|
use dpp::errors::consensus::ConsensusError;
|
|
9
9
|
|
|
10
|
-
use dpp::serialization::{
|
|
10
|
+
use dpp::serialization::{PlatformDeserializableUntrusted, PlatformSerializable};
|
|
11
11
|
use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0;
|
|
12
12
|
use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition;
|
|
13
13
|
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
@@ -169,7 +169,8 @@ impl DataContractCreateTransitionWasm {
|
|
|
169
169
|
#[wasm_bindgen(js_name=fromBuffer)]
|
|
170
170
|
pub fn from_buffer(buffer: Vec<u8>) -> Result<DataContractCreateTransitionWasm, JsValue> {
|
|
171
171
|
let state_transition: StateTransition =
|
|
172
|
-
|
|
172
|
+
PlatformDeserializableUntrusted::deserialize_from_bytes_untrusted(&buffer)
|
|
173
|
+
.with_js_error()?;
|
|
173
174
|
match state_transition {
|
|
174
175
|
StateTransition::DataContractCreate(dct) => Ok(dct.into()),
|
|
175
176
|
_ => Err(JsValue::from_str("Invalid state transition type")),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
use dpp::consensus::ConsensusError;
|
|
6
6
|
use dpp::serialization::ValueConvertible;
|
|
7
|
-
use dpp::serialization::{
|
|
7
|
+
use dpp::serialization::{PlatformDeserializableUntrusted, PlatformSerializable};
|
|
8
8
|
use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0;
|
|
9
9
|
use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition;
|
|
10
10
|
use dpp::state_transition::StateTransition;
|
|
@@ -164,7 +164,8 @@ impl DataContractUpdateTransitionWasm {
|
|
|
164
164
|
#[wasm_bindgen(js_name=fromBuffer)]
|
|
165
165
|
pub fn from_buffer(buffer: Vec<u8>) -> Result<DataContractUpdateTransitionWasm, JsValue> {
|
|
166
166
|
let state_transition: StateTransition =
|
|
167
|
-
|
|
167
|
+
PlatformDeserializableUntrusted::deserialize_from_bytes_untrusted(&buffer)
|
|
168
|
+
.with_js_error()?;
|
|
168
169
|
match state_transition {
|
|
169
170
|
StateTransition::DataContractUpdate(dct) => Ok(dct.into()),
|
|
170
171
|
_ => Err(JsValue::from_str("Invalid state transition type")),
|
package/src/document/factory.rs
CHANGED
|
@@ -145,7 +145,7 @@ impl DocumentFactoryWASM {
|
|
|
145
145
|
|
|
146
146
|
let documents_by_action = extract_documents_by_action(documents)?;
|
|
147
147
|
|
|
148
|
-
for
|
|
148
|
+
for documents in documents_by_action.values() {
|
|
149
149
|
for document in documents.iter() {
|
|
150
150
|
if !contract_ids_to_check.contains(&document.data_contract().id()) {
|
|
151
151
|
return Err(JsValue::from_str(
|
|
@@ -23,6 +23,7 @@ use dpp::state_transition::batch_transition::document_replace_transition::v0::v0
|
|
|
23
23
|
use dpp::state_transition::batch_transition::batched_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods;
|
|
24
24
|
use dpp::state_transition::batch_transition::batched_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods;
|
|
25
25
|
use dpp::state_transition::batch_transition::batched_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods;
|
|
26
|
+
use dpp::state_transition::batch_transition::batched_transition::document_index_only_delete_transition::v0::v0_methods::DocumentIndexOnlyDeleteTransitionV0Methods;
|
|
26
27
|
use dpp::state_transition::batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods;
|
|
27
28
|
use crate::{
|
|
28
29
|
buffer::Buffer,
|
|
@@ -67,6 +68,12 @@ impl DocumentTransitionWasm {
|
|
|
67
68
|
DocumentTransition::Transfer(_) => JsValue::null(),
|
|
68
69
|
DocumentTransition::UpdatePrice(_) => JsValue::null(),
|
|
69
70
|
DocumentTransition::Purchase(_) => JsValue::null(),
|
|
71
|
+
DocumentTransition::IndexOnlyDelete(index_only_delete) => {
|
|
72
|
+
let json_value = index_only_delete.data().to_json_value().unwrap();
|
|
73
|
+
json_value
|
|
74
|
+
.serialize(&serde_wasm_bindgen::Serializer::json_compatible())
|
|
75
|
+
.unwrap()
|
|
76
|
+
}
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
79
|
|
|
@@ -110,6 +117,7 @@ impl DocumentTransitionWasm {
|
|
|
110
117
|
DocumentTransition::Transfer(_) => None,
|
|
111
118
|
DocumentTransition::UpdatePrice(update_price) => Some(update_price.price()),
|
|
112
119
|
DocumentTransition::Purchase(purchase) => Some(purchase.price()),
|
|
120
|
+
DocumentTransition::IndexOnlyDelete(_) => None,
|
|
113
121
|
}
|
|
114
122
|
}
|
|
115
123
|
|
|
@@ -122,6 +130,7 @@ impl DocumentTransitionWasm {
|
|
|
122
130
|
DocumentTransition::Transfer(transfer) => Some(transfer.recipient_owner_id().into()),
|
|
123
131
|
DocumentTransition::UpdatePrice(_) => None,
|
|
124
132
|
DocumentTransition::Purchase(_) => None,
|
|
133
|
+
DocumentTransition::IndexOnlyDelete(_) => None,
|
|
125
134
|
}
|
|
126
135
|
}
|
|
127
136
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
use dpp::consensus::basic::identity::ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError;
|
|
2
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
+
use dpp::consensus::ConsensusError;
|
|
4
|
+
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError)]
|
|
8
|
+
pub struct ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationErrorWasm {
|
|
9
|
+
inner: ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError>
|
|
13
|
+
for ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationErrorWasm
|
|
14
|
+
{
|
|
15
|
+
fn from(e: &ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError) -> Self {
|
|
16
|
+
Self { inner: e.clone() }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#[wasm_bindgen(js_class=ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError)]
|
|
21
|
+
impl ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationErrorWasm {
|
|
22
|
+
#[wasm_bindgen(js_name=getKeyId)]
|
|
23
|
+
pub fn get_key_id(&self) -> u32 {
|
|
24
|
+
self.inner.key_id()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
28
|
+
pub fn get_code(&self) -> u32 {
|
|
29
|
+
ConsensusError::from(self.inner.clone()).code()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#[wasm_bindgen(getter)]
|
|
33
|
+
pub fn message(&self) -> String {
|
|
34
|
+
self.inner.to_string()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
mod contract_group_bound_key_not_allowed_in_shielded_identity_creation_error;
|
|
1
2
|
mod duplicated_identity_public_key_error;
|
|
2
3
|
mod duplicated_identity_public_key_id_error;
|
|
3
4
|
mod identity_asset_lock_proof_locked_transaction_mismatch_error;
|
|
@@ -28,6 +29,7 @@ mod missing_master_public_key_error;
|
|
|
28
29
|
mod missing_public_key_error;
|
|
29
30
|
mod not_implemented_credit_withdrawal_transition_pooling_error;
|
|
30
31
|
|
|
32
|
+
pub use contract_group_bound_key_not_allowed_in_shielded_identity_creation_error::*;
|
|
31
33
|
pub use duplicated_identity_public_key_error::*;
|
|
32
34
|
pub use duplicated_identity_public_key_id_error::*;
|
|
33
35
|
pub use identity_asset_lock_proof_locked_transaction_mismatch_error::*;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
use super::signature::ContractBoundedKeyNonBatchErrorWasm;
|
|
2
|
+
use super::signature::ContractBoundedKeyOutOfBoundsErrorWasm;
|
|
3
|
+
use crate::errors::consensus::basic::identity::ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationErrorWasm;
|
|
1
4
|
use crate::errors::consensus::basic::{
|
|
2
5
|
IncompatibleProtocolVersionErrorWasm, InvalidIdentifierErrorWasm,
|
|
3
6
|
InvalidSignaturePublicKeyPurposeErrorWasm, JsonSchemaErrorWasm,
|
|
@@ -34,6 +37,7 @@ use crate::errors::consensus::state::identity::{
|
|
|
34
37
|
};
|
|
35
38
|
use dpp::consensus::basic::decode::VersionError;
|
|
36
39
|
use dpp::consensus::basic::BasicError::{
|
|
40
|
+
ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError,
|
|
37
41
|
DuplicatedIdentityPublicKeyBasicError, DuplicatedIdentityPublicKeyIdBasicError,
|
|
38
42
|
IdentityAssetLockProofLockedTransactionMismatchError,
|
|
39
43
|
IdentityAssetLockStateTransitionReplayError, IdentityAssetLockTransactionIsNotFoundError,
|
|
@@ -62,25 +66,45 @@ use dpp::consensus::state::data_trigger::DataTriggerError::{
|
|
|
62
66
|
DataTriggerConditionError, DataTriggerExecutionError, DataTriggerInvalidResultError,
|
|
63
67
|
};
|
|
64
68
|
use wasm_bindgen::{JsError, JsValue};
|
|
65
|
-
use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, ContestedUniqueIndexWithUniqueIndexError, DataContractTokenConfigurationUpdateError, DecimalsOverLimitError, DuplicateKeywordsError, GroupExceedsMaxMembersError, GroupHasTooFewMembersError, GroupMemberHasPowerOfZeroError, GroupMemberHasPowerOverLimitError, GroupNonUnilateralMemberPowerHasLessThanRequiredPowerError, GroupPositionDoesNotExistError, GroupRequiredPowerIsInvalidError, GroupTotalPowerLessThanRequiredError, InvalidDescriptionLengthError, InvalidDocumentTypeRequiredSecurityLevelError, InvalidKeywordCharacterError, InvalidKeywordLengthError, InvalidTokenBaseSupplyError, InvalidTokenDistributionFunctionDivideByZeroError, InvalidTokenDistributionFunctionIncoherenceError, InvalidTokenDistributionFunctionInvalidParameterError, InvalidTokenDistributionFunctionInvalidParameterTupleError, InvalidTokenLanguageCodeError, InvalidTokenNameCharacterError, InvalidTokenNameLengthError, MainGroupIsNotDefinedError, NewTokensDestinationIdentityOptionRequiredError, NonContiguousContractGroupPositionsError, NonContiguousContractTokenPositionsError, RedundantDocumentPaidForByTokenWithContractId, TokenPaymentByBurningOnlyAllowedOnInternalTokenError, TooManyKeywordsError, UnknownDocumentActionTokenEffectError, UnknownDocumentCreationRestrictionModeError, UnknownGasFeesPaidByError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError};
|
|
69
|
+
use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, DataContractInvalidRequiredFieldsUpdateError, ContestedUniqueIndexWithUniqueIndexError, DataContractTokenConfigurationUpdateError, DecimalsOverLimitError, DuplicateKeywordsError, GroupExceedsMaxMembersError, GroupHasTooFewMembersError, GroupMemberHasPowerOfZeroError, GroupMemberHasPowerOverLimitError, GroupNonUnilateralMemberPowerHasLessThanRequiredPowerError, GroupPositionDoesNotExistError, GroupRequiredPowerIsInvalidError, GroupTotalPowerLessThanRequiredError, InvalidDescriptionLengthError, InvalidDocumentTypeRequiredSecurityLevelError, InvalidKeywordCharacterError, InvalidKeywordLengthError, InvalidTokenBaseSupplyError, InvalidTokenDistributionFunctionDivideByZeroError, InvalidTokenDistributionFunctionIncoherenceError, InvalidTokenDistributionFunctionInvalidParameterError, InvalidTokenDistributionFunctionInvalidParameterTupleError, InvalidTokenLanguageCodeError, InvalidTokenNameCharacterError, InvalidTokenNameLengthError, MainGroupIsNotDefinedError, NewTokensDestinationIdentityOptionRequiredError, NonContiguousContractGroupPositionsError, NonContiguousContractTokenPositionsError, RedundantDocumentPaidForByTokenWithContractId, TokenPaymentByBurningOnlyAllowedOnInternalTokenError, TooManyKeywordsError, UnknownDocumentActionTokenEffectError, UnknownDocumentCreationRestrictionModeError, UnknownGasFeesPaidByError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError};
|
|
66
70
|
use dpp::consensus::basic::document::{ContestedDocumentsTemporarilyNotAllowedError, DocumentCreationNotAllowedError, DocumentFieldMaxSizeExceededError, MaxDocumentsTransitionsExceededError, MissingPositionsInDocumentTypePropertiesError};
|
|
67
71
|
use dpp::consensus::basic::group::GroupActionNotAllowedOnTransitionError;
|
|
68
72
|
use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, InvalidKeyPurposeForContractBoundsError, TooManyMasterPublicKeyError, WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError};
|
|
69
73
|
use dpp::consensus::basic::overflow_error::OverflowError;
|
|
70
|
-
use dpp::consensus::basic::token::{ChoosingTokenMintRecipientNotAllowedError, ContractHasNoTokensError, DestinationIdentityForTokenMintingNotSetError, InvalidActionIdError, InvalidTokenAmountError, InvalidTokenConfigUpdateNoChangeError, InvalidTokenIdError, InvalidTokenNoteTooBigError, InvalidTokenPositionError, MissingDefaultLocalizationError, TokenNoteOnlyAllowedWhenProposerError, TokenPricingScheduleEmptyError, TokenTransferToOurselfError, InvalidTokenDistributionTimeIntervalNotMinuteAlignedError, InvalidTokenDistributionTimeIntervalTooShortError, InvalidTokenDistributionBlockIntervalTooShortError};
|
|
74
|
+
use dpp::consensus::basic::token::{ChoosingTokenMintRecipientNotAllowedError, ContractHasNoTokensError, DestinationIdentityForTokenMintingNotSetError, InvalidActionIdError, InvalidTokenAmountError, InvalidTokenConfigUpdateNoChangeError, InvalidTokenIdError, InvalidTokenNoteTooBigError, InvalidTokenPositionError, MissingDefaultLocalizationError, TokenNoteOnlyAllowedWhenProposerError, TokenPricingScheduleEmptyError, TokenTransferToOurselfError, InvalidTokenDistributionTimeIntervalNotMinuteAlignedError, InvalidTokenDistributionTimeIntervalTooShortError, InvalidTokenDistributionBlockIntervalTooShortError, InvalidTokenDistributionEpochIntervalTooShortError};
|
|
71
75
|
use dpp::consensus::state::data_contract::data_contract_not_found_error::DataContractNotFoundError;
|
|
72
76
|
use dpp::consensus::state::data_contract::data_contract_update_action_not_allowed_error::DataContractUpdateActionNotAllowedError;
|
|
73
77
|
use dpp::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError;
|
|
74
78
|
use dpp::consensus::state::document::document_contest_currently_locked_error::DocumentContestCurrentlyLockedError;
|
|
75
79
|
use dpp::consensus::state::document::document_contest_document_with_same_id_already_present_error::DocumentContestDocumentWithSameIdAlreadyPresentError;
|
|
76
80
|
use dpp::consensus::state::document::document_contest_identity_already_contestant::DocumentContestIdentityAlreadyContestantError;
|
|
81
|
+
use dpp::consensus::state::document::document_contest_index_mismatch_error::DocumentContestIndexMismatchError;
|
|
77
82
|
use dpp::consensus::state::document::document_contest_not_joinable_error::DocumentContestNotJoinableError;
|
|
78
83
|
use dpp::consensus::state::document::document_contest_not_paid_for_error::DocumentContestNotPaidForError;
|
|
84
|
+
use dpp::consensus::state::document::document_contest_not_required_error::DocumentContestNotRequiredError;
|
|
79
85
|
use dpp::consensus::state::document::document_incorrect_purchase_price_error::DocumentIncorrectPurchasePriceError;
|
|
80
86
|
use dpp::consensus::state::document::document_not_for_sale_error::DocumentNotForSaleError;
|
|
87
|
+
use dpp::consensus::basic::contract_group::{
|
|
88
|
+
ContractGroupMemberNotInContractError, ContractGroupMembershipsOverLimitError,
|
|
89
|
+
DuplicateContractGroupMembershipError,
|
|
90
|
+
InvalidContractGroupDescriptionLengthError, InvalidContractGroupNameLengthError,
|
|
91
|
+
InvalidContractGroupAdminsError, RedundantContractGroupMembershipError,
|
|
92
|
+
};
|
|
93
|
+
use dpp::consensus::state::contract_group::{
|
|
94
|
+
ContractGroupAdminNotFoundError, ContractGroupAlreadyExistsError, ContractGroupNotFoundError,
|
|
95
|
+
IdentityNotContractGroupOwnerOrAdminError,
|
|
96
|
+
};
|
|
81
97
|
use dpp::consensus::state::group::{GroupActionAlreadyCompletedError, GroupActionAlreadySignedByIdentityError, GroupActionDoesNotExistError, IdentityMemberOfGroupNotFoundError, IdentityNotMemberOfGroupError, ModificationOfGroupActionMainParametersNotPermittedError};
|
|
82
98
|
use dpp::consensus::state::identity::identity_for_token_configuration_not_found_error::IdentityInTokenConfigurationNotFoundError;
|
|
83
99
|
use dpp::consensus::state::identity::identity_public_key_already_exists_for_unique_contract_bounds_error::IdentityPublicKeyAlreadyExistsForUniqueContractBoundsError;
|
|
100
|
+
use dpp::consensus::basic::identity::{
|
|
101
|
+
IdentityPublicKeyLimitsNotAllowedError,
|
|
102
|
+
IdentityPublicKeyLimitsNotAllowedInShieldedIdentityCreationError,
|
|
103
|
+
InvalidIdentityPublicKeyBudgetError,
|
|
104
|
+
};
|
|
105
|
+
use dpp::consensus::signature::{PublicKeyBudgetExhaustedError, PublicKeyExpiredError};
|
|
106
|
+
use dpp::consensus::state::identity::identity_public_key_already_expired_error::IdentityPublicKeyAlreadyExpiredError;
|
|
107
|
+
use dpp::consensus::state::identity::identity_public_key_budget_exceeded_error::IdentityPublicKeyBudgetExceededError;
|
|
84
108
|
use dpp::consensus::state::identity::identity_to_freeze_does_not_exist_error::IdentityToFreezeDoesNotExistError;
|
|
85
109
|
use dpp::consensus::state::identity::master_public_key_update_error::MasterPublicKeyUpdateError;
|
|
86
110
|
use dpp::consensus::state::identity::missing_transfer_key_error::MissingTransferKeyError;
|
|
@@ -90,6 +114,13 @@ use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized
|
|
|
90
114
|
use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError;
|
|
91
115
|
use dpp::consensus::state::token::{IdentityDoesNotHaveEnoughTokenBalanceError, IdentityTokenAccountNotFrozenError, IdentityTokenAccountFrozenError, TokenIsPausedError, IdentityTokenAccountAlreadyFrozenError, UnauthorizedTokenActionError, TokenSettingMaxSupplyToLessThanCurrentSupplyError, TokenMintPastMaxSupplyError, NewTokensDestinationIdentityDoesNotExistError, NewAuthorizedActionTakerIdentityDoesNotExistError, NewAuthorizedActionTakerGroupDoesNotExistError, NewAuthorizedActionTakerMainGroupNotSetError, InvalidGroupPositionError, TokenAlreadyPausedError, TokenNotPausedError, InvalidTokenClaimPropertyMismatch, InvalidTokenClaimNoCurrentRewards, InvalidTokenClaimWrongClaimant, TokenTransferRecipientIdentityNotExistError, PreProgrammedDistributionTimestampInPastError, IdentityHasNotAgreedToPayRequiredTokenAmountError, RequiredTokenPaymentInfoNotSetError, IdentityTryingToPayWithWrongTokenError, TokenDirectPurchaseUserPriceTooLow, TokenAmountUnderMinimumSaleAmount, TokenNotForDirectSale, InvalidTokenPositionStateError};
|
|
92
116
|
use dpp::consensus::state::address_funds::{AddressDoesNotExistError, AddressInvalidNonceError, AddressNotEnoughFundsError, AddressesNotEnoughFundsError};
|
|
117
|
+
use dpp::consensus::state::document::referenced_document_type_deletable_error::ReferencedDocumentTypeDeletableError;
|
|
118
|
+
use dpp::consensus::state::document::referenced_identity_key_disabled_error::ReferencedIdentityKeyDisabledError;
|
|
119
|
+
use dpp::consensus::state::document::referenced_identity_key_not_found_error::ReferencedIdentityKeyNotFoundError;
|
|
120
|
+
use dpp::consensus::state::document::referenced_document_property_agreement_invalid_error::ReferencedDocumentPropertyAgreementInvalidError;
|
|
121
|
+
use dpp::consensus::state::document::referenced_document_property_mismatch_error::ReferencedDocumentPropertyMismatchError;
|
|
122
|
+
use dpp::consensus::state::document::referenced_key_id_property_invalid_error::ReferencedKeyIdPropertyInvalidError;
|
|
123
|
+
use dpp::consensus::state::document::referenced_document_type_not_found_error::ReferencedDocumentTypeNotFoundError;
|
|
93
124
|
use dpp::consensus::state::shielded::insufficient_pool_notes_error::InsufficientPoolNotesError;
|
|
94
125
|
use dpp::consensus::state::shielded::insufficient_shielded_fee_error::InsufficientShieldedFeeError;
|
|
95
126
|
use dpp::consensus::state::shielded::invalid_anchor_error::InvalidAnchorError;
|
|
@@ -136,6 +167,7 @@ use crate::errors::consensus::state::document::{
|
|
|
136
167
|
DocumentAlreadyPresentErrorWasm, DocumentNotFoundErrorWasm, DocumentOwnerIdMismatchErrorWasm,
|
|
137
168
|
DocumentTimestampWindowViolationErrorWasm, DocumentTimestampsMismatchErrorWasm,
|
|
138
169
|
DuplicateUniqueIndexErrorWasm, InvalidDocumentRevisionErrorWasm,
|
|
170
|
+
ReferencedEntityNotFoundErrorWasm,
|
|
139
171
|
};
|
|
140
172
|
use crate::errors::consensus::state::identity::{
|
|
141
173
|
IdentityAlreadyExistsErrorWasm, IdentityPublicKeyIsDisabledErrorWasm,
|
|
@@ -325,6 +357,12 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
|
|
|
325
357
|
StateError::DocumentContestNotPaidForError(e) => {
|
|
326
358
|
generic_consensus_error!(DocumentContestNotPaidForError, e).into()
|
|
327
359
|
}
|
|
360
|
+
StateError::DocumentContestIndexMismatchError(e) => {
|
|
361
|
+
generic_consensus_error!(DocumentContestIndexMismatchError, e).into()
|
|
362
|
+
}
|
|
363
|
+
StateError::DocumentContestNotRequiredError(e) => {
|
|
364
|
+
generic_consensus_error!(DocumentContestNotRequiredError, e).into()
|
|
365
|
+
}
|
|
328
366
|
StateError::RecipientIdentityDoesNotExistError(e) => {
|
|
329
367
|
generic_consensus_error!(RecipientIdentityDoesNotExistError, e).into()
|
|
330
368
|
}
|
|
@@ -463,6 +501,48 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
|
|
|
463
501
|
StateError::InsufficientShieldedFeeError(e) => {
|
|
464
502
|
generic_consensus_error!(InsufficientShieldedFeeError, e).into()
|
|
465
503
|
}
|
|
504
|
+
StateError::ReferencedEntityNotFoundError(e) => {
|
|
505
|
+
ReferencedEntityNotFoundErrorWasm::from(e).into()
|
|
506
|
+
}
|
|
507
|
+
StateError::ReferencedDocumentTypeNotFoundError(e) => {
|
|
508
|
+
generic_consensus_error!(ReferencedDocumentTypeNotFoundError, e).into()
|
|
509
|
+
}
|
|
510
|
+
StateError::ReferencedDocumentTypeDeletableError(e) => {
|
|
511
|
+
generic_consensus_error!(ReferencedDocumentTypeDeletableError, e).into()
|
|
512
|
+
}
|
|
513
|
+
StateError::ReferencedIdentityKeyNotFoundError(e) => {
|
|
514
|
+
generic_consensus_error!(ReferencedIdentityKeyNotFoundError, e).into()
|
|
515
|
+
}
|
|
516
|
+
StateError::ReferencedIdentityKeyDisabledError(e) => {
|
|
517
|
+
generic_consensus_error!(ReferencedIdentityKeyDisabledError, e).into()
|
|
518
|
+
}
|
|
519
|
+
StateError::ReferencedKeyIdPropertyInvalidError(e) => {
|
|
520
|
+
generic_consensus_error!(ReferencedKeyIdPropertyInvalidError, e).into()
|
|
521
|
+
}
|
|
522
|
+
StateError::ReferencedDocumentPropertyAgreementInvalidError(e) => {
|
|
523
|
+
generic_consensus_error!(ReferencedDocumentPropertyAgreementInvalidError, e).into()
|
|
524
|
+
}
|
|
525
|
+
StateError::ReferencedDocumentPropertyMismatchError(e) => {
|
|
526
|
+
generic_consensus_error!(ReferencedDocumentPropertyMismatchError, e).into()
|
|
527
|
+
}
|
|
528
|
+
StateError::ContractGroupAlreadyExistsError(e) => {
|
|
529
|
+
generic_consensus_error!(ContractGroupAlreadyExistsError, e).into()
|
|
530
|
+
}
|
|
531
|
+
StateError::ContractGroupNotFoundError(e) => {
|
|
532
|
+
generic_consensus_error!(ContractGroupNotFoundError, e).into()
|
|
533
|
+
}
|
|
534
|
+
StateError::IdentityNotContractGroupOwnerOrAdminError(e) => {
|
|
535
|
+
generic_consensus_error!(IdentityNotContractGroupOwnerOrAdminError, e).into()
|
|
536
|
+
}
|
|
537
|
+
StateError::ContractGroupAdminNotFoundError(e) => {
|
|
538
|
+
generic_consensus_error!(ContractGroupAdminNotFoundError, e).into()
|
|
539
|
+
}
|
|
540
|
+
StateError::IdentityPublicKeyBudgetExceededError(e) => {
|
|
541
|
+
generic_consensus_error!(IdentityPublicKeyBudgetExceededError, e).into()
|
|
542
|
+
}
|
|
543
|
+
StateError::IdentityPublicKeyAlreadyExpiredError(e) => {
|
|
544
|
+
generic_consensus_error!(IdentityPublicKeyAlreadyExpiredError, e).into()
|
|
545
|
+
}
|
|
466
546
|
}
|
|
467
547
|
}
|
|
468
548
|
|
|
@@ -619,6 +699,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
|
|
|
619
699
|
IdentityAssetLockTransactionTooManyInputsError(e) => {
|
|
620
700
|
IdentityAssetLockTransactionTooManyInputsErrorWasm::from(e).into()
|
|
621
701
|
}
|
|
702
|
+
ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationError(e) => {
|
|
703
|
+
ContractGroupBoundKeyNotAllowedInShieldedIdentityCreationErrorWasm::from(e).into()
|
|
704
|
+
}
|
|
622
705
|
InvalidInstantAssetLockProofError(e) => {
|
|
623
706
|
InvalidInstantAssetLockProofErrorWasm::from(e).into()
|
|
624
707
|
}
|
|
@@ -877,6 +960,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
|
|
|
877
960
|
generic_consensus_error!(InvalidTokenDistributionTimeIntervalNotMinuteAlignedError, e)
|
|
878
961
|
.into()
|
|
879
962
|
}
|
|
963
|
+
BasicError::InvalidTokenDistributionEpochIntervalTooShortError(e) => {
|
|
964
|
+
generic_consensus_error!(InvalidTokenDistributionEpochIntervalTooShortError, e).into()
|
|
965
|
+
}
|
|
880
966
|
BasicError::RedundantDocumentPaidForByTokenWithContractId(e) => {
|
|
881
967
|
generic_consensus_error!(RedundantDocumentPaidForByTokenWithContractId, e).into()
|
|
882
968
|
}
|
|
@@ -973,6 +1059,43 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
|
|
|
973
1059
|
BasicError::TokenPricingScheduleEmptyError(e) => {
|
|
974
1060
|
generic_consensus_error!(TokenPricingScheduleEmptyError, e).into()
|
|
975
1061
|
}
|
|
1062
|
+
BasicError::DataContractInvalidRequiredFieldsUpdateError(e) => {
|
|
1063
|
+
generic_consensus_error!(DataContractInvalidRequiredFieldsUpdateError, e).into()
|
|
1064
|
+
}
|
|
1065
|
+
BasicError::ContractGroupMembershipsOverLimitError(e) => {
|
|
1066
|
+
generic_consensus_error!(ContractGroupMembershipsOverLimitError, e).into()
|
|
1067
|
+
}
|
|
1068
|
+
BasicError::DuplicateContractGroupMembershipError(e) => {
|
|
1069
|
+
generic_consensus_error!(DuplicateContractGroupMembershipError, e).into()
|
|
1070
|
+
}
|
|
1071
|
+
BasicError::RedundantContractGroupMembershipError(e) => {
|
|
1072
|
+
generic_consensus_error!(RedundantContractGroupMembershipError, e).into()
|
|
1073
|
+
}
|
|
1074
|
+
BasicError::ContractGroupMemberNotInContractError(e) => {
|
|
1075
|
+
generic_consensus_error!(ContractGroupMemberNotInContractError, e).into()
|
|
1076
|
+
}
|
|
1077
|
+
BasicError::InvalidContractGroupAdminsError(e) => {
|
|
1078
|
+
generic_consensus_error!(InvalidContractGroupAdminsError, e).into()
|
|
1079
|
+
}
|
|
1080
|
+
BasicError::InvalidContractGroupNameLengthError(e) => {
|
|
1081
|
+
generic_consensus_error!(InvalidContractGroupNameLengthError, e).into()
|
|
1082
|
+
}
|
|
1083
|
+
BasicError::InvalidContractGroupDescriptionLengthError(e) => {
|
|
1084
|
+
generic_consensus_error!(InvalidContractGroupDescriptionLengthError, e).into()
|
|
1085
|
+
}
|
|
1086
|
+
BasicError::IdentityPublicKeyLimitsNotAllowedError(e) => {
|
|
1087
|
+
generic_consensus_error!(IdentityPublicKeyLimitsNotAllowedError, e).into()
|
|
1088
|
+
}
|
|
1089
|
+
BasicError::InvalidIdentityPublicKeyBudgetError(e) => {
|
|
1090
|
+
generic_consensus_error!(InvalidIdentityPublicKeyBudgetError, e).into()
|
|
1091
|
+
}
|
|
1092
|
+
BasicError::IdentityPublicKeyLimitsNotAllowedInShieldedIdentityCreationError(e) => {
|
|
1093
|
+
generic_consensus_error!(
|
|
1094
|
+
IdentityPublicKeyLimitsNotAllowedInShieldedIdentityCreationError,
|
|
1095
|
+
e
|
|
1096
|
+
)
|
|
1097
|
+
.into()
|
|
1098
|
+
}
|
|
976
1099
|
}
|
|
977
1100
|
}
|
|
978
1101
|
|
|
@@ -1006,9 +1129,21 @@ fn from_signature_error(signature_error: &SignatureError) -> JsValue {
|
|
|
1006
1129
|
SignatureError::InvalidSignaturePublicKeyPurposeError(err) => {
|
|
1007
1130
|
InvalidSignaturePublicKeyPurposeErrorWasm::from(err).into()
|
|
1008
1131
|
}
|
|
1132
|
+
SignatureError::ContractBoundedKeyNonBatchError(err) => {
|
|
1133
|
+
ContractBoundedKeyNonBatchErrorWasm::from(err).into()
|
|
1134
|
+
}
|
|
1135
|
+
SignatureError::ContractBoundedKeyOutOfBoundsError(err) => {
|
|
1136
|
+
ContractBoundedKeyOutOfBoundsErrorWasm::from(err).into()
|
|
1137
|
+
}
|
|
1009
1138
|
SignatureError::UncompressedPublicKeyNotAllowedError(err) => {
|
|
1010
1139
|
UncompressedPublicKeyNotAllowedErrorWasm::from(err).into()
|
|
1011
1140
|
}
|
|
1141
|
+
SignatureError::PublicKeyBudgetExhaustedError(e) => {
|
|
1142
|
+
generic_consensus_error!(PublicKeyBudgetExhaustedError, e).into()
|
|
1143
|
+
}
|
|
1144
|
+
SignatureError::PublicKeyExpiredError(e) => {
|
|
1145
|
+
generic_consensus_error!(PublicKeyExpiredError, e).into()
|
|
1146
|
+
}
|
|
1012
1147
|
}
|
|
1013
1148
|
}
|
|
1014
1149
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
use crate::errors::consensus::consensus_error::from_consensus_error;
|
|
2
2
|
use dpp::consensus::ConsensusError;
|
|
3
|
-
use dpp::serialization::
|
|
3
|
+
use dpp::serialization::PlatformDeserializableUntrusted;
|
|
4
4
|
use wasm_bindgen::prelude::wasm_bindgen;
|
|
5
5
|
use wasm_bindgen::{JsError, JsValue};
|
|
6
6
|
|
|
7
7
|
#[wasm_bindgen(js_name=deserializeConsensusError)]
|
|
8
8
|
pub fn deserialize_consensus_error(bytes: Vec<u8>) -> Result<JsValue, JsError> {
|
|
9
|
-
ConsensusError::
|
|
9
|
+
ConsensusError::deserialize_from_bytes_untrusted(bytes.as_slice())
|
|
10
10
|
.map(from_consensus_error)
|
|
11
11
|
.map_err(|e| e.into())
|
|
12
12
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
2
|
+
use dpp::consensus::signature::ContractBoundedKeyNonBatchError;
|
|
3
|
+
use dpp::consensus::ConsensusError;
|
|
4
|
+
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=ContractBoundedKeyNonBatchError)]
|
|
8
|
+
pub struct ContractBoundedKeyNonBatchErrorWasm {
|
|
9
|
+
inner: ContractBoundedKeyNonBatchError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&ContractBoundedKeyNonBatchError> for ContractBoundedKeyNonBatchErrorWasm {
|
|
13
|
+
fn from(e: &ContractBoundedKeyNonBatchError) -> Self {
|
|
14
|
+
Self { inner: e.clone() }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=ContractBoundedKeyNonBatchError)]
|
|
19
|
+
impl ContractBoundedKeyNonBatchErrorWasm {
|
|
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
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
2
|
+
use dpp::consensus::signature::ContractBoundedKeyOutOfBoundsError;
|
|
3
|
+
use dpp::consensus::ConsensusError;
|
|
4
|
+
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=ContractBoundedKeyOutOfBoundsError)]
|
|
8
|
+
pub struct ContractBoundedKeyOutOfBoundsErrorWasm {
|
|
9
|
+
inner: ContractBoundedKeyOutOfBoundsError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&ContractBoundedKeyOutOfBoundsError> for ContractBoundedKeyOutOfBoundsErrorWasm {
|
|
13
|
+
fn from(e: &ContractBoundedKeyOutOfBoundsError) -> Self {
|
|
14
|
+
Self { inner: e.clone() }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=ContractBoundedKeyOutOfBoundsError)]
|
|
19
|
+
impl ContractBoundedKeyOutOfBoundsErrorWasm {
|
|
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
|
+
}
|
|
@@ -9,3 +9,9 @@ pub use basic_ecdsa_error::*;
|
|
|
9
9
|
pub use identity_not_found_error::*;
|
|
10
10
|
pub use signature_should_not_be_present_error::*;
|
|
11
11
|
pub use uncompressed_public_key_not_allowed_error::*;
|
|
12
|
+
|
|
13
|
+
mod contract_bounded_key_non_batch_error;
|
|
14
|
+
pub use contract_bounded_key_non_batch_error::ContractBoundedKeyNonBatchErrorWasm;
|
|
15
|
+
|
|
16
|
+
mod contract_bounded_key_out_of_bounds_error;
|
|
17
|
+
pub use contract_bounded_key_out_of_bounds_error::ContractBoundedKeyOutOfBoundsErrorWasm;
|
|
@@ -6,6 +6,7 @@ mod document_timestamps_are_equal_error;
|
|
|
6
6
|
mod document_timestamps_mismatch_error;
|
|
7
7
|
mod duplicate_unique_index_error;
|
|
8
8
|
mod invalid_document_revision_error;
|
|
9
|
+
mod referenced_entity_not_found_error;
|
|
9
10
|
|
|
10
11
|
pub use document_already_present_error::*;
|
|
11
12
|
pub use document_not_found_error::*;
|
|
@@ -15,3 +16,4 @@ pub use document_timestamps_are_equal_error::*;
|
|
|
15
16
|
pub use document_timestamps_mismatch_error::*;
|
|
16
17
|
pub use duplicate_unique_index_error::*;
|
|
17
18
|
pub use invalid_document_revision_error::*;
|
|
19
|
+
pub use referenced_entity_not_found_error::*;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
+
use dpp::consensus::state::document::referenced_entity_not_found_error::ReferencedEntityNotFoundError;
|
|
4
|
+
use dpp::consensus::ConsensusError;
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=ReferencedEntityNotFoundError)]
|
|
8
|
+
pub struct ReferencedEntityNotFoundErrorWasm {
|
|
9
|
+
inner: ReferencedEntityNotFoundError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&ReferencedEntityNotFoundError> for ReferencedEntityNotFoundErrorWasm {
|
|
13
|
+
fn from(e: &ReferencedEntityNotFoundError) -> Self {
|
|
14
|
+
Self { inner: e.clone() }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=ReferencedEntityNotFoundError)]
|
|
19
|
+
impl ReferencedEntityNotFoundErrorWasm {
|
|
20
|
+
#[wasm_bindgen(js_name=getEntityId)]
|
|
21
|
+
pub fn entity_id(&self) -> Buffer {
|
|
22
|
+
Buffer::from_bytes(self.inner.entity_id().as_bytes())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[wasm_bindgen(js_name=getEntityType)]
|
|
26
|
+
pub fn entity_type(&self) -> String {
|
|
27
|
+
self.inner.entity_type().to_string()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[wasm_bindgen(js_name=getPath)]
|
|
31
|
+
pub fn path(&self) -> String {
|
|
32
|
+
self.inner.path().to_string()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
36
|
+
pub fn get_code(&self) -> u32 {
|
|
37
|
+
ConsensusError::from(self.inner.clone()).code()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#[wasm_bindgen(getter)]
|
|
41
|
+
pub fn message(&self) -> String {
|
|
42
|
+
self.inner.to_string()
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/identity/identity.rs
CHANGED
|
@@ -10,7 +10,7 @@ use dpp::identity::identity_public_key::accessors::v0::IdentityPublicKeyGettersV
|
|
|
10
10
|
use dpp::identity::{Identity, IdentityPublicKey, KeyID};
|
|
11
11
|
use dpp::metadata::Metadata;
|
|
12
12
|
use dpp::platform_value::ReplacementType;
|
|
13
|
-
use dpp::serialization::
|
|
13
|
+
use dpp::serialization::PlatformDeserializableUntrusted;
|
|
14
14
|
use dpp::serialization::PlatformSerializable;
|
|
15
15
|
use dpp::serialization::ValueConvertible;
|
|
16
16
|
use dpp::version::PlatformVersion;
|
|
@@ -267,7 +267,8 @@ impl IdentityWasm {
|
|
|
267
267
|
#[wasm_bindgen(js_name=fromBuffer)]
|
|
268
268
|
pub fn from_buffer(buffer: Vec<u8>) -> Result<IdentityWasm, JsValue> {
|
|
269
269
|
let identity: Identity =
|
|
270
|
-
|
|
270
|
+
PlatformDeserializableUntrusted::deserialize_from_bytes_untrusted(buffer.as_slice())
|
|
271
|
+
.with_js_error()?;
|
|
271
272
|
Ok(identity.into())
|
|
272
273
|
}
|
|
273
274
|
}
|
|
@@ -11,7 +11,7 @@ use dpp::identity::identity_public_key::accessors::v0::{
|
|
|
11
11
|
use dpp::identity::identity_public_key::hash::IdentityPublicKeyHashMethodsV0;
|
|
12
12
|
use dpp::identity::{IdentityPublicKey, KeyID, TimestampMillis};
|
|
13
13
|
use dpp::platform_value::{BinaryData, ReplacementType};
|
|
14
|
-
use dpp::serialization::{
|
|
14
|
+
use dpp::serialization::{PlatformDeserializableUntrusted, PlatformSerializable, ValueConvertible};
|
|
15
15
|
use dpp::ProtocolError;
|
|
16
16
|
|
|
17
17
|
use dpp::version::PlatformVersion;
|
|
@@ -196,7 +196,8 @@ impl IdentityPublicKeyWasm {
|
|
|
196
196
|
#[wasm_bindgen(js_name=fromBuffer)]
|
|
197
197
|
pub fn from_buffer(buffer: Vec<u8>) -> Result<IdentityPublicKeyWasm, JsValue> {
|
|
198
198
|
let key: IdentityPublicKey =
|
|
199
|
-
|
|
199
|
+
PlatformDeserializableUntrusted::deserialize_from_bytes_untrusted(buffer.as_slice())
|
|
200
|
+
.with_js_error()?;
|
|
200
201
|
Ok(key.into())
|
|
201
202
|
}
|
|
202
203
|
}
|
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;
|
package/src/lib.rs
CHANGED
|
@@ -84,7 +84,9 @@ impl StateTransitionFactoryWasm {
|
|
|
84
84
|
| StateTransition::Unshield(_)
|
|
85
85
|
| StateTransition::ShieldFromAssetLock(_)
|
|
86
86
|
| StateTransition::ShieldedWithdrawal(_)
|
|
87
|
-
| StateTransition::IdentityCreateFromShieldedPool(_)
|
|
87
|
+
| StateTransition::IdentityCreateFromShieldedPool(_)
|
|
88
|
+
| StateTransition::ShieldFromIdentity(_)
|
|
89
|
+
| StateTransition::IdentityTopUpFromShieldedPool(_) => Err(JsValue::from_str(
|
|
88
90
|
"shielded transitions are not yet supported in wasm-dpp StateTransitionFactory",
|
|
89
91
|
)),
|
|
90
92
|
},
|
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
|
}
|