updating static for transaction page

master
lalanza808 5 years ago
parent 6d7bac3fac
commit c4d3df61c8

@ -85,11 +85,15 @@ fn get_block_by_height(block_height: String) -> Template {
} }
#[get("/transaction/<tx_hash>")] #[get("/transaction/<tx_hash>")]
fn get_transaction_by_hash(tx_hash: String) -> Json<GetTransactions> { fn get_transaction_by_hash(tx_hash: String) -> Template {
let params: JsonValue = json!({"txs_hashes": [&tx_hash]}); let params: JsonValue = json!({"txs_hashes": [&tx_hash]});
let res: GetTransactions = issue_raw_rpc(&"get_transactions", params) let res: GetTransactions = issue_raw_rpc(&"get_transactions", params)
.send().unwrap().json().unwrap(); .send().unwrap().json().unwrap();
Json(res) let context = json!({
"tx_info": res.txs,
"tx_hash": tx_hash
});
Template::render("transaction", context)
} }
#[get("/search?<value>")] #[get("/search?<value>")]

@ -2,100 +2,54 @@
{% block content %} {% block content %}
{% for i in tx_info %}
{{i.block_height}}
{{i.block_timestamp}}
{{i.double_spend_seen}}
{{i.in_pool}}
{{i.output_indices}}
{% endfor %}
<section id="main"> <section id="main">
<div class="container"> <div class="container">
<div class="col-12"> <div class="col-12">
<section> <section>
<header class="major"> <header class="major">
<h2>Transaction {{ block_header.height }}</h2> <h2>Transaction {{ tx_hash | truncate(length=4) }}</h2>
<p class="subheader"><strong>Hash</strong>: {{ block_header.hash }}</p> <p class="subheader"><strong>Full Hash</strong>: {{ tx_hash }}</p>
<p class="subheader"><strong>Timestamp</strong>: {{ block_header.timestamp }} <p class="subheader"><strong>Block Timestamp</strong>: {{ tx_info.0.block_timestamp }}
</header> </header>
<div class="row"> <div class="row">
<div class="col-4 col-6-medium col-12-small"> <div class="col-4 col-6-medium col-12-small">
<section class="box"> <section class="box">
<header> <header>
<h3>Size</h3> <h3>Block Height</h3>
</header>
<p>{{ block_header.block_size }} bytes</p>
</section>
</div>
<div class="col-4 col-6-medium col-12-small">
<section class="box">
<header>
<h3>Depth</h3>
</header>
<p>{{ block_header.depth }}</p>
</section>
</div>
<div class="col-4 col-6-medium col-12-small">
<section class="box">
<header>
<h3>Difficulty</h3>
</header>
<p>{{ block_header.difficulty }}</p>
</section>
</div>
<div class="col-4 col-6-medium col-12-small">
<section class="box">
<header>
<h3>Transactions</h3>
</header> </header>
<p>{% if tx_hashes %}{{ tx_hashes | length }}{% else %}0{% endif %}</p> <p>{{ tx_info.0.block_height }}</p>
</section> </section>
</div> </div>
<div class="col-4 col-6-medium col-12-small"> <div class="col-4 col-6-medium col-12-small">
<section class="box"> <section class="box">
<header> <header>
<h3>Orphaned</h3> <h3>In Pool</h3>
</header> </header>
<p>{{ block_header.orphan_status }}</p> <p>{{ tx_info.0.in_pool }}</p>
</section> </section>
</div> </div>
<div class="col-4 col-6-medium col-12-small"> <div class="col-4 col-6-medium col-12-small">
<section class="box"> <section class="box">
<header> <header>
<h3>Nonce</h3> <h3>Double Spend</h3>
</header> </header>
<p>{{ block_header.nonce }}</p> <p>{{ tx_info.0.double_spend_seen }}</p>
</section> </section>
</div> </div>
</div> </div>
</section> </section>
</div> </div>
<br><br> <br><br>
<div class="tx-table">
<table>
<caption><h2>Block Transactions</h2></caption>
<tr>
<th>Coinbase</th>
<th>Hash</th>
<th>Amount</th>
<th>Fee</th>
<th>Bytes</th>
</tr>
<tr>
<td>√</td>
<td><a href="/transaction/{{ block_header.miner_tx_hash }}">{{ block_header.miner_tx_hash | truncate(length=8) }}</a></td>
<td>{{ block_header.reward / 1000000000000 }} XMR</td>
<td>0</td>
<td>?</td>
</tr>
{% if tx_hashes %}
{% for hash in tx_hashes %}
<tr>
<td></td>
<td><a href="/transaction/{{ hash }}">{{ hash | truncate(length=8) }}</a></td>
<td>?</td>
<td>?</td>
<td>?</td>
</tr>
{% endfor %}
{% endif %}
</table>
</div>
<header class="major"> <header class="major">
<h2><a href="/block/hash/{{ block_header.prev_hash }}">Previous Block</a></h2> <h2><a href="/block/height/{{ tx_info.0.block_height }}">View Block</a></h2>
</header> </header>
</div> </div>
</section> </section>

Loading…
Cancel
Save