Skip to content

Commit

Permalink
add: verbosity 2 getrawtransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
0xB10C committed Mar 20, 2024
1 parent ec42b97 commit d0eef19
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,15 @@ pub trait RpcApi: Sized {
let mut args = [into_json(txid)?, into_json(true)?, opt_into_json(block_hash)?];
self.call("getrawtransaction", handle_defaults(&mut args, &[null()]))
}

fn get_raw_transaction_info_with_fee(
&self,
txid: &bitcoin::Txid,
block_hash: Option<&bitcoin::BlockHash>,
) -> Result<json::GetRawTransactionResult> {
let mut args = [into_json(txid)?, into_json(2)?, opt_into_json(block_hash)?];
self.call("getrawtransaction", handle_defaults(&mut args, &[null()]))
}

fn get_block_filter(
&self,
Expand Down
7 changes: 7 additions & 0 deletions json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,13 @@ pub struct GetRawTransactionResult {
pub confirmations: Option<u32>,
pub time: Option<usize>,
pub blocktime: Option<usize>,
// #[serde(
// default,
// skip_serializing_if = "Option::is_none",
// with = "bitcoin::amount::serde::as_btc::opt"
// )]
#[serde(with = "bitcoin::amount::serde::as_btc::opt")]
pub fee: Option<Amount>,
}

#[derive(Clone, PartialEq, Eq, Debug, Deserialize, Serialize)]
Expand Down

0 comments on commit d0eef19

Please sign in to comment.