Skip to main content

onyx_sdk/
error.rs

1//! Error types for the Solana Stealth SDK
2
3use thiserror::Error;
4
5/// Errors that can occur in the Stealth SDK
6#[derive(Error, Debug)]
7pub enum StealthError {
8    #[error("Invalid meta-address format: {0}")]
9    InvalidMetaAddress(String),
10
11    #[error("Invalid stealth address: {0}")]
12    InvalidStealthAddress(String),
13
14    #[error("Invalid public key: {0}")]
15    InvalidPublicKey(String),
16
17    #[error("Invalid private key")]
18    InvalidPrivateKey,
19
20    #[error("Cryptographic operation failed: {0}")]
21    CryptoError(String),
22
23    #[error("Serialization error: {0}")]
24    SerializationError(String),
25
26    #[error("IO error: {0}")]
27    IoError(#[from] std::io::Error),
28
29    #[error("JSON error: {0}")]
30    JsonError(#[from] serde_json::Error),
31
32    #[error("Solana client error: {0}")]
33    SolanaClientError(String),
34
35    #[error("No payments found for this meta-address")]
36    NoPaymentsFound,
37
38    #[error("Invalid ephemeral public key")]
39    InvalidEphemeralKey,
40}
41
42pub type Result<T> = std::result::Result<T, StealthError>;