extern crate alloc;
use alloc::string::{String, ToString};
use alloy_primitives::Address;
use thiserror::Error;
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, Error)]
pub enum Error {
#[error("Transport error: {0}")]
Transport(#[from] alloy_transport::TransportError),
#[error("Transaction error: {0}")]
PendingTransaction(#[from] alloy_provider::PendingTransactionError),
#[error("Contract error: {0}")]
Contract(String),
#[error("Configuration error: {0}")]
Config(String),
#[error("Keystore error: {0}")]
Keystore(#[from] blueprint_keystore::Error),
#[error("Blueprint {0} not found")]
BlueprintNotFound(u64),
#[error("Service {0} not found")]
ServiceNotFound(u64),
#[error("Operator {0} not found")]
OperatorNotFound(Address),
#[error("Operator {0} not registered for blueprint {1}")]
OperatorNotRegistered(Address, u64),
#[error("Missing ECDSA key for operator {0}")]
MissingEcdsa(Address),
#[error("Not configured for Tangle EVM")]
NotTangle,
#[error("Current party not found in operators list")]
PartyNotFound,
#[error("Status registry contract address not configured")]
MissingStatusRegistry,
#[error("Invalid address: {0}")]
InvalidAddress(String),
#[error("Serialization error: {0}")]
Serialization(String),
#[error("Provider not initialized - call connect() first")]
ProviderNotInitialized,
#[error("Client error: {0}")]
ClientCore(#[from] blueprint_client_core::error::Error),
#[error("{0}")]
Other(String),
}
impl From<serde_json::Error> for Error {
fn from(err: serde_json::Error) -> Self {
Error::Serialization(err.to_string())
}
}