Skip to content

refactor: Wallet Connection Bug Fix (#503, Issue #105)#574

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Muyideen-js:muyideen-js
May 29, 2026
Merged

refactor: Wallet Connection Bug Fix (#503, Issue #105)#574
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Muyideen-js:muyideen-js

Conversation

@Muyideen-js
Copy link
Copy Markdown
Contributor

Closes #503

Overview

This PR addresses issue #503 (referencing #105) by implementing comprehensive bug fixes and proper event handling for the Web3 Wallet Connection flow.

Changes Made

  • Starknet Event Handling: Added event listeners (accountsChanged and networkChanged) to the Starknet provider in useWeb3Wallet.ts to mirror the MetaMask implementation.
  • Robust Event Cleanup: Implemented conditional checks to ensure compatibility with varied Starknet wallet extension APIs. When binding and unbinding listeners, the hook checks for the existence of .on(), .off(), or .removeListener() methods.
  • State Updates:
    • Empty Starknet accounts array triggers a disconnect.
    • Starknet network changes trigger a safe window reload to refresh contract references.
  • Unit Tests: Added a test case should update Starknet connection state when Starknet accountsChanged event is fired in useWeb3Wallet.test.ts verifying the disconnect flow.

Verification

  • Ran unit tests specifically for useWeb3Wallet.ts and WalletConnector.tsx.
  • Verified all 9 wallet connection unit tests pass successfully.
  • Confirmed no regressions were introduced to existing wallet connection modules.

- Add Starknet event listeners (accountsChanged, networkChanged) to useWeb3Wallet hook
- Ensure both MetaMask and Starknet wallet providers have proper event handling
- Gracefully handle Starknet wallets that may not support .on()/.off() methods
- Add unit test for Starknet accountsChanged event disconnection behavior
- All 9 wallet tests passing with no regressions
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@Muyideen-js Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER RUKAYAT-CODER merged commit 7039f90 into rinafcode:main May 29, 2026
2 of 8 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.

refactor Wallet Connection : Bug Fix (Issue 105)

2 participants