Skip to content

Commit

Permalink
wasm fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer committed Jan 23, 2025
1 parent 197de1e commit b59f157
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use crate::consensus::state::state_error::StateError;
use crate::consensus::ConsensusError;
use crate::data_contract::GroupContractPosition;
use crate::ProtocolError;
use bincode::{Decode, Encode};
use platform_serialization_derive::{PlatformDeserialize, PlatformSerialize};
use platform_value::Identifier;
use thiserror::Error;

#[derive(
Expand Down
29 changes: 23 additions & 6 deletions packages/wasm-dpp/src/errors/consensus/consensus_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ use dpp::consensus::basic::document::{ContestedDocumentsTemporarilyNotAllowedErr
use dpp::consensus::basic::group::GroupActionNotAllowedOnTransitionError;
use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, TooManyMasterPublicKeyError, WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError};
use dpp::consensus::basic::overflow_error::OverflowError;
use dpp::consensus::basic::token::{ChoosingTokenMintRecipientNotAllowedError, ContractHasNoTokensError, DestinationIdentityForTokenMintingNotSetError, InvalidActionIdError, InvalidGroupPositionError, InvalidTokenIdError, InvalidTokenPositionError, TokenTransferToOurselfError};
use dpp::consensus::basic::token::{ChoosingTokenMintRecipientNotAllowedError, ContractHasNoTokensError, DestinationIdentityForTokenMintingNotSetError, InvalidActionIdError, InvalidTokenIdError, InvalidTokenPositionError, TokenTransferToOurselfError};
use dpp::consensus::state::data_contract::data_contract_update_action_not_allowed_error::DataContractUpdateActionNotAllowedError;
use dpp::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError;
use dpp::consensus::state::document::document_contest_currently_locked_error::DocumentContestCurrentlyLockedError;
Expand All @@ -84,7 +84,7 @@ use dpp::consensus::state::identity::no_transfer_key_for_core_withdrawal_availab
use dpp::consensus::state::identity::RecipientIdentityDoesNotExistError;
use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_insufficient_error::PrefundedSpecializedBalanceInsufficientError;
use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError;
use dpp::consensus::state::token::{IdentityDoesNotHaveEnoughTokenBalanceError, IdentityTokenAccountNotFrozenError, IdentityTokenAccountFrozenError, UnauthorizedTokenActionError};
use dpp::consensus::state::token::{IdentityDoesNotHaveEnoughTokenBalanceError, IdentityTokenAccountNotFrozenError, IdentityTokenAccountFrozenError, UnauthorizedTokenActionError, TokenSettingMaxSupplyToLessThanCurrentSupplyError, TokenMintPastMaxSupplyError, NewTokensDestinationIdentityDoesNotExistError, NewAuthorizedActionTakerIdentityDoesNotExistError, NewAuthorizedActionTakerGroupDoesNotExistError, NewAuthorizedActionTakerMainGroupNotSetError, InvalidGroupPositionError};
use dpp::consensus::state::voting::masternode_incorrect_voter_identity_id_error::MasternodeIncorrectVoterIdentityIdError;
use dpp::consensus::state::voting::masternode_incorrect_voting_address_error::MasternodeIncorrectVotingAddressError;
use dpp::consensus::state::voting::masternode_not_found_error::MasternodeNotFoundError;
Expand Down Expand Up @@ -344,6 +344,27 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
StateError::DataContractUpdateActionNotAllowedError(e) => {
generic_consensus_error!(DataContractUpdateActionNotAllowedError, e).into()
}
StateError::TokenSettingMaxSupplyToLessThanCurrentSupplyError(e) => {
generic_consensus_error!(TokenSettingMaxSupplyToLessThanCurrentSupplyError, e).into()
}
StateError::TokenMintPastMaxSupplyError(e) => {
generic_consensus_error!(TokenMintPastMaxSupplyError, e).into()
}
StateError::NewTokensDestinationIdentityDoesNotExistError(e) => {
generic_consensus_error!(NewTokensDestinationIdentityDoesNotExistError, e).into()
}
StateError::NewAuthorizedActionTakerIdentityDoesNotExistError(e) => {
generic_consensus_error!(NewAuthorizedActionTakerIdentityDoesNotExistError, e).into()
}
StateError::NewAuthorizedActionTakerGroupDoesNotExistError(e) => {
generic_consensus_error!(NewAuthorizedActionTakerGroupDoesNotExistError, e).into()
}
StateError::NewAuthorizedActionTakerMainGroupNotSetError(e) => {
generic_consensus_error!(NewAuthorizedActionTakerMainGroupNotSetError, e).into()
}
StateError::InvalidGroupPositionError(e) => {
generic_consensus_error!(InvalidGroupPositionError, e).into()
}
}
}

Expand Down Expand Up @@ -622,10 +643,6 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
generic_consensus_error!(ContractHasNoTokensError, e).into()
}

BasicError::InvalidGroupPositionError(e) => {
generic_consensus_error!(InvalidGroupPositionError, e).into()
}

BasicError::InvalidActionIdError(e) => {
generic_consensus_error!(InvalidActionIdError, e).into()
}
Expand Down

0 comments on commit b59f157

Please sign in to comment.