From d966d87736309619278a6c66bd8291c25436ea93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Thu, 5 Sep 2024 11:50:50 +0300 Subject: [PATCH] rpc: adapter: Return type updates. --- src/rpc/adapter/wallet.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/rpc/adapter/wallet.rs b/src/rpc/adapter/wallet.rs index af14584..86731d7 100644 --- a/src/rpc/adapter/wallet.rs +++ b/src/rpc/adapter/wallet.rs @@ -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( @@ -25,12 +28,12 @@ pub fn gettransaction( txid: String, include_watchonly: Option, _verbose: Option, -) -> Result { +) -> Result { 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. @@ -46,7 +49,7 @@ pub fn sendtoaddress( conf_target: Option, _estimate_mode: Option<&str>, _avoid_reuse: Option, -) -> Result { +) -> Result { let address = match Address::from_str(&address) { Ok(a) => a, Err(e) => { @@ -72,7 +75,7 @@ pub fn sendtoaddress( None, )?; - Ok(txid.to_string()) + Ok(txid) } #[cfg(test)]