#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Allocation already available")]
AllocationsAlreadyAvailable,
#[error("Asset with id {0} not found")]
AssetNotFound(String),
#[error("Batch transfer with TXID {0} not found")]
BatchTransferNotFound(String),
#[error("Blinded UTXO already used")]
BlindedUTXOAlreadyUsed,
#[error("Cannot change online object")]
CannotChangeOnline(),
#[error("Transfer cannot be deleted")]
CannotDeleteTransfer,
#[error("Transfer cannot be set to failed status")]
CannotFailTransfer,
#[error("Electrum error: {0}")]
Electrum(#[from] electrum_client::Error),
#[error("Failed bdk sync: {0}")]
FailedBdkSync(String),
#[error("Failed broadcast: {0}")]
FailedBroadcast(String),
#[error("Failed issuance. Register status: {0}")]
FailedIssuance(String),
#[error("I/O error: {0}")]
IO(#[from] std::io::Error),
#[error("Data is inconsistent ({0}). Please check its integrity.")]
Inconsistency(String),
#[error("Inexistent data directory")]
InexistentDataDir,
#[error("Insufficient allocations")]
InsufficientAllocationSlots,
#[error("Insufficient bitcoin funds")]
InsufficientBitcoins,
#[error("Insufficient spendable funds for asset: {0}")]
InsufficientSpendableAssets(String),
#[error("Insufficient total funds for asset: {0}")]
InsufficientTotalAssets(String),
#[error("Internal error: {0}")]
Internal(#[from] InternalError),
#[error("Address error: {0}")]
InvalidAddress(#[from] bitcoin::util::address::Error),
#[error("Invalid bitcoin keys")]
InvalidBitcoinKeys(),
#[error("Invalid blinded UTXO: {0}")]
InvalidBlindedUTXO(#[from] bp::seals::txout::blind::ParseError),
#[error("Invalid description: {0}")]
InvalidDescription(String),
#[error("Invalid electrum server: {0}")]
InvalidElectrum(String),
#[error("Invalid file path: {0}")]
InvalidFilePath(String),
#[error("Invalid invoice: {0}")]
InvalidInvoice(#[from] lnpbp::bech32::Error),
#[error("Invalid mnemonic error: {0}")]
InvalidMnemonic(#[from] bdk::keys::bip39::Error),
#[error("Invalid name: {0}")]
InvalidName(String),
#[error("Invalid online object")]
InvalidOnline(),
#[error("Invalid parent ID: {0}")]
InvalidParentId(String),
#[error("Invalid PSBT: {0}")]
InvalidPsbt(#[from] bitcoin::util::psbt::PsbtParseError),
#[error("Invalid pubkey: {0}")]
InvalidPubkey(#[from] bitcoin::util::bip32::Error),
#[error("Invalid ticker: {0}")]
InvalidTicker(String),
#[error("Issuance request with no provided amounts")]
NoIssuanceAmounts,
#[error("Proxy error: {0}")]
Proxy(#[from] reqwest::Error),
#[error("Transfer with blinded UTXO {0} not found")]
TransferNotFound(String),
#[error("Unknown RGB schema: {0}")]
UnknownRgbSchema(String),
#[error("Invoice type is not supported")]
UnsupportedInvoice,
#[error("Operation not allowed on watch only wallet")]
WatchOnly(),
}
#[derive(Debug, thiserror::Error)]
pub enum InternalError {
#[error("Anchor error: {0}")]
Anchor(#[from] dbc::tapret::PsbtCommitError),
#[error("API error: {0}")]
Api(#[from] reqwest::Error),
#[error("Base64 decode error: {0}")]
Base64Decode(#[from] base64::DecodeError),
#[error("Error from bdk: {0}")]
Bdk(#[from] bdk::Error),
#[error("Bech32 error: {0}")]
Bech32(#[from] lnpbp::bech32::Error),
#[error("Cannot query rgb-node")]
CannotQueryRgbNode,
#[error("Confidential data error: {0}")]
ConfidentialData(#[from] rgb_core::ConfidentialDataError),
#[error("Database error: {0}")]
Database(#[from] sea_orm::DbErr),
#[error("Encode error: {0}")]
Encode(#[from] bitcoin::consensus::encode::Error),
#[error("PSBT key error: {0}")]
PsbtKey(#[from] rgb::psbt::KeyError),
#[error("PSBT parse error: {0}")]
PsbtParse(#[from] bitcoin::util::psbt::PsbtParseError),
#[error("Rgb 121 create error: {0}")]
Rgb121Creation(#[from] rgb121::CreateError),
#[error("Rgb blank error: {0}")]
RgbBlank(#[from] rgb::blank::Error),
#[error("RPC error from rgb: {0}")]
RgbRpc(#[from] rgb_rpc::Error),
#[error("Seal parse error: {0}")]
SealParse(#[from] bp::seals::txout::explicit::ParseError),
#[error("Serde JSON error: {0}")]
SerdeJSON(#[from] serde_json::Error),
#[error("Strict encode error: {0}")]
StrictEncode(#[from] strict_encoding::Error),
#[error("Strip prefix error: {0}")]
StripPrefix(#[from] std::path::StripPrefixError),
#[error("System time error: {0}")]
SystemTime(#[from] std::time::SystemTimeError),
#[error("Unexpected error")]
Unexpected,
}