json representation of tx displied

master
moneroexamples 8 years ago
parent 2cf9714d21
commit 32c75e1a46

@ -110,6 +110,8 @@ namespace xmreg {
crypto::hash payment_id = null_hash; // normal crypto::hash payment_id = null_hash; // normal
crypto::hash8 payment_id8 = null_hash8; // encrypted crypto::hash8 payment_id8 = null_hash8; // encrypted
string json_representation;
std::vector<std::vector<crypto::signature> > signatures; std::vector<std::vector<crypto::signature> > signatures;
// key images of inputs // key images of inputs
@ -969,6 +971,8 @@ namespace xmreg {
string pid8_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.payment_id8)); string pid8_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.payment_id8));
string tx_json = obj_to_json_str(tx);
// initalise page tempate map with basic info about blockchain // initalise page tempate map with basic info about blockchain
mstch::map context { mstch::map context {
{"tx_hash" , tx_hash_str}, {"tx_hash" , tx_hash_str},
@ -989,7 +993,9 @@ namespace xmreg {
{"payment_id" , pid_str}, {"payment_id" , pid_str},
{"payment_id8" , pid8_str}, {"payment_id8" , pid8_str},
{"extra" , txd.get_extra_str()}, {"extra" , txd.get_extra_str()},
{"with_ring_signatures" , static_cast<bool>(with_ring_signatures)} {"with_ring_signatures" , static_cast<bool>(
with_ring_signatures)},
{"tx_json" , tx_json}
}; };
string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F"); string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F");
@ -2043,6 +2049,10 @@ namespace xmreg {
txd.fee = 0; txd.fee = 0;
transaction tx_copy = tx;
txd.json_representation = obj_to_json_str(tx_copy);
if (!coinbase && tx.vin.size() > 0) if (!coinbase && tx.vin.size() > 0)
{ {
// check if not miner tx // check if not miner tx

@ -46,6 +46,12 @@
</table> </table>
<h3>JSON representaiton of tx</h3>
<div class="center">
<code style="white-space: pre-wrap; font-size: 10px">
{{tx_json}}
</code>
</div>
<h3>{{outputs_no}} output(s) for total of {{outputs_xmr_sum}} xmr</h3> <h3>{{outputs_no}} output(s) for total of {{outputs_xmr_sum}} xmr</h3>
<div class="center"> <div class="center">

Loading…
Cancel
Save