fixing tx pool/index and tightening up page content

master
lza_menace 4 years ago
parent a2c4739344
commit e7d7e45df3

@ -159,7 +159,7 @@ pub struct GetTransactionPool {
pub spent_key_images: Option<Vec<SpentKeyImages>>,
pub status: String,
pub top_hash: String,
pub transactions: Option<Vec<Transactions>>
pub transactions: Vec<Transactions>
}
#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, Clone)]

@ -216,30 +216,22 @@ fn index() -> Template {
&"get_info", None, true
).send().unwrap().json().unwrap();
let tx_pool: GetTransactionPool = build_rpc(
let mut tx_pool: GetTransactionPool = build_rpc(
&"get_transaction_pool", None, true
).send().unwrap().json().unwrap();
println!("{:#?}", tx_pool);
let mut tx_json_raw: Vec<TransactionJSON> = vec![];
// let mut tx_pool_txs = tx_pool.transactions;
//
// match tx_pool_txs {
// Some(s) => {
// for mut f in s {
// let mut _fp = f.process();
// }
// },
// None => {}
// };
// for f in &mut tx_pool.transactions {
// f.process();
// };
for f in &mut tx_pool.transactions {
f.process();
let j: TransactionJSON = serde_json::from_str(&f.tx_json).unwrap();
tx_json_raw.push(j)
};
let context: JsonValue = json!({
"daemon_info": daemon_info,
"tx_pool_txs": tx_pool.transactions
"tx_pool_txs": tx_pool.transactions,
"tx_json": tx_json_raw
});
Template::render("index", context)

@ -2064,10 +2064,6 @@ input, select, textarea {
#header {
position: relative;
background-image: : url("https://git.wownero.com/wownero/wow-assets/raw/branch/master/WOW-WOW-720x234.png");
background-repeat: repeat-x;
border-bottom: solid 1px #ccc;
padding: 5em 0 4em 0;
text-align: center;
}
@ -2266,7 +2262,7 @@ input, select, textarea {
#main {
position: relative;
background-color: #f7f7f7;
padding: 4em 0 4em 0;
padding: 2em 0 2em 0;
}
#main:before {
@ -2285,7 +2281,7 @@ input, select, textarea {
#footer {
position: relative;
color: #858484;
padding: 4em 0;
padding: 2em 0;
}
#footer:before {

@ -6,22 +6,13 @@
<div class="container">
<section id="slim-header">
<a href="/" class="button">Go Back</a>
<!-- <nav id="nav">
<img src="//files.lzahq.tech/wow/WOW-Laptop-720x515.png"/ width=200>
<div class="search">
<form action="/search" method="get">
<input type="text" name="value" placeholder="Enter a transaction hash, block hash, block height, or wallet address.">
<input type="submit" value="Search">
</form>
</div>
</nav> -->
</section>
<div class="col-12">
<section>
<header class="major">
<h2>Block {{ block_header.height }}</h2>
<p class="subheader"><strong>Hash</strong>: {{ block_header.hash }}</p>
<p class="subheader"><strong>Timestamp</strong>: {{ block_header.timestamp }}</p>
<p class="subheader"><strong>Timestamp</strong>: {{ block_header.timestamp | date(format="%Y-%m-%d %H:%M") }}</p>
</header>
<div class="row">
<div class="col-4 col-6-medium col-12-small">
@ -53,7 +44,7 @@
<header>
<h3>Coinbase Transaction</h3>
</header>
<p><a href="/transaction/{{ block_header.miner_tx_hash }}">{{ block_header.miner_tx_hash | truncate(length=12) }}</a></p>
<p><a href="/transaction/{{ block_header.miner_tx_hash }}">{{ block_header.miner_tx_hash | truncate(length=8) }}</a></p>
</section>
</div>
<div class="col-4 col-6-medium col-12-small">
@ -85,7 +76,7 @@
</tr>
{% for hash in tx_hashes %}
<tr>
<td><a href="/transaction/{{ hash }}">{{ hash | truncate(length=12) }}</a></td>
<td><a href="/transaction/{{ hash }}">{{ hash }}</a></td>
</tr>
{% endfor %}
{% endif %}

@ -7,7 +7,7 @@
<section id="header">
<h1>Wownero Block Explorer</h1>
<nav id="nav">
<img src="//files.lzahq.tech/wow/WOW-Laptop-720x515.png"/ width=200>
<img src="//files.lzahq.tech/wow/Wownero-Development-Stock-720x440.png"/ width=300>
<div class="search">
<form action="/search" method="get">
<input type="text" name="value" placeholder="Enter a transaction hash, block hash, block height, or wallet address.">
@ -99,23 +99,21 @@
<h2>Transaction Pool ({{ daemon_info.tx_pool_size }})</h2>
<p>Transactions that have yet to be mined into a block. This is where payments sit in a PENDING state.</p>
</caption>
{% if daemon_info.tx_pool_size > 0 %}
<tr>
<th>Received Time</th>
<th>Hash</th>
<th>Fee</th>
<!-- <th>Inputs / Outputs</th> -->
<!-- <th>Ring Decoys</th> -->
<th>Inputs / Outputs</th>
<th>Ring Decoys</th>
</tr>
{% if daemon_info.tx_pool_size > 0 %}
{% for tx in tx_pool_txs %}
<tr>
<td>{{ tx.receive_time }}</td>
<td>{{ tx.receive_time | date(format="%Y-%m-%d %H:%M") }}</td>
<td><a href="/transaction/{{ tx.id_hash }}">{{ tx.id_hash | truncate(length=8) }}</a></td>
<td>{{ tx.fee / 1000000000000 }} WOW</td>
{% raw %}
<!-- <td>{{ tx.tx_json_full.vin | length }} / {{ tx.tx_json_full.vout | length }}</td> -->
<!-- <td>{{ tx.tx_json_full.vin.0.key.key_offsets | length }}</td> -->
{% endraw %}
<td>{{ tx.tx_json_full.vin | length }} / {{ tx.tx_json_full.vout | length }}</td>
<td>{{ tx.tx_json_full.vin.0.key.key_offsets | length }}</td>
</tr>
{% endfor %}
{% endif %}

@ -10,7 +10,7 @@
<div class="col-12">
<section>
<header class="major">
<h2>Transaction {{ tx_hash | truncate(length=4) }}</h2>
<h2>Transaction {{ tx_hash | truncate(length=8) }}</h2>
<p class="subheader"><strong>Full Hash</strong>: {{ tx_hash }}</p>
<p class="subheader"><strong>Block Timestamp</strong>: {% if tx_info.0.block_timestamp %}{{ tx_info.0.block_timestamp | date(format="%Y-%m-%d %H:%M") }}{% else %}?{% endif %}</p>
</header>
@ -20,7 +20,7 @@
<header>
<h3>Block Height</h3>
</header>
<p>{% if tx_info.0.block_height %}{{ tx_info.0.block_height }}{% else %}pending{% endif %}</p>
<p><a href="/block/height/{{ tx_info.0.block_height }}">{{ tx_info.0.block_height }}</a></p>
</section>
</div>
<div class="col-4 col-6-medium col-12-small">
@ -67,21 +67,36 @@
</section>
</div>
<br><br>
<header class="major">
<div class="tx-table">
<header>
<h2>Stealth Addresses</h2>
</header>
<ol>
{% for i in tx_info.0.as_json_full.vout %}
<li>{{ i.target.key }}</li>
{% endfor %}
</ol>
</div>
</header>
<header class="major">
{% if tx_info.0.block_height %}<h2><a href="/block/height/{{ tx_info.0.block_height }}">View Block</a></h2>{% endif %}
</header>
<div class="tx-table">
<table>
<caption><h2>Inputs ({{ tx_info.0.as_json_full.vin | length | default(value="?") }})</h2></caption>
{% if tx_info.0.as_json_full %}
<tr>
<th>Key Images</th>
</tr>
{% for i in tx_info.0.as_json_full.vin %}
<tr>
<td>{{ i.key.k_image }}</td>
</tr>
{% endfor %}
{% endif %}
</table>
</div>
<div class="tx-table">
<table>
<caption><h2>Outputs ({{ tx_info.0.as_json_full.vout | length | default(value="?") }})</h2></caption>
{% if tx_info.0.as_json_full %}
<tr>
<th>Stealth Addresses</th>
</tr>
{% for i in tx_info.0.as_json_full.vout %}
<tr>
<td>{{ i.target.key }}</td>
</tr>
{% endfor %}
{% endif %}
</table>
</div>
</div>
</section>