From ee1305b9936274c6721d16a250858f71bd0511e9 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 24 Oct 2016 09:51:53 +0800 Subject: [PATCH] change info added to signed tx data --- src/page.h | 23 ++++++++++++++++++----- src/templates/checkrawtx.html | 7 ++++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/page.h b/src/page.h index 93f7e1b..3f683ff 100644 --- a/src/page.h +++ b/src/page.h @@ -1572,7 +1572,7 @@ namespace xmreg { if (strncmp(decoded_raw_tx_data.c_str(), SIGNED_TX_PREFIX, magiclen) != 0) { - cout << "The data is neigther unsigned nor signed tx!" << endl; + cout << "The data is neither unsigned nor signed tx!" << endl; return string( "The data is neither unsigned nor signed tx!"); } @@ -1616,12 +1616,25 @@ namespace xmreg { destination_addresses.push_back( mstch::map { - {"dest_address", get_account_address_as_str(testnet, a_dest.addr)}, - {"dest_amount" , fmt::format("{:0.12f}", XMR_AMOUNT(a_dest.amount))} + {"dest_address" , get_account_address_as_str(testnet, a_dest.addr)}, + {"dest_amount" , fmt::format("{:0.12f}", XMR_AMOUNT(a_dest.amount))}, + {"is_this_change" , false} } ); } + // get change address and amount info + if (ptx.construction_data.change_dts.amount > 0) + { + destination_addresses.push_back( + mstch::map { + {"dest_address" , get_account_address_as_str(testnet, ptx.construction_data.change_dts.addr)}, + {"dest_amount" , fmt::format("{:0.12f}", XMR_AMOUNT(ptx.construction_data.change_dts.amount))}, + {"is_this_change" , true} + } + ); + }; + tx_context.insert({"dest_infos", destination_addresses}); // get reference to inputs array created of the tx @@ -1632,8 +1645,8 @@ namespace xmreg { { mstch::map& output_map = boost::get(outputs.at(i)); - //cout << boost::get(output_map["out_pub_key"]) <<", " << address_amounts.at(i) << endl; - //cout << boost::get(output_map["out_pub_key"]) << endl; + cout << boost::get(output_map["out_pub_key"]) + <<", " << boost::get(output_map["amount"]) << endl; } // get public keys of real outputs diff --git a/src/templates/checkrawtx.html b/src/templates/checkrawtx.html index 2da965c..cc87d40 100644 --- a/src/templates/checkrawtx.html +++ b/src/templates/checkrawtx.html @@ -93,7 +93,12 @@ {{#txs}}
{{#dest_infos}} - Send {{dest_amount}} to {{dest_address}}
+ {{^is_this_change}} + Send {{dest_amount}} to {{dest_address}}
+ {{/is_this_change}} + {{#is_this_change}} + Change {{dest_amount}} back to {{dest_address}}
+ {{/is_this_change}} {{/dest_infos}}
{{>tx_details}}