1use bitcoin::secp256k1;
2use tonic::codegen::http::uri::InvalidUri;
3
4#[derive(Debug, thiserror::Error)]
5pub enum SparkSdkError {
6 #[error("Transport error: {0}")]
7 Transport(#[from] tonic::transport::Error),
8
9 #[error("Status error: {0}")]
10 Status(#[from] tonic::Status),
11
12 #[error("Invalid URI: {0}")]
13 InvalidUri(#[from] InvalidUri),
14
15 #[error("Invalid configuration: {0}")]
16 Config(String),
17
18 #[error("Wallet error: {0}")]
19 Wallet(String),
20
21 #[error("Signature error: {0}")]
22 Secp256k1(#[from] secp256k1::Error),
23
24 #[error("Invalid input: {0}")]
25 InvalidInput(String),
26
27 #[error("RPC connection error: {0}")]
28 RpcConnection(String),
29
30 #[error("Deposit address validation failed: {0}")]
31 DepositAddressValidationFailed(String),
32
33 #[error("Tree creation error: {0}")]
34 TreeCreationError(String),
35
36 #[error("Frost signing error: {0}")]
37 FrostSigningError(String),
38
39 #[error("Frost aggregation error: {0}")]
40 FrostAggregationError(String),
41
42 #[error("Invalid argument: {0}")]
43 InvalidArgument(String),
44
45 #[error("Invalid address: {0}")]
46 InvalidAddress(String),
47
48 #[error("Transfer error: {0}")]
49 TransferError(String),
50
51 #[error("Crypto error: {0}")]
52 CryptoError(String),
53
54 #[error("Authentication error: {0}")]
55 AuthenticationError(String),
56
57 #[error("Initialization error: {0}")]
58 InitializationError(String),
59
60 #[error("General error (this must be defined last): {0}")]
61 General(String),
62
63 #[error("There is no leaf for the wallet. Perhaps you should query pending transfers headed to you first?")]
64 NoLeavesFound,
65
66 #[error("There is no leaf with the exact amount.")]
67 NoLeafWithExactAmount,
68
69 #[error("Leaf selection error: {0}")]
70 LeafSelectionError(String),
71
72 #[error("Invalid hash: {0}")]
73 InvalidHash(String),
74
75 #[error("Invalid bitcoin transaction: {0}")]
76 InvalidBitcoinTransaction(String),
77
78 #[error("IO error: {0}")]
79 IoError(String),
80
81 #[error("Decryption error: {0}")]
82 DecryptionError(String),
83
84 #[error("Secret key not found for public key: {0}")]
85 SecretKeyNotFound(String),
86
87 #[error("Missing keyshare info in response: {0}")]
88 MissingKeyshareInfo(String),
89
90 #[error("Invalid response: {0}")]
91 InvalidResponse(String),
92
93 #[error("IO error: {0}")]
94 Io(String),
95
96 #[error("Bitcoin RPC error: {0}")]
97 BitcoinRpc(String),
98
99 #[error("Invalid keyshare config: {0}")]
100 InvalidKeyshareConfig(String),
101
102 #[error("Invalid token transaction: {0}")]
103 InvalidTokenTransaction(String),
104
105 #[error("Test database query error: {0}")]
106 TestDatabaseQueryError(String),
107
108 #[error("Serde Json error: {0}")]
109 SerdeJson(#[from] serde_json::Error),
110
111 #[error("GraphQL error: {0}")]
112 GraphQLError(String),
113
114 #[error("GraphQL request failed: {0}")]
115 GraphQLRequestFailed(String),
116
117 #[error("Decoding error: {0}")]
118 DecodingError(#[from] hex::FromHexError),
119
120 #[error("Leaf not found: {0}")]
121 LeafNotFound(String),
122
123 #[error("Invalid UUID: {0}")]
124 FromUuidError(#[from] uuid::Error),
125
126 #[error("Faucet request failed: {0}")]
127 FaucetRequestFailed(String),
128}