Contract, live ledger, terms, privacy and disclaimer on the Instrument scheme; contract page shows chain totals and never falls back to another contract's source; terms and privacy updated for links, pages, zones and leads; share images point at the LinkSpin image; toolkit banners use the LinkSpin house set
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+16
-19
@@ -1,21 +1,18 @@
|
||||
// Contract page: inject live address, chain, explorer + verified-source links.
|
||||
// Contract page: live address, chain, explorer + verified-source links, the chain totals. No shared nav (2026-10-07).
|
||||
(async function () {
|
||||
await IAP.renderNav('contract');
|
||||
const c = await IAP.getConfig();
|
||||
const $ = IAP.$;
|
||||
$('cAddr').textContent = c.contract.slice(0, 10) + '…' + c.contract.slice(-6);
|
||||
$('cChain').textContent = c.chainName;
|
||||
$('mockAddr').textContent = c.contract.slice(0, 18) + '…';
|
||||
if (c.explorer) {
|
||||
$('lnkExplorer').href = c.explorer + '/address/' + c.contract + '#code';
|
||||
const src = 'https://repo.sourcify.dev/contracts/full_match/' + c.chainId + '/' + c.contract + '/';
|
||||
$('lnkSource').href = src;
|
||||
$('lnkSource2').href = src;
|
||||
} else {
|
||||
// fallback if explorer unset: point straight at the Sourcify-verified source
|
||||
const src = 'https://repo.sourcify.dev/contracts/full_match/137/0xBE1ECA72AFF47d13D8E907e523F55eB9e2d365E0/';
|
||||
$('lnkExplorer').href = src;
|
||||
$('lnkSource').href = src;
|
||||
$('lnkSource2').href = src;
|
||||
}
|
||||
const $ = id => document.getElementById(id);
|
||||
let c = {}; try { c = await (await fetch('/api/config')).json(); } catch (e) {}
|
||||
const addr = String(c.contract || '');
|
||||
$('cAddr').textContent = addr || 'not deployed yet';
|
||||
$('cChain').textContent = c.chainName || '';
|
||||
const src = 'https://repo.sourcify.dev/contracts/full_match/' + (c.chainId || 137) + '/' + addr + '/';
|
||||
$('lnkExplorer').href = c.explorer ? c.explorer + '/address/' + addr + '#code' : src;
|
||||
$('lnkSource').href = src; $('lnkSource2').href = src;
|
||||
try {
|
||||
const s = await (await fetch('/api/stats')).json();
|
||||
$('stMembers').textContent = Number(s.onchainMembers || 0).toLocaleString();
|
||||
$('stPackages').textContent = Number(s.purchases || 0).toLocaleString();
|
||||
const pol = Number(BigInt(String(s.payoutWei || s.paidInWei || '0')) / 10000000000000000n) / 100;
|
||||
$('stPol').textContent = pol.toLocaleString(undefined, { maximumFractionDigits: 2 });
|
||||
} catch (e) {}
|
||||
})();
|
||||
|
||||
+14
-20
@@ -1,31 +1,25 @@
|
||||
// Live ledger: recent history + SSE stream of new chain events.
|
||||
// Live ledger: recent history + SSE stream of new chain events (feed rows from common.js; no shared nav, 2026-10-07).
|
||||
(async function () {
|
||||
await IAP.renderNav('ledger');
|
||||
const $ = id => document.getElementById(id);
|
||||
const c = await IAP.getConfig();
|
||||
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();
|
||||
feed.innerHTML = '';
|
||||
if (!events.length) feed.innerHTML = '<div class="row muted">No activity yet. The first purchase will appear here the moment it lands.</div>';
|
||||
for (const ev of events) feed.appendChild(IAP.feedRow(ev, c));
|
||||
|
||||
if (c.explorer && c.contract) $('contractLink').href = c.explorer + '/address/' + c.contract;
|
||||
const feed = $('feed');
|
||||
try {
|
||||
const { events } = await (await fetch('/api/feed?n=150')).json();
|
||||
feed.innerHTML = '';
|
||||
if (!events.length) feed.innerHTML = '<div class="row muted">No activity yet. The first purchase will appear here the moment it lands.</div>';
|
||||
for (const ev of events) feed.appendChild(IAP.feedRow(ev, c));
|
||||
} catch (e) { feed.innerHTML = '<div class="row muted">Could not read the chain just now. Refresh in a minute.</div>'; }
|
||||
try {
|
||||
const stats = await (await fetch('/api/stats')).json();
|
||||
IAP.$('statLine').textContent = stats.onchainMembers + ' on-chain member(s)';
|
||||
$('statLine').innerHTML = 'members on-chain <b>' + Number(stats.onchainMembers || 0).toLocaleString() + '</b> · packages bought <b>' + Number(stats.purchases || 0).toLocaleString() + '</b>';
|
||||
} catch (e) {}
|
||||
|
||||
IAP.adSlot('banner', 'adSlotBanner');
|
||||
IAP.adSlot('text', 'adSlotText');
|
||||
|
||||
const es = new EventSource('/api/feed/live');
|
||||
es.onopen = () => { const b = IAP.$('liveBadge'); b.textContent = '● live'; };
|
||||
es.onerror = () => { const b = IAP.$('liveBadge'); b.textContent = 'reconnecting…'; };
|
||||
es.onopen = () => { $('liveBadge').textContent = 'live'; $('liveDot').className = 'dot'; };
|
||||
es.onerror = () => { $('liveBadge').textContent = 'reconnecting'; $('liveDot').className = 'dot off'; };
|
||||
es.onmessage = m => {
|
||||
try {
|
||||
const ev = JSON.parse(m.data);
|
||||
feed.prepend(IAP.feedRow(ev, c));
|
||||
while (feed.children.length > 200) feed.removeChild(feed.lastChild);
|
||||
} catch (e) {}
|
||||
try { const ev = JSON.parse(m.data); feed.prepend(IAP.feedRow(ev, c)); while (feed.children.length > 200) feed.removeChild(feed.lastChild); } catch (e) {}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
// legal/static content pages: render the shared nav + footer
|
||||
(async function () { try { await IAP.renderNav(''); } catch (e) {} })();
|
||||
@@ -162,3 +162,16 @@ button,input,select,textarea{font:inherit;color:inherit}
|
||||
.amts{grid-template-columns:1fr}
|
||||
.doc h1{font-size:32px}
|
||||
}
|
||||
|
||||
/* live ledger feed (rows come from common.js feedRow) */
|
||||
.feed{font-family:var(--mono);font-size:13px;line-height:1.6}
|
||||
.feed .row{padding:9px 14px;border-bottom:1px solid var(--line);display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}
|
||||
.feed .row:last-child{border-bottom:0}
|
||||
.feed .row:first-child{background:var(--hi-row)}
|
||||
.feed .row .when{font-size:11px;color:var(--muted);white-space:nowrap;min-width:92px}
|
||||
.feed .t-Purchase,.feed .t-AwardPaid{color:var(--accent-hi);font-weight:700}
|
||||
.feed .t-TierPaid{color:var(--ok)}
|
||||
.feed .t-AdminPaid,.feed .t-PriceCached,.feed .t-FallbackPriceUsed{color:var(--muted)}
|
||||
.feed .tx{margin-left:auto}
|
||||
.feed .tx a{color:var(--muted);font-size:12px}
|
||||
.ad-report{color:var(--muted)}
|
||||
|
||||
Reference in New Issue
Block a user