use stellar_baselib::xdr::SorobanTransactionData;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum AuthModeError {
#[error("Invalid auth mode: {0}, should be one of 'enforce', 'record', 'record_allow_nonroot' or be omitted")]
Invalid(String),
}
#[derive(Error, Debug)]
pub enum Error {
#[error(transparent)]
InvalidRpc(#[from] InvalidRpcUrl),
#[error("XdrError")]
XdrError,
#[error("JsonError: could not parse {0}")]
JsonError(String),
#[error("NetworkError")]
NetworkError(#[from] reqwest::Error),
#[error("AccountError")]
AccountNotFound,
#[error("ContractError")]
ContractDataNotFound,
#[error("TransactionError")]
TransactionError,
#[error("InvalidSorobanTransaction")]
InvalidSorobanTransaction,
#[error("SimulationFailed: `{0}`")]
SimulationFailed(String),
#[error("RestorationRequired")]
RestorationRequired(i64, SorobanTransactionData),
#[error("RPCError {code}: {message}")]
RPCError {
code: i32,
message: String,
},
#[error("UnexpectedError")]
UnexpectedError,
#[error("NoFriendbot")]
NoFriendbot,
#[error("Timeout of {0}s reached after {1}s while waiting for a transaction to complete")]
WaitTransactionTimeout(u64, u64),
#[error("NotImplemented: `{0}`")]
NotImplemented(String),
}
#[derive(Error, Debug)]
pub enum InvalidRpcUrl {
#[error("The RPC Url scheme should be http or https")]
NotHttpScheme,
#[error("Http scheme requires the option allow_http: true")]
UnsecureHttpNotAllowed,
#[error("InvalidUrl")]
InvalidUri,
}