use alloy::primitives::Address;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("contract error: {0}")]
Contract(#[from] alloy::contract::Error),
#[error("transport error: {0}")]
Transport(#[from] alloy::transports::RpcError<alloy::transports::TransportErrorKind>),
#[error("registry not configured: {registry}")]
RegistryNotConfigured {
registry: &'static str,
},
#[error("agent {agent_id} does not exist")]
AgentNotFound {
agent_id: alloy::primitives::U256,
},
#[error("pending transaction error: {0}")]
PendingTransaction(#[from] alloy::providers::PendingTransactionError),
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
#[error("invalid address: {address}")]
InvalidAddress {
address: String,
#[source]
source: alloy::hex::FromHexError,
},
#[error("identity registry mismatch: expected {expected}, got {actual}")]
IdentityRegistryMismatch {
expected: Address,
actual: Address,
},
}
pub type Result<T> = core::result::Result<T, Error>;