diff --git a/src/data_types.rs b/src/data_types.rs index fadf64f..ca8e6a1 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: Vec + pub transactions: Option> } #[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, Clone)] diff --git a/src/main.rs b/src/main.rs index 599b2d5..3fe9cf8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -183,11 +183,11 @@ fn search(value: &RawStr) -> Redirect { } } } else if sl == 97 { - // Equal to 95 characters is probably a wallet address. + // Equal to 97 characters is probably a wallet address. // For this let's just redirect to the `show_wallet_address` route. return Redirect::found(uri!(show_wallet_address: value.as_str(), "", "", "", "")) - } else if sl == 105 { - // Equal to 105 characters is probably an integrated address. + } else if sl == 107 { + // Equal to 107 characters is probably an integrated address. // For this let's just redirect to the `show_wallet_address` route. return Redirect::found(uri!(show_wallet_address: value.as_str(), "", "", "", "")) } else { @@ -212,26 +212,25 @@ fn search(value: &RawStr) -> Redirect { #[get("/")] fn index() -> Template { + let daemon_uri = env::var("DAEMON_URI").unwrap(); let daemon_info: GetInfoResult = build_rpc( &"get_info", None, true ).send().unwrap().json().unwrap(); - let mut tx_pool: GetTransactionPool = build_rpc( + let tx_pool: GetTransactionPool = build_rpc( &"get_transaction_pool", None, true ).send().unwrap().json().unwrap(); - let mut tx_json_raw: Vec = vec![]; + let mut pool_txs: Vec = tx_pool.transactions.unwrap_or(vec![]); - for f in &mut tx_pool.transactions { + for f in &mut pool_txs { 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_json": tx_json_raw + "tx_pool_txs": pool_txs, + "daemon_uri": daemon_uri }); Template::render("index", context) diff --git a/templates/address.html.tera b/templates/address.html.tera index b129d2e..639f199 100644 --- a/templates/address.html.tera +++ b/templates/address.html.tera @@ -4,8 +4,12 @@
-
- Go Back +
diff --git a/templates/block.html.tera b/templates/block.html.tera index 37f93f3..07dfb7d 100644 --- a/templates/block.html.tera +++ b/templates/block.html.tera @@ -4,8 +4,12 @@
-
- Go Back +
diff --git a/templates/index.html.tera b/templates/index.html.tera index 9cd1d72..e2391f9 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -20,7 +20,8 @@
-

Network Statistics

+

Daemon Statistics

+

Address: {{ daemon_uri | default(value="?") }}

@@ -28,7 +29,7 @@

Version

-

{% if daemon_info.version %}{{ daemon_info.version }}{% else %}?{% endif %}

+

{{ daemon_info.version | default(value="?") }}

@@ -68,7 +69,7 @@

Database Size

-

{% if daemon_info.database_size %}{{ daemon_info.database_size / 1000000000 }} GB{% else %}?{% endif %}

+

{{ daemon_info.database_size / 1000000000 | default(value="?") }} GB

diff --git a/templates/transaction.html.tera b/templates/transaction.html.tera index 7857949..365ccf1 100644 --- a/templates/transaction.html.tera +++ b/templates/transaction.html.tera @@ -4,8 +4,12 @@
-
- Go Back +
@@ -26,9 +30,9 @@
-

In Pool

+

Transaction Fee

-

{{ tx_info.0.in_pool }}

+

{{ tx_info.0.as_json_full.rct_signatures.txnFee | default(value="?") }} WOW

@@ -42,9 +46,9 @@
-

Transaction Fee

+

In Tx Pool

-

{{ tx_info.0.as_json_full.rct_signatures.txnFee / 1000000000000 | default(value="?") }} WOW

+

{{ tx_info.0.in_pool }}

@@ -76,7 +80,7 @@ {% for i in tx_info.0.as_json_full.vin %} - {{ i.key.k_image }} + {{ i.key.k_image | default(value="?") }} {% endfor %} {% endif %}