From 32c75e1a46b80bc1e9c981617324a5e4c4949f77 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Wed, 7 Sep 2016 10:00:16 +0800 Subject: [PATCH] json representation of tx displied --- src/page.h | 12 +++++++++++- src/templates/tx.html | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/page.h b/src/page.h index 909cc60..2abea4a 100644 --- a/src/page.h +++ b/src/page.h @@ -110,6 +110,8 @@ namespace xmreg { crypto::hash payment_id = null_hash; // normal crypto::hash8 payment_id8 = null_hash8; // encrypted + string json_representation; + std::vector > signatures; // key images of inputs @@ -969,6 +971,8 @@ namespace xmreg { 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 mstch::map context { {"tx_hash" , tx_hash_str}, @@ -989,7 +993,9 @@ namespace xmreg { {"payment_id" , pid_str}, {"payment_id8" , pid8_str}, {"extra" , txd.get_extra_str()}, - {"with_ring_signatures" , static_cast(with_ring_signatures)} + {"with_ring_signatures" , static_cast( + with_ring_signatures)}, + {"tx_json" , tx_json} }; string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F"); @@ -2043,6 +2049,10 @@ namespace xmreg { txd.fee = 0; + transaction tx_copy = tx; + + txd.json_representation = obj_to_json_str(tx_copy); + if (!coinbase && tx.vin.size() > 0) { // check if not miner tx diff --git a/src/templates/tx.html b/src/templates/tx.html index d65df80..d4cda3b 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -46,6 +46,12 @@ +

JSON representaiton of tx

+
+ + {{tx_json}} + +

{{outputs_no}} output(s) for total of {{outputs_xmr_sum}} xmr