From 70b97b0a065811ea64b0794dd067c499384af469 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Tue, 24 Jul 2018 20:49:29 +0100 Subject: [PATCH] add tx retrieval function (#1295) Web-Wallet support updates --- wallet/src/libwallet/controller.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wallet/src/libwallet/controller.rs b/wallet/src/libwallet/controller.rs index 5328ca3df..cdb413fbb 100644 --- a/wallet/src/libwallet/controller.rs +++ b/wallet/src/libwallet/controller.rs @@ -32,7 +32,7 @@ use keychain::Keychain; use libtx::slate::Slate; use libwallet::api::{APIForeign, APIOwner}; use libwallet::types::{ - BlockFees, CbData, OutputData, SendTXArgs, WalletBackend, WalletClient, WalletInfo, + BlockFees, CbData, OutputData, SendTXArgs, TxLogEntry, WalletBackend, WalletClient, WalletInfo, }; use libwallet::{Error, ErrorKind}; @@ -166,6 +166,20 @@ where api.retrieve_outputs(false, update_from_node, None) } + fn retrieve_txs( + &self, + req: &mut Request, + api: &mut APIOwner, + ) -> Result<(bool, Vec), Error> { + let mut update_from_node = false; + if let Ok(params) = req.get_ref::() { + if let Some(_) = params.get("refresh") { + update_from_node = true; + } + } + api.retrieve_txs(update_from_node, None) + } + fn retrieve_summary_info( &self, req: &mut Request, @@ -198,6 +212,8 @@ where match *path_elems.last().unwrap() { "retrieve_outputs" => json_response(&self.retrieve_outputs(req, api) .map_err(|e| IronError::new(Fail::compat(e), status::BadRequest))?), + "retrieve_txs" => json_response(&self.retrieve_txs(req, api) + .map_err(|e| IronError::new(Fail::compat(e), status::BadRequest))?), "retrieve_summary_info" => json_response(&self.retrieve_summary_info(req, api) .map_err(|e| IronError::new(Fail::compat(e), status::BadRequest))?), "node_height" => json_response(&self.node_height(req, api)