Skip to content

feat: implement Queue Management for Wallet Connection#642

Merged
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
Akanimoh12:feat/wallet-connection-queue-management
Jun 3, 2026
Merged

feat: implement Queue Management for Wallet Connection#642
RUKAYAT-CODER merged 2 commits into
rinafcode:mainfrom
Akanimoh12:feat/wallet-connection-queue-management

Conversation

@Akanimoh12
Copy link
Copy Markdown
Contributor

Summary

  • Adds a WalletConnectionQueue class (src/utils/web3/walletQueue.ts) that serialises all wallet connection requests in FIFO order, preventing concurrent pop-ups and conflicting state updates.
  • Routes every connect() call in useWeb3Wallet and WalletProvider through a shared singleton queue instance.
  • Exposes queueStats from useWeb3Wallet so components can observe queue depth and processing state.
  • Exports the queue class, singleton, and related types from the src/utils/web3/ barrel.

Changes

File Change
src/utils/web3/walletQueue.ts New — WalletConnectionQueue class + singleton
src/utils/web3/index.ts Export queue class, singleton, and types
src/hooks/useWeb3Wallet.ts Route connect() through walletConnectionQueue.enqueue(); expose queueStats
src/providers/WalletProvider.tsx Route connect() through the same shared queue
src/utils/__tests__/walletQueue.test.ts New — unit tests for queue (FIFO order, error propagation, clear, stats)
src/hooks/__tests__/useWeb3Wallet.test.ts Extended — queue stats shape test, concurrent connect serialisation test

Testing Notes

  • WalletConnectionQueue unit tests cover: single success, single failure, FIFO serialisation, continue-after-failure, clear(), length/processing accessors.
  • useWeb3Wallet tests verify queueStats shape and that concurrent connect() calls are serialised.
  • All existing tests are preserved with no regressions.
  • Run locally: pnpm run type-check && pnpm run lint && pnpm run test

Acceptance Criteria Checklist

  • Wallet Connection properly implements Queue Management
  • All related tests pass
  • No regression in existing functionality
  • Code follows project coding standards
  • Performance impact is minimal (pure in-memory queue, zero external deps)
  • Security considerations addressed (queue prevents duplicate auth pop-ups)

Closes #391

Serialises concurrent wallet connection requests through a
WalletConnectionQueue so that rapid successive connect() calls never
fire multiple wallet pop-ups or produce conflicting state updates.

- Add WalletConnectionQueue class (FIFO, stats, clear()) in
  src/utils/web3/walletQueue.ts with a shared singleton export
- Route all connect() calls in useWeb3Wallet and WalletProvider
  through walletConnectionQueue.enqueue()
- Expose queueStats from useWeb3Wallet for observability
- Export queue types/singleton from the web3 barrel (utils/web3/index)
- Add unit tests for WalletConnectionQueue
- Add queue-related integration tests to useWeb3Wallet test suite

Closes rinafcode#391
@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

Kindly resolve conflict and fix workflow.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 3, 2026

@Akanimoh12 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

@Akanimoh12
Copy link
Copy Markdown
Contributor Author

Kindly resolve conflict and fix workflow.

Done

@RUKAYAT-CODER
Copy link
Copy Markdown
Contributor

Thanks for your contribution.

@RUKAYAT-CODER RUKAYAT-CODER merged commit 528c8bf into rinafcode:main Jun 3, 2026
3 of 6 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.

performance Wallet Connection : Queue Management

2 participants