Expand ecash explorer capabilities
Add Fedimint discovery, dual SQLite/Postgres storage, richer review handling, and generated social imagery.
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* The edge cases the template must survive, as synthetic API payloads.
|
||||
*
|
||||
* Run through the same cashuModel/fedimintModel 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 },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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,
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user