Skip to main content

smplx_sdk/signer/
error.rs

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