Skip to main content

smplx_sdk/signer/
error.rs

1use crate::program::ProgramError;
2use crate::provider::ProviderError;
3use crate::transaction::TransactionError;
4
5#[derive(Debug, thiserror::Error)]
6pub enum SignerError {
7    #[error(transparent)]
8    Program(#[from] ProgramError),
9
10    #[error(transparent)]
11    Provider(#[from] ProviderError),
12
13    #[error(transparent)]
14    Transaction(#[from] TransactionError),
15
16    #[error("Failed to parse a mnemonic: {0}")]
17    Mnemonic(String),
18
19    #[error("Failed to extract tx from pst: {0}")]
20    TxExtraction(#[from] simplicityhl::elements::pset::Error),
21
22    #[error("Failed to construct a message for the input spending: {0}")]
23    SighashConstruction(#[from] elements_miniscript::psbt::SighashError),
24
25    #[error("Fee amount is too low: {0}")]
26    DustAmount(i64),
27
28    #[error("Not enough fee amount {0} to cover transaction costs: {1}")]
29    NotEnoughFeeAmount(i64, u64),
30
31    #[error("Not enough funds on account to cover transaction costs: {0}")]
32    NotEnoughFunds(u64),
33
34    #[error("Invalid secret key")]
35    InvalidSecretKey(#[from] simplicityhl::elements::secp256k1_zkp::UpstreamError),
36
37    #[error("Failed to derive a private key: {0}")]
38    PrivateKeyDerivation(#[from] elements_miniscript::bitcoin::bip32::Error),
39
40    #[error("Failed to construct a derivation path: {0}")]
41    DerivationPath(String),
42
43    #[error("Failed to construct a wpkh descriptor: {0}")]
44    WpkhDescriptor(String),
45
46    #[error("Failed to convert a descriptor: {0}")]
47    DescriptorConversion(#[from] elements_miniscript::descriptor::ConversionError),
48
49    #[error("Failed to construct a wpkh address: {0}")]
50    WpkhAddressConstruction(#[from] elements_miniscript::Error),
51}