more info about inputs and outputs added

This commit is contained in:
moneroexamples 2016-04-21 06:52:04 +08:00
parent a73d919389
commit df4a9b9f3f
2 changed files with 75 additions and 35 deletions

View File

@ -615,8 +615,14 @@ namespace xmreg {
// for each found output public key find its block to get timestamp
for (const uint64_t &i: absolute_offsets)
{
// get basic information about mixn's output
cryptonote::output_data_t output_data = outputs.at(count);
// get pair pair<crypto::hash, uint64_t> where first is tx hash
// and second is local index of the output i in that tx
tx_out_index tx_out_idx =
core_storage->get_db().get_output_tx_and_index(in_key.amount, i);
// get block of given height, as we want to get its timestamp
cryptonote::block blk;
@ -629,7 +635,11 @@ namespace xmreg {
pair<string, string> mixin_age = get_age(server_timestamp, blk.timestamp);
mixins.push_back(mstch::map {
{"mix_timestamp" , blk.timestamp},
{"mix_blk" , fmt::format("{:d}", output_data.height)},
{"mix_pub_key" , fmt::format("{:s}", output_data.pubkey)},
{"mix_tx_hash" , fmt::format("{:s}", tx_out_idx.first)},
{"mix_out_indx" , fmt::format("{:d}", tx_out_idx.second)},
{"mix_timestamp" , xmreg::timestamp_to_str(blk.timestamp)},
{"mix_age" , mixin_age.first},
{"mix_age_format" , mixin_age.second}
});
@ -655,6 +665,19 @@ namespace xmreg {
context["inputs"] = inputs;
context["timescales"] = mixins_timescales;
mstch::array outputs;
for (pair<txout_to_key, uint64_t>& outp: txd.output_pub_keys)
{
outputs.push_back(mstch::map {
{"out_pub_key" , fmt::format("{:s}", outp.first.key)},
{"amount" , fmt::format("{:0.4f}", XMR_AMOUNT(outp.second))}
});
}
context["outputs"] = outputs;
// read tx.html
string tx_html = xmreg::read(TMPL_TX);

View File

@ -32,20 +32,45 @@
</tr>
</table>
<h3>Inputs {{inputs_no}}</h3>
<table class="center">
<tr>
<td>key image</td>
<td>amount</td>
</tr>
{{#inputs}}
<tr>
<td>{{in_key_img}}</td>
<td>{{amount}}</td>
</tr>
{{/inputs}}
</table>
<h3>Inputs {{inputs_no}}</h3>
<div class="center">
<table class="center">
<tr>
<td>key image</td>
<td>amount</td>
</tr>
{{#inputs}}
<tr>
<td>{{in_key_img}}</td>
<td>{{amount}}</td>
</tr>
<tr>
<td colspan="2">
<table style="width:100%">
<tr>
<td>pub_key</td>
<td>blk</td>
<td>timestamp</td>
<td>age</td>
</tr>
{{#mixins}}
<tr>
<td><a href="/tx/{{mix_tx_hash}}">{{mix_pub_key}}</a></td> <td>{{mix_blk}}</td> <td>{{mix_timestamp}}</td><td>{{mix_age}}</td>
</tr>
<!-- <tr>
<td>{{mix_tx_hash}}</td> <td>{{mix_out_indx}}</td><td></td><td></td>
</tr>-->
{{/mixins}}
</table>
</td>
</tr>
{{/inputs}}
</table>
</div>
<h3>Mixins time scale</h3>
@ -56,28 +81,20 @@
</ul>
<h3>Outputs ({{outputs_no}})</h3>
{{#have_txs}}
<table class="center" style="width:80%">
<h3>Outputs</h3>
<div class="center">
<table class="center" >
<tr>
<td>hash</td>
<td>outputs</td>
<td>fee</td>
<td>mixin no</td>
<td>size [kB]</td>
<td>version</td>
<td>out_pub_key</td>
<td>amount</td>
</tr>
{{#blk_txs}}
<tr>
<td>{{hash}}</td>
<td>{{sum_outputs}}</td>
<td>{{tx_fee}}</td>
<td>{{mixin}}</td>
<td>{{tx_size}}</td>
<td>{{version}}</td>
</tr>
{{/blk_txs}}
</table>
{{/have_txs}}
{{#outputs}}
<tr>
<td>{{out_pub_key}}</td>
<td>{{amount}}</td>
</tr>
{{/outputs}}
</table>
</div>
</div>