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.
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
manageWalletConnectSession
method toBaseWallet
class for centralized session managementconnect
,disconnect
, andsetActive
methods in Defly and Pera (v1) wallet classes to use the new session management approachclient.disconnect()
to prevent race conditionsThese 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