use bitcoin::address::Error as BitcoinAddressError;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("Currently not supported: {0}")]
CurrentlyNotSupported(String),
#[error("Did not get fee map")]
MissingFeeMap,
#[error("Insufficent funds")]
InsufficientFunds(String),
#[error("Public Key not included")]
MissingPublicKey,
#[error("Private Key not included")]
MissingPrivateKey,
#[error("No blockchain client set")]
MissingBlockchainClient,
#[error("No master HD key set")]
MissingMasterHDKey,
#[error("Missing info: {0}")]
MissingInfo(String),
#[error("Could not downcast to BitcoinWallet")]
UnableToDowncastWallet,
#[error("Error downcasting: {0}")]
UnableToDowncastBlockchainConnector(String),
#[error("Transaction info not available")]
TransactionInfoUnavailable,
#[error("Error in broadcasting the transaction: {0}")]
BroadcastTransaction(String),
#[error("Txid error: {0}")]
TxId(String),
#[error("Script error: {0}")]
ScriptInvalid(String),
#[error("Missing data: {0}")]
MissingData(String),
#[error("Missing network type")]
MissingNetwork,
#[error("Unable to import wallet: {0}")]
UnableToImportWallet(String),
#[error("Error converting to a type from a string: {0}")]
FromStr(String),
#[error("Bitcoin address error: {0}")]
Bitcoin(#[from] BitcoinAddressError),
#[error("Secp256k1 error: {0}")]
Secp256k1(#[from] secp256k1::Error),
#[error("Bitcoin key error: {0}")]
BitcoinKey(#[from] bitcoin::key::Error),
#[error("Bitcoin PushBytesError: {0}")]
BitcoinPushBytes(#[from] bitcoin::blockdata::script::PushBytesError),
#[error("Hex error: {0}")]
Hex(#[from] hex::FromHexError),
#[error("Error converting from/to int: {0}")]
TryFromInt(#[from] std::num::TryFromIntError),
#[error("Error converting from/to json: {0}")]
SerdeJson(#[from] serde_json::Error),
#[error("Error from reqwest: {0}")]
Reqwest(#[from] reqwest::Error),
#[error("Error from walletd_hd_key: {0}")]
WalletdHDKey(#[from] walletd_hd_key::Error),
#[error("Error discerning the timestamp: {0}")]
Timestamp(String),
#[error("Error from time crate: {0}")]
TimeFormat(#[from] time::error::Format),
#[error("Overflow error: {0}")]
Overflow(String),
}