use ethrex_common::H256;
use thiserror::Error;
use crate::client::TransactionReceipt;
#[derive(Debug, Error)]
pub enum Error {
#[error("rpc client error: {0}")]
Client(#[from] ethrex_rpc::clients::EthClientError),
#[error("call reverted: {message}")]
Revert {
message: String,
data: Option<Vec<u8>>,
},
#[error("transaction {hash:#x} reverted")]
TransactionReverted {
hash: H256,
receipt: Box<TransactionReceipt>,
},
#[error("transaction {hash:#x} emitted no {event} event")]
MissingEvent { hash: H256, event: &'static str },
#[error("abi error: {0}")]
Abi(String),
#[error("overrides error: {0}")]
Overrides(String),
#[error("timeout: {0}")]
Timeout(String),
#[error("invalid input: {0}")]
InvalidInput(String),
}
pub type Result<T> = std::result::Result<T, Error>;