smplx_sdk_test/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(
13 "Covenant input {index} did not execute (transaction locktime {locktime}, input sequence {sequence}): {source}"
14 )]
15 CovenantExecution {
16 index: usize,
18 locktime: u32,
20 sequence: u32,
22 source: ProgramError,
24 },
25
26 #[error(transparent)]
28 Provider(#[from] ProviderError),
29
30 #[cfg(feature = "provider")]
32 #[error("This signer was constructed without a provider")]
33 ProviderUnavailable,
34
35 #[error(transparent)]
37 WtnsInjectError(#[from] WtnsWrappingError),
38
39 #[error("Failed to parse a mnemonic: {0}")]
41 Mnemonic(String),
42
43 #[error("Failed to extract tx from pst: {0}")]
45 TxExtraction(#[from] simplicityhl::elements::pset::Error),
46
47 #[error("Failed to unblind txout: {0}")]
49 Unblind(#[from] simplicityhl::elements::UnblindError),
50
51 #[error("Failed to blind a PST: {0}")]
53 PsetBlind(#[from] simplicityhl::elements::pset::PsetBlindError),
54
55 #[error("Failed to construct a message for the input spending: {0}")]
57 SighashConstruction(#[from] elements_miniscript::psbt::SighashError),
58
59 #[error("Transaction is not balanced or malformed")]
61 Unbalanced(),
62
63 #[error("Fee amount is too low: {0}")]
65 DustAmount(i64),
66
67 #[error("Not enough fee amount {0} to cover transaction costs: {1}")]
69 NotEnoughFeeAmount(i64, u64),
70
71 #[error("Not enough funds on account to cover transaction costs: {0}")]
73 NotEnoughFunds(u64),
74
75 #[error("A confidential input needs at least one blinded output, but the change target is explicit")]
80 ConfidentialInputWithoutBlindedOutput,
81
82 #[error("Invalid secret key")]
84 InvalidSecretKey(#[from] simplicityhl::elements::secp256k1_zkp::UpstreamError),
85
86 #[error("Failed to derive a private key: {0}")]
88 PrivateKeyDerivation(#[from] elements_miniscript::bitcoin::bip32::Error),
89
90 #[error("Failed to construct a derivation path: {0}")]
92 DerivationPath(String),
93
94 #[error("Failed to construct a wpkh descriptor: {0}")]
96 WpkhDescriptor(String),
97
98 #[error("Failed to construct a slip77 descriptor: {0}")]
100 Slip77Descriptor(String),
101
102 #[error("Failed to convert a descriptor: {0}")]
104 DescriptorConversion(#[from] elements_miniscript::descriptor::ConversionError),
105
106 #[error("Failed to construct a wpkh address: {0}")]
108 WpkhAddressConstruction(#[from] elements_miniscript::Error),
109
110 #[error("Missing such witness field: {0}")]
112 WtnsFieldNotFound(String),
113}
114
115#[derive(Debug, thiserror::Error)]
117pub enum WtnsWrappingError {
118 #[error("Failed to parse path")]
120 ParsingError,
121
122 #[error("Unsupported path type: {0}")]
124 UnsupportedPathType(String),
125
126 #[error("Path index out of bounds: len is {0}, got {1}")]
128 IdxOutOfBounds(usize, usize),
129
130 #[error("Root type mismatch: expected {0}, got {1}")]
132 RootTypeMismatch(String, String),
133
134 #[error("Path reached undefined branch of Either")]
136 EitherBranchMismatch,
137}