From a903ff0b8d4e72445c94c27dabb788da80c01cb1 Mon Sep 17 00:00:00 2001 From: The Joel Date: Fri, 24 Apr 2026 13:29:18 +0100 Subject: [PATCH 01/22] feat: implement Sign-In With Stellar (SIWS) authentication and wallet session management hooks --- apps/web/components/navigation/top-nav.tsx | 6 +- .../components/ui/network-mismatch-banner.tsx | 64 +++++-- apps/web/components/wallet/wallet-connect.tsx | 22 +-- apps/web/hooks/use-wallet-session.ts | 180 ++++++------------ apps/web/lib/siws.ts | 29 +-- apps/web/lib/stellar.ts | 12 +- apps/web/lib/store/use-wallet-store.ts | 10 +- backend/src/routes/auth.rs | 32 ++-- 8 files changed, 163 insertions(+), 192 deletions(-) diff --git a/apps/web/components/navigation/top-nav.tsx b/apps/web/components/navigation/top-nav.tsx index a329cc6e..0d780d32 100644 --- a/apps/web/components/navigation/top-nav.tsx +++ b/apps/web/components/navigation/top-nav.tsx @@ -132,7 +132,7 @@ export function TopNav({ onOpenSidebar }: { onOpenSidebar?: () => void }) { )} {networkMismatch ? ( - + ) : null} @@ -166,9 +166,9 @@ export function TopNav({ onOpenSidebar }: { onOpenSidebar?: () => void }) { )} {networkMismatch ? ( - + - {walletNetwork} vs {appNetwork} + Network Mismatch ) : null} {error ? ( diff --git a/apps/web/components/ui/network-mismatch-banner.tsx b/apps/web/components/ui/network-mismatch-banner.tsx index 143adc68..b8997bdb 100644 --- a/apps/web/components/ui/network-mismatch-banner.tsx +++ b/apps/web/components/ui/network-mismatch-banner.tsx @@ -1,25 +1,61 @@ "use client"; -import { AlertTriangle } from "lucide-react"; -import { useAuthStore } from "@/lib/store/use-auth-store"; +import { TriangleAlert, ArrowRightLeft, X } from "lucide-react"; +import { useWalletStore } from "@/lib/store/use-wallet-store"; +import { APP_STELLAR_NETWORK } from "@/lib/stellar"; +import { cn } from "@/lib/utils"; export function NetworkMismatchBanner() { - const networkMismatch = useAuthStore((state) => state.networkMismatch); + const { networkMismatch, setNetworkMismatch } = useWalletStore(); if (!networkMismatch) return null; return ( -
-