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 txnFee: Option<u64>,
|
||||||
pub outPk: Option<Vec<String>>
|
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>,
|
recipient_name: Option<String>,
|
||||||
tx_payment_id: Option<String>
|
tx_payment_id: Option<String>
|
||||||
) -> Template {
|
) -> 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!(
|
let address_uri = format!(
|
||||||
"wownero:{}&tx_amount={}&tx_description={}&recipient_name={}&tx_payment_id={}",
|
"wownero:{}&tx_amount={}&tx_description={}&recipient_name={}&tx_payment_id={}",
|
||||||
wallet_address,
|
wallet_address,
|
||||||
tx_amount.unwrap_or("".to_string()),
|
qr_data.tx_amount,
|
||||||
tx_description.unwrap_or("".to_string()),
|
qr_data.tx_description,
|
||||||
recipient_name.unwrap_or("".to_string()),
|
qr_data.recipient_name,
|
||||||
tx_payment_id.unwrap_or("".to_string())
|
qr_data.tx_payment_id
|
||||||
);
|
);
|
||||||
let qr_code: String = qrcode_generator::to_svg_to_string(address_uri, QrCodeEcc::Low, 256, None)
|
let qr_code: String = qrcode_generator::to_svg_to_string(address_uri, QrCodeEcc::Low, 256, None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let qr_code: String = base64::encode(qr_code);
|
let qr_code: String = base64::encode(qr_code);
|
||||||
let context: JsonValue = json!({
|
let context: JsonValue = json!({
|
||||||
"qr_code": qr_code,
|
"qr_code": qr_code,
|
||||||
|
"qr_data": qr_data,
|
||||||
"wallet_address": wallet_address
|
"wallet_address": wallet_address
|
||||||
});
|
});
|
||||||
Template::render("address", context)
|
Template::render("address", context)
|
||||||
|
|
|
@ -308,6 +308,10 @@ p.subheader {
|
||||||
padding-bottom: 1em;
|
padding-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.qr_code {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
#slim-header {
|
#slim-header {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,18 +11,25 @@
|
||||||
<section>
|
<section>
|
||||||
<header class="major">
|
<header class="major">
|
||||||
<h2>Wallet Address</h2>
|
<h2>Wallet Address</h2>
|
||||||
<p class="subheader"><strong>Address</strong>: {{ wallet_address }}</p>
|
|
||||||
</header>
|
</header>
|
||||||
<div class="center">
|
<div class="center qr_code">
|
||||||
<img src="data:image/svg+xml;base64,{{ qr_code }}" width=200 class="center">
|
<img src="data:image/svg+xml;base64,{{ qr_code }}" width=200 class="center">
|
||||||
|
<ul>
|
||||||
|
<li><strong>Address</strong>: {{ wallet_address }}</li>
|
||||||
|
<li><strong>Tx Amount</strong>: {{ qr_data.tx_amount }}</li>
|
||||||
|
<li><strong>Tx Payment Id</strong>: {{ qr_data.tx_payment_id }}</li>
|
||||||
|
<li><strong>Tx Description</strong>: {{ qr_data.tx_description }}</li>
|
||||||
|
<li><strong>Recipient Name</strong>: {{ qr_data.recipient_name }}</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="qr_form">
|
<div class="qr_form">
|
||||||
<p>Want to generate a QR code for incoming payment?</p>
|
<p>Want to generate a QR code for incoming payment?</p>
|
||||||
<form action="" method="get">
|
<form action="" method="get">
|
||||||
<input type="text" name="tx_amount" placeholder="Enter amount for transaction.">
|
<input type="text" name="tx_amount" placeholder="Enter amount for transaction." value="{{ qr_data.tx_amount }}">
|
||||||
<input type="text" name="tx_payment_id" placeholder="Enter a payment ID for transaction.">
|
<input type="text" name="tx_payment_id" placeholder="Enter a payment ID for transaction." value="{{ qr_data.tx_payment_id }}">
|
||||||
<input type="text" name="recipient_name" placeholder="Enter the name of the recipient.">
|
<input type="text" name="tx_description" placeholder="Enter a description for the transaction." value="{{ qr_data.tx_description }}">
|
||||||
<input type="text" name="tx_description" placeholder="Enter a description for the transaction.">
|
<input type="text" name="recipient_name" placeholder="Enter the name of the recipient." value="{{ qr_data.recipient_name }}">
|
||||||
<button type="submit" value="">Regenerate QR Code</button>
|
<button type="submit" value="">Regenerate QR Code</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -78,11 +78,11 @@
|
||||||
<br><br>
|
<br><br>
|
||||||
<div class="tx-table">
|
<div class="tx-table">
|
||||||
<table>
|
<table>
|
||||||
<caption><h2>Transactions ({% if tx_hashes %}{{ tx_hashes | length - 1 }}{% else %}?{% endif %})</h2></caption>
|
<caption><h2>Transactions ({% if tx_hashes %}{{ tx_hashes | length }}{% else %}0{% endif %})</h2></caption>
|
||||||
|
{% if tx_hashes %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>Hash</th>
|
<th>Hash</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% if tx_hashes %}
|
|
||||||
{% for hash in tx_hashes %}
|
{% for hash in tx_hashes %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/transaction/{{ hash }}">{{ hash | truncate(length=12) }}</a></td>
|
<td><a href="/transaction/{{ hash }}">{{ hash | truncate(length=12) }}</a></td>
|
||||||
|
|
|
@ -2,14 +2,6 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% for i in tx_info %}
|
|
||||||
{{i.block_height}}
|
|
||||||
{{i.block_timestamp}}
|
|
||||||
{{i.double_spend_seen}}
|
|
||||||
{{i.in_pool}}
|
|
||||||
{{i.output_indices}}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<section id="main">
|
<section id="main">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<section id="slim-header">
|
<section id="slim-header">
|
||||||
|
@ -20,7 +12,7 @@
|
||||||
<header class="major">
|
<header class="major">
|
||||||
<h2>Transaction {{ tx_hash | truncate(length=4) }}</h2>
|
<h2>Transaction {{ tx_hash | truncate(length=4) }}</h2>
|
||||||
<p class="subheader"><strong>Full Hash</strong>: {{ tx_hash }}</p>
|
<p class="subheader"><strong>Full Hash</strong>: {{ tx_hash }}</p>
|
||||||
<p class="subheader"><strong>Block Timestamp</strong>: {% if tx_info.0.block_timestamp %}{{ tx_info.0.block_timestamp }}{% else %}?{% endif %}</p>
|
<p class="subheader"><strong>Block Timestamp</strong>: {% if tx_info.0.block_timestamp %}{{ tx_info.0.block_timestamp | date(format="%Y-%m-%d %H:%M") }}{% else %}?{% endif %}</p>
|
||||||
</header>
|
</header>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4 col-6-medium col-12-small">
|
<div class="col-4 col-6-medium col-12-small">
|
||||||
|
@ -47,10 +39,46 @@
|
||||||
<p>{{ tx_info.0.double_spend_seen }}</p>
|
<p>{{ tx_info.0.double_spend_seen }}</p>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-4 col-6-medium col-12-small">
|
||||||
|
<section class="box">
|
||||||
|
<header>
|
||||||
|
<h3>Transaction Fee</h3>
|
||||||
|
</header>
|
||||||
|
<p>{{ tx_info.0.as_json_full.rct_signatures.txnFee / 1000000000000 | default(value="?") }} WOW</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 col-6-medium col-12-small">
|
||||||
|
<section class="box">
|
||||||
|
<header>
|
||||||
|
<h3>Version</h3>
|
||||||
|
</header>
|
||||||
|
<p>{{ tx_info.0.as_json_full.version | default(value="?") }}</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="col-4 col-6-medium col-12-small">
|
||||||
|
<section class="box">
|
||||||
|
<header>
|
||||||
|
<h3>Inputs / Outputs</h3>
|
||||||
|
</header>
|
||||||
|
<p>{{ tx_info.0.as_json_full.vin | length | default(value="?") }} / {{ tx_info.0.as_json_full.vout | length | default(value="?") }}</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
<header class="major">
|
||||||
|
<div class="tx-table">
|
||||||
|
<header>
|
||||||
|
<h2>Stealth Addresses</h2>
|
||||||
|
</header>
|
||||||
|
<ol>
|
||||||
|
{% for i in tx_info.0.as_json_full.vout %}
|
||||||
|
<li>{{ i.target.key }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
<header class="major">
|
<header class="major">
|
||||||
{% if tx_info.0.block_height %}<h2><a href="/block/height/{{ tx_info.0.block_height }}">View Block</a></h2>{% endif %}
|
{% if tx_info.0.block_height %}<h2><a href="/block/height/{{ tx_info.0.block_height }}">View Block</a></h2>{% endif %}
|
||||||
</header>
|
</header>
|
||||||
|
|
Loading…
Reference in a new issue