Skip to content

Comments

feat: Implement useWallet custom hook for wallet state management#90

Merged
Emmyt24 merged 1 commit intoEmmyt24:mainfrom
Rajkoli145:feat/use-wallet-hook
Feb 20, 2026
Merged

feat: Implement useWallet custom hook for wallet state management#90
Emmyt24 merged 1 commit intoEmmyt24:mainfrom
Rajkoli145:feat/use-wallet-hook

Conversation

@Rajkoli145
Copy link
Contributor

@Rajkoli145 Rajkoli145 commented Feb 20, 2026

Closes #3


Description

Implemented a custom useWallet hook to manage Stellar wallet state via Freighter. This includes:

  • A WalletService abstraction Layer for @stellar/freighter-api.
  • Persistent connection state using localStorage.
  • Reactive updates for account/network changes using WatchWalletChanges.
  • Comprehensive unit tests verifying connection logic and event handling.
  • Proper cleanup of listeners on unmount.

Changes

  • [NEW] frontend/src/hooks/useWallet.ts
  • [NEW] frontend/src/services/wallet.ts
  • [NEW] frontend/src/test/hooks/useWallet.test.ts
  • [MODIFY] frontend/package.json (Added @stellar/freighter-api)

Verification

  • Ran npm test - 7/7 tests passed.
  • Ran npm run type-check - No errors.

@Emmyt24 Emmyt24 merged commit 6bab9bb into Emmyt24:main Feb 20, 2026
1 of 2 checks 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.

Create useWallet React Hook

2 participants