From 4f48035767953fd5f6d553472960f00da8cd26f7 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 9 May 2016 05:48:03 +0000 Subject: [PATCH] search outputs form added to tx.html --- main.cpp | 12 ++++++++++-- src/page.h | 20 ++++++++++++++++++++ src/templates/tx.html | 9 +++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index d3ff1e5..cb55bfc 100644 --- a/main.cpp +++ b/main.cpp @@ -100,8 +100,16 @@ int main(int ac, const char* av[]) { return xmrblocks.show_tx(tx_hash, with_ring_signatures); }); - CROW_ROUTE(app, "/myoutputs///") - ([&](string tx_hash, string xmr_address, string viewkey) { +// CROW_ROUTE(app, "/myoutputs///") +// ([&](string tx_hash, string xmr_address, string viewkey) { +// return xmrblocks.show_my_outputs(tx_hash, xmr_address, viewkey); +// }); + + CROW_ROUTE(app, "/myoutputs").methods("GET"_method) + ([&](const crow::request& req) { + string tx_hash = string(req.url_params.get("tx_hash")); + string xmr_address = string(req.url_params.get("xmr_address")); + string viewkey = string(req.url_params.get("viewkey")); return xmrblocks.show_my_outputs(tx_hash, xmr_address, viewkey); }); diff --git a/src/page.h b/src/page.h index 3d2e188..33a251c 100644 --- a/src/page.h +++ b/src/page.h @@ -1101,6 +1101,26 @@ namespace xmreg { show_my_outputs(string tx_hash_str, string xmr_address_str, string viewkey_str) { + // remove white characters + boost::trim(tx_hash_str); + boost::trim(xmr_address_str); + boost::trim(viewkey_str); + + if (tx_hash_str.empty()) + { + return string("tx hash not provided!"); + } + + if (xmr_address_str.empty()) + { + return string("Monero address not provided!"); + } + + if (viewkey_str.empty()) + { + return string("Viewkey not provided!"); + } + // parse tx hash string to hash object crypto::hash tx_hash; diff --git a/src/templates/tx.html b/src/templates/tx.html index 60183a7..11e82d6 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -56,6 +56,15 @@ +

Check which of the above outputs belong to the provided address and viewkey

+ +
+
+
+
+ +
+ {{#has_inputs}}

Inputs' mixins time scale (from genesis till {{server_time}};