1pub type Result<T> = core::result::Result<T, WalletError>;
3
4#[derive(thiserror::Error, Debug)]
6pub enum WalletError {
7 #[error("Wallet feature is not implemented")]
9 WalletFeatureNotImplemented,
10
11 #[error("Wallet address is empty")]
13 EmptyWalletAddress,
14
15 #[error("ParseError: {0}")]
17 Parse(String),
18
19 #[error("InvalidTransactionAmount: {0}")]
21 InvalidTransactionAmount(String),
22
23 #[error("InvalidTransaction: {0}")]
25 InvalidTransaction(String),
26
27 #[error("InsufficientBalanceError: {0}")]
29 InsufficientBalance(String),
30
31 #[error("Decimal error: {0}")]
33 Decimal(rust_decimal::Error),
34
35 #[error("Bip32: {0:?}")]
37 Bip32(#[from] bip32::Error),
38
39 #[error("LocalSignerError: {0}")]
41 LocalSignerError(#[from] alloy::signers::local::LocalSignerError),
42
43 #[error("PendingTransactionError: {0}")]
45 PendingTransactionError(#[from] alloy::providers::PendingTransactionError),
46
47 #[error("Invalid hex value: {0}")]
49 FromHexError(#[from] alloy_primitives::hex::FromHexError),
50
51 #[error("Alloy transport RPC error: {0}")]
53 AlloyTransportRpcError(#[from] alloy_json_rpc::RpcError<alloy_transport::TransportErrorKind>),
54
55 #[error("TransactionNotFound")]
57 TransactionNotFound,
58
59 #[error("Unable to convert: {0}")]
61 ConversionError(String),
62
63 #[error("Contract error: {0}")]
65 Contract(#[from] alloy::contract::Error),
66
67 #[error("SolidityError error: {0}")]
69 SolidityError(#[from] alloy::sol_types::Error),
70
71 #[error("IotaRebased: {0}")]
73 IotaRebased(#[from] crate::rebased::RebasedError),
74
75 #[error("FailToConfirmTransactionStatus: Failed to confirm tx status for {0} within {1} seconds.")]
77 FailToConfirmTransactionStatus(String, u64),
78}
79
80impl From<rust_decimal::Error> for WalletError {
81 fn from(value: rust_decimal::Error) -> Self {
82 Self::Decimal(value)
83 }
84}