Skip to content

feat(frontend): add wallet session persistence and auto-reconnect#172

Merged
Wilfred007 merged 2 commits intoGildado:mainfrom
CMI-James-OD:codex/issue-149-wallet-session-reconnect
Feb 26, 2026
Merged

feat(frontend): add wallet session persistence and auto-reconnect#172
Wilfred007 merged 2 commits intoGildado:mainfrom
CMI-James-OD:codex/issue-149-wallet-session-reconnect

Conversation

@CMI-James
Copy link
Contributor

Description

Implement wallet session persistence, silent reconnect, extension availability banner, and Soroban invoke guard behavior.

Closes #149

Changes proposed

What were you told to do?

I was tasked with extending wallet session behavior so that:

  • Last connected wallet name is persisted and restored
  • Silent reconnect is attempted on app load before protected content renders
  • Missing wallet extension is surfaced as a persistent banner
  • Soroban invoke signing paths are guarded and prompt wallet connect when disconnected
  • isConnecting reflects reconnect attempts accurately

What did I do?

Added wallet session persistence and restore

Updated frontend/src/providers/WalletProvider.tsx to:

  • Persist wallet provider id in localStorage (payd:last_wallet_name) on connect
  • Restore saved wallet id on app startup
  • Clear stored wallet id on disconnect

Added silent reconnect on initialization

Provider now:

  • Attempts kit.getAddress() when a saved wallet exists
  • Sets isConnecting during silent reconnect
  • Marks provider as initialized only after reconnect attempt completes
  • Delays rendering children until initialization finishes (Restoring wallet session...)

Added extension-availability UX banner

Provider now detects wallet extension presence and shows a persistent warning banner when no supported extension is found.

Added requireWallet guard in wallet context

Extended wallet context API (frontend/src/hooks/useWallet.ts) with:

  • requireWallet() guard that prompts connect if disconnected
  • isInitialized and walletExtensionAvailable context state

Guarded signing flow against disconnected state

Updated frontend/src/hooks/useWalletSigning.ts to:

  • Call requireWallet() before signing
  • Prompt user to connect wallet when disconnected
  • Surface signing failures via notification
  • Expose readiness based on both address and connecting state

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

Screenshots / Testing Evidence

  • npm run lint could not be validated in this environment because frontend dependencies are not installed (eslint unavailable)
  • npm run build could not be fully validated in this environment due missing node_modules/type packages
  • Session restore, reconnect, and guard flow validated through static inspection of provider lifecycle and signing guard paths

@Wilfred007 Wilfred007 merged commit fb8b6c9 into Gildado:main Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#076: Wallet Session Persistence and Auto-Reconnect

2 participants