mirror of
https://git.wownero.com/lza_menace/wownero-explorer.git
synced 2024-08-15 01:03:26 +00:00
improve qr code page and adding more meta to others
This commit is contained in:
parent
136756c690
commit
a2c4739344
6 changed files with 75 additions and 21 deletions
|
@ -234,3 +234,11 @@ pub struct RingSignatures {
|
|||
pub txnFee: Option<u64>,
|
||||
pub outPk: Option<Vec<String>>
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Hash, Eq, PartialEq, Debug, Clone)]
|
||||
pub struct QRData {
|
||||
pub tx_amount: String,
|
||||
pub tx_description: String,
|
||||
pub recipient_name: String,
|
||||
pub tx_payment_id: String
|
||||
}
|
||||
|
|
15
src/main.rs
15
src/main.rs
|
@ -109,19 +109,26 @@ fn show_wallet_address(
|
|||
recipient_name: Option<String>,
|
||||
tx_payment_id: Option<String>
|
||||
) -> Template {
|
||||
let qr_data: QRData = QRData {
|
||||
tx_amount: tx_amount.unwrap_or("".to_string()),
|
||||
tx_description: tx_description.unwrap_or("".to_string()),
|
||||
recipient_name: recipient_name.unwrap_or("".to_string()),
|
||||
tx_payment_id: tx_payment_id.unwrap_or("".to_string())
|
||||
};
|
||||
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())
|
||||
qr_data.tx_amount,
|
||||
qr_data.tx_description,
|
||||
qr_data.recipient_name,
|
||||
qr_data.tx_payment_id
|
||||
);
|
||||
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,
|
||||
"qr_data": qr_data,
|
||||
"wallet_address": wallet_address
|
||||
});
|
||||
Template::render("address", context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue