Skip to content

V2-FE-006: Implement real wallet connection lifecycle - #300

Open
abdullahilateefat03-boop wants to merge 1 commit into
DigiNodes:mainfrom
abdullahilateefat03-boop:feat/v2-fe-006-wallet
Open

V2-FE-006: Implement real wallet connection lifecycle#300
abdullahilateefat03-boop wants to merge 1 commit into
DigiNodes:mainfrom
abdullahilateefat03-boop:feat/v2-fe-006-wallet

Conversation

@abdullahilateefat03-boop

@abdullahilateefat03-boop abdullahilateefat03-boop commented Sep 1, 2026

Copy link
Copy Markdown

Closes #241

Changes

Implements the canonical EVM/Wagmi wallet connection lifecycle for TruthBounty frontend, replacing incomplete connection state handling with a complete lifecycle contract.

Implementation Details

useAccount Hook: Central EVM account adapter

  • Returns null when wallet is disconnected to prevent phantom connected state
  • Exposes lifecycle metadata: address, chain, isConnecting, isReconnecting, connector, connectorError
  • Hydration-safe: guards against SSR mismatches

useWallet Hook: App-facing wallet state adapter

  • Full lifecycle exposure: address, chainId, isConnected, isReconnecting, connectorInfo, connectorError
  • Canonical Wagmi hooks as source of truth
  • Connection actions: connect, disconnect, switchChain

Wallet Preference Storage: Minimal, non-sensitive persistence

  • Persists only connector ID and chain ID
  • Hydration-safe read/write
  • Optional storage abstraction

Configuration: TypeScript and environment fixes

  • Added Node and Jest type definitions to tsconfig
  • Installed @types/jest for test environment
  • Fixed malformed test block in claim-submission integration test

Testing

Wallet lifecycle verification passing:

  • useAccount lifecycle tests (connected, disconnected, reconnecting states)
  • useWallet state and actions tests
  • 4 tests passing, 0 failures

Related Issue

Fixes #V2-FE-006

…EVM/Wagmi patterns

- Add lifecycle metadata to useAccount: address, chain, isConnecting, isReconnecting, connector, connectorError
- Return null when wallet is disconnected to prevent phantom connected state
- Implement useWallet hook as app-facing wallet state adapter exposing full lifecycle
- Add minimal localStorage persistence for wallet preference (connector + chain only)
- Update TypeScript config to include Node and Jest types for proper test environment
- Add @types/jest to devDependencies for test type resolution
- Fix malformed test block in claim-submission integration test
- Ensure hydration-safe rendering of wallet connection status

Fixes V2-FE-006
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.

V2-FE-006 — Implement Real Wallet Connection Lifecycle

1 participant