search outputs form added to tx.html

This commit is contained in:
moneroexamples 2016-05-09 05:48:03 +00:00
parent a9b9974340
commit 4f48035767
3 changed files with 39 additions and 2 deletions

View File

@ -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>/<string>/<string>")
([&](string tx_hash, string xmr_address, string viewkey) {
// CROW_ROUTE(app, "/myoutputs/<string>/<string>/<string>")
// ([&](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);
});

View File

@ -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;

View File

@ -56,6 +56,15 @@
</table>
</div>
<h4 style="margin-bottom:0px">Check which of the above outputs belong to the provided address and viewkey</h4>
<form action="/myoutputs" method="get" style="width:100%; margin-top:2px" class="style-1">
<input type="hidden" name="tx_hash" size="100" value="{{tx_hash}}"><br/>
<input type="text" name="xmr_address" size="100" placeholder="Monero address"><br/>
<input type="text" name="viewkey" size="100" placeholder="viewkey" style="margin-top:5px"><br/>
<input type="submit" value="Search outputs" style="margin-top:5px" >
</form>
{{#has_inputs}}
<h3>Inputs' mixins time scale (from genesis till {{server_time}};