From beb25f73135fdfc4ecdca73d2aa7d8b0f1d3d991 Mon Sep 17 00:00:00 2001 From: yilkash <260288456+yilkash@users.noreply.github.com> Date: Sun, 18 Oct 2026 16:17:36 +0100 Subject: [PATCH] feat: surface data freshness and node health on market views Adds a shared health monitor (Stellar RPC + backend API + realtime socket), a navbar health indicator, a shared SourceTag with ledger id and read age, on-chain market reads stamped with the ledger they came from, and a staleness guard before trades are signed. --- app/layout.tsx | 13 +- app/markets/page.tsx | 21 +-- app/markets/quick-view/page.tsx | 31 ++-- components/layout/HealthIndicator.tsx | 114 ++++++++++++++ components/layout/Navbar.tsx | 2 + components/ui/source-tag.tsx | 57 +++++++ lib/health/HealthProvider.tsx | 72 +++++++++ lib/health/useTicker.ts | 40 +++++ lib/hooks/useStellar.ts | 6 +- lib/realtime/RealtimeProvider.tsx | 19 ++- lib/stellar/__tests__/health.test.ts | 166 ++++++++++++++++++++ lib/stellar/health.ts | 216 ++++++++++++++++++++++++++ 12 files changed, 720 insertions(+), 37 deletions(-) create mode 100644 components/layout/HealthIndicator.tsx create mode 100644 components/ui/source-tag.tsx create mode 100644 lib/health/HealthProvider.tsx create mode 100644 lib/health/useTicker.ts create mode 100644 lib/stellar/__tests__/health.test.ts create mode 100644 lib/stellar/health.ts diff --git a/app/layout.tsx b/app/layout.tsx index 5e2ec51..8c7d24b 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -5,6 +5,7 @@ import { Footer } from "@/components/layout/Footer"; import { WalletProvider } from "@/lib/contexts/WalletContext"; import "./globals.css"; import { RealtimeProvider } from "@/lib/realtime/RealtimeProvider"; +import { HealthProvider } from "@/lib/health/HealthProvider"; import { InboxProvider } from "@/lib/notifications/InboxProvider"; const geistSans = { @@ -43,11 +44,13 @@ export default function RootLayout({ - - - {children} -