Fees are shown in micromonero now

https://github.com/moneroexamples/onion-monero-blockchain-explorer/
issues/151
This commit is contained in:
moneroexamples 2018-10-22 10:14:15 +08:00
parent 77d2a98e2f
commit 7453999415
6 changed files with 18 additions and 8 deletions

View file

@ -177,7 +177,6 @@ MempoolStatus::read_mempool()
tx, output_pub_keys, input_key_imgs);
double tx_size = static_cast<double>(_tx_info.blob_size)/1024.0;
double payed_for_kB = XMR_AMOUNT(_tx_info.fee) / tx_size;
@ -192,7 +191,9 @@ MempoolStatus::read_mempool()
last_tx.num_nonrct_inputs = sum_data[3];
last_tx.fee_str = xmreg::xmr_amount_to_str(_tx_info.fee, "{:0.4f}", false);
last_tx.fee_micro_str = xmreg::xmr_amount_to_str(_tx_info.fee*1.0e6, "{:04.0f}", false);
last_tx.payed_for_kB_str = fmt::format("{:0.4f}", payed_for_kB);
last_tx.payed_for_kB_micro_str = fmt::format("{:04.0f}", payed_for_kB*1e6);
last_tx.xmr_inputs_str = xmreg::xmr_amount_to_str(last_tx.sum_inputs , "{:0.3f}");
last_tx.xmr_outputs_str = xmreg::xmr_amount_to_str(last_tx.sum_outputs, "{:0.3f}");
last_tx.timestamp_str = xmreg::timestamp_to_str_gm(_tx_info.receive_time);

View file

@ -38,7 +38,9 @@ struct MempoolStatus
uint64_t mixin_no {0};
string fee_str;
string fee_micro_str;
string payed_for_kB_str;
string payed_for_kB_micro_str;
string xmr_inputs_str;
string xmr_outputs_str;
string timestamp_str;

View file

@ -244,6 +244,8 @@ struct tx_details
string fee_str {"N/A"};
string fee_short_str {"N/A"};
string payed_for_kB_str {""};
string fee_micro_str {"N/A"};
string payed_for_kB_micro_str {""};
const double& xmr_amount = XMR_AMOUNT(fee);
@ -258,7 +260,9 @@ struct tx_details
mixin_str = std::to_string(mixin_no);
fee_str = fmt::format("{:0.6f}", xmr_amount);
fee_short_str = fmt::format("{:0.4f}", xmr_amount);
fee_micro_str = fmt::format("{:04.0f}" , xmr_amount * 1e6);
payed_for_kB_str = fmt::format("{:0.4f}", payed_for_kB);
payed_for_kB_micro_str = fmt::format("{:04.0f}", payed_for_kB * 1e6);
}
@ -268,7 +272,9 @@ struct tx_details
{"pub_key" , pod_to_hex(pk)},
{"tx_fee" , fee_str},
{"tx_fee_short" , fee_short_str},
{"fee_micro" , fee_micro_str},
{"payed_for_kB" , payed_for_kB_str},
{"payed_for_kB_micro", payed_for_kB_micro_str},
{"sum_inputs" , xmr_amount_to_str(xmr_inputs , "{:0.6f}")},
{"sum_outputs" , xmr_amount_to_str(xmr_outputs, "{:0.6f}")},
{"sum_inputs_short" , xmr_amount_to_str(xmr_inputs , "{:0.3f}")},
@ -1055,8 +1061,8 @@ mempool(bool add_header_and_footer = false, uint64_t no_of_mempool_tx = 25)
{"timestamp" , mempool_tx.timestamp_str},
{"age" , age_str},
{"hash" , pod_to_hex(mempool_tx.tx_hash)},
{"fee" , mempool_tx.fee_str},
{"payed_for_kB" , mempool_tx.payed_for_kB_str},
{"fee" , mempool_tx.fee_micro_str},
{"payed_for_kB" , mempool_tx.payed_for_kB_micro_str},
{"xmr_inputs" , mempool_tx.xmr_inputs_str},
{"xmr_outputs" , mempool_tx.xmr_outputs_str},
{"no_inputs" , mempool_tx.no_inputs},
@ -5918,6 +5924,7 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0)
{"tx_blk_height" , tx_blk_height},
{"tx_size" , fmt::format("{:0.4f}", tx_size)},
{"tx_fee" , xmreg::xmr_amount_to_str(txd.fee, "{:0.12f}", false)},
{"tx_fee_micro" , xmreg::xmr_amount_to_str(txd.fee*1e6, "{:0.4f}", false)},
{"payed_for_kB" , fmt::format("{:0.12f}", payed_for_kB)},
{"tx_version" , static_cast<uint64_t>(txd.version)},
{"blk_timestamp" , blk_timestamp},

View file

@ -64,7 +64,7 @@
<tr>
<td>hash</td>
<td>outputs</td>
<td>fee</td>
<td>fee [&#181;&#x271]</td>
<td>ring size</td>
<td>in/out</td>
<td>size [kB]</td>
@ -74,7 +74,7 @@
<tr>
<td><a href="/tx/{{hash}}">{{hash}}</a></td>
<td>{{sum_outputs}}</td>
<td>{{tx_fee}}</td>
<td>{{fee_micro}}</td>
<td>{{mixin}}</td>
<td>{{no_inputs}}/{{no_outputs}}</td>
<td>{{tx_size}}</td>

View file

@ -81,7 +81,7 @@
<td>age {{age_format}}<!--(Δm)--></td>
<td>size [kB]<!--(Δm)--></td>
<td>transaction hash</td>
<td>fee</td>
<td>fee [&#181;&#x271]</td>
<td>outputs</td>
<td>in/out/pID</td>
<td>ring size</td>
@ -93,7 +93,7 @@
<td>{{age}}<!--{{time_delta}}--></td>
<td>{{blk_size}}</td>
<td><a href="/tx/{{hash}}">{{hash}}</a></td>
<td>{{tx_fee_short}}</td>
<td>{{fee_micro}}</td>
<td>{{sum_outputs_short}}</td>
<td>{{no_inputs}}/{{no_outputs}}/{{pID}}</td>
<td>{{mixin}}</td>

View file

@ -8,7 +8,7 @@
<tr>
<td>age [h:m:s]</td>
<td>transaction hash</td>
<td>fee/per_kB</td>
<td>fee/per_kB [&#181;&#x271]</td>
<!--<td>outputs</td>-->
<td>in/out/pID</td>
<td>ring size</td>