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 spent_key_images: Option<Vec<SpentKeyImages>>,
pub status: String, pub status: String,
pub top_hash: String, pub top_hash: String,
pub transactions: Option<Vec<Transactions>> pub transactions: Vec<Transactions>
} }
#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, Clone)]

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

@ -2064,10 +2064,6 @@ input, select, textarea {
#header { #header {
position: relative; 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; text-align: center;
} }
@ -2266,7 +2262,7 @@ input, select, textarea {
#main { #main {
position: relative; position: relative;
background-color: #f7f7f7; background-color: #f7f7f7;
padding: 4em 0 4em 0; padding: 2em 0 2em 0;
} }
#main:before { #main:before {
@ -2285,7 +2281,7 @@ input, select, textarea {
#footer { #footer {
position: relative; position: relative;
color: #858484; color: #858484;
padding: 4em 0; padding: 2em 0;
} }
#footer:before { #footer:before {

@ -6,22 +6,13 @@
<div class="container"> <div class="container">
<section id="slim-header"> <section id="slim-header">
<a href="/" class="button">Go Back</a> <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> </section>
<div class="col-12"> <div class="col-12">
<section> <section>
<header class="major"> <header class="major">
<h2>Block {{ block_header.height }}</h2> <h2>Block {{ block_header.height }}</h2>
<p class="subheader"><strong>Hash</strong>: {{ block_header.hash }}</p> <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> </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">
@ -53,7 +44,7 @@
<header> <header>
<h3>Coinbase Transaction</h3> <h3>Coinbase Transaction</h3>
</header> </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> </section>
</div> </div>
<div class="col-4 col-6-medium col-12-small"> <div class="col-4 col-6-medium col-12-small">
@ -85,7 +76,7 @@
</tr> </tr>
{% for hash in tx_hashes %} {% for hash in tx_hashes %}
<tr> <tr>
<td><a href="/transaction/{{ hash }}">{{ hash | truncate(length=12) }}</a></td> <td><a href="/transaction/{{ hash }}">{{ hash }}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

@ -7,7 +7,7 @@
<section id="header"> <section id="header">
<h1>Wownero Block Explorer</h1> <h1>Wownero Block Explorer</h1>
<nav id="nav"> <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"> <div class="search">
<form action="/search" method="get"> <form action="/search" method="get">
<input type="text" name="value" placeholder="Enter a transaction hash, block hash, block height, or wallet address."> <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> <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> <p>Transactions that have yet to be mined into a block. This is where payments sit in a PENDING state.</p>
</caption> </caption>
{% if daemon_info.tx_pool_size > 0 %}
<tr> <tr>
<th>Received Time</th> <th>Received Time</th>
<th>Hash</th> <th>Hash</th>
<th>Fee</th> <th>Fee</th>
<!-- <th>Inputs / Outputs</th> --> <th>Inputs / Outputs</th>
<!-- <th>Ring Decoys</th> --> <th>Ring Decoys</th>
</tr> </tr>
{% if daemon_info.tx_pool_size > 0 %}
{% for tx in tx_pool_txs %} {% for tx in tx_pool_txs %}
<tr> <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><a href="/transaction/{{ tx.id_hash }}">{{ tx.id_hash | truncate(length=8) }}</a></td>
<td>{{ tx.fee / 1000000000000 }} WOW</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 | length }} / {{ tx.tx_json_full.vout | length }}</td> --> <td>{{ tx.tx_json_full.vin.0.key.key_offsets | length }}</td>
<!-- <td>{{ tx.tx_json_full.vin.0.key.key_offsets | length }}</td> -->
{% endraw %}
</tr> </tr>
{% endfor %} {% endfor %}
{% endif %} {% endif %}

@ -10,7 +10,7 @@
<div class="col-12"> <div class="col-12">
<section> <section>
<header class="major"> <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>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> <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> </header>
@ -20,7 +20,7 @@
<header> <header>
<h3>Block Height</h3> <h3>Block Height</h3>
</header> </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> </section>
</div> </div>
<div class="col-4 col-6-medium col-12-small"> <div class="col-4 col-6-medium col-12-small">
@ -67,21 +67,36 @@
</section> </section>
</div> </div>
<br><br> <br><br>
<header class="major"> <div class="tx-table">
<div class="tx-table"> <table>
<header> <caption><h2>Inputs ({{ tx_info.0.as_json_full.vin | length | default(value="?") }})</h2></caption>
<h2>Stealth Addresses</h2> {% if tx_info.0.as_json_full %}
</header> <tr>
<ol> <th>Key Images</th>
{% for i in tx_info.0.as_json_full.vout %} </tr>
<li>{{ i.target.key }}</li> {% for i in tx_info.0.as_json_full.vin %}
{% endfor %} <tr>
</ol> <td>{{ i.key.k_image }}</td>
</div> </tr>
</header> {% endfor %}
<header class="major"> {% endif %}
{% if tx_info.0.block_height %}<h2><a href="/block/height/{{ tx_info.0.block_height }}">View Block</a></h2>{% endif %} </table>
</header> </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> </div>
</section> </section>