Built-in transaction viewer: every ledger row verifiable at /tx/<hash>, explorer link when configured
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -92,7 +92,7 @@ window.IAP = (function () {
|
||||
div.innerHTML = '<span>' + describeEvent(ev, c) + '</span>'
|
||||
+ (c.explorer
|
||||
? '<span class="tx"><a target="_blank" rel="noopener" href="' + c.explorer + '/tx/' + ev.tx + '">verify ↗</a></span>'
|
||||
: '<span class="tx mono">' + ev.tx.slice(0, 12) + '…</span>');
|
||||
: '<span class="tx"><a href="/tx/' + ev.tx + '">verify ↗</a></span>'); // built-in viewer when the chain has no public explorer
|
||||
return div;
|
||||
}
|
||||
// Render one served ad into #<elId>. Silent if no inventory.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
(async function () {
|
||||
await IAP.renderNav('ledger');
|
||||
const c = await IAP.getConfig();
|
||||
IAP.$('contractLink').href = c.explorer + '/address/' + c.contract;
|
||||
IAP.$('contractLink').href = c.explorer ? c.explorer + '/address/' + c.contract : '/contract';
|
||||
const feed = IAP.$('feed');
|
||||
|
||||
const { events } = await (await fetch('/api/feed?n=150')).json();
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
// Transaction viewer: renders one tx from /api/tx/<hash> (the server-side RPC
|
||||
// relay, so the browser never talks to the chain directly and CSP stays 'self').
|
||||
// This is the "verify it yourself" page for chains without a public explorer;
|
||||
// when the config carries an explorer URL, feed links point there instead.
|
||||
(async function () {
|
||||
await IAP.renderNav('ledger');
|
||||
const c = await IAP.getConfig();
|
||||
const hash = location.pathname.split('/').pop();
|
||||
IAP.$('txHash').textContent = hash;
|
||||
IAP.$('txChain').textContent = 'on ' + (c.chainName || 'the settlement chain');
|
||||
let r = null;
|
||||
try { r = await (await fetch('/api/tx/' + hash)).json(); } catch (e) {}
|
||||
const stat = IAP.$('txStatus');
|
||||
if (!r || !r.found) {
|
||||
stat.textContent = 'not found';
|
||||
stat.className = 'badge amber';
|
||||
IAP.$('txHint').hidden = false;
|
||||
return;
|
||||
}
|
||||
const ok = r.status === '0x1';
|
||||
stat.textContent = ok ? '✓ confirmed' : '✗ reverted';
|
||||
stat.className = 'badge' + (ok ? '' : ' amber');
|
||||
const hx = v => { try { return parseInt(v, 16); } catch (e) { return 0; } };
|
||||
const rows = [
|
||||
['Block', '#' + hx(r.blockNumber).toLocaleString()],
|
||||
['Time', r.ts ? new Date(hx(r.ts) * 1000).toLocaleString() : 'pending'],
|
||||
['From', r.from || ''],
|
||||
['To (contract)', r.to || ''],
|
||||
['Value sent', IAP.fmtPol(r.valueWei || '0') + ' POL'],
|
||||
['Gas used', hx(r.gasUsed).toLocaleString()]
|
||||
];
|
||||
const tb = IAP.$('txTable');
|
||||
tb.hidden = false;
|
||||
tb.querySelector('tbody').innerHTML = rows.map(x =>
|
||||
'<tr><td class="muted small" style="white-space:nowrap">' + x[0] + '</td>'
|
||||
+ '<td class="mono small" style="overflow-wrap:anywhere">' + String(x[1]).replace(/[&<>]/g, '') + '</td></tr>').join('');
|
||||
if (r.events && r.events.length) {
|
||||
IAP.$('evCard').hidden = false;
|
||||
const feed = IAP.$('evFeed');
|
||||
for (const ev of r.events) feed.appendChild(IAP.feedRow(ev, c));
|
||||
}
|
||||
})();
|
||||
@@ -5,7 +5,7 @@
|
||||
<title>The contract | InstantAdPay</title>
|
||||
<meta name="description" content="Plain-language review of the InstantAdPay settlement contract: what it does, what nobody can change, what the operator can and cannot touch, and how to verify all of it yourself.">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905j">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905r">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
@@ -129,8 +129,8 @@
|
||||
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20260905j"></script>
|
||||
<script src="/assets/contract.js?v=20260905j"></script>
|
||||
<script src="/assets/chat.js?v=20260905j"></script>
|
||||
<script src="/assets/common.js?v=20260905r"></script>
|
||||
<script src="/assets/contract.js?v=20260905r"></script>
|
||||
<script src="/assets/chat.js?v=20260905r"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@
|
||||
<title>InstantAdPay: advertise and earn, locked in code</title>
|
||||
<meta name="description" content="Real ad packages with instant on-chain settlement. Every purchase pays the sponsor line in the same transaction, verifiable by anyone on the live ledger.">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905j">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905r">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -409,9 +409,9 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script src="/assets/common.js?v=20260905j"></script>
|
||||
<script src="/assets/wallet.js?v=20260905j"></script>
|
||||
<script src="/assets/home.js?v=20260905j"></script>
|
||||
<script src="/assets/chat.js?v=20260905j"></script>
|
||||
<script src="/assets/common.js?v=20260905r"></script>
|
||||
<script src="/assets/wallet.js?v=20260905r"></script>
|
||||
<script src="/assets/home.js?v=20260905r"></script>
|
||||
<script src="/assets/chat.js?v=20260905r"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@
|
||||
<title>Live ledger | InstantAdPay</title>
|
||||
<meta name="description" content="Every purchase, payout, and pass-up on InstantAdPay, streamed straight from the blockchain with a verify link on every line.">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905j">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905r">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
@@ -25,8 +25,8 @@
|
||||
<div>InstantAdPay · <a href="/">how it works</a> · <a id="contractLink" href="#" target="_blank" rel="noopener">contract source ↗</a></div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="/assets/common.js?v=20260905j"></script>
|
||||
<script src="/assets/ledger.js?v=20260905j"></script>
|
||||
<script src="/assets/chat.js?v=20260905j"></script>
|
||||
<script src="/assets/common.js?v=20260905r"></script>
|
||||
<script src="/assets/ledger.js?v=20260905r"></script>
|
||||
<script src="/assets/chat.js?v=20260905r"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Member area | InstantAdPay</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905q">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905r">
|
||||
</head>
|
||||
<body class="bo-body">
|
||||
|
||||
@@ -399,9 +399,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/assets/common.js?v=20260905q"></script>
|
||||
<script src="/assets/wallet.js?v=20260905q"></script>
|
||||
<script src="/assets/my.js?v=20260905q"></script>
|
||||
<script src="/assets/chat.js?v=20260905q"></script>
|
||||
<script src="/assets/common.js?v=20260905r"></script>
|
||||
<script src="/assets/wallet.js?v=20260905r"></script>
|
||||
<script src="/assets/my.js?v=20260905r"></script>
|
||||
<script src="/assets/chat.js?v=20260905r"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Transaction | InstantAdPay</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905r">
|
||||
</head>
|
||||
<body>
|
||||
<div id="nav"></div>
|
||||
<section>
|
||||
<div class="wrap" style="max-width:860px">
|
||||
<div class="sectionhead" style="text-align:left">
|
||||
<h2>One transaction, <em>fully public</em></h2>
|
||||
<p>Pulled straight from the chain this site settles on. Every field below is read from the node,
|
||||
not from our database.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<p><span class="badge" id="txStatus">looking it up…</span>
|
||||
<span class="small muted" id="txChain"></span></p>
|
||||
<p class="mono small" id="txHash" style="overflow-wrap:anywhere"></p>
|
||||
<div class="tablewrap"><table id="txTable" hidden>
|
||||
<tbody></tbody>
|
||||
</table></div>
|
||||
<p class="small muted" id="txHint" hidden>Nothing under that hash on this chain yet. If the
|
||||
transaction just happened, give the next block a moment and refresh.</p>
|
||||
</div>
|
||||
<div class="card" id="evCard" hidden>
|
||||
<h3>What this transaction did</h3>
|
||||
<p class="muted small">The contract events inside it, decoded to plain language.</p>
|
||||
<div class="feed" id="evFeed"></div>
|
||||
</div>
|
||||
<p><a href="/ledger">← Back to the live ledger</a> · <a href="/contract">Read the contract review</a></p>
|
||||
</div>
|
||||
</section>
|
||||
<script src="/assets/common.js?v=20260905r"></script>
|
||||
<script src="/assets/tx.js?v=20260905r"></script>
|
||||
</body>
|
||||
</html>
|
||||
+2
-2
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Viewing ad — InstantAdPay</title>
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905q">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=20260905r">
|
||||
<style>
|
||||
html,body{height:100%;margin:0;overflow:hidden}
|
||||
.vw{display:flex;flex-direction:column;height:100vh;height:100dvh;background:var(--bg,#04110c);color:var(--ink,#e8fff7)}
|
||||
@@ -43,6 +43,6 @@
|
||||
</div>
|
||||
<iframe class="vframe" id="vFrame" sandbox="allow-scripts allow-same-origin allow-forms allow-popups" referrerpolicy="no-referrer" title="Advertiser site"></iframe>
|
||||
</div>
|
||||
<script src="/assets/view.js?v=20260905q"></script>
|
||||
<script src="/assets/view.js?v=20260905r"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user