Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wallets): add WalletConnect v1 session management #275

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

drichar
Copy link
Collaborator

@drichar drichar commented Sep 27, 2024

Description

This PR fixes the WalletConnect session management for Defly and Pera wallets, addressing the issues with session persistence and wallet switching described in issue #274. It implements a more robust approach to backing up and restoring WalletConnect sessions, resolving the problems with lost connections and improving overall wallet management reliability.

Details

  • Added manageWalletConnectSession method to BaseWallet class for centralized session management
  • Updated connect, disconnect, and setActive methods in Defly and Pera (v1) wallet classes to use the new session management approach
  • Implemented proper session backup and restoration when switching between wallets
  • Added a delay after client.disconnect() to prevent race conditions
  • Updated and expanded test cases to cover new functionality and edge cases

These changes ensure that WalletConnect sessions are properly maintained when connecting multiple wallets, preventing local storage key collisions and fixing issues caused by lost session data.

Closes #274

This commit introduces WalletConnect v1 session management functionality for Pera (v1) and Defly wallets to improve multi-wallet support.

- Added `manageWalletConnectSession` method to Pera and Defly wallet classes
- Implemented session backup and restore logic in `connect` and `setActive` methods
- Updated `StorageAdapter` mock in tests to handle WalletConnect data
- Added new test cases for WalletConnect session management
- Move `manageWalletConnectSession` to `BaseWallet`
- Update `connect`, `disconnect`, and `setActive` methods
- Add delay after disconnect to prevent race condition
- Adjust tests to reflect new behavior
@drichar drichar merged commit 484b2b5 into main Sep 27, 2024
1 check passed
@drichar drichar deleted the fix/274-walletconnect-collision branch September 27, 2024 22:28
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.

WalletConnect v1 session collision when connecting multiple wallets
1 participant