PageSourceSearch

https://kingpepe.net/bridge-mints.js?v=mints-v2

js kingpepe.net collected 2026-10-04 02:27:54 UTC 7,185 bytes, 55 lines download raw bytes

1// Bridge Mint History: every mint the Native → Solana Bridge has executed, read from the public
2// /api/v1/bridge/mints route (finalized Solana facts verified server-side, served from a cache).
3// Display only: no wallet, no requests that change anything.
4const REFRESH_MS=60000,LIMIT=10;
5const esc=s=>String(s??'').replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
6const short=s=>s&&s.length>16?s.slice(0,6)+'…'+s.slice(-6):(s??'');
7export const SOLANA_TX='https://explorer.solana.com/tx/',SOLANA_ADDRESS='https://explorer.solana.com/address/',NATIVE_TX='/tx/';
8export function formatUtc(iso){if(!iso)return 'unavailable';const d=new Date(iso);if(Number.isNaN(d.getTime()))return 'unavailable';return d.toISOString().replace('T',' ').slice(0,19)+' UTC';}
9export function describeSync(view){
10  if(!view)return {tone:'muted',text:'Loading…'};
11  if(view.synchronization==='COMPLETE'&&!view.stale)return {tone:'ok',text:'Complete: every verified mint matches the Bridge’s canonical issuance.'};
12  if(view.synchronization==='COMPLETE'&&view.stale)return {tone:'warn',text:'Complete at last refresh; the history has not been refreshed recently.'};
13  if(view.synchronization==='UNCONFIRMED')return {tone:'warn',text:'Verified mints are listed; the Bridge’s canonical total could not be read to confirm completeness.'};
14  const diff=view.differenceAtomic&&view.differenceAtomic!=='0'?' Difference to the canonical issuance: '+view.differenceAtomic+' atoms.':'';
15  return {tone:'warn',text:'Historical synchronization is incomplete; entries may still be missing or unverified.'+diff};
16}
17export function renderRows(items){
18  if(!items.length)return '<tr><td class="bmh-empty" colspan="6">No mints match this search.</td></tr>';
19  return items.map(it=>{const burn=it.burnTxid?`<a href="${NATIVE_TX}${esc(it.burnTxid)}" target="_blank" rel="noopener">${esc(short(it.burnTxid))}</a>`:'<span class="bmh-unavailable">association unavailable</span>';
20    const op=it.operationId?`<code>${esc(short(it.operationId))}</code> <button type="button" class="bmh-copy" data-copy="${esc(it.operationId)}" aria-label="Copy operation ID">Copy</button>`:'<span class="bmh-unavailable">unavailable</span>';
21    const status=it.status==='VERIFIED'?'<span class="bmh-badge bmh-ok">Verified</span>':`<span class="bmh-badge bmh-warn" title="${esc(it.reason??'')}">
21Unverified</span>`;
22    return `<tr><td data-label="Date and time (UTC)">${esc(formatUtc(it.timeUtc))}</td><td data-label="Amount (KPEPE)" class="bmh-amount">${esc(it.amountText)}</td>`+
23      `<td data-label="Native burn transaction">${burn}</td><td data-label="Solana mint transaction"><a href="${SOLANA_TX}${esc(it.signature)}" target="_blank" rel="noopener">${esc(short(it.signature))}</a></td>`+
24      `<td data-label="Operation ID">${op}</td><td data-label="Status">${status}</td></tr>`;}).join('');
25}
26export function renderBridgeMints(root,{fetchImpl=fetch,now=Date.now}={}){
27  root.className=(root.className?root.className+' ':'')+'bmh';root.innerHTML=`
28  <section class="bmh-card" aria-labelledby="bmh-title">
29    <h2 id="bmh-title">Bridge Mint History</h2>
30    <p class="bmh-intro">Every KPEPE mint executed by the Native → Solana Bridge since it began operating. Each row is a finalized Solana transaction in which the Bridge program minted the official token, verified against the Bridge’s own claim record and the matching Native burn.</p>
31    <div class="bmh-summary">
32      <div class="bmh-stat"><span class="bmh-label">Mint operations</span><strong id="bmh-count">—</strong></div>
33      <div class="bmh-stat"><span class="bmh-label">Total minted through the Bridge</span><strong id="bmh-total">—</strong><span class="bmh-sub" id="bmh-live"></span></div>
34      <div class="bmh-stat"><span class="bmh-label">Last updated</span><strong id="bmh-updated">—</strong></div>
35    </div>
36    <p class="bmh-state" id="bmh-state" role="status" data-tone="muted">Loading…</p>
37    <div class="bmh-toolbar"><label class="bmh-search"><span>Search</span><input id="bmh-q" type="search" maxlength="100" placeholder="Transaction signature / hash or operation ID" autocomplete="off"></label></div>
38    <div class="bmh-tablewrap"><table class="bmh-table"><thead><tr><th>Date and time (UTC)</th><th>Amount (KPEPE)</th><th>Native burn transaction</th><th>Solana mint transaction</th><th>Operation ID</th><th>Status</th></tr></thead><tbody id="bmh-rows"><tr><td colspan="6" class="bmh-empty">Loading…</td></tr></tbody></table></div>
39    <div class="bmh-pager"><button type="button" id="bmh-prev" disabled>Previous</button><span id="bmh-page">—</span><button type="button" id="bmh-next" disabled>Next</button></div>
40    <p class="bmh-note">Cumulative Bridge issuance is not the current Solana token supply: tokens can be burned on Solana after they are minted, so the live supply can be lower.</p>
41  </section>`;
42  const $=id=>root.querySelector('#'+id);let page=1,q='',view=null,timer=null,stopped=false,inflight=null,debounce=null;
43  function render(){const s=describeSync(view);$('bmh-state').textContent=s.text;$('bmh-state').dataset.tone=s.tone;if(!view)return;
44    $('bmh-count').textContent=String(view.mintCount)+(view.unverifiedCount?` (+${view.unverifiedCount} unverified)`:'');$('bmh-total').textContent=view.totalMintedText+' KPEPE';
45    $('bmh-live').textContent=view.liveMintSupplyAtomic&&view.liveMintSupplyAtomic!==view.totalMintedAtomic?'Live Solana supply differs after on-chain burns.':'';$('bmh-updated').textContent=formatUtc(view.updatedAt);
46    $('bmh-rows').innerHTML=renderRows(view.items);$('bmh-page').textContent=`Page ${view.page} of ${view.pages} · ${view.total} ${view.total===1?'entry':'entries'}`;$('bmh-prev').disabled=view.page<=1;$('bmh-next').disabled=view.page>=view.pages;}
47  async function load(){if(stopped)return;if(inflight)return inflight;inflight=(async()=>{try{const r=await fetchImpl(`/api/v1/bridge/mints?page=${page}&limit=${LIMIT}&q=${encodeURIComponent(q)}`,{cache:'no-store'});if(!r.ok)throw new Error('HTTP '+r.status);view=await r.json();render();}
48    catch(e){$('bmh-state').textContent='The mint history could not be loaded ('+(e.message||'error')+'). Showing the last data received, if any; retrying automatically.';$('bmh-state').dataset.tone='bad';if(!view)$('bmh-rows').innerHTML='<tr><td colspan="6" class="bmh-empty">Unavailable.</td></tr>';}
49    finally{inflight=null;}})();return inflight;}
50  root.addEventListener('click',e=>{const b=e.target.closest('button');if(!b)return;if(b.id==='bmh-prev'&&page>1){page--;void load();}
50else if(b.id==='bmh-next'&&view&&page<view.pages){page++;void load();}
51    else if(b.dataset.copy){navigator.clipboard?.writeText(b.dataset.copy).then(()=>{const t=b.textContent;b.textContent='Copied';setTimeout(()=>{b.textContent=t;},1200);}).catch(()=>{});}});
52  $('bmh-q').addEventListener('input',e=>{clearTimeout(debounce);debounce=setTimeout(()=>{q=e.target.value.trim();page=1;void load();},300);});
53  const tick=()=>{if(document.visibilityState==='visible')void load();};void load();timer=setInterval(tick,REFRESH_MS);
54  return ()=>{stopped=true;clearInterval(timer);clearTimeout(debounce);};
55}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.