Skip to content

Commit

Permalink
rpc: adapter: Return type updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Sep 5, 2024
1 parent fcf23b1 commit d966d87
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/rpc/adapter/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
use crate::Client;
use bitcoin::{Address, Amount, Txid};
use bitcoincore_rpc::{json, Error, RpcApi};
use bitcoincore_rpc::{
json::{self, GetTransactionResult},
Error, RpcApi,
};
use std::str::FromStr;

pub fn getnewaddress(
Expand All @@ -25,12 +28,12 @@ pub fn gettransaction(
txid: String,
include_watchonly: Option<bool>,
_verbose: Option<bool>,
) -> Result<String, Error> {
) -> Result<GetTransactionResult, Error> {
let txid = Txid::from_str(&txid).unwrap();

let tx = client.get_transaction(&txid, include_watchonly)?;

Ok(serde_json::to_string_pretty(&tx)?)
Ok(tx)
}

// This has nothing to do with us. Ignore it.
Expand All @@ -46,7 +49,7 @@ pub fn sendtoaddress(
conf_target: Option<u32>,
_estimate_mode: Option<&str>,
_avoid_reuse: Option<bool>,
) -> Result<String, Error> {
) -> Result<Txid, Error> {
let address = match Address::from_str(&address) {
Ok(a) => a,
Err(e) => {
Expand All @@ -72,7 +75,7 @@ pub fn sendtoaddress(
None,
)?;

Ok(txid.to_string())
Ok(txid)
}

#[cfg(test)]
Expand Down

0 comments on commit d966d87

Please sign in to comment.