, edits: Edit[]) {
+ setRechecking(true);
+ try {
+ const doc = edits.reduce((d, e) => edit(d, e), r.original);
+ const verdict = await withFetch(fetchRef.current ?? fetch, () => verifyReceipt(doc));
+ setResult({ ...r, doc, verdict, edits });
+ } finally {
+ setRechecking(false);
+ }
+ }
+
+ function onEdit(e: Edit | null) {
+ if (result?.kind !== "receipt") return;
+ const edits = e === null ? [] : result.edits.includes(e) ? result.edits.filter((x) => x !== e) : [...result.edits, e];
+ applyEdits(result, edits);
+ }
+
+ async function run(input = text, firstEdit?: Edit) {
+ const c = classify(input);
+ setResult(null);
+ if (c.kind === "invalid") return setResult({ kind: "invalid", reason: c.reason });
+ if (c.kind === "foreign") return setResult({ kind: "foreign", family: c.family, cid: null });
+ try {
+ if (c.kind === "receipt" || c.kind === "decision") return await checkDoc(c.doc, null, firstEdit);
+ if (c.kind === "cid") {
+ setBusy("fetching");
+ const got = await fetchCid(c.cid);
+ if (got.status === "mismatch") return setResult({ kind: "mismatch", cid: c.cid, gateway: got.gateway });
+ if (got.status === "not-found") return setResult({ kind: "not-found", cid: c.cid, attempts: got.attempts });
+ let doc: unknown;
+ try { doc = JSON.parse(new TextDecoder().decode(got.bytes)); } catch { return setResult({ kind: "invalid", reason: "not-json" }); }
+ return await checkDoc(doc, { cid: c.cid, gateway: got.gateway, cidCheck: got.cidCheck }, firstEdit);
+ }
+ setBusy("checking");
+ const found: TxView[] = [];
+ let error: RpcFailure | null = null;
+ for (const network of [BASE_SEPOLIA, BASE_MAINNET]) {
+ try { const v = await lookupTransaction(c.hash, network); if (v) found.push(v); }
+ catch (e) { error = rpcFailureOf(e) ?? "unreachable"; }
+ }
+ setResult({ kind: "tx", found, error });
+ } finally {
+ setBusy(null);
+ }
+ }
+
+ // Shareable: /explorer?cid=Qm… runs once on load.
+ useEffect(() => {
+ const cid = new URLSearchParams(location.search).get("cid");
+ if (cid) { setText(cid); run(cid); }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ async function onDrop(e: React.DragEvent) {
+ e.preventDefault();
+ setDragging(false);
+ const file = e.dataTransfer.files?.[0];
+ if (!file) return;
+ const content = (await file.text()).trim();
+ setText(content);
+ run(content);
+ }
+
+ function open(value: string, firstEdit?: Edit) {
+ setText(value);
+ run(value, firstEdit);
+ resultRef.current?.scrollIntoView({ behavior: matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth", block: "start" });
+ }
+
+ return (
+
+
+ {t.eyebrow}
+ {t.titlePre} {t.titleEm}
+ {t.intro}
+
+
+
+
+
+ {t.examples}
+
+ {STORIES.map((s) => (
+
+ open(s.cid, "edit" in s ? s.edit : undefined)} disabled={!!busy}>
+ {s.title[lang]}
+ {s.text[lang]}
+ {t.selftest} {short(s.cid)}
+
+
+ ))}
+
+
+
+
+ {busy && {busy === "fetching" ? t.fetching : t.checking}
}
+ {!busy && result && }
+
+
+ );
+}
+
+function SourceLine({ source }: { source: Source | null }) {
+ const { t } = usePrefs();
+ if (!source) return null;
+ const ok = source.cidCheck === true;
+ return (
+
+ {ok ? t.cidMatch : t.cidUnchecked} {short(source.cid)} · {t.servedBy} {host(source.gateway)}
+
+ );
+}
+
+function ResultView({ result, onEdit, rechecking }: { result: Result; onEdit: (e: Edit | null) => void; rechecking: boolean }) {
+ const { t } = usePrefs();
+ if (result.kind === "invalid") return {t.invalidInput[result.reason]}
;
+ if (result.kind === "tx") return ;
+ if (result.kind === "foreign") {
+ const href = result.cid ? `${FOREIGN_URL[result.family]}?cid=${encodeURIComponent(result.cid)}` : FOREIGN_URL[result.family];
+ return {t.foreign[result.family]} {t.foreignLink[result.family]} →
;
+ }
+ if (result.kind === "mismatch") return {t.fail}
{t.mismatch.replace("{gateway}", host(result.gateway)).replace("{cid}", result.cid)}
;
+ if (result.kind === "not-found") return (
+
+
{t.notFound}
+
{result.attempts.map((a) => {host(a.gateway)}: {a.status} )}
+
+ );
+ if (result.kind === "decision") return ;
+ const v = result.verdict;
+ if (v.status === "rpc-error") return {t.rpcError[v.failure]}
;
+ if (v.status === "bad-input") return {t.badInput} {v.message}
;
+ const label = v.status === "valid" ? t.valid : v.status === "invalid" ? t.invalid : t.incomplete;
+ const lead = v.status === "incomplete" ? `${t.incompleteLead} ${t.rpcError[v.failure]}` : v.status === "valid" ? t.validLead : t.invalidLead;
+ return (
+
+
+
{label} {NETWORKS[result.network].name} {result.edits.length > 0 && {t.mech.edited} }
+
{result.edits.length ? t.mech.editedLead : lead}
+
+
+ {t.mech.allChecks.replace("{n}", String(v.checks.length))}
+ !isChainCheck(c.name))} />
+ isChainCheck(c.name))} />
+
+
+ );
+}
+
+function CheckGroup({ title, checks }: { title: string; checks: Check[] }) {
+ const { t } = usePrefs();
+ if (!checks.length) return null;
+ return (
+
+ {title}
+
+ {checks.map((c, i) => {
+ const why = !c.ok && reasonKey(c.name);
+ return (
+
+ {c.ok ? t.pass : t.fail}
+ {c.name}
+ {why && {t.reasons[why]} }
+ {c.detail && {c.detail} }
+
+ );
+ })}
+
+
+ );
+}
+
+function TxResult({ result }: { result: Extract }) {
+ const { lang, t } = usePrefs();
+ return (
+
+ {result.error &&
{t.rpcError[result.error]}
}
+ {!result.found.length && !result.error &&
{t.txNotFound}
}
+ {result.found.map((v) => (
+
+ {t.txTitle} {t.txOn} {NETWORKS[v.network].name}
+ {t.txLead}
+ {v.failed && {t.txFailed}
}
+ {!v.transfers.length && {t.txNone}
}
+
+ {t.txBlock} {v.block}
+ {t.txTime} {v.blockTime ? new Date(v.blockTime * 1000).toLocaleString(lang) : "n/a"}
+ {v.nonces.flatMap((n, i) => [{t.txNonce} , {short(n.nonce)} ])}
+
+ {v.transfers.map((x) => (
+
+ logIndex {x.logIndex}
+ {t.txFrom} {short(x.from)}
+ {t.txTo} {short(x.to)}
+ {t.txAmount} {x.usdc ? `${formatUnits(x.value, 6)} USDC` : `${x.value} (${t.rawUnits}, ${short(x.token)})`}
+
+ ))}
+ {t.explorerLink}
+
+ ))}
+
+ );
+}
+
+export function Mark({ ok }: { ok: boolean | null }) {
+ return (
+
+ {ok === null ? : ok ? : }
+
+ );
+}
+
+function DecisionResult({ result }: { result: Extract }) {
+ const { t } = usePrefs();
+ const r = result.doc.record ?? {};
+ const i = r.intent ?? {};
+ const outcome = String(r.decision?.outcome ?? "");
+ const lead = !result.ok ? t.decision.invalidLead : outcome === "DENY" ? t.decision.deny : outcome === "WAIT" ? t.decision.wait : t.decision.other;
+ return (
+
+
+
{result.ok ? t.valid : t.invalid} {NETWORKS[result.network].name} {outcome}
+
{lead}
+
+ {t.decision.outcome} {outcome}
+ {r.decision?.reason && <>{t.decision.reason} {r.decision.reason} >}
+ {r.decision?.policyVersion && <>{t.decision.policy} {r.decision.policyVersion} >}
+ {t.decision.amount} {formatUnits(String(i.amount ?? ""), typeof i.decimals === "number" ? i.decimals : null)} USDC
+ {t.decision.to} {short(String(i.to ?? ""))}
+ {t.decision.from} {short(String(i.from ?? ""))}
+ {t.decision.resource} {String(i.resource ?? "")}
+ {r.purpose?.note && <>{t.decision.purpose} {r.purpose.note} >}
+ {r.purpose?.ref && <>{t.decision.ref} {r.purpose.ref} >}
+
+
{t.decision.noChain}
+
+
+ );
+}
diff --git a/apps/demo/app/explorer/Mechanism.tsx b/apps/demo/app/explorer/Mechanism.tsx
new file mode 100644
index 0000000..b8be2a9
--- /dev/null
+++ b/apps/demo/app/explorer/Mechanism.tsx
@@ -0,0 +1,66 @@
+"use client";
+// The result drawn as the mechanism: the receipt on the left, the transfer on the chain on the
+// right, and a wire for each thing that must match. Each wire says PASS or FAIL in words and, when
+// it breaks, why. The visitor can edit the receipt and watch the wires that depend on that field
+// break, with the same verifier re-run on the chain answers already read.
+import { usePrefs } from "../Prefs";
+import type { Link, Edit } from "@/lib/mechanism.ts";
+import { reasonKey } from "@/lib/receipt.ts";
+
+export function Mechanism({ links, network, purpose, edits, onEdit, rechecking }: {
+ links: Link[]; network: string; purpose: string | null; edits: Edit[]; onEdit: (e: Edit | null) => void; rechecking: boolean;
+}) {
+ const { t } = usePrefs();
+ const m = t.mech;
+ return (
+
+ {m.title}
+
+
+
{m.receiptHead} {m.receiptSub}
+
+
{m.chainHead.replace("{network}", network)} {m.chainSub}
+
+ {purpose && (
+
+
{m.purpose} {purpose}
+
+
{m.purpose} {m.purposeChain}
+
+ )}
+
+ {links.map((l, i) => {
+ const why = l.failed ? reasonKey(l.failed) : null;
+ return (
+
+ {m.srRow.replace("{what}", m.links[l.key]).replace("{receipt}", l.receipt).replace("{chain}", l.chain ?? m.none).replace("{state}", l.ok ? t.pass : t.fail)}
+ {m.links[l.key]} {l.receipt}
+
+
+ {l.ok
+ ?
+ : <> >}
+
+
+
{l.ok ? t.pass : t.fail}
+
+ {m.chainLinks[l.key]} {l.chain ?? m.none}
+ {!l.ok && {why ? t.reasons[why] : m.notChecked}
}
+
+ );
+ })}
+
+
+
+ {m.editTitle}
+ {m.editHint}
+
+ {(["amount", "destination", "purpose"] as const).map((e) => (
+ onEdit(e)}>{m.edit[e]}
+ ))}
+ {edits.length > 0 && onEdit(null)}>{m.restore} }
+
+
+
+ );
+}
diff --git a/apps/demo/app/explorer/page.tsx b/apps/demo/app/explorer/page.tsx
new file mode 100644
index 0000000..a5dd2d6
--- /dev/null
+++ b/apps/demo/app/explorer/page.tsx
@@ -0,0 +1,20 @@
+import type { Metadata } from "next";
+import { Explorer } from "./Explorer";
+
+// Its own link preview: a child openGraph replaces the layout's, so the image is listed again.
+export const metadata: Metadata = {
+ title: "Receipt explorer · Nirium on Base",
+ openGraph: {
+ type: "website",
+ siteName: "Nirium",
+ url: "https://nirium.xyz/base/explorer",
+ title: "Receipt explorer · Nirium on Base",
+ description: "Paste a receipt's CID and check it against Base, in your browser.",
+ images: [{ url: "https://nirium.xyz/branding-nirium/png/social-banner-1200x630.png", width: 1200, height: 630, alt: "Nirium on Base: a receipt signed by whoever pays, checked against Base in the browser" }],
+ },
+ twitter: { card: "summary_large_image", title: "Receipt explorer · Nirium on Base", description: "Paste a receipt's CID and check it against Base, in your browser.", images: ["https://nirium.xyz/branding-nirium/png/social-banner-1200x630.png"] },
+};
+
+export default function ExplorerPage() {
+ return ;
+}
diff --git a/apps/demo/app/globals.css b/apps/demo/app/globals.css
new file mode 100644
index 0000000..b38a3d4
--- /dev/null
+++ b/apps/demo/app/globals.css
@@ -0,0 +1,258 @@
+/* The nirium.xyz look, read from nirium-core-private (apps/web/app/globals.css, tailwind.config.ts and
+ app/(app)/verify/page.tsx): #050505 page, #121212 cards with a 2rem radius, black/40 inputs,
+ Inter 900 italic uppercase titles with an accent word, 10px uppercase labels with wide tracking,
+ a white primary button. On this page the N and the accent are Base blue (#0052FF; #4C8DFF for text on dark: 5.85:1 on #121212; #0052FF on light: 5.75:1 on white). So that the accent
+ never reads as FAIL, the result panels keep their labels neutral and FAIL keeps its own mark,
+ word and dashed line. Text colors are
+ lighter than the site's gray-500 so small text reaches WCAG AA on #121212 and on white. */
+:root, :root[data-theme="dark"] {
+ --chain-line: linear-gradient(90deg, #003ECB, #0052FF 45%, #4C8DFF);
+ --chain-glow: rgba(0, 82, 255, 0.16);
+ color-scheme: dark;
+ --bg: #050505;
+ --card: #121212;
+ --field: rgba(0, 0, 0, 0.4);
+ --text: #ffffff;
+ --muted: #a1a1aa; /* 7.3:1 on #121212 */
+ --faint: #8b8b93; /* 5.5:1 on #121212 */
+ --line: rgba(255, 255, 255, 0.06);
+ --line-2: rgba(255, 255, 255, 0.12);
+ --accent: #4C8DFF;
+ --accent-soft: rgba(0, 82, 255, 0.1);
+ --pass: #34d399;
+ --pass-soft: rgba(52, 211, 153, 0.1);
+ --fail: #f87171;
+ --fail-soft: rgba(248, 113, 113, 0.1);
+ --warn: #fbbf24;
+ --warn-soft: rgba(251, 191, 36, 0.1);
+ --btn: #ffffff;
+ --btn-text: #000000;
+ --dot: #0a0a0c;
+ --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
+}
+:root[data-theme="light"] {
+ --chain-glow: rgba(0, 82, 255, 0.08);
+ color-scheme: light;
+ --bg: #f8f9fa;
+ --card: #ffffff;
+ --field: #f4f4f6;
+ --text: #18181b;
+ --muted: #52525b; /* 7.7:1 on white */
+ --faint: #63636b; /* 6.0:1 on white, 5.7:1 on #f8f9fa */
+ --line: rgba(24, 24, 27, 0.08);
+ --line-2: rgba(24, 24, 27, 0.14);
+ --accent: #0052FF;
+ --accent-soft: rgba(0, 82, 255, 0.07);
+ --pass: #047857;
+ --pass-soft: rgba(4, 120, 87, 0.08);
+ --fail: #b91c1c;
+ --fail-soft: rgba(185, 28, 28, 0.07);
+ --warn: #92400e;
+ --warn-soft: rgba(146, 64, 14, 0.08);
+ --btn: #18181b;
+ --btn-text: #ffffff;
+ --dot: #0a0a0c;
+ --shadow: 0 1px 3px rgba(16, 24, 40, 0.02), 0 8px 24px rgba(16, 24, 40, 0.04);
+}
+
+* { box-sizing: border-box; }
+html, body { margin: 0; }
+html { -webkit-text-size-adjust: 100%; }
+body {
+ background: var(--bg);
+ color: var(--text);
+ font-family: var(--font-inter), system-ui, sans-serif;
+ line-height: 1.55;
+ -webkit-font-smoothing: antialiased;
+ overflow-x: hidden;
+}
+.mono, pre, code, textarea, input { font-family: var(--font-inconsolata), ui-monospace, monospace; }
+a { color: var(--accent); text-underline-offset: 3px; }
+:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
+.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
+
+/* Status bar: the site's ticker strip, here with facts about this page instead of prices. */
+.status { display: flex; gap: 1.75rem; overflow-x: auto; scrollbar-width: none; padding: 0.45rem clamp(1rem, 4vw, 2.5rem); border-bottom: 1px solid var(--line); background: var(--chain-line) top / 100% 3px no-repeat, var(--card); padding-top: calc(0.45rem + 3px); font-family: var(--font-inconsolata), monospace; font-size: 0.75rem; white-space: nowrap; margin: 0; }
+.status::-webkit-scrollbar { display: none; }
+.status div { display: flex; gap: 0.5rem; align-items: center; }
+.status dt { color: var(--faint); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.68rem; font-weight: 700; }
+.status dd { margin: 0; color: var(--text); font-weight: 700; }
+.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
+
+.bar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 2.5rem); }
+.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); min-height: 44px; }
+.brand svg { width: 34px; height: 34px; flex: none; }
+.brand b { font-weight: 900; letter-spacing: 0.08em; font-size: 0.95rem; }
+.chip { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-soft); border-radius: 999px; padding: 0.3rem 0.75rem; }
+.toggles { display: flex; gap: 0.5rem; }
+@media (max-width: 420px) { .bar { gap: 0.5rem; } .brand { gap: 0.45rem; } .brand svg { width: 28px; height: 28px; } .brand b { font-size: 0.85rem; letter-spacing: 0.05em; } .chip { padding: 0.25rem 0.55rem; letter-spacing: 0.1em; } .toggles button { padding: 0 0.6rem; min-width: 40px; } }
+.toggles [role="group"] { display: flex; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--card); }
+.toggles button { background: transparent; color: var(--muted); border: 0; padding: 0 0.75rem; font: inherit; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; min-height: 40px; min-width: 44px; }
+.toggles button[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
+.toggles .theme { display: inline-flex; padding: 0; min-width: 0; align-items: center; justify-content: center; width: 42px; min-height: 42px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); color: var(--text); cursor: pointer; }
+.toggles .theme svg { width: 16px; height: 16px; }
+
+.wrap { max-width: 860px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 4rem; }
+.wide { max-width: 1100px; }
+.hero { text-align: center; margin: 1.5rem 0 2.5rem; padding: 1rem 0; background: radial-gradient(ellipse 60% 70% at 50% 45%, var(--chain-glow), transparent 70%); }
+.badge { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.7rem; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; color: var(--pass); background: var(--pass-soft); border: 1px solid var(--pass-soft); border-radius: 999px; padding: 0.4rem 1rem; margin-bottom: 1.4rem; }
+.display { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: -0.05em; line-height: 0.9; font-size: clamp(2.2rem, 8vw, 4.2rem); margin: 0 0 1.25rem; overflow-wrap: anywhere; }
+.display em { color: var(--accent); font-style: italic; }
+.lead { color: var(--muted); max-width: 60ch; margin: 0 auto; font-size: clamp(0.95rem, 2.2vw, 1.05rem); }
+.fine { color: var(--faint); font-size: 0.78rem; font-style: italic; max-width: 62ch; margin: 0.9rem auto 0; }
+
+.card { background: var(--card); border: 1px solid var(--line); border-radius: clamp(1.5rem, 3vw, 2rem); padding: clamp(1.25rem, 3.5vw, 2rem); box-shadow: var(--shadow); }
+.label { display: block; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); margin: 0 0 0.65rem 0.2rem; }
+.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; background: var(--btn); color: var(--btn-text); border: 0; border-radius: 1rem; padding: 0 1.75rem; min-height: 52px; font: inherit; font-size: 0.75rem; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; cursor: pointer; text-decoration: none; }
+.btn:disabled { opacity: 0.4; cursor: not-allowed; }
+.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-2); }
+.foot { max-width: 1100px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem; color: var(--faint); font-size: 0.8rem; border-top: 1px solid var(--line); }
+
+/* Pieces the current explorer still uses; the explorer PRs replace them. */
+.eyebrow { color: var(--accent); font-family: var(--font-inconsolata), monospace; text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.75rem; font-weight: 700; margin: 0; }
+h1 { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: -0.05em; line-height: 0.92; font-size: clamp(2rem, 7vw, 3.4rem); margin: 0.5rem 0 1rem; }
+h2 { font-size: 0.7rem; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); margin: 0 0 0.75rem; }
+h3 { font-size: 0.95rem; margin: 0 0 0.6rem; display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
+.panel, .group, .note { background: var(--card); border: 1px solid var(--line); border-radius: 1.5rem; box-shadow: var(--shadow); }
+.panel { display: grid; gap: 0.5rem; padding: clamp(1.25rem, 3.5vw, 2rem); margin: 1.5rem 0; }
+.panel label { font-size: 0.66rem; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); margin-top: 0.5rem; }
+textarea, input { width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--line-2); border-radius: 1rem; padding: 0.9rem 1rem; font-size: 0.9rem; }
+input[aria-invalid="true"] { border-color: var(--fail); }
+.drop { display: grid; gap: 0.35rem; }
+.drop.over textarea { border-color: var(--accent); border-style: dashed; }
+.hint { color: var(--faint); font-size: 0.8rem; }
+.primary { justify-self: start; margin-top: 0.75rem; background: var(--btn); color: var(--btn-text); border: 0; border-radius: 1rem; padding: 0 1.75rem; min-height: 52px; font: inherit; font-size: 0.75rem; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; cursor: pointer; }
+.primary:disabled { opacity: 0.4; cursor: not-allowed; }
+.examples ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
+.examples button { background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-radius: 0.75rem; padding: 0.5rem 0.75rem; font: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; text-align: left; min-height: 44px; }
+.tag { display: inline-block; margin-left: 0.4rem; font-size: 0.7rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 0.45rem; }
+.result { margin-top: 2rem; display: grid; gap: 1rem; }
+.skeleton { height: 9rem; border-radius: 1.5rem; background: var(--card); border: 1px solid var(--line); animation: pulse 1.4s ease-in-out infinite; }
+@keyframes pulse { 50% { opacity: 0.45; } }
+.note { padding: 1rem 1.25rem; margin: 0 0 1rem; }
+.note.warn { border-color: var(--warn); }
+.note pre { margin: 0.5rem 0 0; overflow-x: auto; }
+.verdict { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 900; font-size: 1.25rem; letter-spacing: 0.05em; margin: 0 0 0.25rem; }
+.verdict.valid { color: var(--pass); }
+.verdict.invalid { color: var(--fail); }
+.verdict.incomplete { color: var(--warn); }
+.net { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); border: 1px solid var(--line-2); border-radius: 999px; padding: 0.05rem 0.55rem; }
+.group { padding: 1.1rem 1.25rem; margin-top: 1rem; }
+.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
+.checks li { display: grid; grid-template-columns: 5.2rem 1fr; gap: 0.1rem 0.75rem; padding: 0.45rem 0; border-top: 1px solid var(--line); }
+.checks li:first-child { border-top: 0; }
+.state { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 800; font-size: 0.85rem; }
+.pass .state { color: var(--pass); }
+.fail .state { color: var(--fail); }
+.name { font-size: 0.88rem; overflow-wrap: anywhere; }
+.why, .detail { grid-column: 2; font-size: 0.82rem; }
+.detail { color: var(--muted); overflow-wrap: anywhere; }
+.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0.75rem 0; font-size: 0.88rem; }
+.facts dt { color: var(--muted); }
+.facts dd { margin: 0; overflow-wrap: anywhere; }
+.transfer { border-top: 1px solid var(--line); padding-top: 0.75rem; }
+@media (max-width: 480px) { .checks li { grid-template-columns: 1fr; } .why, .detail { grid-column: 1; } }
+@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
+a.sr:focus-visible { position: fixed; top: 0.5rem; left: 0.5rem; width: auto; height: auto; clip: auto; z-index: 20; background: var(--btn); color: var(--btn-text); padding: 0.6rem 1rem; border-radius: 0.75rem; }
+
+/* Home */
+.ctas { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }
+.tiles { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: 1rem; grid-template-columns: 1fr; }
+@media (min-width: 720px) { .tiles { grid-template-columns: 1fr 1fr; } }
+.tile { display: flex; flex-direction: column; gap: 0.6rem; }
+.tile p { margin: 0; color: var(--muted); font-size: 0.92rem; }
+.tile a { margin-top: auto; font-weight: 700; font-size: 0.85rem; overflow-wrap: anywhere; }
+.tile.soon { border-style: dashed; border-color: var(--line-2); background: transparent; box-shadow: none; }
+.tile-title { font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: -0.02em; font-size: 1.15rem; margin: 0; display: block; }
+.state-pill { align-self: flex-start; font-size: 0.64rem !important; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; border: 1px solid var(--line-2); border-radius: 999px; padding: 0.2rem 0.6rem; color: var(--faint) !important; }
+.state-pill.live { color: var(--pass) !important; background: var(--pass-soft); border-color: var(--pass-soft); }
+.small { font-size: 0.8rem !important; }
+.cmd { margin: 0; background: var(--field); border: 1px solid var(--line-2); border-radius: 0.75rem; padding: 0.6rem 0.8rem; font-size: 0.85rem; overflow-x: auto; }
+/* Explorer: one field, like nirium.xyz/verify */
+.search { margin-bottom: 2rem; }
+.search .row { display: flex; gap: 0.75rem; }
+.search .row.over .field { border-color: var(--accent); border-style: dashed; }
+.field { flex: 1; min-width: 0; background: var(--field); color: var(--text); border: 1px solid var(--line-2); border-radius: 1rem; padding: 0 1rem; min-height: 54px; font-size: 0.9rem; }
+.field::placeholder { color: var(--faint); }
+.detect { margin: 0.7rem 0.2rem 0; min-height: 1.3em; }
+.rpc { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.9rem; }
+.rpc summary { cursor: pointer; font-size: 0.82rem; font-weight: 700; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
+.rpc .field { width: 100%; margin-top: 0.5rem; }
+@media (max-width: 560px) { .search .row { flex-direction: column; } .search .btn { width: 100%; } }
+.stories ul { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
+.story { width: 100%; height: 100%; text-align: left; display: flex; flex-direction: column; gap: 0.45rem; background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-radius: 1.25rem; padding: 1rem 1.1rem; font: inherit; cursor: pointer; }
+.story:hover:not(:disabled) { border-color: var(--accent); }
+.story:disabled { opacity: 0.55; cursor: wait; }
+.story-title { font-weight: 800; font-size: 0.95rem; }
+.story-text { color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
+.story-meta { margin-top: auto; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-size: 0.75rem; color: var(--faint); }
+.story-meta .tag { margin: 0; }
+.working { display: flex; gap: 0.75rem; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
+.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
+@keyframes spin { to { transform: rotate(360deg); } }
+.source { display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; font-size: 0.82rem; font-weight: 700; padding: 0.7rem 1rem; border-radius: 1rem; margin: 0 0 1rem; overflow-wrap: anywhere; }
+.source.pass { color: var(--pass); background: var(--pass-soft); }
+.source.warn { color: var(--warn); background: var(--warn-soft); }
+.card.note { box-shadow: none; }
+.note.bad { border-color: var(--fail); background: var(--fail-soft); }
+.attempts { list-style: none; padding: 0; margin: 0.5rem 0; font-size: 0.8rem; color: var(--muted); }
+/* The mechanism: receipt on the left, chain on the right, one wire per thing that must match. */
+.mech { position: relative; margin: 1.25rem 0 1rem; }
+.mech-heads, .wire-row { display: grid; grid-template-columns: minmax(0, 1fr) clamp(84px, 14vw, 140px) minmax(0, 1fr); align-items: center; }
+.mech-heads p { margin: 0; padding: 1.1rem 1.25rem 0.4rem; }
+.mech-heads .label { margin: 0 0 0.2rem; color: var(--text); }
+.mech-sub { display: block; font-size: 0.78rem; color: var(--muted); }
+.wires { list-style: none; margin: 0; padding: 0 0 0.75rem; }
+/* The two cards behind the columns. */
+.mech-board { position: relative; }
+.mech-board::before, .mech-board::after { content: ""; position: absolute; top: 0; bottom: 0; width: calc((100% - clamp(84px, 14vw, 140px)) / 2); background: var(--card); border: 1px solid var(--line); border-radius: 1.5rem; box-shadow: var(--shadow); z-index: 0; }
+.mech-board::before { left: 0; }
+.mech-board::after { right: 0; }
+.mech-board > * { position: relative; z-index: 1; }
+.purpose-row .side { margin: 0; }
+.purpose-row .side-value { font-family: var(--font-inter), sans-serif; }
+.purpose-chain { font-size: 0.84rem; color: var(--muted); font-style: italic; }
+.side { padding: 0.55rem 1.25rem; min-width: 0; display: grid; gap: 0.1rem; }
+.side.right { text-align: left; }
+.side-label { font-size: 0.68rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
+.side-value { font-size: 0.9rem; font-weight: 700; overflow-wrap: anywhere; }
+.fail .side-value { color: var(--fail); }
+.wire { position: relative; height: 40px; display: grid; place-items: center; color: var(--pass); }
+.fail .wire { color: var(--fail); }
+.wire svg { position: absolute; inset: 8px 0; width: 100%; height: 24px; overflow: visible; }
+.wire circle { fill: currentColor; }
+.w-line { stroke: currentColor; stroke-width: 2.5; fill: none; stroke-dasharray: 120; stroke-dashoffset: 120; animation: draw 0.5s ease-out forwards; animation-delay: calc(var(--i) * 70ms); }
+.fail .w-line { stroke-dasharray: 5 4; stroke-dashoffset: 0; animation: none; }
+.w-gap { stroke: currentColor; stroke-width: 2.5; fill: none; }
+@keyframes draw { to { stroke-dashoffset: 0; } }
+.w-badge { position: relative; font-size: 0.66rem; font-weight: 900; letter-spacing: 0.14em; background: var(--bg); border: 1px solid currentColor; border-radius: 999px; padding: 0.1rem 0.5rem; }
+.wire-why { grid-column: 1 / -1; margin: 0 1.25rem 0.5rem; padding: 0.5rem 0.75rem; border-radius: 0.75rem; background: var(--fail-soft); color: var(--fail); font-size: 0.84rem; font-weight: 600; }
+.edits { border: 1px dashed var(--line-2); border-radius: 1.25rem; padding: 1rem 1.25rem; margin: 1rem 0 0; background: var(--bg); }
+.edits legend { padding: 0 0.4rem; margin: 0; }
+.edits .hint { margin: 0 0 0.75rem; }
+.edit-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
+.small-btn { min-height: 44px; padding: 0 1rem; font-size: 0.68rem; }
+.small-btn[aria-pressed="true"] { border-color: var(--fail); color: var(--fail); background: var(--fail-soft); }
+.net.edited { color: var(--fail); margin-left: 0.4rem; }
+.all-checks { margin-top: 1rem; }
+.all-checks summary { cursor: pointer; font-weight: 800; font-size: 0.85rem; min-height: 40px; display: flex; align-items: center; color: var(--muted); }
+@media (max-width: 640px) {
+ .mech-board::before, .mech-board::after, .mech-heads { display: none; }
+ .purpose-row { margin-bottom: 0.6rem; }
+ .wires { display: grid; gap: 0.6rem; padding: 0; }
+ .wire-row { grid-template-columns: 1fr; background: var(--card); border: 1px solid var(--line); border-radius: 1.1rem; padding: 0.4rem 0; }
+ .wire { height: 34px; }
+ .wire svg { inset: 5px auto; width: 24px; height: 24px; left: 50%; transform: translateX(-50%) rotate(90deg); }
+}
+
+/* What runs on mainnet today, right under the hero: the demo payments are on a test network, the
+ status bar says so, and without this line a visitor reads the whole page as test-only. */
+.mainnet { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin: 1.5rem auto 0; }
+.mainnet-head { display: inline-flex; align-items: center; gap: 0.55rem; margin: 0; color: var(--text); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.7rem; }
+.mainnet-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pass); box-shadow: 0 0 0 4px var(--pass-soft); }
+.mainnet-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
+.mainnet-items li { border: 1px solid var(--line-2); background: var(--card); border-radius: 999px; padding: 0.35rem 0.9rem; font-size: 0.82rem; color: var(--text); }
+
+/* Back to nirium.xyz/chains, where every chain is listed: this page is one of them. */
+.allchains { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.9rem; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
+.allchains:hover { color: var(--text); border-color: var(--accent); }
diff --git a/apps/demo/app/layout.tsx b/apps/demo/app/layout.tsx
new file mode 100644
index 0000000..062eb8b
--- /dev/null
+++ b/apps/demo/app/layout.tsx
@@ -0,0 +1,47 @@
+import type { Metadata, Viewport } from "next";
+import { Inter, Inconsolata } from "next/font/google";
+import { Prefs } from "./Prefs";
+import "./globals.css";
+
+// Same typefaces as nirium.xyz: Inter for text, Inconsolata for data, hashes and addresses.
+// Inter in both styles: the display titles are 900 italic, like nirium.xyz.
+const inter = Inter({ subsets: ["latin"], style: ["normal", "italic"], variable: "--font-inter" });
+const inconsolata = Inconsolata({ subsets: ["latin"], variable: "--font-inconsolata" });
+
+export const metadata: Metadata = {
+ title: "Nirium on Base",
+ description: "A receipt signed by whoever pays, that anyone can check against Base, in the browser.",
+ icons: { icon: "/base/icon.svg" }, // basePath is not added to metadata icons
+ robots: { index: false, follow: false },
+ // Link previews (Telegram, X, Slack, WhatsApp). Absolute URLs: basePath is not added to metadata
+ metadataBase: new URL("https://nirium.xyz"),
+ openGraph: {
+ type: "website",
+ siteName: "Nirium",
+ url: "https://nirium.xyz/base",
+ title: "Nirium on Base",
+ description: "A receipt signed by whoever pays, that anyone can check against Base, in the browser.",
+ images: [{ url: "https://nirium.xyz/branding-nirium/png/social-banner-1200x630.png", width: 1200, height: 630, alt: "Nirium on Base: a receipt signed by whoever pays, checked against Base in the browser" }],
+ },
+ twitter: {
+ card: "summary_large_image",
+ title: "Nirium on Base",
+ description: "A receipt signed by whoever pays, that anyone can check against Base, in the browser.",
+ images: ["https://nirium.xyz/branding-nirium/png/social-banner-1200x630.png"],
+ },
+};
+export const viewport: Viewport = { width: "device-width", initialScale: 1 };
+
+// Sets the theme before paint, from the visitor's choice or their system setting.
+const themeScript = `(function(){try{var t=localStorage.getItem('nirium-demo-theme');if(t!=='light'&&t!=='dark')t=matchMedia('(prefers-color-scheme: light)').matches?'light':'dark';document.documentElement.dataset.theme=t;}catch(e){document.documentElement.dataset.theme='dark';}})();`;
+
+export default function RootLayout({ children }: { children: React.ReactNode }) {
+ return (
+
+
+
+ {children}
+
+
+ );
+}
diff --git a/apps/demo/app/page.tsx b/apps/demo/app/page.tsx
new file mode 100644
index 0000000..23a91b1
--- /dev/null
+++ b/apps/demo/app/page.tsx
@@ -0,0 +1,55 @@
+"use client";
+import Link from "next/link";
+import { usePrefs } from "./Prefs";
+
+const MARKET = "https://nirium-market-base.fly.dev/v1/market/info";
+
+// The entry page: what Nirium on Base is, and what already exists, each with an honest state.
+export default function Home() {
+ const { t } = usePrefs();
+ const h = t.homePage;
+ return (
+
+
+ {h.badge}
+ {h.titlePre} Base
+ {h.lead}
+
+
{h.onMainnet}
+
{h.mainnetItems.map((item) => {item} )}
+
+
+
+
+ {h.existsTitle}
+
+
+ {h.live}
+ {h.verifyTitle}
+ {h.verifyText}
+ {h.verifyLink} →
+
+
+ {h.charging}
+ {h.marketTitle}
+ {h.marketText}
+ {h.marketSales}
+ /v1/market/info ↗
+
+
+ {h.notPublished}
+ {h.libraryTitle}
+ {h.libraryText}
+
+
+ {h.soon}
+ {h.payTitle}
+ {h.payText}
+
+
+
+ );
+}
diff --git a/apps/demo/lib/chain.ts b/apps/demo/lib/chain.ts
new file mode 100644
index 0000000..49a599a
--- /dev/null
+++ b/apps/demo/lib/chain.ts
@@ -0,0 +1,99 @@
+// What the chain alone shows about an Base transaction: the ERC-20 Transfer logs in it
+// (token, from, to, value, block-level logIndex), any EIP-3009 AuthorizationUsed nonce, the block
+// and its time. Read-only, straight from a public RPC in the visitor's browser. No receipt is made
+// up here: a receipt is what adds who declared the payment and what it was for.
+
+export const BASE_SEPOLIA = "eip155:84532";
+export const BASE_MAINNET = "eip155:8453";
+
+export const NETWORKS: Record = {
+ [BASE_SEPOLIA]: { name: "base sepolia", rpc: "https://sepolia.base.org", usdc: "0x036cbd53842c5426634e7929541ec2318f3dcf7e", explorer: "https://sepolia.basescan.org/tx/" },
+ [BASE_MAINNET]: { name: "base mainnet", rpc: "https://mainnet.base.org", usdc: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", explorer: "https://basescan.org/tx/" },
+};
+
+// keccak256("Transfer(address,address,uint256)") and keccak256("AuthorizationUsed(address,bytes32)").
+const TRANSFER = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
+const AUTHORIZATION_USED = "0x98de503528ee59b575ef0c0a2576a82497bfc029a5685b209e9ec333479b10a5";
+export const HASH_RE = /^0x[0-9a-fA-F]{64}$/;
+
+export const explorerTxUrl = (hash: string, network: string) => `${NETWORKS[network].explorer}${hash}`;
+
+export type RpcFailure = "rate-limited" | "blocked" | "unreachable";
+export class RpcError extends Error {
+ kind: RpcFailure;
+ constructor(kind: RpcFailure, message: string) { super(message); this.kind = kind; }
+}
+
+/** Maps a transport error (ours or viem's, from the verifier) to something a person can act on. */
+export function rpcFailureOf(err: unknown): RpcFailure | null {
+ if (err instanceof RpcError) return err.kind;
+ const m = String((err as Error)?.message ?? err);
+ if (/(Status:|HTTP) 429/.test(m)) return "rate-limited";
+ if (/(Status:|HTTP) 40[13]/.test(m)) return "blocked";
+ if (/HTTP request failed|Failed to fetch|NetworkError|fetch failed|Load failed|(Status:|HTTP) 5\d\d/.test(m)) return "unreachable";
+ return null;
+}
+
+const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
+
+/** JSON-RPC with growing waits on 429/5xx, so a busy public RPC is not reported as "not found". */
+export async function rpc(url: string, method: string, params: unknown[]): Promise {
+ let status = 0;
+ for (let attempt = 0; attempt < 4; attempt++) {
+ let res: Response;
+ try {
+ res = await fetch(url, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }) });
+ } catch (e) {
+ throw new RpcError("unreachable", String((e as Error).message));
+ }
+ status = res.status;
+ if (status === 429 || status >= 500) { await sleep(1000 * 2 ** attempt); continue; }
+ if (status === 401 || status === 403) throw new RpcError("blocked", `${method}: HTTP ${status}`);
+ const body = await res.json();
+ if (body.error) throw new Error(`${method}: ${body.error.message} (code ${body.error.code})`);
+ return body.result as T;
+ }
+ throw new RpcError(status === 429 ? "rate-limited" : "unreachable", `${method}: HTTP ${status}`);
+}
+
+export type Transfer = { logIndex: number; token: string; from: string; to: string; value: string; usdc: boolean };
+export type TxView = { network: string; hash: string; block: number; blockTime: number | null; failed: boolean; transfers: Transfer[]; nonces: { authorizer: string; nonce: string }[] };
+type Log = { address: string; topics: string[]; data: string; logIndex: string };
+type Receipt = { status: string; blockNumber: string; logs: Log[] };
+
+const topicAddress = (t: string) => `0x${t.slice(26)}`;
+
+/** Pure: the Transfer and AuthorizationUsed logs of an eth_getTransactionReceipt result. */
+export function readTransaction(receipt: Receipt, network: string, hash: string, blockTime: number | null): TxView {
+ const usdc = NETWORKS[network]?.usdc;
+ const transfers: Transfer[] = [];
+ const nonces: TxView["nonces"] = [];
+ for (const log of receipt.logs) {
+ const [topic0, a, b] = log.topics.map((t) => t.toLowerCase());
+ if (topic0 === TRANSFER && log.topics.length === 3) {
+ const token = log.address.toLowerCase();
+ transfers.push({ logIndex: Number(BigInt(log.logIndex)), token, from: topicAddress(a), to: topicAddress(b), value: BigInt(log.data).toString(), usdc: token === usdc });
+ } else if (topic0 === AUTHORIZATION_USED && log.topics.length === 3) {
+ nonces.push({ authorizer: topicAddress(a), nonce: b });
+ }
+ }
+ return { network, hash, block: Number(BigInt(receipt.blockNumber)), blockTime, failed: receipt.status !== "0x1", transfers, nonces };
+}
+
+/** Looks a tx hash up on one network. null = not there. */
+export async function lookupTransaction(hash: string, network: string): Promise {
+ const url = NETWORKS[network].rpc;
+ const receipt = await rpc(url, "eth_getTransactionReceipt", [hash]);
+ if (!receipt) return null;
+ const block = await rpc<{ timestamp: string } | null>(url, "eth_getBlockByNumber", [receipt.blockNumber, false]);
+ return readTransaction(receipt, network, hash, block ? Number(BigInt(block.timestamp)) : null);
+}
+
+/** "10000" with 6 decimals -> "0.01". */
+export function formatUnits(amount: string, decimals: number | null): string {
+ if (decimals === null || !/^\d+$/.test(amount)) return amount;
+ const s = amount.padStart(decimals + 1, "0");
+ const whole = s.slice(0, s.length - decimals);
+ const frac = s.slice(s.length - decimals).replace(/0+$/, "");
+ return frac ? `${whole}.${frac}` : whole;
+}
diff --git a/apps/demo/lib/examples.ts b/apps/demo/lib/examples.ts
new file mode 100644
index 0000000..1f4ea68
--- /dev/null
+++ b/apps/demo/lib/examples.ts
@@ -0,0 +1,38 @@
+// Examples as stories: receipts the team anchored on Nirium's Audit Trail, opened by CID so they go
+// through the same gateway fetch and CID recomputation as anything a visitor pastes. All of them are
+// the team's own test payments and are labeled that way on the page.
+export const STORIES = [
+ {
+ cid: "QmPFkCiyUXZd9Z6Na8d7WcPYEvxfP1ShRVNZ39ouwfLDUU",
+ title: { en: "The first payment on Base mainnet", es: "El primer pago en Base mainnet" },
+ text: {
+ en: "0.01 USDC on 1 Dec 2026, settled by PayAI with an EIP-3009 authorization; the payer held no ETH. Paid by the team, and every check runs here.",
+ es: "0.01 USDC el 1 dic 2026, liquidado por PayAI con una autorización EIP-3009; quien pagó no tenía ETH. Lo pagó el equipo, y aquí corren todas las comprobaciones.",
+ },
+ },
+ {
+ cid: "QmQeDGGKVGMT3LkK5qFNrsd4Q7d8NEjJMgsNEHizvaP4ak",
+ title: { en: "A sale of the x402 market on mainnet", es: "Una venta del market x402 en mainnet" },
+ text: {
+ en: "A $0.01 query to Nirium's x402 market for Base network data, on Base mainnet, paid by the team. The payer signed this receipt for that exact transfer, and every check runs here.",
+ es: "Una consulta de $0.01 al market x402 de Nirium por datos de la red de Base, en Base mainnet, pagada por el equipo. Quien pagó firmó este recibo para esa transferencia exacta, y aquí corren todas las comprobaciones.",
+ },
+ },
+ {
+ cid: "QmPFkCiyUXZd9Z6Na8d7WcPYEvxfP1ShRVNZ39ouwfLDUU",
+ edit: "amount",
+ title: { en: "An edited receipt", es: "Un recibo editado" },
+ text: {
+ en: "The first Base mainnet receipt with its amount changed in this page after it was signed. Watch which links break, and why.",
+ es: "El primer recibo de Base mainnet con el monto cambiado en esta página después de firmarse. Mira qué líneas se rompen, y por qué.",
+ },
+ },
+ {
+ cid: "QmWMvQ8pcAGs2fojuZvUzxj68VvZfdYYpbR8gqL6j9cCi6",
+ title: { en: "A receipt from another network", es: "Un recibo de otra red" },
+ text: {
+ en: "A payment on Solana devnet. This page recognizes it and sends you to the page that checks Solana.",
+ es: "Un pago en devnet de Solana. Esta página lo reconoce y te manda a la que comprueba Solana.",
+ },
+ },
+] as const;
diff --git a/apps/demo/lib/explorer.test.ts b/apps/demo/lib/explorer.test.ts
new file mode 100644
index 0000000..0c61d38
--- /dev/null
+++ b/apps/demo/lib/explorer.test.ts
@@ -0,0 +1,76 @@
+// Offline tests for the explorer logic. The chain answers are the recorded public Base Sepolia RPC answers
+// for one of the team's self-test receipts (base/fixtures/base-sepolia-sdk-selftest-rpc.json).
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { classify, verifyReceipt, isChainCheck } from "./receipt.ts";
+import { readTransaction, formatUnits, rpcFailureOf, BASE_SEPOLIA, BASE_MAINNET } from "./chain.ts";
+
+const read = (p: string) => JSON.parse(readFileSync(new URL(p, import.meta.url), "utf8"));
+const recorded = read("../../../base/fixtures/base-sepolia-sdk-selftest-rpc.json");
+const receipt = read("../../../evidence/2026-12-01/selftest-base-sepolia-binding.json");
+const mainnetReceipt = read("../../../evidence/2026-12-01/selftest-base-mainnet-binding.json");
+
+async function withFetch(impl: (body: { id: number; method: string; params: unknown[] }) => Response | Promise, fn: () => Promise): Promise {
+ const real = globalThis.fetch;
+ globalThis.fetch = (async (_url: string, init: RequestInit) => impl(JSON.parse(String(init.body)))) as typeof fetch;
+ try { return await fn(); } finally { globalThis.fetch = real; }
+}
+const recordedRpc = ({ id, method, params }: { id: number; method: string; params: unknown[] }) => {
+ const result = method === "eth_chainId" ? recorded.chainId
+ : method === "eth_getTransactionReceipt" && String(params[0]).toLowerCase() === recorded.txReceipt.transactionHash.toLowerCase() ? recorded.txReceipt : null;
+ return new Response(JSON.stringify({ jsonrpc: "2.0", id, result }), { headers: { "content-type": "application/json" } });
+};
+
+test("classify: the network comes from the receipt, and bad input is named", () => {
+ const r = classify(JSON.stringify(receipt));
+ assert.equal(r.kind === "receipt" ? r.network : null, BASE_SEPOLIA);
+ const m = classify(JSON.stringify(mainnetReceipt));
+ assert.equal(m.kind === "receipt" ? m.network : null, BASE_MAINNET);
+ assert.deepEqual(classify(` ${receipt.record.payment.tx.toUpperCase().replace("0X", "0x")}\n`), { kind: "hash", hash: receipt.record.payment.tx.toLowerCase() });
+ assert.deepEqual(classify("{ not json"), { kind: "invalid", reason: "not-json" });
+ assert.deepEqual(classify('{"a":1}'), { kind: "invalid", reason: "not-a-receipt" });
+ assert.deepEqual(classify('{"record":{"payment":{"network":"eip155:1"}}}'), { kind: "invalid", reason: "unknown-network" });
+ assert.deepEqual(classify("0x1234"), { kind: "invalid", reason: "unrecognized" });
+});
+
+test("a real Base Sepolia receipt is VALID with the shared verifier, checks split receipt / chain", async () => {
+ const v = await withFetch(recordedRpc, () => verifyReceipt(receipt));
+ assert.equal(v.status, "valid");
+ if (v.status !== "valid") return;
+ assert.equal(v.checks.length, 18);
+ assert.ok(v.checks.some((c) => isChainCheck(c.name)) && v.checks.some((c) => !isChainCheck(c.name)));
+ assert.equal(isChainCheck("content_sha256 == sha256(canonical(record))"), false);
+ assert.equal(isChainCheck("Transfer.value == payment.amount"), true);
+});
+
+test("an altered receiver is INVALID, not a transport problem", async () => {
+ const d = structuredClone(receipt);
+ d.record.payment.to = "0x000000000000000000000000000000000000dEaD";
+ const v = await withFetch(recordedRpc, () => verifyReceipt(d));
+ assert.equal(v.status, "invalid");
+});
+
+test("an RPC that refuses or limits requests is reported as such, not as an invalid receipt", async () => {
+ const blocked = await withFetch(() => new Response("no", { status: 403 }), () => verifyReceipt(receipt));
+ assert.deepEqual(blocked, { status: "rpc-error", failure: "blocked" });
+ assert.equal(rpcFailureOf(new Error("HTTP request failed.\n\nStatus: 429")), "rate-limited");
+ assert.equal(rpcFailureOf(new Error("HTTP request failed.\n\nURL: https://sepolia.base.org")), "unreachable");
+ assert.equal(rpcFailureOf(new Error("missing record.payment")), null);
+});
+
+test("what the chain alone shows: the USDC Transfer at its block logIndex, and the EIP-3009 nonce", () => {
+ const v = readTransaction(recorded.txReceipt, BASE_SEPOLIA, receipt.record.payment.tx, null);
+ assert.equal(v.failed, false);
+ assert.equal(v.block, Number(BigInt(recorded.txReceipt.blockNumber)));
+ assert.equal(v.transfers.length, 1);
+ const [x] = v.transfers;
+ assert.equal(x.logIndex, receipt.record.payment.locator.index);
+ assert.equal(x.from, receipt.record.payment.from.toLowerCase());
+ assert.equal(x.to, receipt.record.payment.to.toLowerCase());
+ assert.equal(x.value, "10000");
+ assert.equal(x.usdc, true);
+ assert.deepEqual(v.nonces, [{ authorizer: receipt.record.payment.from.toLowerCase(), nonce: receipt.record.payment.x402.nonce.toLowerCase() }]);
+ assert.equal(formatUnits(x.value, 6), "0.01");
+});
+
diff --git a/apps/demo/lib/geo.test.ts b/apps/demo/lib/geo.test.ts
new file mode 100755
index 0000000..9922ec1
--- /dev/null
+++ b/apps/demo/lib/geo.test.ts
@@ -0,0 +1,12 @@
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { isTierA, TIER_A_COUNTRIES } from "./geo.ts";
+
+test("Tier A list matches the site, the node and the markets", () => {
+ assert.deepEqual([...TIER_A_COUNTRIES].sort(), ["AF", "BY", "CN", "CU", "IR", "KP", "MM", "RU", "SY"]);
+});
+
+test("only known Tier A countries are blocked", () => {
+ for (const c of ["IR", "KP", "cn"]) assert.equal(isTierA(c), true, c);
+ for (const c of ["US", "MX", "GB", "DE", "", null, undefined]) assert.equal(isTierA(c), false, String(c));
+});
diff --git a/apps/demo/lib/geo.ts b/apps/demo/lib/geo.ts
new file mode 100755
index 0000000..24cf49d
--- /dev/null
+++ b/apps/demo/lib/geo.ts
@@ -0,0 +1,11 @@
+// Tier A of Nirium's Restricted Jurisdictions & Sanctions Policy (nirium.xyz/legal/restricted-jurisdictions-v1.md,
+// §2): no access to any Nirium service, paid or free. nirium.xyz already blocks it before rewriting to this demo;
+// this covers direct visits to the demo's own domains. Same countries as the site, the node and the markets.
+export const TIER_A_COUNTRIES = new Set(["CU", "IR", "KP", "SY", "AF", "MM", "RU", "BY", "CN"]);
+
+export const POLICY_URL = "https://nirium.xyz/legal/restricted-jurisdictions-v1.md";
+
+/** True only for a known Tier A country. Unknown passes: IP geolocation is imperfect (policy §7). */
+export function isTierA(country: string | null | undefined): boolean {
+ return !!country && TIER_A_COUNTRIES.has(country.toUpperCase());
+}
diff --git a/apps/demo/lib/i18n.ts b/apps/demo/lib/i18n.ts
new file mode 100644
index 0000000..7ea5d3e
--- /dev/null
+++ b/apps/demo/lib/i18n.ts
@@ -0,0 +1,284 @@
+export type Lang = "en" | "es";
+
+const en = {
+ skip: "Skip to content",
+ home: "home",
+ status: { label: "About this page", demo: "Demo payments", demoValue: "Base Sepolia, test tokens only", checks: "Checks", checksValue: "in your browser", stored: "Sent to Nirium", storedValue: "nothing", networks: "Networks", library: "Library", libraryValue: "not published yet" },
+ allChains: "All chains",
+ langLabel: "Language",
+ toLight: "Switch to the light theme",
+ toDark: "Switch to the dark theme",
+ homePage: {
+ badge: "Payer-signed receipts",
+ titlePre: "Nirium on",
+ lead: "A receipt signed by whoever pays: what the payment was for and who declared it. Anyone can check it against Base, in the browser, without trusting us.",
+ verifyCta: "Verify a receipt",
+ repoCta: "All chains", notPublished: "Not published yet",
+ existsTitle: "What exists today",
+ live: "Live",
+ charging: "Charging on mainnet",
+ soon: "Soon",
+ verifyTitle: "Verify a receipt",
+ verifyText: "Paste a CID, a transaction hash or a receipt. Every check runs in your browser, with the same code as the command line verifier.",
+ verifyLink: "Open the explorer",
+ onMainnet: "On mainnet today",
+ mainnetItems: ["receipts checked in full in your browser", "the x402 market, charging real USDC"],
+ marketTitle: "An x402 market",
+ marketText: "Network conditions of Base mainnet (base fee and its trend, priority fees, block fill, block time) for $0.01 per query, paid in USDC with x402. Network data only.",
+ marketSales: "1 sale: a team self-test",
+ libraryTitle: "The library",
+ libraryText: "Pay and charge with x402 on Base, refuse a payment before it is signed, and keep a receipt bound to the exact USDC transfer. Tested on Base mainnet with the team's own funds; not on npm yet.",
+ payTitle: "Pay with your wallet",
+ payText: "A Base Sepolia payment from your own wallet, with its receipt checked and edited in front of you.",
+ },
+ eyebrow: "Receipt explorer",
+ titlePre: "Verify a",
+ titleEm: "receipt",
+ intro: "Paste a CID, a transaction hash or a receipt. Your browser fetches the receipt from public IPFS gateways, recomputes its CID from the bytes, and checks it against the receipt's own network (Base Sepolia or Base mainnet) with the same code as the command line verifier. Nothing goes through Nirium's servers.",
+ inputLabel: "CID, transaction or receipt",
+ placeholder: "Qm…, 0x…, or a receipt JSON",
+ drop: "You can also drop a receipt .json file on this box.",
+ detected: { cid: "Looks like a CID.", hash: "Looks like an EVM transaction hash.", receipt: "Looks like a receipt (JSON).", decision: "Looks like a decision receipt (JSON).", invalid: "Not recognized yet: a CID, a 0x hash or a receipt JSON.", "foreign-svm": "Looks like a Solana transaction signature: that is checked on the Solana page.", "foreign-stellar": "Looks like a Stellar receipt." } as Record,
+ fetching: "Fetching from public IPFS gateways…",
+ cidMatch: "CID recomputed in your browser from the bytes: it matches",
+ cidUnchecked: "CID not recomputed here (larger than one block):",
+ servedBy: "served by",
+ mismatch: "The gateway {gateway} served bytes whose CID is not {cid}. That is not the anchored receipt, so it is not shown.",
+ notFound: "No public gateway returned this CID. A receipt that was just anchored can take a minute to appear. With your own copy of the receipt you can paste its JSON instead, or, once a gateway serves it, download it and check it in a terminal:",
+ foreign: { stellar: "This is a Stellar receipt.", svm: "This is a receipt or transaction from Solana." },
+ foreignLink: { stellar: "Check it on nirium.xyz/verify", svm: "Check it on nirium.xyz/solana" },
+ check: "Check",
+ checking: "Checking against the chain…",
+ examples: "Open an example",
+ selftest: "team self-test",
+ decision: {
+ outcome: "Decision",
+ reason: "Why",
+ policy: "Policy",
+ amount: "Would have paid",
+ to: "To",
+ from: "Payer (signed this)",
+ resource: "For",
+ purpose: "What for",
+ ref: "Reference",
+ deny: "The payer's policy refused this payment before it was signed. Nothing was signed or sent, so the chain has no trace of it: this receipt, signed by the payer, is the record of the attempt and of the reason.",
+ wait: "The payer's policy held this payment for a person's approval before it was signed. Nothing was signed while it waited, so the chain has no trace of it: this receipt, signed by the payer, is the record.",
+ other: "A decision the payer's pre-sign policy made about a payment, signed by the payer.",
+ invalidLead: "This decision receipt does not check out. The check that fails is marked below.",
+ noChain: "A decision receipt has no transfer to compare against the chain. It is checked by its hash and by the payer's signature, here in your browser.",
+ },
+ valid: "VALID",
+ invalid: "INVALID",
+ incomplete: "NOT CHECKED",
+ pass: "PASS",
+ fail: "FAIL",
+ validLead: "Every check passed. The receipt matches the Transfer log on chain, and the payer signed this exact content.",
+ invalidLead: "At least one check failed. The receipt and the Transfer log on chain do not match, or the signature does not cover this content.",
+ incompleteLead: "The chain could not be read, so this is not a verdict on the receipt.",
+ groupReceipt: "The receipt itself",
+ groupChain: "Against the chain",
+ rpcError: {
+ "rate-limited": "The public RPC is limiting requests right now. Wait a minute and try again.",
+ blocked: "The public RPC refused the request. Try again later.",
+ unreachable: "The RPC could not be reached. Check your connection and try again.",
+ },
+ badInput: "This does not read as a receipt:",
+ invalidInput: {
+ "not-json": "This starts like JSON but does not parse.",
+ "not-a-receipt": "This JSON has no record.payment.network, so it is not a receipt.",
+ "unknown-network": "This receipt is not for Base Sepolia or Base mainnet.",
+ unrecognized: "Paste a CID, a 0x transaction hash or a receipt (JSON).",
+ },
+ txTitle: "What the chain shows",
+ txLead: "The chain proves this transfer. A receipt would add who declared it and what it was for.",
+ txFrom: "From",
+ txTo: "To",
+ txAmount: "Amount",
+ txBlock: "Block",
+ txTime: "Time",
+ txNonce: "EIP-3009 nonce",
+ rawUnits: "raw units of token",
+ txFailed: "This transaction failed on chain.",
+ txNone: "No ERC-20 Transfer log in this transaction.",
+ txNotFound: "No transaction with this hash on Base Sepolia or Base mainnet.",
+ txOn: "Found on",
+ explorerLink: "Open in the block explorer",
+ reasons: {
+ hash: "The receipt was edited after it was hashed: its hash no longer matches its content.",
+ statement: "The content changed, so the payer's signature no longer covers it.",
+ signature: "The signature is not the payer's signature over this statement.",
+ signer: "The receipt was signed by someone other than the payer.",
+ unsigned: "The receipt has no payer signature.",
+ amount: "The amount in the receipt is not the amount the chain moved.",
+ destination: "The receiver in the receipt is not where the chain sent the funds.",
+ authority: "The payer in the receipt is not who the funds came from.",
+ nonce: "The payer did not use this EIP-3009 nonce in this transaction.",
+ tx: "The chain does not have this transaction, or it did not succeed.",
+ index: "The log the receipt points to is not the USDC Transfer.",
+ } as Record,
+ mech: {
+ title: "How the receipt matches the chain",
+ receiptHead: "The receipt",
+ receiptSub: "What the payer declared and signed",
+ chainHead: "{network}",
+ chainSub: "What the chain shows, read just now",
+ purpose: "What it was for",
+ purposeChain: "The chain does not keep this. Only the payer's signature on the receipt protects it.",
+ links: { content: "Signed content", payer: "Signed by", amount: "Amount", destination: "Paid to", reference: "x402 nonce", where: "Transaction" } as Record,
+ chainLinks: { content: "Hash computed in your browser", payer: "Transfer from", amount: "Transfer value", destination: "Transfer to", reference: "EIP-3009 nonce used", where: "Succeeded in" } as Record,
+ srRow: "{what}: the receipt says {receipt}, the other side shows {chain}. {state}.",
+ none: "not found",
+ notChecked: "This could not be checked.",
+ editTitle: "Edit this receipt",
+ editHint: "Change a field after it was signed and the page checks it again, on the same chain answers. The edit stays in this page.",
+ edit: { amount: "Change the amount", destination: "Pay someone else", purpose: "Change what it was for" } as Record,
+ restore: "Restore the original",
+ edited: "edited here",
+ editedLead: "This is the receipt with your edits, checked again. A real receipt with the same edit would fail the same way.",
+ allChecks: "All {n} checks",
+ },
+ footer: "A receipt shows who declared a payment and what it was for. It does not show that goods or a service were delivered.",
+};
+
+const es: typeof en = {
+ skip: "Ir al contenido",
+ home: "inicio",
+ status: { label: "Sobre esta página", demo: "Pagos de la demo", demoValue: "Base Sepolia, solo tokens de prueba", checks: "Comprobaciones", checksValue: "en tu navegador", stored: "Enviado a Nirium", storedValue: "nada", networks: "Redes", library: "Librería", libraryValue: "aún no publicada" },
+ allChains: "Todas las redes",
+ langLabel: "Idioma",
+ toLight: "Cambiar al tema claro",
+ toDark: "Cambiar al tema oscuro",
+ homePage: {
+ badge: "Recibos firmados por quien paga",
+ titlePre: "Nirium en",
+ lead: "Un recibo firmado por quien paga: para qué fue el pago y quién lo declaró. Cualquiera lo comprueba contra Base, en el navegador, sin confiar en nosotros.",
+ verifyCta: "Verificar un recibo",
+ repoCta: "Todas las redes", notPublished: "Aún no publicada",
+ existsTitle: "Lo que ya existe",
+ live: "Funcionando",
+ charging: "Cobrando en mainnet",
+ soon: "Pronto",
+ verifyTitle: "Verificar un recibo",
+ verifyText: "Pega un CID, un hash de transacción o un recibo. Cada comprobación corre en tu navegador, con el mismo código que el verificador de terminal.",
+ verifyLink: "Abrir el explorador",
+ onMainnet: "En mainnet hoy",
+ mainnetItems: ["recibos que se comprueban completos en tu navegador", "el market x402, cobrando USDC real"],
+ marketTitle: "Un market x402",
+ marketText: "Condiciones de la red de Base mainnet (base fee y su tendencia, comisiones de prioridad, llenado y tiempo de bloque) a $0.01 por consulta, pagado en USDC con x402. Solo datos de la red.",
+ marketSales: "1 venta: autoprueba del equipo",
+ libraryTitle: "La librería",
+ libraryText: "Paga y cobra con x402 en Base, rechaza un pago antes de firmarlo y guarda un recibo atado a la transferencia exacta de USDC. Probada en Base mainnet con fondos del equipo; todavía no está en npm.",
+ payTitle: "Paga con tu cartera",
+ payText: "Un pago en Base Sepolia desde tu propia cartera, con su recibo comprobado y alterado frente a ti.",
+ },
+ eyebrow: "Explorador de recibos",
+ titlePre: "Verifica un",
+ titleEm: "recibo",
+ intro: "Pega un CID, un hash de transacción o un recibo. Tu navegador baja el recibo de gateways públicos de IPFS, recalcula su CID desde los bytes y lo comprueba contra la red del propio recibo (Base Sepolia o Base mainnet) con el mismo código que el verificador de terminal. Nada pasa por los servidores de Nirium.",
+ inputLabel: "CID, transacción o recibo",
+ placeholder: "Qm…, 0x… o el JSON de un recibo",
+ drop: "También puedes soltar el archivo .json de un recibo sobre este cuadro.",
+ detected: { cid: "Parece un CID.", hash: "Parece un hash de transacción EVM.", receipt: "Parece un recibo (JSON).", decision: "Parece un recibo de decisión (JSON).", invalid: "Aún no se reconoce: un CID, un hash 0x o el JSON de un recibo.", "foreign-svm": "Parece una firma de transacción de Solana: eso se comprueba en la página de Solana.", "foreign-stellar": "Parece un recibo de Stellar." },
+ fetching: "Bajando de gateways públicos de IPFS…",
+ cidMatch: "CID recalculado en tu navegador desde los bytes: coincide",
+ cidUnchecked: "CID no recalculado aquí (más grande que un bloque):",
+ servedBy: "servido por",
+ mismatch: "El gateway {gateway} sirvió bytes cuyo CID no es {cid}. Ese no es el recibo anclado, así que no se muestra.",
+ notFound: "Ningún gateway público devolvió este CID. Un recibo recién anclado puede tardar un minuto en aparecer. Si tienes tu propia copia del recibo, pega su JSON, o, cuando un gateway lo sirva, bájalo y compruébalo en una terminal:",
+ foreign: { stellar: "Este es un recibo de Stellar.", svm: "Este es un recibo o una transacción de Solana." },
+ foreignLink: { stellar: "Compruébalo en nirium.xyz/verify", svm: "Compruébalo en nirium.xyz/solana" },
+ check: "Comprobar",
+ checking: "Comprobando contra la cadena…",
+ examples: "Abre un ejemplo",
+ selftest: "autoprueba del equipo",
+ decision: {
+ outcome: "Decisión",
+ reason: "Por qué",
+ policy: "Política",
+ amount: "Habría pagado",
+ to: "A",
+ from: "Quien paga (lo firmó)",
+ resource: "Por",
+ purpose: "Para qué",
+ ref: "Referencia",
+ deny: "La política de quien paga rechazó este pago antes de firmarlo. No se firmó ni se envió nada, así que la cadena no tiene rastro: este recibo, firmado por quien paga, es el registro del intento y del motivo.",
+ wait: "La política de quien paga retuvo este pago hasta que lo aprobara una persona, antes de firmarlo. Mientras esperaba no se firmó nada, así que la cadena no tiene rastro: este recibo, firmado por quien paga, es el registro.",
+ other: "Una decisión que tomó la política de quien paga sobre un pago, firmada por quien paga.",
+ invalidLead: "Este recibo de decisión no cuadra. Abajo está marcada la comprobación que falla.",
+ noChain: "Un recibo de decisión no tiene transferencia que comparar con la cadena. Se comprueba por su hash y por la firma de quien paga, aquí en tu navegador.",
+ },
+ valid: "VÁLIDO",
+ invalid: "NO VÁLIDO",
+ incomplete: "SIN COMPROBAR",
+ pass: "PASA",
+ fail: "FALLA",
+ validLead: "Pasaron todas las comprobaciones. El recibo coincide con el log Transfer en la cadena y el pagador firmó exactamente este contenido.",
+ invalidLead: "Falló al menos una comprobación. El recibo y el log Transfer en la cadena no coinciden, o la firma no cubre este contenido.",
+ incompleteLead: "No se pudo leer la cadena, así que esto no es un veredicto sobre el recibo.",
+ groupReceipt: "El recibo en sí",
+ groupChain: "Contra la cadena",
+ rpcError: {
+ "rate-limited": "El RPC público está limitando peticiones en este momento. Espera un minuto e inténtalo de nuevo.",
+ blocked: "El RPC público rechazó la petición. Inténtalo más tarde.",
+ unreachable: "No se pudo llegar al RPC. Revisa tu conexión e inténtalo de nuevo.",
+ },
+ badInput: "Esto no se lee como un recibo:",
+ invalidInput: {
+ "not-json": "Empieza como JSON pero no se puede leer.",
+ "not-a-receipt": "Este JSON no tiene record.payment.network, así que no es un recibo.",
+ "unknown-network": "Este recibo no es de Base Sepolia ni de Base mainnet.",
+ unrecognized: "Pega un CID, un hash de transacción 0x o un recibo (JSON).",
+ },
+ txTitle: "Lo que muestra la cadena",
+ txLead: "La cadena prueba esta transferencia. Un recibo agregaría quién la declaró y para qué fue.",
+ txFrom: "De",
+ txTo: "A",
+ txAmount: "Monto",
+ txBlock: "Bloque",
+ txTime: "Hora",
+ txNonce: "Nonce EIP-3009",
+ rawUnits: "unidades crudas del token",
+ txFailed: "Esta transacción falló en la cadena.",
+ txNone: "Esta transacción no tiene logs Transfer de ERC-20.",
+ txNotFound: "No hay ninguna transacción con este hash en Base Sepolia ni en Base mainnet.",
+ txOn: "Encontrada en",
+ explorerLink: "Abrir en el explorador de bloques",
+ reasons: {
+ hash: "El recibo se editó después de calcular su hash: el hash ya no coincide con su contenido.",
+ statement: "El contenido cambió, así que la firma del pagador ya no lo cubre.",
+ signature: "La firma no es la del pagador sobre este enunciado.",
+ signer: "El recibo lo firmó alguien que no es el pagador.",
+ unsigned: "El recibo no tiene la firma del pagador.",
+ amount: "El monto del recibo no es el monto que movió la cadena.",
+ destination: "El destinatario del recibo no es adonde la cadena envió los fondos.",
+ authority: "El pagador del recibo no es de quien salieron los fondos.",
+ nonce: "El pagador no usó este nonce EIP-3009 en esta transacción.",
+ tx: "La cadena no tiene esta transacción, o no se completó.",
+ index: "El log al que apunta el recibo no es el Transfer de USDC.",
+ },
+ mech: {
+ title: "Cómo coincide el recibo con la cadena",
+ receiptHead: "El recibo",
+ receiptSub: "Lo que declaró y firmó quien pagó",
+ chainHead: "{network}",
+ chainSub: "Lo que muestra la cadena, leído ahora",
+ purpose: "Para qué fue",
+ purposeChain: "La cadena no guarda esto. Solo lo protege la firma de quien pagó, en el recibo.",
+ links: { content: "Contenido firmado", payer: "Firmado por", amount: "Monto", destination: "Pagado a", reference: "Nonce de x402", where: "Transacción" },
+ chainLinks: { content: "Hash calculado en tu navegador", payer: "Transfer desde", amount: "Valor del Transfer", destination: "Transfer hacia", reference: "Nonce EIP-3009 usado", where: "Exitosa en" },
+ srRow: "{what}: el recibo dice {receipt}, el otro lado muestra {chain}. {state}.",
+ none: "no encontrado",
+ notChecked: "Esto no se pudo comprobar.",
+ editTitle: "Edita este recibo",
+ editHint: "Cambia un campo después de firmado y la página lo vuelve a comprobar, con las mismas respuestas de la cadena. El cambio se queda en esta página.",
+ edit: { amount: "Cambiar el monto", destination: "Pagarle a otra persona", purpose: "Cambiar para qué fue" },
+ restore: "Volver al original",
+ edited: "editado aquí",
+ editedLead: "Este es el recibo con tus cambios, comprobado de nuevo. Un recibo real con el mismo cambio fallaría igual.",
+ allChecks: "Las {n} comprobaciones",
+ },
+ footer: "Un recibo muestra quién declaró un pago y para qué fue. No muestra que se entregaron bienes o un servicio.",
+};
+
+export const STRINGS = { en, es };
+export type Strings = typeof en;
diff --git a/apps/demo/lib/ipfs.test.ts b/apps/demo/lib/ipfs.test.ts
new file mode 100644
index 0000000..ea34f86
--- /dev/null
+++ b/apps/demo/lib/ipfs.test.ts
@@ -0,0 +1,82 @@
+// Offline tests for the CID path: detection of what was pasted, the gateway chain (recorded
+// answers, no network), and the CID recomputed from the bytes. The bytes anchored on IPFS for each
+// team receipt are the compact JSON of its file in evidence/, so these tests use those files.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { extractCid, cidMatches, fetchCid, base32, GATEWAYS } from "./ipfs.ts";
+import { classify } from "./receipt.ts";
+
+const anchored = (p: string) => new TextEncoder().encode(JSON.stringify(JSON.parse(readFileSync(new URL(p, import.meta.url), "utf8"))));
+const selftest = anchored("../../../evidence/2026-12-01/selftest-base-mainnet-binding.json");
+const SELFTEST_CID = "QmPFkCiyUXZd9Z6Na8d7WcPYEvxfP1ShRVNZ39ouwfLDUU";
+const market = anchored("../../../evidence/2026-12-01/selftest-base-mainnet-market-binding.json");
+const MARKET_CID = "QmQeDGGKVGMT3LkK5qFNrsd4Q7d8NEjJMgsNEHizvaP4ak";
+const SIG = "2uyixpix6haUfxhzRfMNtRcZ8fDHGJ1dNLHSZQ5dL6qXK3B6KfTpFpvSpgwXhpqjQ5AmD2xT2KuMt7p8m9g5UfE8";
+
+test("detects what was pasted: CID, gateway URL, transaction hash, receipt, other networks", () => {
+ for (const s of [SELFTEST_CID, `ipfs://${SELFTEST_CID}`, `https://gateway.pinata.cloud/ipfs/${SELFTEST_CID}`, `https://${SELFTEST_CID}.ipfs.dweb.link/`, ` ${SELFTEST_CID}\n`]) {
+ assert.deepEqual(classify(s), { kind: "cid", cid: SELFTEST_CID }, s);
+ }
+ assert.deepEqual(classify(SIG), { kind: "foreign", family: "svm" });
+ assert.deepEqual(classify(`0x${"AB".repeat(32)}`), { kind: "hash", hash: `0x${"ab".repeat(32)}` });
+ assert.equal(classify(new TextDecoder().decode(selftest)).kind, "receipt");
+ assert.deepEqual(classify('{"version":"1.1.0","content_sha256":"x","network":"stellar:pubnet"}'), { kind: "foreign", family: "stellar" });
+ assert.deepEqual(classify('{"record":{"payment":{"network":"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"}}}'), { kind: "foreign", family: "svm" });
+ assert.equal(extractCid("Qm123"), null);
+ assert.equal(classify("hello").kind, "invalid");
+});
+
+test("the CID recomputed from the anchored bytes is the CID (v0 and v1)", async () => {
+ assert.equal(await cidMatches(SELFTEST_CID, selftest), true);
+ assert.equal(await cidMatches(MARKET_CID, market), true);
+ assert.equal(await cidMatches(SELFTEST_CID, market), false);
+ // The same block as CIDv1 (dag-pb, base32): same multihash, different spelling.
+ const B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+ let n = 0n;
+ for (const c of SELFTEST_CID) n = n * 58n + BigInt(B58.indexOf(c));
+ const mh = Uint8Array.from(n.toString(16).padStart(68, "0").match(/../g)!.map((h) => parseInt(h, 16)));
+ const v1 = "b" + base32(Uint8Array.of(0x01, 0x70, ...mh));
+ assert.equal(extractCid(v1), v1);
+ assert.equal(await cidMatches(v1, selftest), true);
+ assert.equal(await cidMatches(v1, market), false);
+});
+
+// A fetch that answers per gateway from a recorded table, and remembers what was asked.
+function recorded(answers: Record Response>) {
+ const asked: string[] = [];
+ const impl = (async (url: string) => {
+ asked.push(url);
+ const gw = GATEWAYS.find((g) => url.startsWith(g))!;
+ return answers[gw] ? answers[gw]() : new Response("not found", { status: 404 });
+ }) as unknown as typeof fetch;
+ return { impl, asked };
+}
+
+test("a 429 or a failing gateway moves on to the next one, in order", async () => {
+ const { impl, asked } = recorded({
+ [GATEWAYS[0]]: () => new Response("slow down", { status: 429 }),
+ [GATEWAYS[1]]: () => { throw new TypeError("Failed to fetch"); },
+ [GATEWAYS[2]]: () => new Response(selftest, { status: 200 }),
+ });
+ const got = await fetchCid(SELFTEST_CID, { fetchImpl: impl });
+ assert.equal(got.status, "ok");
+ if (got.status !== "ok") return;
+ assert.equal(got.gateway, GATEWAYS[2]);
+ assert.equal(got.cidCheck, true);
+ assert.deepEqual(got.attempts.map((a) => a.status), [429, "error", 200]);
+ assert.deepEqual(asked, GATEWAYS.slice(0, 3).map((g) => `${g}/ipfs/${SELFTEST_CID}`));
+});
+
+test("a gateway that serves other bytes is a FAIL that names it, not a receipt", async () => {
+ const { impl } = recorded({ [GATEWAYS[0]]: () => new Response(market, { status: 200 }) });
+ const got = await fetchCid(SELFTEST_CID, { fetchImpl: impl });
+ assert.deepEqual(got, { status: "mismatch", gateway: GATEWAYS[0], attempts: [{ gateway: GATEWAYS[0], status: 200 }] });
+});
+
+test("no gateway has it: not-found, with every attempt listed", async () => {
+ const { impl } = recorded({});
+ const got = await fetchCid(SELFTEST_CID, { fetchImpl: impl });
+ assert.equal(got.status, "not-found");
+ assert.equal(got.attempts.length, GATEWAYS.length);
+});
diff --git a/apps/demo/lib/ipfs.ts b/apps/demo/lib/ipfs.ts
new file mode 100644
index 0000000..3ce946a
--- /dev/null
+++ b/apps/demo/lib/ipfs.ts
@@ -0,0 +1,122 @@
+// Fetches a receipt by its CID straight from public IPFS gateways, in the visitor's browser, and
+// recomputes the CID from the bytes that came back. Nothing goes through a Nirium server. A gateway
+// that serves bytes whose CID is not the one asked for is caught here, never shown as a receipt.
+// The CIDv0 algorithm is the one nirium.xyz/verify uses (apps/web/lib/receiptCid.ts in
+// nirium-core-private): one dag-pb block wrapping a UnixFS file. CIDv1 (base32, "b…") is also
+// recomputed, for dag-pb and raw blocks.
+
+export const GATEWAYS = [
+ "https://nirium.myfilebase.com",
+ "https://gateway.pinata.cloud",
+ "https://ipfs.io",
+ "https://dweb.link",
+] as const;
+
+const B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+const B32 = "abcdefghijklmnopqrstuvwxyz234567";
+export const BLOCK_BYTES = 262144;
+
+/** A CID from a bare CID, ipfs://, …/ipfs/, or https://.ipfs./. */
+export function extractCid(input: string): string | null {
+ const t = input.trim();
+ const m = t.match(/^ipfs:\/\/([^/?#]+)/i) ?? t.match(/^https?:\/\/([a-z0-9]+)\.ipfs\.[^/]+/i) ?? t.match(/\/ipfs\/([^/?#]+)/) ?? [null, t];
+ const cid = (m[1] ?? "").replace(/\/+$/, "");
+ return /^Qm[1-9A-HJ-NP-Za-km-z]{44}$/.test(cid) || /^b[a-z2-7]{50,}$/.test(cid) ? cid : null;
+}
+
+const concat = (parts: Uint8Array[]) => {
+ const out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));
+ let o = 0;
+ for (const p of parts) { out.set(p, o); o += p.length; }
+ return out;
+};
+const varint = (n: number) => {
+ const out: number[] = [];
+ while (n >= 0x80) { out.push((n & 0x7f) | 0x80); n = Math.floor(n / 128); }
+ out.push(n);
+ return Uint8Array.from(out);
+};
+const field = (tag: number, b: Uint8Array) => concat([Uint8Array.of(tag), varint(b.length), b]);
+const sha256 = async (b: Uint8Array) => new Uint8Array(await crypto.subtle.digest("SHA-256", b as BufferSource));
+const hex = (b: Uint8Array) => Array.from(b, (x) => x.toString(16).padStart(2, "0")).join("");
+
+function base58(b: Uint8Array): string {
+ let n = BigInt("0x" + (hex(b) || "0"));
+ let out = "";
+ while (n > 0n) { out = B58[Number(n % 58n)] + out; n /= 58n; }
+ for (const x of b) { if (x !== 0) break; out = "1" + out; }
+ return out;
+}
+export function base32(b: Uint8Array): string {
+ let bits = 0, value = 0, out = "";
+ for (const x of b) {
+ value = (value << 8) | x; bits += 8;
+ while (bits >= 5) { out += B32[(value >>> (bits - 5)) & 31]; bits -= 5; }
+ }
+ if (bits > 0) out += B32[(value << (5 - bits)) & 31];
+ return out;
+}
+function unbase32(s: string): Uint8Array | null {
+ let bits = 0, value = 0;
+ const out: number[] = [];
+ for (const c of s) {
+ const i = B32.indexOf(c);
+ if (i < 0) return null;
+ value = (value << 5) | i; bits += 5;
+ if (bits >= 8) { out.push((value >>> (bits - 8)) & 255); bits -= 8; }
+ }
+ return Uint8Array.from(out);
+}
+
+/** The dag-pb node `ipfs add` makes for a file that fits in one block. */
+const unixfsNode = (bytes: Uint8Array) =>
+ field(0x0a, concat([Uint8Array.of(0x08, 0x02), field(0x12, bytes), Uint8Array.of(0x18), varint(bytes.length)]));
+
+/**
+ * Does `bytes` hash to `cid`? true / false, or null when it can't be decided here (more than one
+ * block, or a CID kind this page does not handle); then the downloaded receipt has to be checked with the verifier in the repo.
+ */
+export async function cidMatches(cid: string, bytes: Uint8Array): Promise {
+ if (bytes.length === 0 || bytes.length > BLOCK_BYTES) return null;
+ if (cid.startsWith("Qm")) return base58(concat([Uint8Array.of(0x12, 0x20), await sha256(unixfsNode(bytes))])) === cid;
+ const raw = unbase32(cid.slice(1));
+ // CIDv1: version 1, codec dag-pb (0x70) or raw (0x55), multihash sha2-256 (0x12, 32 bytes).
+ if (!raw || raw.length !== 36 || raw[0] !== 0x01 || raw[2] !== 0x12 || raw[3] !== 0x20) return null;
+ const digest = raw[1] === 0x70 ? await sha256(unixfsNode(bytes)) : raw[1] === 0x55 ? await sha256(bytes) : null;
+ return digest ? hex(digest) === hex(raw.slice(4)) : null;
+}
+
+export type Attempt = { gateway: string; status: number | "timeout" | "error" };
+export type Fetched =
+ | { status: "ok"; gateway: string; bytes: Uint8Array; cidCheck: boolean | null; attempts: Attempt[] }
+ | { status: "mismatch"; gateway: string; attempts: Attempt[] }
+ | { status: "not-found"; attempts: Attempt[] };
+
+/**
+ * Tries each gateway in order and moves on when one fails, times out or rate-limits (429). The
+ * first one that answers decides: if its bytes do not hash to the CID, the result is a mismatch
+ * naming that gateway, not a receipt.
+ */
+export async function fetchCid(cid: string, opts: { gateways?: readonly string[]; timeoutMs?: number; fetchImpl?: typeof fetch } = {}): Promise {
+ const { gateways = GATEWAYS, timeoutMs = 15000, fetchImpl = fetch } = opts;
+ const attempts: Attempt[] = [];
+ // Only a well-formed CID reaches a URL, and only as one encoded path segment of a fixed gateway.
+ if (extractCid(cid) !== cid) return { status: "not-found", attempts };
+ const path = `/ipfs/${encodeURIComponent(cid)}`;
+ for (const gateway of gateways) {
+ let res: Response;
+ try {
+ res = await fetchImpl(new URL(path, gateway).toString(), { signal: AbortSignal.timeout(timeoutMs), credentials: "omit", referrerPolicy: "no-referrer" });
+ } catch (e) {
+ attempts.push({ gateway, status: (e as Error)?.name === "TimeoutError" ? "timeout" : "error" });
+ continue;
+ }
+ attempts.push({ gateway, status: res.status });
+ if (!res.ok) continue;
+ const bytes = new Uint8Array(await res.arrayBuffer());
+ const cidCheck = await cidMatches(cid, bytes);
+ if (cidCheck === false) return { status: "mismatch", gateway, attempts };
+ return { status: "ok", gateway, bytes, cidCheck, attempts };
+ }
+ return { status: "not-found", attempts };
+}
diff --git a/apps/demo/lib/mechanism.test.ts b/apps/demo/lib/mechanism.test.ts
new file mode 100644
index 0000000..2f80933
--- /dev/null
+++ b/apps/demo/lib/mechanism.test.ts
@@ -0,0 +1,56 @@
+// Offline tests for the drawing: each link is decided by the verifier's checks, and each edit breaks
+// the links it should and only those. Chain answers are the recorded public Base Sepolia RPC answers.
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { verifyReceipt } from "./receipt.ts";
+import { readTransaction, BASE_SEPOLIA } from "./chain.ts";
+import { links, edit, cachingFetch, withFetch, type Edit } from "./mechanism.ts";
+
+const read = (p: string) => JSON.parse(readFileSync(new URL(p, import.meta.url), "utf8"));
+const recorded = read("../../../base/fixtures/base-sepolia-sdk-selftest-rpc.json");
+const receipt = read("../../../evidence/2026-12-01/selftest-base-sepolia-binding.json");
+const tx = readTransaction(recorded.txReceipt, BASE_SEPOLIA, recorded.txReceipt.transactionHash, null);
+
+let calls = 0;
+const rpc = (async (_url: string, init: RequestInit) => {
+ calls++;
+ const { id, method, params } = JSON.parse(String(init.body));
+ const result = method === "eth_chainId" ? recorded.chainId
+ : method === "eth_getTransactionReceipt" && String(params[0]).toLowerCase() === recorded.txReceipt.transactionHash.toLowerCase() ? recorded.txReceipt : null;
+ return new Response(JSON.stringify({ jsonrpc: "2.0", id, result }), { headers: { "content-type": "application/json" } });
+}) as unknown as typeof fetch;
+
+async function check(doc: any, f: typeof fetch) {
+ const v = await withFetch(f, () => verifyReceipt(doc));
+ assert.ok(v.status === "valid" || v.status === "invalid", v.status);
+ return { status: v.status, links: links(doc, tx, "checks" in v ? v.checks : []) };
+}
+const broken = (ls: ReturnType) => ls.filter((l) => !l.ok).map((l) => l.key).sort();
+
+test("a real receipt: every link passes, and both sides show the same values", async () => {
+ const { status, links: ls } = await check(receipt, rpc);
+ assert.equal(status, "valid");
+ assert.deepEqual(broken(ls), []);
+ const by = Object.fromEntries(ls.map((l) => [l.key, l]));
+ assert.equal(by.amount.receipt, "0.01 USDC");
+ assert.equal(by.amount.chain, "0.01 USDC");
+ assert.ok(by.reference.chain && receipt.record.payment.x402.nonce.startsWith(by.reference.chain.slice(0, 6)));
+});
+
+test("each edit breaks exactly the links it should, with the verifier re-run from cache", async () => {
+ const f = cachingFetch(rpc);
+ await check(receipt, f);
+ const before = calls;
+ const expected: Record = {
+ amount: ["amount", "content"], // the chain moved another amount, and the signature no longer covers it
+ destination: ["content", "destination"],
+ purpose: ["content"], // the chain never had the purpose: only the signature protects it
+ };
+ for (const [what, keys] of Object.entries(expected)) {
+ const { status, links: ls } = await check(edit(receipt, what as Edit), f);
+ assert.equal(status, "invalid", what);
+ assert.deepEqual(broken(ls), keys, what);
+ }
+ assert.equal(calls, before, "edits must not ask the RPC again");
+});
diff --git a/apps/demo/lib/mechanism.ts b/apps/demo/lib/mechanism.ts
new file mode 100644
index 0000000..c1e497c
--- /dev/null
+++ b/apps/demo/lib/mechanism.ts
@@ -0,0 +1,86 @@
+// The result as a drawing of the mechanism: what the receipt declares on one side, what the chain
+// shows on the other, and one link per thing that must match, each decided by the verifier's own
+// checks (never by this file). Also the edits a visitor can make to a real receipt to watch a link
+// break, re-checked with the same verifier.
+import type { Check } from "nirium-base/verify";
+import { formatUnits, type TxView } from "./chain.ts";
+
+export type LinkKey = "content" | "payer" | "amount" | "destination" | "reference" | "where";
+export type Link = { key: LinkKey; receipt: string; chain: string | null; ok: boolean; failed: string | null };
+
+/** Which verifier checks decide each link. A link passes only if all of its checks ran and passed. */
+const DECIDED_BY: Record = {
+ content: /^content_sha256 |^agent\.statement /,
+ payer: /^agent\.key |^EIP-191 signature|^Transfer\.from /,
+ amount: /^Transfer\.value |^log \d+ emitted by asset/,
+ destination: /^Transfer\.to /,
+ reference: /^AuthorizationUsed/,
+ where: /^network == eip155:|^tx |^log \d+ is Transfer/,
+};
+
+const short = (s: string) => (s && s.length > 16 ? `${s.slice(0, 6)}…${s.slice(-4)}` : s);
+
+export function links(doc: any, tx: TxView | null, checks: Check[]): Link[] {
+ const p = doc.record.payment;
+ const x = tx?.transfers.find((t) => t.logIndex === p.locator?.index) ?? null;
+ const nonce = tx?.nonces.find((n) => n.authorizer.toLowerCase() === String(p.from).toLowerCase())?.nonce ?? null;
+ const usdc = (a: string) => `${formatUnits(a, p.decimals ?? 6)} USDC`;
+ const pick = (key: LinkKey) => {
+ const mine = checks.filter((c) => DECIDED_BY[key].test(c.name));
+ const bad = mine.find((c) => !c.ok);
+ return { ok: mine.length > 0 && !bad, failed: bad?.name ?? (mine.length ? null : "not checked") };
+ };
+ return [
+ // The content link is not on chain: its right side is the hash this browser computed.
+ { key: "content", receipt: short(doc.content_sha256), chain: short(checks.find((c) => c.name.startsWith("content_sha256"))?.detail.match(/computed=(\w+)/)?.[1] ?? ""), ...pick("content") },
+ { key: "payer", receipt: short(doc.agent?.key ?? p.from), chain: x ? short(x.from) : null, ...pick("payer") },
+ { key: "amount", receipt: usdc(p.amount), chain: x ? usdc(x.value) : null, ...pick("amount") },
+ { key: "destination", receipt: short(p.to), chain: x ? short(x.to) : null, ...pick("destination") },
+ { key: "reference", receipt: short(p.x402?.nonce ?? ""), chain: nonce ? short(nonce) : null, ...pick("reference") },
+ { key: "where", receipt: short(p.tx), chain: tx ? `block ${tx.block}` : null, ...pick("where") },
+ ];
+}
+
+export type Edit = "amount" | "destination" | "purpose";
+
+/** A copy of the receipt with one field changed after it was signed. */
+export function edit(doc: any, what: Edit): any {
+ const d = structuredClone(doc);
+ const p = d.record.payment;
+ if (what === "amount") p.amount = String(BigInt(p.amount) * 10n);
+ // Paid to someone else: here, the payer's own address.
+ if (what === "destination") p.to = p.from;
+ if (what === "purpose") d.record.purpose = { ...(d.record.purpose ?? {}), note: "Edited after it was signed" };
+ return d;
+}
+
+/**
+ * A fetch that answers repeated identical RPC calls from memory, so the edits re-run the real
+ * verifier against the chain answers already read, without asking the RPC again.
+ */
+export function cachingFetch(base: typeof fetch = fetch): typeof fetch {
+ const seen = new Map>();
+ return (async (url: RequestInfo | URL, init?: RequestInit) => {
+ // The key leaves out the JSON-RPC id, which some clients (viem) change on every call; the
+ // answer is handed back with the id of the request that asked.
+ let rpc: { id?: unknown; method?: string; params?: unknown } | null = null;
+ try { rpc = typeof init?.body === "string" ? JSON.parse(init.body) : null; } catch { rpc = null; }
+ const key = `${String(url)} ${rpc?.method ? JSON.stringify([rpc.method, rpc.params]) : init?.body ?? ""}`;
+ if (!seen.has(key)) {
+ const pending = base(url, init).then(async (r) => ({ status: r.status, body: await r.text() }));
+ seen.set(key, pending);
+ pending.then((r) => { if (r.status !== 200) seen.delete(key); }, () => seen.delete(key));
+ }
+ const r = await seen.get(key)!;
+ let body = r.body;
+ if (rpc?.method) { try { body = JSON.stringify({ ...JSON.parse(r.body), id: rpc.id }); } catch { /* not JSON: as is */ } }
+ return new Response(body, { status: r.status, headers: { "content-type": "application/json" } });
+ }) as typeof fetch;
+}
+
+/** Runs `fn` with `f` as the global fetch (the shared verifier calls fetch directly), then restores it. */
+export async function withFetch(f: typeof fetch, fn: () => Promise): Promise {
+ const real = globalThis.fetch;
+ globalThis.fetch = f;
+ try { return await fn(); } finally { globalThis.fetch = real; }
+}
diff --git a/apps/demo/lib/nirium-base.d.ts b/apps/demo/lib/nirium-base.d.ts
new file mode 100644
index 0000000..1f70366
--- /dev/null
+++ b/apps/demo/lib/nirium-base.d.ts
@@ -0,0 +1,12 @@
+// Types for the parts of the nirium-base package (plain .mjs) this app uses.
+declare module "nirium-base/verify" {
+ export type Check = { name: string; ok: boolean; detail: string };
+ export function verifyBinding(doc: unknown, opts?: { requireSig?: boolean; rpc?: string }): Promise<{ ok: boolean; checks: Check[] }>;
+ export function contentSha256(record: unknown): string;
+ export const VERSION: string;
+}
+
+declare module "nirium-base/decision" {
+ export const DECISION_VERSION: string;
+ export function verifyDecision(doc: unknown, opts?: { record?: unknown }): Promise<{ ok: boolean; checks: { name: string; ok: boolean; detail?: string }[] }>;
+}
diff --git a/apps/demo/lib/receipt.ts b/apps/demo/lib/receipt.ts
new file mode 100644
index 0000000..15bc470
--- /dev/null
+++ b/apps/demo/lib/receipt.ts
@@ -0,0 +1,90 @@
+// Runs the same verifier as the command line verifier (nirium-base/verify, the shared core) on a
+// receipt the visitor pasted, and sorts the result for the page. Nothing leaves the browser except
+// the RPC calls the verifier makes to the receipt's own network.
+
+import { verifyBinding, type Check } from "nirium-base/verify";
+import { extractCid } from "./ipfs.ts";
+import { NETWORKS, HASH_RE, rpcFailureOf, type RpcFailure } from "./chain.ts";
+
+export type Input =
+ | { kind: "receipt"; doc: Record; network: string }
+ | { kind: "decision"; doc: Record; network: string }
+ | { kind: "hash"; hash: string }
+ | { kind: "cid"; cid: string }
+ | { kind: "foreign"; family: "stellar" | "svm" }
+ | { kind: "invalid"; reason: "not-json" | "not-a-receipt" | "unknown-network" | "unrecognized" };
+
+/** Decides what was pasted: a CID (or gateway URL), a transaction hash, or a receipt. The network
+ * comes from the receipt itself, never from the page. */
+export function classify(text: string): Input {
+ const t = text.trim();
+ if (!t) return { kind: "invalid", reason: "unrecognized" };
+ if (t.startsWith("{")) {
+ let doc: any;
+ try { doc = JSON.parse(t); } catch { return { kind: "invalid", reason: "not-json" }; }
+ return classifyDoc(doc);
+ }
+ const cid = extractCid(t);
+ if (cid) return { kind: "cid", cid };
+ if (HASH_RE.test(t)) return { kind: "hash", hash: t.toLowerCase() };
+ // A base58 Solana transaction signature.
+ if (/^[1-9A-HJ-NP-Za-km-z]{64,90}$/.test(t)) return { kind: "foreign", family: "svm" };
+ return { kind: "invalid", reason: "unrecognized" };
+}
+
+/** A parsed document: a receipt for this page's networks, one for another network, or neither. */
+export function classifyDoc(doc: any): Input {
+ const network = doc?.record?.payment?.network ?? doc?.network;
+ if (typeof network === "string" && network.startsWith("stellar:")) return { kind: "foreign", family: "stellar" };
+ if (typeof network === "string" && network.startsWith("solana:")) return { kind: "foreign", family: "svm" };
+ // A decision receipt (what the payer's pre-sign policy decided, refusals included) has no
+ // transfer to bind to: it is checked by its hash and the payer's signature.
+ if (doc?.version === "nirium-decision-v1") return NETWORKS[network] ? { kind: "decision", doc, network } : { kind: "invalid", reason: "unknown-network" };
+ if (typeof doc?.record?.payment?.network !== "string") return { kind: "invalid", reason: "not-a-receipt" };
+ if (!NETWORKS[network]) return { kind: "invalid", reason: "unknown-network" };
+ return { kind: "receipt", doc, network };
+}
+
+/** Where a receipt or transaction of another network can be checked. */
+export const FOREIGN_URL = { stellar: "https://nirium.xyz/verify", svm: "https://nirium.xyz/solana/explorer" } as const;
+
+export type Verdict =
+ | { status: "valid" | "invalid"; checks: Check[] }
+ | { status: "incomplete"; checks: Check[]; failure: RpcFailure }
+ | { status: "rpc-error"; failure: RpcFailure }
+ | { status: "bad-input"; message: string };
+
+const TRANSPORT = /HTTP request failed|Failed to fetch|Status: \d{3}/;
+
+export async function verifyReceipt(doc: unknown): Promise {
+ let res;
+ try {
+ res = await verifyBinding(doc);
+ } catch (e) {
+ const failure = rpcFailureOf(e);
+ return failure ? { status: "rpc-error", failure } : { status: "bad-input", message: String((e as Error).message) };
+ }
+ // A check that failed because the RPC did not answer is not a verdict on the receipt.
+ const transport = res.checks.find((c) => !c.ok && TRANSPORT.test(c.detail));
+ if (transport) return { status: "incomplete", checks: res.checks, failure: rpcFailureOf(transport.detail) ?? "unreachable" };
+ return { status: res.ok ? "valid" : "invalid", checks: res.checks };
+}
+
+/** Checks the chain answers, as opposed to checks of the receipt document on its own. */
+export const isChainCheck = (name: string) => /chainId|^tx |^log |^Transfer\.|AuthorizationUsed/.test(name);
+
+/** Key for a plain-language reason (see i18n.ts), when a check has one. */
+export function reasonKey(name: string): string | null {
+ if (name.startsWith("content_sha256")) return "hash";
+ if (name.startsWith("agent.statement")) return "statement";
+ if (name.startsWith("EIP-191 signature")) return "signature";
+ if (name.startsWith("agent.key")) return "signer";
+ if (name.startsWith("agent block")) return "unsigned";
+ if (name.startsWith("Transfer.value")) return "amount";
+ if (name.startsWith("Transfer.to")) return "destination";
+ if (name.startsWith("Transfer.from")) return "authority";
+ if (name.startsWith("AuthorizationUsed")) return "nonce";
+ if (/^tx (receipt found|status)/.test(name)) return "tx";
+ if (/^log \d+ /.test(name)) return "index";
+ return null;
+}
diff --git a/apps/demo/next.config.mjs b/apps/demo/next.config.mjs
new file mode 100644
index 0000000..80ff876
--- /dev/null
+++ b/apps/demo/next.config.mjs
@@ -0,0 +1,21 @@
+import { fileURLToPath } from "node:url";
+
+// The repo root, so the app can import the package from ../../base (file: link, the code of
+// this same commit) and the team's receipts from ../../evidence.
+const root = fileURLToPath(new URL("../..", import.meta.url));
+
+// The demo lives at nirium.xyz/base: nirium.xyz rewrites /base/* to this deployment, so every
+// path here starts with /base. The old address (base.nirium.xyz/ and /explorer) redirects there.
+/** @type {import("next").NextConfig} */
+export default {
+ basePath: "/base",
+ async redirects() {
+ return [
+ { source: "/", destination: "https://nirium.xyz/base", permanent: false, basePath: false },
+ { source: "/explorer", destination: "https://nirium.xyz/base/explorer", permanent: false, basePath: false },
+ ];
+ },
+ turbopack: { root },
+ outputFileTracingRoot: root,
+ poweredByHeader: false,
+};
diff --git a/apps/demo/package-lock.json b/apps/demo/package-lock.json
new file mode 100644
index 0000000..c55892d
--- /dev/null
+++ b/apps/demo/package-lock.json
@@ -0,0 +1,1114 @@
+{
+ "name": "nirium-base-demo",
+ "version": "0.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "nirium-base-demo",
+ "version": "0.0.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "next": "16.4.6",
+ "nirium-base": "file:../../base",
+ "react": "19.3.1",
+ "react-dom": "19.3.1"
+ },
+ "devDependencies": {
+ "@types/node": "24.19.4",
+ "@types/react": "19.3.3",
+ "@types/react-dom": "19.3.0",
+ "typescript": "6.0.3"
+ },
+ "engines": {
+ "node": ">=24"
+ }
+ },
+ "../../base": {
+ "name": "nirium-base",
+ "version": "0.3.0",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@x402/core": "2.32.0",
+ "@x402/evm": "2.32.0",
+ "@x402/express": "2.32.0",
+ "@x402/fetch": "2.32.0",
+ "viem": "2.58.7"
+ },
+ "bin": {
+ "nirium-verify-evm": "verify-evm-receipt.mjs"
+ },
+ "devDependencies": {
+ "express": "5.3.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "peerDependencies": {
+ "express": "^4.22.3 || ^5.3.0"
+ },
+ "peerDependenciesMeta": {
+ "express": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@emnapi/runtime": {
+ "version": "1.11.3",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz",
+ "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@img/colour": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",
+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@img/sharp-darwin-arm64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz",
+ "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-arm64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-darwin-x64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz",
+ "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-x64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-freebsd-wasm32": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz",
+ "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==",
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "dependencies": {
+ "@img/sharp-wasm32": "0.35.5"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-arm64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz",
+ "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-x64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz",
+ "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz",
+ "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==",
+ "cpu": [
+ "arm"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz",
+ "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-ppc64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz",
+ "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-riscv64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz",
+ "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==",
+ "cpu": [
+ "riscv64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-s390x": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz",
+ "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==",
+ "cpu": [
+ "s390x"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-x64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz",
+ "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz",
+ "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz",
+ "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz",
+ "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==",
+ "cpu": [
+ "arm"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz",
+ "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-ppc64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz",
+ "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-ppc64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-riscv64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz",
+ "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-riscv64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-s390x": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz",
+ "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==",
+ "cpu": [
+ "s390x"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-s390x": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-x64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz",
+ "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-x64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-arm64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz",
+ "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-x64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz",
+ "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-x64": "1.3.4"
+ }
+ },
+ "node_modules/@img/sharp-wasm32": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz",
+ "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==",
+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",
+ "optional": true,
+ "dependencies": {
+ "@emnapi/runtime": "^1.11.3"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-webcontainers-wasm32": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz",
+ "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==",
+ "cpu": [
+ "wasm32"
+ ],
+ "license": "Apache-2.0",
+ "optional": true,
+ "dependencies": {
+ "@img/sharp-wasm32": "0.35.5"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-arm64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz",
+ "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-ia32": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz",
+ "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==",
+ "cpu": [
+ "ia32"
+ ],
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-x64": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz",
+ "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@next/env": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.6.tgz",
+ "integrity": "sha512-SunBjJ6t+oBtecS3dTjdVuMhUogP5wD/vrGL5EVuQYM1iS4O5ilL51HkiJ3sPjMzRHiCChvr4dbaSJbR7F3lxA==",
+ "license": "MIT"
+ },
+ "node_modules/@next/swc-darwin-arm64": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.6.tgz",
+ "integrity": "sha512-kJ4VVZkley17xKaJx72QN2IBqjrj7zenCQZaUF0l9ShS/1Mt2kW4+Z5KGG6vgr3L/J562xTOizVyM1iA/u5nlg==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-darwin-x64": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.6.tgz",
+ "integrity": "sha512-eIPGZIqC+8JKaeZmvnCANJQF4xWkkHqSnAAajtFxgwDMAOnCgxNvP52SeWZ41PyVwoe+Le/NQuZSaQ8j7YshSA==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.6.tgz",
+ "integrity": "sha512-9nI6O8vvczH2D9ZNdMGqb/3NuT15T9ksOZnAmx9/gjF2cOi74+xxyf1Hk96uIMfm14c9y6wHeBq6SH8g6udvcA==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-musl": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.6.tgz",
+ "integrity": "sha512-7/qPhTxDp2ScluOJOhLuhWmlA17o1yZ0SIgpISBCpBxXgtnK4+KGywBpFkfLPiU1rnSM1faFGzYkH6i7JdTrqA==",
+ "cpu": [
+ "arm64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-gnu": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.6.tgz",
+ "integrity": "sha512-oOpbNa8XOW1qCGd9VvzC4fbkkRxEls7/WI6tz+YHC0xRA7KpV1U7DrAnCPjzVyOk/karzWEepCOcTIDmwK8FwQ==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "glibc"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-musl": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.6.tgz",
+ "integrity": "sha512-aM8CZ+OR2EwXaAYw7KGkW2GDmNDsLBIRe1MMRZCJPTdw/xhTD0IMUVO4sf3KqrzuRouGzwwLZn34+gFeVXiUQA==",
+ "cpu": [
+ "x64"
+ ],
+ "libc": [
+ "musl"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.6.tgz",
+ "integrity": "sha512-U0p7/tEtqvHX2crhd841CDwKtp5CFkKXVjOhmfccR3Pvp64sj8KBwRqsvltqLOwVBbj0NtkxwXSDpEHYGbxeXQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-x64-msvc": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.6.tgz",
+ "integrity": "sha512-3ZG15/5WIdlTQsIEvc9sPTTSL5XFrlLklIKmfF4fwsDnoAhu6NcBDXsk3mbGxNyo6aVLEGex+fHCv2MahY7a9g==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@swc/helpers": {
+ "version": "0.5.23",
+ "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz",
+ "integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "tslib": "^2.8.0"
+ }
+ },
+ "node_modules/@types/node": {
+ "version": "24.19.4",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.4.tgz",
+ "integrity": "sha512-s04odlR3ksJrLu7QLi+pddkWLD0RmSbcP9KuWn2/ozQKAp/YgwBC/6x9kJj8yAzZnGPfxePm7zm7nysVPCRagw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": ">=7.24.0 <7.24.7"
+ }
+ },
+ "node_modules/@types/react": {
+ "version": "19.3.3",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.3.tgz",
+ "integrity": "sha512-K8uWpJc4teiuOPdiP1umjeA9rGMgVPiXuoL66fcS1QlwBT1WMqY8PORmub9FadopIs+RCW6siYEs7Lpq+vDlog==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "csstype": "^3.2.2"
+ }
+ },
+ "node_modules/@types/react-dom": {
+ "version": "19.3.0",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz",
+ "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "^19.3.0"
+ }
+ },
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.11.40",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.40.tgz",
+ "integrity": "sha512-WJhaQ3kW5+5BpOduI64ewvykhCyK/IHHG5jCIzivmW2nkYPRowUjs0DbBXY4CAr1LLrN7QEzZGL9727aXH9sJA==",
+ "license": "Apache-2.0",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.cjs"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001828",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001828.tgz",
+ "integrity": "sha512-7MWeT+3DlrpuDybTWHl4Zb1Z80Z1fLLnOXuBjDXebzDVcqnEWUlV8JcbASg8B8BhcW8QT2UiR1KAtzYFIZHZYA==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/client-only": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz",
+ "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==",
+ "license": "MIT"
+ },
+ "node_modules/csstype": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.4.tgz",
+ "integrity": "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "license": "Apache-2.0",
+ "optional": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.20",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/next": {
+ "version": "16.4.6",
+ "resolved": "https://registry.npmjs.org/next/-/next-16.4.6.tgz",
+ "integrity": "sha512-QZJiYhaZLJMo2KpkQGQIwvmd79WVsAWeYIU554a8d7zArS3si/IRy3lBNV/rtYhE70oLwdLYhPAXLPx8HwcwtA==",
+ "license": "MIT",
+ "dependencies": {
+ "@next/env": "16.4.6",
+ "@swc/helpers": "0.5.23",
+ "baseline-browser-mapping": "^2.9.19",
+ "caniuse-lite": "^1.0.30001579",
+ "postcss": "8.5.23",
+ "styled-jsx": "5.1.6"
+ },
+ "bin": {
+ "next": "dist/bin/next"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "optionalDependencies": {
+ "@next/swc-darwin-arm64": "16.4.6",
+ "@next/swc-darwin-x64": "16.4.6",
+ "@next/swc-linux-arm64-gnu": "16.4.6",
+ "@next/swc-linux-arm64-musl": "16.4.6",
+ "@next/swc-linux-x64-gnu": "16.4.6",
+ "@next/swc-linux-x64-musl": "16.4.6",
+ "@next/swc-win32-arm64-msvc": "16.4.6",
+ "@next/swc-win32-x64-msvc": "16.4.6",
+ "sharp": "^0.35.5"
+ },
+ "peerDependencies": {
+ "@opentelemetry/api": "^1.1.0",
+ "@playwright/test": "^1.51.1",
+ "babel-plugin-react-compiler": "*",
+ "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
+ "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0",
+ "sass": "^1.3.0"
+ },
+ "peerDependenciesMeta": {
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@playwright/test": {
+ "optional": true
+ },
+ "babel-plugin-react-compiler": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/nirium-base": {
+ "resolved": "../../base",
+ "link": true
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "license": "ISC"
+ },
+ "node_modules/postcss": {
+ "version": "8.5.23",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.23.tgz",
+ "integrity": "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==",
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.16",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/react": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz",
+ "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "19.3.1",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz",
+ "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==",
+ "license": "MIT",
+ "dependencies": {
+ "scheduler": "^0.28.0"
+ },
+ "peerDependencies": {
+ "react": "^19.3.1"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.28.0",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz",
+ "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==",
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "7.8.6",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz",
+ "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==",
+ "license": "ISC",
+ "optional": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/sharp": {
+ "version": "0.35.5",
+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz",
+ "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==",
+ "license": "Apache-2.0",
+ "optional": true,
+ "dependencies": {
+ "@img/colour": "^1.1.0",
+ "detect-libc": "^2.1.2",
+ "semver": "^7.8.5"
+ },
+ "engines": {
+ "node": ">=20.9.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-darwin-arm64": "0.35.5",
+ "@img/sharp-darwin-x64": "0.35.5",
+ "@img/sharp-freebsd-wasm32": "0.35.5",
+ "@img/sharp-libvips-darwin-arm64": "1.3.4",
+ "@img/sharp-libvips-darwin-x64": "1.3.4",
+ "@img/sharp-libvips-linux-arm": "1.3.4",
+ "@img/sharp-libvips-linux-arm64": "1.3.4",
+ "@img/sharp-libvips-linux-ppc64": "1.3.4",
+ "@img/sharp-libvips-linux-riscv64": "1.3.4",
+ "@img/sharp-libvips-linux-s390x": "1.3.4",
+ "@img/sharp-libvips-linux-x64": "1.3.4",
+ "@img/sharp-libvips-linuxmusl-arm64": "1.3.4",
+ "@img/sharp-libvips-linuxmusl-x64": "1.3.4",
+ "@img/sharp-linux-arm": "0.35.5",
+ "@img/sharp-linux-arm64": "0.35.5",
+ "@img/sharp-linux-ppc64": "0.35.5",
+ "@img/sharp-linux-riscv64": "0.35.5",
+ "@img/sharp-linux-s390x": "0.35.5",
+ "@img/sharp-linux-x64": "0.35.5",
+ "@img/sharp-linuxmusl-arm64": "0.35.5",
+ "@img/sharp-linuxmusl-x64": "0.35.5",
+ "@img/sharp-webcontainers-wasm32": "0.35.5",
+ "@img/sharp-win32-arm64": "0.35.5",
+ "@img/sharp-win32-ia32": "0.35.5",
+ "@img/sharp-win32-x64": "0.35.5"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.4.tgz",
+ "integrity": "sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/styled-jsx": {
+ "version": "5.1.6",
+ "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz",
+ "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==",
+ "license": "MIT",
+ "dependencies": {
+ "client-only": "0.0.1"
+ },
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "peerDependencies": {
+ "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0"
+ },
+ "peerDependenciesMeta": {
+ "@babel/core": {
+ "optional": true
+ },
+ "babel-plugin-macros": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.9.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz",
+ "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==",
+ "license": "0BSD"
+ },
+ "node_modules/typescript": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz",
+ "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "7.24.6",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
+ "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
+ "dev": true,
+ "license": "MIT"
+ }
+ }
+}
diff --git a/apps/demo/package.json b/apps/demo/package.json
new file mode 100644
index 0000000..a4aa7d2
--- /dev/null
+++ b/apps/demo/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "nirium-base-demo",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "license": "Apache-2.0",
+ "scripts": {
+ "dev": "next dev",
+ "build": "next build",
+ "start": "next start",
+ "test": "node --test lib/*.test.ts"
+ },
+ "engines": {
+ "node": ">=24"
+ },
+ "dependencies": {
+ "next": "16.4.6",
+ "nirium-base": "file:../../base",
+ "react": "19.3.1",
+ "react-dom": "19.3.1"
+ },
+ "devDependencies": {
+ "@types/node": "24.19.4",
+ "@types/react": "19.3.3",
+ "@types/react-dom": "19.3.0",
+ "typescript": "6.0.3"
+ }
+}
diff --git a/apps/demo/proxy.ts b/apps/demo/proxy.ts
new file mode 100755
index 0000000..0fdca7a
--- /dev/null
+++ b/apps/demo/proxy.ts
@@ -0,0 +1,19 @@
+// Tier A gets 451 on every path of this demo (see lib/geo.ts). Vercel sets x-vercel-ip-country from the
+// connecting IP. Requests rewritten from nirium.xyz were already checked there.
+import { NextResponse, type NextRequest } from "next/server";
+import { isTierA, POLICY_URL } from "./lib/geo.ts";
+
+export function proxy(request: NextRequest) {
+ const country = request.headers.get("x-vercel-ip-country");
+ if (!isTierA(country)) return NextResponse.next();
+ return NextResponse.json(
+ {
+ error: "unavailable_for_legal_reasons",
+ message: "Nirium does not offer any service in your jurisdiction.",
+ jurisdiction: country,
+ policy: POLICY_URL,
+ contact: "niriumprotocol@gmail.com",
+ },
+ { status: 451, headers: { "X-Restricted-Jurisdiction": String(country) } },
+ );
+}
diff --git a/apps/demo/public/icon.svg b/apps/demo/public/icon.svg
new file mode 100644
index 0000000..ab7b3e6
--- /dev/null
+++ b/apps/demo/public/icon.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/apps/demo/tsconfig.json b/apps/demo/tsconfig.json
new file mode 100644
index 0000000..2096ff0
--- /dev/null
+++ b/apps/demo/tsconfig.json
@@ -0,0 +1,42 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "es2022"
+ ],
+ "allowJs": false,
+ "skipLibCheck": true,
+ "strict": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "allowImportingTsExtensions": true,
+ "isolatedModules": true,
+ "jsx": "react-jsx",
+ "incremental": true,
+ "plugins": [
+ {
+ "name": "next"
+ }
+ ],
+ "paths": {
+ "@/*": [
+ "./*"
+ ]
+ }
+ },
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ ".next/types/**/*.ts",
+ ".next/dev/types/**/*.ts"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
+}