add tx retrieval function
Web-Wallet support updates
@@ -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<T, C, K>,
+ ) -> Result<(bool, Vec<TxLogEntry>), Error> {
+ let mut update_from_node = false;
+ if let Ok(params) = req.get_ref::<UrlEncodedQuery>() {
+ 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)
