From 2bd7d785f6f24ad2fb61347dde85917e4d307037 Mon Sep 17 00:00:00 2001 From: akintewe <85641756+akintewe@users.noreply.github.com> Date: Tue, 24 Feb 2026 09:59:36 +0100 Subject: [PATCH] feat(wallet): expose kit/network in context and wire NEXT_PUBLIC_STELLAR_NETWORK - Resolve NEXT_PUBLIC_STELLAR_NETWORK at module load: "pubnet" maps to WalletNetwork.PUBLIC, anything else (including unset) defaults to TESTNET - Pass the resolved network constant into StellarWalletsKit constructor instead of the previous hardcoded WalletNetwork.TESTNET - Add kit (StellarWalletsKit instance) and network (WalletNetwork) to StellarWalletContextType and the Provider value so consumers can sign transactions and inspect the active network without prop-drilling --- contexts/stellar-wallet-context.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/contexts/stellar-wallet-context.tsx b/contexts/stellar-wallet-context.tsx index a39a0064..32cc25bf 100644 --- a/contexts/stellar-wallet-context.tsx +++ b/contexts/stellar-wallet-context.tsx @@ -16,7 +16,13 @@ import { FREIGHTER_ID, } from "@creit.tech/stellar-wallets-kit"; +const network = + process.env.NEXT_PUBLIC_STELLAR_NETWORK === "pubnet" + ? WalletNetwork.PUBLIC + : WalletNetwork.TESTNET; + interface StellarWalletContextType { + kit: StellarWalletsKit; address: string | null; publicKey: string | null; isConnected: boolean; @@ -26,6 +32,7 @@ interface StellarWalletContextType { isLoading: boolean; isConnecting: boolean; error: string | null; + network: WalletNetwork; } const StellarWalletContext = createContext< @@ -52,7 +59,7 @@ export function StellarWalletProvider({ children }: { children: ReactNode }) { () => new StellarWalletsKit({ selectedWalletId: FREIGHTER_ID, - network: WalletNetwork.TESTNET, + network, modules: allowAllModules(), }) ); @@ -143,6 +150,7 @@ export function StellarWalletProvider({ children }: { children: ReactNode }) { return ( {children}