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

Commit

Permalink
Use SignedAmount in GetTransactionDetail
Browse files Browse the repository at this point in the history
Turns out this amount is signed, use `SignedAmount` instead of `Amount`.
  • Loading branch information
tcharding committed Jun 13, 2024
1 parent 37dcb95 commit 049c98d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion json/src/model/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ pub struct GetTransaction {
pub struct GetTransactionDetail {
pub address: Address<NetworkUnchecked>,
pub category: GetTransactionDetailCategory,
pub amount: Amount,
#[serde(default, with = "bitcoin::amount::serde::as_btc")]
pub amount: SignedAmount,
pub label: Option<String>,
pub vout: u32,
#[serde(default, with = "bitcoin::amount::serde::as_btc::opt")]
Expand Down
2 changes: 1 addition & 1 deletion json/src/v17/wallet/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl TryFrom<v17::GetTransactionDetail> for model::GetTransactionDetail {
use GetTransactionDetailError as E;

let address = Address::from_str(&json.address).map_err(E::Address)?;
let amount = Amount::from_btc(json.amount).map_err(E::Amount)?;
let amount = SignedAmount::from_btc(json.amount).map_err(E::Amount)?;
// FIMXE: Use combinators.
let fee = match json.fee {
None => None,
Expand Down

0 comments on commit 049c98d

Please sign in to comment.