diff --git a/src/page.h b/src/page.h index da6073b..078efa9 100644 --- a/src/page.h +++ b/src/page.h @@ -690,6 +690,8 @@ public: pair sum_inputs = sum_xmr_inputs(_tx_info.tx_json); pair sum_outputs = sum_xmr_outputs(_tx_info.tx_json); + sum_money_in_outputs(_tx_info.tx_json); + // get mixin number in each transaction vector mixin_numbers = get_mixin_no_in_txs(_tx_info.tx_json); diff --git a/src/tools.cpp b/src/tools.cpp index 1db16d4..6774a39 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -306,7 +306,28 @@ sum_money_in_outputs(const transaction& tx) return sum_xmr; } +pair +sum_money_in_outputs(const string& json_str) +{ + pair sum_xmr {0, 0}; + + cout << json_str << endl; + + + json j; + try + { + j = json::parse( json_str); + } + catch (std::invalid_argument& e) + { + cerr << "sum_money_in_outputs: " << e.what() << endl; + } + cout << j.dump() << endl; + + return sum_xmr; +}; uint64_t sum_money_in_inputs(const transaction& tx) diff --git a/src/tools.h b/src/tools.h index 3d46ee6..6b76ff6 100644 --- a/src/tools.h +++ b/src/tools.h @@ -47,6 +47,7 @@ namespace pt = boost::posix_time; namespace gt = boost::gregorian; namespace lt = boost::local_time; +using json = nlohmann::json; struct outputs_visitor { @@ -126,12 +127,17 @@ get_blockchain_path(const boost::optional& bc_path, uint64_t sum_money_in_outputs(const transaction& tx); +pair +sum_money_in_outputs(const string& json_str); + uint64_t sum_money_in_inputs(const transaction& tx); array sum_money_in_tx(const transaction& tx); + + array sum_money_in_txs(const vector& txs);