pub type Result<T> = core::result::Result<T, WalletError>;
#[derive(thiserror::Error, Debug)]
pub enum WalletError {
#[error("Wallet feature is not implemented")]
WalletFeatureNotImplemented,
#[error("Wallet address is empty")]
EmptyWalletAddress,
#[error("ParseError: {0}")]
Parse(String),
#[error("InvalidTransactionAmount: {0}")]
InvalidTransactionAmount(String),
#[error("InvalidTransaction: {0}")]
InvalidTransaction(String),
#[error("InsufficientBalanceError: {0}")]
InsufficientBalance(String),
#[error("Decimal error: {0}")]
Decimal(rust_decimal::Error),
#[error("Bip32: {0:?}")]
Bip32(#[from] bip32::Error),
#[error("LocalSignerError: {0}")]
LocalSignerError(#[from] alloy::signers::local::LocalSignerError),
#[error("PendingTransactionError: {0}")]
PendingTransactionError(#[from] alloy::providers::PendingTransactionError),
#[error("Invalid hex value: {0}")]
FromHexError(#[from] alloy_primitives::hex::FromHexError),
#[error("Alloy transport RPC error: {0}")]
AlloyTransportRpcError(#[from] alloy_json_rpc::RpcError<alloy_transport::TransportErrorKind>),
#[error("TransactionNotFound")]
TransactionNotFound,
#[error("Unable to convert: {0}")]
ConversionError(String),
#[error("Contract error: {0}")]
Contract(#[from] alloy::contract::Error),
#[error("SolidityError error: {0}")]
SolidityError(#[from] alloy::sol_types::Error),
#[error("IotaRebased: {0}")]
IotaRebased(#[from] crate::rebased::RebasedError),
#[error("FailToConfirmTransactionStatus: Failed to confirm tx status for {0} within {1} seconds.")]
FailToConfirmTransactionStatus(String, u64),
}
impl From<rust_decimal::Error> for WalletError {
fn from(value: rust_decimal::Error) -> Self {
Self::Decimal(value)
}
}