From e7d7e45df34bcb72ca751861f5d7ad0126b07ba3 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Thu, 2 Jul 2020 21:52:21 -0700 Subject: [PATCH] fixing tx pool/index and tightening up page content --- src/data_types.rs | 2 +- src/main.rs | 26 ++++++----------- static/css/dopetrope.css | 8 ++---- templates/block.html.tera | 15 ++-------- templates/index.html.tera | 16 +++++------ templates/transaction.html.tera | 49 +++++++++++++++++++++------------ 6 files changed, 54 insertions(+), 62 deletions(-) diff --git a/src/data_types.rs b/src/data_types.rs index dcc02ab..f2b9ff4 100644 --- a/src/data_types.rs +++ b/src/data_types.rs @@ -159,7 +159,7 @@ pub struct GetTransactionPool { pub spent_key_images: Option>, pub status: String, pub top_hash: String, - pub transactions: Option> + pub transactions: Vec } #[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, Clone)] diff --git a/src/main.rs b/src/main.rs index c3cfea1..599b2d5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 = 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) diff --git a/static/css/dopetrope.css b/static/css/dopetrope.css index 0ced2e6..83899fd 100644 --- a/static/css/dopetrope.css +++ b/static/css/dopetrope.css @@ -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 { diff --git a/templates/block.html.tera b/templates/block.html.tera index f13052b..37f93f3 100644 --- a/templates/block.html.tera +++ b/templates/block.html.tera @@ -6,22 +6,13 @@
Go Back -

Block {{ block_header.height }}

Hash: {{ block_header.hash }}

-

Timestamp: {{ block_header.timestamp }}

+

Timestamp: {{ block_header.timestamp | date(format="%Y-%m-%d %H:%M") }}

@@ -85,7 +76,7 @@ {% for hash in tx_hashes %} - {{ hash | truncate(length=12) }} + {{ hash }} {% endfor %} {% endif %} diff --git a/templates/index.html.tera b/templates/index.html.tera index 2049c2e..9cd1d72 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -7,7 +7,7 @@


-
-
-
-

Stealth Addresses

-
-
    - {% for i in tx_info.0.as_json_full.vout %} -
  1. {{ i.target.key }}
  2. - {% endfor %} -
-
-
-
- {% if tx_info.0.block_height %}

View Block

{% endif %} -
+
+ + + {% if tx_info.0.as_json_full %} + + + + {% for i in tx_info.0.as_json_full.vin %} + + + + {% endfor %} + {% endif %} +

Inputs ({{ tx_info.0.as_json_full.vin | length | default(value="?") }})

Key Images
{{ i.key.k_image }}
+
+
+ + + {% if tx_info.0.as_json_full %} + + + + {% for i in tx_info.0.as_json_full.vout %} + + + + {% endfor %} + {% endif %} +

Outputs ({{ tx_info.0.as_json_full.vout | length | default(value="?") }})

Stealth Addresses
{{ i.target.key }}
+