normalized images and flow on pages

This commit is contained in:
lza_menace 2020-07-02 23:58:34 -07:00
parent 45d2618f39
commit 0a7170a08b
6 changed files with 37 additions and 25 deletions

View file

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

View file

@ -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<TransactionJSON> = vec![];
let mut pool_txs: Vec<Transactions> = 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)