From df4a9b9f3f24a5e3087f20f35b8853feb976c056 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Thu, 21 Apr 2016 06:52:04 +0800 Subject: [PATCH] more info about inputs and outputs added --- src/page.h | 25 ++++++++++++- src/templates/tx.html | 83 ++++++++++++++++++++++++++----------------- 2 files changed, 74 insertions(+), 34 deletions(-) diff --git a/src/page.h b/src/page.h index c1ef8bf..5ca87dd 100644 --- a/src/page.h +++ b/src/page.h @@ -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 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 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& 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); diff --git a/src/templates/tx.html b/src/templates/tx.html index fbc4856..41e866e 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -32,20 +32,45 @@ -

Inputs {{inputs_no}}

- + +

Inputs {{inputs_no}}

+
+
+ + + + + + {{#inputs}} - - - - {{#inputs}} - - - - - {{/inputs}} + + + + + + + {{/inputs}} +
key imageamount
key imageamount
{{in_key_img}}{{amount}}
{{in_key_img}}{{amount}}
+ + + + + + + + {{#mixins}} + + + + + + {{/mixins}} +
pub_keyblktimestampage
{{mix_pub_key}} {{mix_blk}} {{mix_timestamp}}{{mix_age}}
+
+ -

Mixins time scale

@@ -56,28 +81,20 @@ -

Outputs ({{outputs_no}})

- {{#have_txs}} - +

Outputs

+
+
- - - - - - + + - {{#blk_txs}} - - - - - - - - - {{/blk_txs}} -
hashoutputsfeemixin nosize [kB]versionout_pub_keyamount
{{hash}}{{sum_outputs}}{{tx_fee}}{{mixin}}{{tx_size}}{{version}}
- {{/have_txs}} + {{#outputs}} + + {{out_pub_key}} + {{amount}} + + {{/outputs}} + +