Context
src/lib/stellar.ts exposes connectWallet, but there is no React state around it, so components re-implement connection logic.
Acceptance criteria
- Add
src/hooks/useWallet.ts returning { publicKey, connected, connect, disconnect, network }.
connect calls connectWallet() and stores the pubkey; disconnect clears it (and localStorage).
- Persist the connected pubkey across reloads; re-validate Freighter availability on mount.
Technical notes
- Use
useState/useEffect; wrap in a context provider in App.tsx if preferred.
- Keep
lib/stellar.ts as the low-level signer.
Testing
- Unit test the hook with a mocked
stellar-sdk wallet.
Context
src/lib/stellar.tsexposesconnectWallet, but there is no React state around it, so components re-implement connection logic.Acceptance criteria
src/hooks/useWallet.tsreturning{ publicKey, connected, connect, disconnect, network }.connectcallsconnectWallet()and stores the pubkey;disconnectclears it (andlocalStorage).Technical notes
useState/useEffect; wrap in a context provider inApp.tsxif preferred.lib/stellar.tsas the low-level signer.Testing
stellar-sdkwallet.