From c3fa792babc260795f5cc4d5559672e2d49f1568 Mon Sep 17 00:00:00 2001 From: Giovanny Amador <219895655+Eras256@users.noreply.github.com> Date: Tue, 1 Dec 2026 16:14:21 -0600 Subject: [PATCH] feat(demo): nirium.xyz/base, the receipt explorer for Base Ported from the nirium-avalanche demo (apps/demo): Base Sepolia and Base mainnet RPCs, Circle USDC, explorers, Base colors with AA contrast, examples from the team's own anchored mainnet receipts, Tier A 451 proxy. The library is not on npm yet, so the page says so and links no npm or repo. Tests 14/14, next build passes; CI job added. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/tests.yml | 21 + apps/demo/.gitignore | 4 + apps/demo/app/Logo.tsx | 19 + apps/demo/app/Prefs.tsx | 62 ++ apps/demo/app/explorer/Explorer.tsx | 313 ++++++++ apps/demo/app/explorer/Mechanism.tsx | 66 ++ apps/demo/app/explorer/page.tsx | 20 + apps/demo/app/globals.css | 258 ++++++ apps/demo/app/layout.tsx | 47 ++ apps/demo/app/page.tsx | 55 ++ apps/demo/lib/chain.ts | 99 +++ apps/demo/lib/examples.ts | 38 + apps/demo/lib/explorer.test.ts | 76 ++ apps/demo/lib/geo.test.ts | 12 + apps/demo/lib/geo.ts | 11 + apps/demo/lib/i18n.ts | 284 +++++++ apps/demo/lib/ipfs.test.ts | 82 ++ apps/demo/lib/ipfs.ts | 122 +++ apps/demo/lib/mechanism.test.ts | 56 ++ apps/demo/lib/mechanism.ts | 86 ++ apps/demo/lib/nirium-base.d.ts | 12 + apps/demo/lib/receipt.ts | 90 +++ apps/demo/next.config.mjs | 21 + apps/demo/package-lock.json | 1114 ++++++++++++++++++++++++++ apps/demo/package.json | 28 + apps/demo/proxy.ts | 19 + apps/demo/public/icon.svg | 9 + apps/demo/tsconfig.json | 42 + 28 files changed, 3066 insertions(+) create mode 100644 apps/demo/.gitignore create mode 100644 apps/demo/app/Logo.tsx create mode 100644 apps/demo/app/Prefs.tsx create mode 100644 apps/demo/app/explorer/Explorer.tsx create mode 100644 apps/demo/app/explorer/Mechanism.tsx create mode 100644 apps/demo/app/explorer/page.tsx create mode 100644 apps/demo/app/globals.css create mode 100644 apps/demo/app/layout.tsx create mode 100644 apps/demo/app/page.tsx create mode 100644 apps/demo/lib/chain.ts create mode 100644 apps/demo/lib/examples.ts create mode 100644 apps/demo/lib/explorer.test.ts create mode 100755 apps/demo/lib/geo.test.ts create mode 100755 apps/demo/lib/geo.ts create mode 100644 apps/demo/lib/i18n.ts create mode 100644 apps/demo/lib/ipfs.test.ts create mode 100644 apps/demo/lib/ipfs.ts create mode 100644 apps/demo/lib/mechanism.test.ts create mode 100644 apps/demo/lib/mechanism.ts create mode 100644 apps/demo/lib/nirium-base.d.ts create mode 100644 apps/demo/lib/receipt.ts create mode 100644 apps/demo/next.config.mjs create mode 100644 apps/demo/package-lock.json create mode 100644 apps/demo/package.json create mode 100755 apps/demo/proxy.ts create mode 100644 apps/demo/public/icon.svg create mode 100644 apps/demo/tsconfig.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dce1235..1651ceb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,6 +50,27 @@ jobs: npx --no-install nirium-verify-evm "$GITHUB_WORKSPACE/base/fixtures/payai-ok.json" --no-sig | tail -1 | grep -q "RESULT: VALID" if tar -tzf "$RUNNER_TEMP"/nirium-base-*.tgz | grep -E -i "test|example|evidence|fixture|market|demo"; then echo "unexpected files in the package"; exit 1; fi + demo: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 24 + - name: Install (the demo uses the package from ../../base, this commit's code) + run: | + (cd base && npm ci --no-audit --no-fund) + (cd apps/demo && npm ci --no-audit --no-fund) + - name: Explorer logic, the CID path and the drawing (14 tests, no network) + working-directory: apps/demo + run: npm test + - name: Build (type check and browser bundle) + working-directory: apps/demo + env: + NEXT_TELEMETRY_DISABLED: "1" + run: npx next build + market-image: runs-on: ubuntu-latest timeout-minutes: 15 diff --git a/apps/demo/.gitignore b/apps/demo/.gitignore new file mode 100644 index 0000000..9b7655a --- /dev/null +++ b/apps/demo/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +.next/ +next-env.d.ts +*.tsbuildinfo diff --git a/apps/demo/app/Logo.tsx b/apps/demo/app/Logo.tsx new file mode 100644 index 0000000..759e877 --- /dev/null +++ b/apps/demo/app/Logo.tsx @@ -0,0 +1,19 @@ +// The Nirium N, from nirium.xyz/branding-nirium/svg/icon.svg (one stroke, three dots for payment, +// audit and agent rails). Gold on nirium.xyz; here in Base blue, from light to dark. Decorative here: the link around it carries the name. +export function Logo() { + return ( + + ); +} diff --git a/apps/demo/app/Prefs.tsx b/apps/demo/app/Prefs.tsx new file mode 100644 index 0000000..d8d74f1 --- /dev/null +++ b/apps/demo/app/Prefs.tsx @@ -0,0 +1,62 @@ +"use client"; +// Language and theme, kept in the visitor's own localStorage (never sent anywhere), and the chrome +// every page shares: the status bar, the header with the N, and the footer. +import { createContext, useContext, useEffect, useState } from "react"; +import Link from "next/link"; +import { STRINGS, type Lang, type Strings } from "@/lib/i18n.ts"; +import { Logo } from "./Logo"; + +type Theme = "light" | "dark"; +const Ctx = createContext<{ lang: Lang; t: Strings }>({ lang: "en", t: STRINGS.en }); +export const usePrefs = () => useContext(Ctx); + +export function Prefs({ children }: { children: React.ReactNode }) { + const [lang, setLang] = useState("en"); + const [theme, setTheme] = useState("dark"); + useEffect(() => { + const l = localStorage.getItem("nirium-demo-lang"); + setLang(l === "es" || l === "en" ? l : navigator.language.startsWith("es") ? "es" : "en"); + setTheme(document.documentElement.dataset.theme === "light" ? "light" : "dark"); + }, []); + useEffect(() => { document.documentElement.lang = lang; }, [lang]); + const pickLang = (l: Lang) => { setLang(l); localStorage.setItem("nirium-demo-lang", l); }; + const pickTheme = (th: Theme) => { setTheme(th); document.documentElement.dataset.theme = th; localStorage.setItem("nirium-demo-theme", th); }; + const t = STRINGS[lang]; + const facts: [string, string][] = [ + [t.status.checks, t.status.checksValue], + [t.status.stored, t.status.storedValue], + [t.status.networks, "Base Sepolia · Base mainnet"], + [t.status.library, t.status.libraryValue], + ]; + return ( + + {t.skip} +
+
+ {facts.map(([k, v]) =>
{k}
{v}
)} +
+
+ + NIRIUM Base, {t.home} + +
+ {t.allChains} +
+ {(["en", "es"] as const).map((l) => ( + + ))} +
+ +
+
+
{children}
+
{t.footer}
+
+ ); +} diff --git a/apps/demo/app/explorer/Explorer.tsx b/apps/demo/app/explorer/Explorer.tsx new file mode 100644 index 0000000..686dea5 --- /dev/null +++ b/apps/demo/app/explorer/Explorer.tsx @@ -0,0 +1,313 @@ +"use client"; +// Receipt explorer: one field, like nirium.xyz/verify. It takes a CID (or a gateway URL), a +// transaction hash, or a receipt pasted or dropped as JSON, says what it detected, and checks +// it in the browser. A CID is fetched from public gateways directly by the browser and its bytes are +// hashed back to the CID before anything is shown. The layout follows the structure of Prova's +// Forensic Explorer (Prova-Solana/Prova, Apache-2.0): one input that detects what was pasted, then a +// detail view. No code or text was copied from it. +import { useEffect, useRef, useState } from "react"; +import { usePrefs } from "../Prefs"; +import { STORIES } from "@/lib/examples.ts"; +import { fetchCid, type Attempt } from "@/lib/ipfs.ts"; +import { classify, classifyDoc, verifyReceipt, isChainCheck, reasonKey, FOREIGN_URL, type Verdict } from "@/lib/receipt.ts"; +import { BASE_SEPOLIA, BASE_MAINNET, NETWORKS, explorerTxUrl, formatUnits, lookupTransaction, rpcFailureOf, type RpcFailure, type TxView } from "@/lib/chain.ts"; +import type { Check } from "nirium-base/verify"; +import { verifyDecision } from "nirium-base/decision"; +import { links, edit, cachingFetch, withFetch, type Edit } from "@/lib/mechanism.ts"; +import { Mechanism } from "./Mechanism"; + +type Source = { cid: string; gateway: string; cidCheck: boolean | null }; +type Result = + | { kind: "receipt"; network: string; verdict: Verdict; source: Source | null; original: Record; doc: Record; tx: TxView | null; edits: Edit[] } + | { kind: "decision"; network: string; ok: boolean; checks: Check[]; source: Source | null; doc: Record } + | { kind: "tx"; found: TxView[]; error: RpcFailure | null } + | { kind: "foreign"; family: "stellar" | "svm"; cid: string | null } + | { kind: "mismatch"; cid: string; gateway: string } + | { kind: "not-found"; cid: string; attempts: Attempt[] } + | { kind: "invalid"; reason: "not-json" | "not-a-receipt" | "unknown-network" | "unrecognized" }; + +const short = (s: string) => (s.length > 20 ? `${s.slice(0, 8)}…${s.slice(-6)}` : s); +const host = (url: string) => url.replace(/^https:\/\//, ""); + +export function Explorer() { + const { lang, t } = usePrefs(); + const [text, setText] = useState(""); + const [busy, setBusy] = useState(null); + const [result, setResult] = useState(null); + const [dragging, setDragging] = useState(false); + const resultRef = useRef(null); + const fetchRef = useRef(null); + const [rechecking, setRechecking] = useState(false); + const detected = text.trim() ? classify(text) : null; + + async function checkDoc(doc: any, source: Source | null, firstEdit?: Edit) { + const c = classifyDoc(doc); + if (c.kind === "foreign") return setResult({ kind: "foreign", family: c.family, cid: source?.cid ?? null }); + if (c.kind === "decision") { + setBusy("checking"); + const v = await verifyDecision(c.doc); + return setResult({ kind: "decision", network: c.network, ok: v.ok, checks: v.checks.map((k) => ({ ...k, detail: k.detail ?? "" })), source, doc: c.doc }); + } + if (c.kind !== "receipt") return setResult({ kind: "invalid", reason: c.kind === "invalid" ? c.reason : "not-a-receipt" }); + setBusy("checking"); + // One caching fetch per receipt: the edits below re-run the verifier on the answers read here. + const f = cachingFetch(); + fetchRef.current = f; + const [verdict, tx] = await withFetch(f, () => Promise.all([ + verifyReceipt(c.doc), + lookupTransaction(c.doc.record.payment.tx, c.network).catch(() => null), + ])); + const base = { kind: "receipt" as const, network: c.network, verdict, source, original: c.doc, doc: c.doc, tx, edits: [] as Edit[] }; + setResult(base); + if (firstEdit) await applyEdits(base, [firstEdit]); + } + + async function applyEdits(r: Extract, 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}

