total xmr spend added to Signed Key Images Checker

master
moneroexamples 8 years ago
parent 14f85fa45c
commit 314d679812

@ -2033,6 +2033,8 @@ namespace xmreg {
mstch::map context { mstch::map context {
{"testnet" , testnet}, {"testnet" , testnet},
{"address" , xmreg::print_address(*xmr_address, testnet)}, {"address" , xmreg::print_address(*xmr_address, testnet)},
{"has_total_xmr" , false},
{"total_xmr" , string{}},
{"key_imgs" , mstch::array{}} {"key_imgs" , mstch::array{}}
}; };
@ -2054,6 +2056,8 @@ namespace xmreg {
mstch::array& key_imgs_ctx = boost::get<mstch::array>(context["key_imgs"]); mstch::array& key_imgs_ctx = boost::get<mstch::array>(context["key_imgs"]);
uint64_t total_xmr {0};
for (size_t n = 0; n < no_key_images; ++n) for (size_t n = 0; n < no_key_images; ++n)
{ {
@ -2119,6 +2123,7 @@ namespace xmreg {
if (it != tx_key_imgs.end()) if (it != tx_key_imgs.end())
{ {
key_img_info["amount"] = fmt::format("{:0.12f}", XMR_AMOUNT((*it).amount)); key_img_info["amount"] = fmt::format("{:0.12f}", XMR_AMOUNT((*it).amount));
total_xmr += (*it).amount;
} }
key_img_info["timestamp"] = xmreg::timestamp_to_str(blk_timestamp); key_img_info["timestamp"] = xmreg::timestamp_to_str(blk_timestamp);
@ -2130,6 +2135,12 @@ namespace xmreg {
//signed_key_images.push_back(make_pair(key_image, signature)); //signed_key_images.push_back(make_pair(key_image, signature));
} }
if (total_xmr > 0)
{
context["has_total_xmr"] = true;
context["total_xmr"] = fmt::format("{:0.12f}", XMR_AMOUNT(total_xmr));
}
string checkrawkeyimgs_html = xmreg::read(TMPL_MY_CHECKRAWKEYIMGS); string checkrawkeyimgs_html = xmreg::read(TMPL_MY_CHECKRAWKEYIMGS);
// add footer // add footer

@ -22,6 +22,9 @@
</div> </div>
<h4>Key images for address: {{address}}</h4> <h4>Key images for address: {{address}}</h4>
{{#has_total_xmr}}
<h4>Total value of xmr spend: {{total_xmr}}</h4>
{{/has_total_xmr}}
<div class="center"> <div class="center">

Loading…
Cancel
Save