feat(demo): network/wallet dummy data — profits, federation, VPN, nostr, visibility
- wallet.networking-profits = 5,231,978 sats (content 3,180,000 / routing 1,281,978 / relay 770,000); 6 labelled profit transactions added to the wallet history (1-2 per type: content sale, routing fee, file/mesh relay) — labels are production-ready. - federation.list (the Web5 Federation container's method) now returns the 12 demo nodes (was unhandled → empty). - vpn.status: connected WireGuard with peers + traffic. - nostr.list-relays / nostr.get-stats: 5 relays (3 connected). - network.get/set-visibility: interactive, persisted per demo session. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b99c4a604f
commit
c991e61a8f
@ -137,6 +137,14 @@ const SEED_WALLET = {
|
||||
{ tx_hash: 'ab12cd34ef5678901234567890abcdef12345678', amount_sats: 2_000_000, direction: 'incoming', num_confirmations: 142, block_height: 892310, time_stamp: Math.floor(Date.now()/1000) - 86400, label: 'Channel funding', total_fees: 0, dest_addresses: [] },
|
||||
{ tx_hash: 'cd34ef5678901234567890abcdef1234567890ab', amount_sats: 250_000, direction: 'incoming', num_confirmations: 28, block_height: 892420, time_stamp: Math.floor(Date.now()/1000) - 7200, label: 'Faucet deposit', total_fees: 0, dest_addresses: [] },
|
||||
{ tx_hash: 'ff99ee88dd7766554433221100aabbccddeeff00', amount_sats: 100_000, direction: 'incoming', num_confirmations: 0, block_height: 0, time_stamp: Math.floor(Date.now()/1000) - 600, label: 'Incoming from faucet', total_fees: 0, dest_addresses: [] },
|
||||
// Networking profits — one or two per type, with human labels (these labels
|
||||
// are intended for the production wallet UI too).
|
||||
{ tx_hash: '1a2b3c4d5e6f78901234567890abcdef11111111', amount_sats: 480_000, direction: 'incoming', num_confirmations: 64, block_height: 892387, time_stamp: Math.floor(Date.now()/1000) - 18000, label: 'Content sale · “Lightning Demo.mp4”', profit_type: 'content_sales', total_fees: 0, dest_addresses: [] },
|
||||
{ tx_hash: '2b3c4d5e6f7890abcdef1234567890abcd222222', amount_sats: 312_500, direction: 'incoming', num_confirmations: 110, block_height: 892341, time_stamp: Math.floor(Date.now()/1000) - 43200, label: 'Content sale · “Sovereign Computing.pdf”', profit_type: 'content_sales', total_fees: 0, dest_addresses: [] },
|
||||
{ tx_hash: '3c4d5e6f7890abcdef1234567890abcdef333333', amount_sats: 1_842, direction: 'incoming', num_confirmations: 12, block_height: 892439, time_stamp: Math.floor(Date.now()/1000) - 3600, label: 'Lightning routing fee', profit_type: 'routing_fees', total_fees: 0, dest_addresses: [] },
|
||||
{ tx_hash: '4d5e6f7890abcdef1234567890abcdef44444444', amount_sats: 906, direction: 'incoming', num_confirmations: 5, block_height: 892446, time_stamp: Math.floor(Date.now()/1000) - 1500, label: 'Lightning routing fee', profit_type: 'routing_fees', total_fees: 0, dest_addresses: [] },
|
||||
{ tx_hash: '5e6f7890abcdef1234567890abcdef5555555555', amount_sats: 64_200, direction: 'incoming', num_confirmations: 38, block_height: 892410, time_stamp: Math.floor(Date.now()/1000) - 9000, label: 'File relay reward', profit_type: 'relay', total_fees: 0, dest_addresses: [] },
|
||||
{ tx_hash: '6f7890abcdef1234567890abcdef666666666666', amount_sats: 28_750, direction: 'incoming', num_confirmations: 21, block_height: 892428, time_stamp: Math.floor(Date.now()/1000) - 5400, label: 'Mesh relay forwarding fee', profit_type: 'relay', total_fees: 0, dest_addresses: [] },
|
||||
],
|
||||
}
|
||||
function randomHex(bytes) { return Array.from({length: bytes}, () => Math.floor(Math.random()*256).toString(16).padStart(2,'0')).join('') }
|
||||
@ -208,7 +216,7 @@ function seedUserState() {
|
||||
}
|
||||
|
||||
function seedMockState() {
|
||||
return { analyticsEnabled: false }
|
||||
return { analyticsEnabled: false, nodeVisibility: 'discoverable' }
|
||||
}
|
||||
|
||||
console.log(`[Auth] Dev mode: ${DEV_MODE}${DEMO ? ' (DEMO multi-session)' : ''}`)
|
||||
@ -1872,6 +1880,18 @@ app.post('/rpc/v1', (req, res) => {
|
||||
// =========================================================================
|
||||
// Nostr
|
||||
// =========================================================================
|
||||
case 'nostr.list-relays': {
|
||||
return res.json({ result: { relays: [
|
||||
{ url: 'wss://relay.damus.io', connected: true, enabled: true, added_at: '2026-04-02T10:00:00Z' },
|
||||
{ url: 'wss://nos.lol', connected: true, enabled: true, added_at: '2026-04-02T10:00:00Z' },
|
||||
{ url: 'wss://relay.snort.social', connected: true, enabled: true, added_at: '2026-04-10T08:30:00Z' },
|
||||
{ url: 'wss://nostr.wine', connected: false, enabled: true, added_at: '2026-05-01T14:00:00Z' },
|
||||
{ url: 'wss://relay.archipelago.lan', connected: true, enabled: false, added_at: '2026-05-20T09:15:00Z' },
|
||||
] } })
|
||||
}
|
||||
case 'nostr.get-stats': {
|
||||
return res.json({ result: { total_relays: 5, connected_count: 3, enabled_count: 4 } })
|
||||
}
|
||||
case 'nostr.add-relay': {
|
||||
const { url } = params || {}
|
||||
console.log(`[Nostr] Added relay: ${url}`)
|
||||
@ -1886,6 +1906,36 @@ app.post('/rpc/v1', (req, res) => {
|
||||
return res.json({ result: { success: true } })
|
||||
}
|
||||
|
||||
// VPN (WireGuard) status
|
||||
case 'vpn.status': {
|
||||
return res.json({ result: {
|
||||
connected: true,
|
||||
provider: 'wireguard',
|
||||
interface: 'wg0',
|
||||
ip_address: '10.64.12.7',
|
||||
hostname: 'archipelago-demo',
|
||||
peers_connected: 3,
|
||||
bytes_in: 1_843_201_004,
|
||||
bytes_out: 642_889_310,
|
||||
} })
|
||||
}
|
||||
|
||||
// Node visibility — interactive (persisted per demo session)
|
||||
case 'network.get-visibility': {
|
||||
return res.json({ result: {
|
||||
visibility: mockState.nodeVisibility,
|
||||
onion_address: mockData['server-info']['tor-address'],
|
||||
} })
|
||||
}
|
||||
case 'network.set-visibility': {
|
||||
const v = params?.visibility
|
||||
if (['hidden', 'discoverable', 'public'].includes(v)) mockState.nodeVisibility = v
|
||||
return res.json({ result: {
|
||||
visibility: mockState.nodeVisibility,
|
||||
onion_address: mockData['server-info']['tor-address'],
|
||||
} })
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Content & Network
|
||||
// =========================================================================
|
||||
@ -2249,6 +2299,7 @@ app.post('/rpc/v1', (req, res) => {
|
||||
// =====================================================================
|
||||
// Federation (multi-node clusters)
|
||||
// =====================================================================
|
||||
case 'federation.list':
|
||||
case 'federation.list-nodes': {
|
||||
return res.json({ result: { nodes: demoFederationNodes() } })
|
||||
}
|
||||
@ -2966,11 +3017,16 @@ app.post('/rpc/v1', (req, res) => {
|
||||
case 'wallet.networking-profits': {
|
||||
return res.json({
|
||||
result: {
|
||||
total_earned_sats: 42,
|
||||
total_forwarded_sats: 35025,
|
||||
forward_count: 3,
|
||||
total_sats: 5_231_978,
|
||||
content_sales_sats: 3_180_000,
|
||||
routing_fees_sats: 1_281_978,
|
||||
relay_sats: 770_000,
|
||||
// legacy aliases kept for older UI builds
|
||||
total_earned_sats: 5_231_978,
|
||||
total_forwarded_sats: 1_281_978,
|
||||
forward_count: 1284,
|
||||
period_days: 30,
|
||||
daily_avg_sats: 1.4,
|
||||
daily_avg_sats: 174_399,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user