+
+ +
{ e.preventDefault(); run(); }} + onDragOver={(e) => { e.preventDefault(); setDragging(true); }} onDragLeave={() => setDragging(false)} onDrop={onDrop}> + +
+ setText(e.target.value)} aria-describedby="q-hint" disabled={!!busy} /> + +
+

{detected ? t.detected[detected.kind === "foreign" ? `foreign-${detected.family}` : detected.kind] : t.drop}

+
+ +
+

{t.examples}

+
    + {STORIES.map((s) => ( +
  • + +
  • + ))} +
+
+ +
+ {busy &&
} + {!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 ( +
  1. + {c.ok ? t.pass : t.fail} + {c.name} + {why && {t.reasons[why]}} + {c.detail && {c.detail}} +
  2. + ); + })} +
+
+ ); +} + +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 ( + + ); +} + +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}

+
+ + {purpose && ( +
+

{m.purpose}{purpose}

+
+ )} +
    + {links.map((l, i) => { + const why = l.failed ? reasonKey(l.failed) : null; + return ( +
  1. + {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)} + + + + {!l.ok &&

    {why ? t.reasons[why] : m.notChecked}

    } +
  2. + ); + })} +
+
+
+ {m.editTitle} +

{m.editHint}

+
+ {(["amount", "destination", "purpose"] as const).map((e) => ( + + ))} + {edits.length > 0 && } +
+
+
+ ); +} 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 ( + +