smplx_sdk/signer/
error.rs1use crate::program::ProgramError;
2use crate::provider::ProviderError;
3
4#[derive(Debug, thiserror::Error)]
6pub enum SignerError {
7 #[error(transparent)]
9 Program(#[from] ProgramError),
10
11 #[error(transparent)]
13 Provider(#[from] ProviderError),
14
15 #[error(transparent)]
17 WtnsInjectError(#[from] WtnsWrappingError),
18
19 #[error("Failed to parse a mnemonic: {0}")]
21 Mnemonic(String),
22
23 #[error("Failed to extract tx from pst: {0}")]
25 TxExtraction(#[from] simplicityhl::elements::pset::Error),
26
27 #[error("Failed to unblind txout: {0}")]
29 Unblind(#[from] simplicityhl::elements::UnblindError),
30
31 #[error("Failed to blind a PST: {0}")]
33 PsetBlind(#[from] simplicityhl::elements::pset::PsetBlindError),
34
35 #[error("Failed to construct a message for the input spending: {0}")]
37 SighashConstruction(#[from] elements_miniscript::psbt::SighashError),
38
39 #[error("Fee amount is too low: {0}")]
41 DustAmount(i64),
42
43 #[error("Not enough fee amount {0} to cover transaction costs: {1}")]
45 NotEnoughFeeAmount(i64, u64),
46
47 #[error("Not enough funds on account to cover transaction costs: {0}")]
49 NotEnoughFunds(u64),
50
51 #[error("Invalid secret key")]
53 InvalidSecretKey(#[from] simplicityhl::elements::secp256k1_zkp::UpstreamError),
54
55 #[error("Failed to derive a private key: {0}")]
57 PrivateKeyDerivation(#[from] elements_miniscript::bitcoin::bip32::Error),
58
59 #[error("Failed to construct a derivation path: {0}")]
61 DerivationPath(String),
62
63 #[error("Failed to construct a wpkh descriptor: {0}")]
65 WpkhDescriptor(String),
66
67 #[error("Failed to construct a slip77 descriptor: {0}")]
69 Slip77Descriptor(String),
70
71 #[error("Failed to convert a descriptor: {0}")]
73 DescriptorConversion(#[from] elements_miniscript::descriptor::ConversionError),
74
75 #[error("Failed to construct a wpkh address: {0}")]
77 WpkhAddressConstruction(#[from] elements_miniscript::Error),
78
79 #[error("Missing such witness field: {0}")]
81 WtnsFieldNotFound(String),
82}
83
84#[derive(Debug, thiserror::Error)]
86pub enum WtnsWrappingError {
87 #[error("Failed to parse path")]
89 ParsingError,
90
91 #[error("Unsupported path type: {0}")]
93 UnsupportedPathType(String),
94
95 #[error("Path index out of bounds: len is {0}, got {1}")]
97 IdxOutOfBounds(usize, usize),
98
99 #[error("Root type mismatch: expected {0}, got {1}")]
101 RootTypeMismatch(String, String),
102
103 #[error("Path reached undefined branch of Either")]
105 EitherBranchMismatch,
106}