adding wallet address view

master
lza_menace 4 years ago
parent 6c2dd2dfca
commit d8d53b810c

@ -111,32 +111,32 @@ fn get_transaction_by_hash(tx_hash: String) -> Template {
Template::render("transaction", context)
}
// #[get("/address/<wallet_address>?<tx_amount>&<tx_description>&<recipient_name>&<tx_payment_id>")]
// fn show_wallet_address(
// wallet_address: String,
// tx_amount: Option<String>,
// tx_description: Option<String>,
// recipient_name: Option<String>,
// tx_payment_id: Option<String>
// ) -> Template {
// let address_uri = format!(
// "wownero:{}&tx_amount={}&tx_description={}&recipient_name={}&tx_payment_id={}",
// wallet_address,
// tx_amount.unwrap_or("".to_string()),
// tx_description.unwrap_or("".to_string()),
// recipient_name.unwrap_or("".to_string()),
// tx_payment_id.unwrap_or("".to_string())
// );
// let qr_code: String = qrcode_generator::to_svg_to_string(address_uri, QrCodeEcc::Low, 256, None)
// .unwrap();
// let qr_code: String = base64::encode(qr_code);
// let context: JsonValue = json!({
// "qr_code": qr_code,
// "wallet_address": wallet_address
// });
// Template::render("address", context)
// }
//
#[get("/address/<wallet_address>?<tx_amount>&<tx_description>&<recipient_name>&<tx_payment_id>")]
fn show_wallet_address(
wallet_address: String,
tx_amount: Option<String>,
tx_description: Option<String>,
recipient_name: Option<String>,
tx_payment_id: Option<String>
) -> Template {
let address_uri = format!(
"wownero:{}&tx_amount={}&tx_description={}&recipient_name={}&tx_payment_id={}",
wallet_address,
tx_amount.unwrap_or("".to_string()),
tx_description.unwrap_or("".to_string()),
recipient_name.unwrap_or("".to_string()),
tx_payment_id.unwrap_or("".to_string())
);
let qr_code: String = qrcode_generator::to_svg_to_string(address_uri, QrCodeEcc::Low, 256, None)
.unwrap();
let qr_code: String = base64::encode(qr_code);
let context: JsonValue = json!({
"qr_code": qr_code,
"wallet_address": wallet_address
});
Template::render("address", context)
}
// #[get("/search?<value>")]
// fn search(value: &RawStr) -> Redirect {
// // This search implementation is not ideal but it works.
@ -270,7 +270,7 @@ fn main() {
// get_block_by_height,
// get_block_by_hash,
get_transaction_by_hash,
// show_wallet_address,
show_wallet_address,
error
])
.mount("/static", StaticFiles::from("./static"))

Loading…
Cancel
Save