Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.

Commit 049c98d

Browse files
committed
Use SignedAmount in GetTransactionDetail
Turns out this amount is signed, use `SignedAmount` instead of `Amount`.
1 parent 37dcb95 commit 049c98d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

json/src/model/wallet.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ pub struct GetTransaction {
107107
pub struct GetTransactionDetail {
108108
pub address: Address<NetworkUnchecked>,
109109
pub category: GetTransactionDetailCategory,
110-
pub amount: Amount,
110+
#[serde(default, with = "bitcoin::amount::serde::as_btc")]
111+
pub amount: SignedAmount,
111112
pub label: Option<String>,
112113
pub vout: u32,
113114
#[serde(default, with = "bitcoin::amount::serde::as_btc::opt")]

json/src/v17/wallet/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl TryFrom<v17::GetTransactionDetail> for model::GetTransactionDetail {
142142
use GetTransactionDetailError as E;
143143

144144
let address = Address::from_str(&json.address).map_err(E::Address)?;
145-
let amount = Amount::from_btc(json.amount).map_err(E::Amount)?;
145+
let amount = SignedAmount::from_btc(json.amount).map_err(E::Amount)?;
146146
// FIMXE: Use combinators.
147147
let fee = match json.fee {
148148
None => None,

0 commit comments

Comments
 (0)