Add lnurl list/detail routes, OG fixtures, i18n strings, and the write/ index client flows so the site surfaces the new mint type end to end. Co-authored-by: Cursor <cursoragent@cursor.com>
176 lines
5.3 KiB
JavaScript
176 lines
5.3 KiB
JavaScript
/**
|
|
* The edge cases the template must survive, as synthetic API payloads.
|
|
*
|
|
* Run through the same cashuModel/fedimintModel/lnurlModel derivation as real data — a fixture
|
|
* that bypassed the model would test a card no build can produce. `NOW` is pinned so
|
|
* the rendered PNGs under og-fixtures/ are byte-stable and can live in the repo as
|
|
* eyeball snapshots.
|
|
*/
|
|
|
|
/** 1 Aug 2026 00:00 UTC. Day counts and month stamps in fixtures derive from this. */
|
|
export const NOW = 1_785_542_400;
|
|
|
|
const dist = (five = 0, four = 0, three = 0, two = 0, one = 0) => ({
|
|
5: five, 4: four, 3: three, 2: two, 1: one,
|
|
});
|
|
|
|
const base = {
|
|
type: 'cashu',
|
|
status: 'online',
|
|
last_online: NOW - 300,
|
|
last_probe: NOW - 300,
|
|
first_seen: NOW - 400 * 86400,
|
|
review_count: 26,
|
|
rating_avg: 4.6,
|
|
rating_distribution: dist(18, 5, 2, 0, 1),
|
|
last_review_at: NOW - 12 * 86400,
|
|
info: {
|
|
nuts: {
|
|
4: { methods: [{ method: 'bolt11', unit: 'sat', min_amount: 100, max_amount: 500000 }], disabled: false },
|
|
5: { methods: [{ method: 'bolt11', unit: 'sat' }], disabled: false },
|
|
},
|
|
},
|
|
};
|
|
|
|
|
|
/**
|
|
* The shared shape of an LNURL row's detail payload, as `GET /api/mints/:host` returns
|
|
* it: the ecosystem fields flattened across the top level, millisatoshi on the wire.
|
|
*/
|
|
const lnurlBase = {
|
|
type: 'lnurl',
|
|
status: 'online',
|
|
last_online: NOW - 300,
|
|
last_probe: NOW - 300,
|
|
first_seen: NOW - 200 * 86400,
|
|
review_count: 9,
|
|
rating_avg: 4.4,
|
|
rating_distribution: dist(6, 2, 1),
|
|
last_review_at: NOW - 20 * 86400,
|
|
features: ['mint', 'melt', 'rotate', 'split', 'merge', 'lud06', 'lud03', 'lud16', 'signed-notes'],
|
|
network: 'mainnet',
|
|
mint_pubkey: '021ab89df9cbd28cdab8c71d228ca40deba1eaebd827f24849ec4f3e919c023555',
|
|
funding_available: true,
|
|
invalid_reason: null,
|
|
min_withdrawable_msat: 5_000,
|
|
max_withdrawable_msat: 999_899_000,
|
|
lightning_address: 'mint@lnurl.example',
|
|
};
|
|
|
|
export const FIXTURES = [
|
|
{
|
|
// A name at the 30-character mark: must step down, never clip.
|
|
...base,
|
|
host: 'fixture-long-name',
|
|
url: 'https://mint.veryserious.example',
|
|
name: 'The Extremely Serious Mint Co.',
|
|
icon: null,
|
|
},
|
|
{
|
|
// No cached icon: the deterministic initial-on-gradient tile.
|
|
...base,
|
|
host: 'fixture-no-icon',
|
|
url: 'https://mint.plain.example',
|
|
name: 'Plain Mint',
|
|
icon: null,
|
|
},
|
|
{
|
|
// Zero reviews: "No reviews yet" in the rating cell, no stars, no sentiment bar.
|
|
...base,
|
|
host: 'fixture-zero-reviews',
|
|
url: 'https://mint.unreviewed.example',
|
|
name: 'Fresh Mint',
|
|
icon: null,
|
|
review_count: 0,
|
|
rating_avg: null,
|
|
rating_distribution: dist(),
|
|
last_review_at: null,
|
|
},
|
|
{
|
|
// Offline 12 days: red glow, "Offline 12d" chip, warning cell instead of limits.
|
|
...base,
|
|
host: 'fixture-offline',
|
|
url: 'https://mint.gone.example',
|
|
name: 'Vanished Mint',
|
|
icon: null,
|
|
status: 'offline',
|
|
last_online: NOW - 12 * 86400,
|
|
rating_avg: 2.4,
|
|
rating_distribution: dist(1, 1, 2, 4, 6),
|
|
review_count: 14,
|
|
},
|
|
{
|
|
// Melt only but ONLINE: green chip stays, warning cell appears anyway.
|
|
...base,
|
|
host: 'fixture-melt-only',
|
|
url: 'https://mint.windingdown.example',
|
|
name: 'Winding Down Mint',
|
|
icon: null,
|
|
info: {
|
|
nuts: {
|
|
4: { methods: [], disabled: true },
|
|
5: { methods: [{ method: 'bolt11', unit: 'sat' }], disabled: false },
|
|
},
|
|
},
|
|
},
|
|
{
|
|
// A federation announced 3 months ago that nothing ever confirmed.
|
|
type: 'fedimint',
|
|
host: 'fixture-fed-announced',
|
|
url: 'fed11qfixture',
|
|
name: 'Quiet Corner Federation',
|
|
icon: null,
|
|
status: 'announced',
|
|
last_online: null,
|
|
last_probe: null,
|
|
first_seen: NOW - 95 * 86400,
|
|
announced_at: NOW - 92 * 86400,
|
|
review_count: 3,
|
|
rating_avg: 4.3,
|
|
rating_distribution: dist(1, 2),
|
|
last_review_at: NOW - 40 * 86400,
|
|
federation_id: 'a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90',
|
|
modules: ['ln', 'mint', 'wallet', 'meta'],
|
|
network: 'mainnet',
|
|
status_source: null,
|
|
},
|
|
{
|
|
// The healthy LNURL card: blue glow, LNURL badge, a withdraw range in the third
|
|
// cell, and the lightning address under it.
|
|
...lnurlBase,
|
|
host: 'fixture-lnurl-online',
|
|
url: 'lnurl:https://lnurl.example',
|
|
base_url: 'https://lnurl.example',
|
|
name: null,
|
|
icon: null,
|
|
},
|
|
{
|
|
// Offline 20 days: red glow beats the blue one, warning cell replaces the range.
|
|
// The blue badge stays, because which ecosystem it is has not changed.
|
|
...lnurlBase,
|
|
host: 'fixture-lnurl-offline',
|
|
url: 'lnurl:https://lnurl.gone.example',
|
|
base_url: 'https://lnurl.gone.example',
|
|
name: 'Departed Notes',
|
|
icon: null,
|
|
status: 'offline',
|
|
last_online: NOW - 20 * 86400,
|
|
rating_avg: 2.1,
|
|
rating_distribution: dist(0, 1, 1, 3, 5),
|
|
review_count: 10,
|
|
},
|
|
{
|
|
// A withdraw ceiling of zero, while ONLINE: green status chip stays, and the
|
|
// critical warning cell appears anyway. The one card that must never print
|
|
// "max 0 sat" as though it were a limit.
|
|
...lnurlBase,
|
|
host: 'fixture-lnurl-no-withdrawals',
|
|
url: 'lnurl:https://lnurl.locked.example',
|
|
base_url: 'https://lnurl.locked.example',
|
|
name: 'Locked Notes Mint',
|
|
icon: null,
|
|
min_withdrawable_msat: 0,
|
|
max_withdrawable_msat: 0,
|
|
},
|
|
];
|