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

Commit

Permalink
Merge pull request #7 from tcharding/06-13-all-signed-amounts
Browse files Browse the repository at this point in the history
Use signed amount for both amounts
  • Loading branch information
tcharding authored Jun 13, 2024
2 parents 6729c07 + c2da191 commit 28cc7db
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 @@ -90,7 +90,8 @@ pub struct SendToAddress {
/// Models the result of JSON-RPC method `gettransaction`.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct GetTransaction {
pub amount: Amount,
#[serde(default, with = "bitcoin::amount::serde::as_btc")]
pub amount: SignedAmount,
#[serde(default, with = "bitcoin::amount::serde::as_btc::opt")]
pub fee: Option<SignedAmount>,
pub confirmations: u32,
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 @@ -63,7 +63,7 @@ impl TryFrom<v17::GetTransaction> for model::GetTransaction {
fn try_from(json: v17::GetTransaction) -> Result<Self, Self::Error> {
use GetTransactionError as E;

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 28cc7db

Please sign in to comment.