Merge #1321: Deserialize error from create_spend http response
b73193ae77dccde519d43e5042324742dbee5523 Deserialize error from create_spend http response (edouardparis)
Pull request description:
Instead of having an unclear and ugly message like:
data did not match any variant of untagged enum DraftPsbtResult
ACKs for top commit:
edouardparis:
Self-ACK b73193ae77dccde519d43e5042324742dbee5523
Tree-SHA512: 8182c01ce4067b30dc821dc8f13243b3df4a85fa8f146d779bd9922fedd26f0eabd7fca07c47fdc517b0d958cbe0185c7003e09d6d28f32312e6cb4d4fb9ba52
This commit is contained in:
commit
2a407013e3
@ -284,6 +284,7 @@ pub struct Psbt {
|
|||||||
pub enum DraftPsbtResult {
|
pub enum DraftPsbtResult {
|
||||||
Success(DraftPsbt),
|
Success(DraftPsbt),
|
||||||
InsufficientFunds(InsufficientFundsInfo),
|
InsufficientFunds(InsufficientFundsInfo),
|
||||||
|
Error(DraftPsbtError),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize)]
|
#[derive(Clone, Deserialize)]
|
||||||
@ -291,6 +292,11 @@ pub struct InsufficientFundsInfo {
|
|||||||
pub missing: u64,
|
pub missing: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Deserialize)]
|
||||||
|
pub struct DraftPsbtError {
|
||||||
|
pub error: String,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize)]
|
#[derive(Clone, Deserialize)]
|
||||||
pub struct DraftPsbt {
|
pub struct DraftPsbt {
|
||||||
pub uuid: Option<String>,
|
pub uuid: Option<String>,
|
||||||
|
|||||||
@ -753,6 +753,9 @@ impl Daemon for BackendWalletClient {
|
|||||||
api::DraftPsbtResult::InsufficientFunds(api::InsufficientFundsInfo { missing }) => {
|
api::DraftPsbtResult::InsufficientFunds(api::InsufficientFundsInfo { missing }) => {
|
||||||
Ok(CreateSpendResult::InsufficientFunds { missing })
|
Ok(CreateSpendResult::InsufficientFunds { missing })
|
||||||
}
|
}
|
||||||
|
api::DraftPsbtResult::Error(api::DraftPsbtError { error }) => {
|
||||||
|
Err(DaemonError::Unexpected(error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,6 +793,9 @@ impl Daemon for BackendWalletClient {
|
|||||||
api::DraftPsbtResult::InsufficientFunds(api::InsufficientFundsInfo { missing }) => {
|
api::DraftPsbtResult::InsufficientFunds(api::InsufficientFundsInfo { missing }) => {
|
||||||
Ok(CreateSpendResult::InsufficientFunds { missing })
|
Ok(CreateSpendResult::InsufficientFunds { missing })
|
||||||
}
|
}
|
||||||
|
api::DraftPsbtResult::Error(api::DraftPsbtError { error }) => {
|
||||||
|
Err(DaemonError::Unexpected(error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user