1pub use crate::json_rpc_error::Error as JsonRpcError;
5use sui_types::base_types::{SuiAddress, TransactionDigest};
6use sui_types::error::UserInputError;
7use thiserror::Error;
8
9pub type SuiRpcResult<T = ()> = Result<T, Error>;
10
11#[derive(Error, Debug)]
12pub enum Error {
13 #[error(transparent)]
14 RpcError(#[from] jsonrpsee::core::ClientError),
15 #[error(transparent)]
16 JsonRpcError(JsonRpcError),
17 #[error(transparent)]
18 BcsSerialisationError(#[from] bcs::Error),
19 #[error(transparent)]
20 JsonSerializationError(#[from] serde_json::Error),
21 #[error(transparent)]
22 UserInputError(#[from] UserInputError),
23 #[error("Subscription error : {0}")]
24 Subscription(String),
25 #[error("Failed to confirm tx status for {0:?} within {1} seconds.")]
26 FailToConfirmTransactionStatus(TransactionDigest, u64),
27 #[error("Data error: {0}")]
28 DataError(String),
29 #[error(
30 "Client/Server api version mismatch, client api version : {client_version}, server api version : {server_version}"
31 )]
32 ServerVersionMismatch {
33 client_version: String,
34 server_version: String,
35 },
36 #[error("Insufficient fund for address [{address}], requested amount: {amount}")]
37 InsufficientFund { address: SuiAddress, amount: u128 },
38 #[error("Invalid signature")]
39 InvalidSignature,
40 #[error("Invalid Header key-value pair: {0}")]
41 CustomHeadersError(String),
42}