amount added to raw key images file info

This commit is contained in:
moneroexamples 2016-10-26 09:54:07 +08:00
parent 00965a473f
commit 14f85fa45c
3 changed files with 19 additions and 3 deletions

View File

@ -2078,9 +2078,11 @@ namespace xmreg {
{"key_no" , fmt::format("{:03d}", n)},
{"key_image" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", key_image))},
{"signature" , fmt::format("{:s}", signature)},
{"address" , xmreg::print_address(*xmr_address, testnet)},
{"amount" , string{}},
{"is_spent" , core_storage->have_tx_keyimg_as_spent(key_image)},
{"tx_hash_found" , !found_tx_hashes.empty()},
{"tx_hash" , string{}},
{"tx_hash" , string{}}
};
@ -2090,7 +2092,7 @@ namespace xmreg {
string tx_hash_str = found_tx_hashes.at(0);
key_img_info["tx_hash"] = tx_hash_str;
key_img_info["timestamp"] = "0";
key_img_info["timestamp"] = "";
transaction tx;
@ -2107,6 +2109,18 @@ namespace xmreg {
uint64_t blk_timestamp = core_storage
->get_db().get_block_timestamp(blk_height);
vector<txin_to_key> tx_key_imgs = get_key_images(tx);
const vector<txin_to_key>::const_iterator it = find_if(tx_key_imgs.begin(), tx_key_imgs.end(), [&](txin_to_key tx_in)
{
return tx_in.k_image == key_image;
});
if (it != tx_key_imgs.end())
{
key_img_info["amount"] = fmt::format("{:0.12f}", XMR_AMOUNT((*it).amount));
}
key_img_info["timestamp"] = xmreg::timestamp_to_str(blk_timestamp);
}
}

View File

@ -31,6 +31,7 @@
<td>Key no.</td>
<td>Key image</td>
<td>Timestamp</td>
<td>Amount</td>
<td>Is spent?</td>
</tr>
{{#key_imgs}}
@ -46,6 +47,7 @@
{{/tx_hash_found}}
</td>
<td>{{timestamp}}</td>
<td>{{amount}}</td>
<td>
{{#is_spent}}
<span style="color: #008009;font-weight: bold">{{is_spent}}</span>

View File

@ -97,7 +97,7 @@
Send {{dest_amount}} to {{dest_address}}<br/>
{{/is_this_change}}
{{#is_this_change}}
Change {{dest_amount}} back to {{dest_address}}<br/>
Total change {{dest_amount}} back to {{dest_address}}<br/>
{{/is_this_change}}
{{/dest_infos}}
</h5>