1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum WalletError {
8 #[error("Wallet not found: {0}")]
10 WalletNotFound(String),
11
12 #[error("Invalid wallet ID: {0}")]
14 InvalidWalletId(String),
15
16 #[error("Wallet already exists: {0}")]
18 WalletAlreadyExists(String),
19
20 #[error("Insufficient balance: have {have}, need {need}")]
22 InsufficientBalance { have: u128, need: u128 },
23
24 #[error("Asset not supported: {0}")]
26 AssetNotSupported(String),
27
28 #[error("Invalid key share: {0}")]
30 InvalidKeyShare(String),
31
32 #[error("Threshold not met: got {got}, need {need}")]
34 ThresholdNotMet { got: usize, need: usize },
35
36 #[error("Signature generation failed: {0}")]
38 SignatureFailed(String),
39
40 #[error("Keystore error: {0}")]
42 KeystoreError(String),
43
44 #[error("Encryption error: {0}")]
46 EncryptionError(String),
47
48 #[error("Decryption error: {0}")]
50 DecryptionError(String),
51
52 #[error("Invalid password")]
54 InvalidPassword,
55
56 #[error("Provisioning failed: {0}")]
58 ProvisioningFailed(String),
59
60 #[error("Transaction validation failed: {0}")]
62 TransactionValidationFailed(String),
63
64 #[error("Signature verification failed: {0}")]
66 SignatureVerificationFailed(String),
67
68 #[error("Contact not found: {0}")]
70 ContactNotFound(String),
71
72 #[error("State sync error: {0}")]
74 StateSyncError(String),
75
76 #[error("Serialization error: {0}")]
78 SerializationError(String),
79
80 #[error("Crypto error: {0}")]
82 CryptoError(#[from] tenzro_crypto::CryptoError),
83
84 #[error("IO error: {0}")]
86 IoError(#[from] std::io::Error),
87
88 #[error("{0}")]
90 Other(String),
91}
92
93pub type Result<T> = std::result::Result<T, WalletError>;