#[derive(Debug, thiserror::Error)]
pub enum WalletAbiError {
#[error("Invalid request: {0}")]
InvalidRequest(String),
#[error("JSON error: {0}")]
Serde(#[from] serde_json::Error),
#[error("Program error: {0}")]
Program(#[from] ProgramError),
#[error("Bitcoin derivation: {0}")]
Derivation(#[from] lwk_wollet::bitcoin::bip32::Error),
#[error("Int conversion: {0}")]
TryFromInt(#[from] std::num::TryFromIntError),
#[error("Failed to fund the request: {0}")]
Funding(String),
#[error("Runtime signer configuration: {0}")]
InvalidSignerConfig(String),
#[error("Runtime response construction: {0}")]
InvalidResponse(String),
#[error("PSET error: {0}")]
Pset(#[from] lwk_wollet::elements::pset::Error),
#[error("PSET blinding error: {0}")]
PsetBlind(#[from] lwk_wollet::elements::pset::PsetBlindError),
#[error("Transaction amount proof verification failed: {0}")]
AmountProofVerification(#[from] lwk_wollet::elements::VerificationError),
#[error("Invalid finalization steps: {0}")]
InvalidFinalizationSteps(String),
}
#[derive(Debug, thiserror::Error)]
pub enum ProgramError {
#[error("Failed to compile Simplicity program: {0}")]
Compilation(String),
#[error("Failed to satisfy witness: {0}")]
WitnessSatisfaction(String),
#[error("Failed to prune program: {0}")]
Pruning(simplicityhl::simplicity::bit_machine::ExecutionError),
#[error("Failed to construct a Bit Machine with enough space: {0}")]
BitMachineCreation(#[from] simplicityhl::simplicity::bit_machine::LimitError),
#[error("Failed to execute program on the Bit Machine: {0}")]
Execution(simplicityhl::simplicity::bit_machine::ExecutionError),
#[error("UTXO index {input_index} out of bounds (have {utxo_count} UTXOs)")]
UtxoIndexOutOfBounds {
input_index: usize,
utxo_count: usize,
},
#[error("Script pubkey mismatch: expected hash {expected_hash}, got {actual_hash}")]
ScriptPubkeyMismatch {
expected_hash: String,
actual_hash: String,
},
#[error("Input index exceeds u32 maximum: {0}")]
InputIndexOverflow(#[from] std::num::TryFromIntError),
}