-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pera): add auto-connect for Pera Discover browser (#323)
* feat(pera): add auto-connect for Pera Discover browser Add automatic connection attempt when Pera wallet is initialized in the Pera Discover browser environment. The connection attempt is handled silently with appropriate logging for success and failure cases. * fix(pera): add window check to prevent SSR errors Add type check for window and navigator objects to prevent errors during server-side rendering. This ensures the Pera auto-connect feature only runs in browser environments. * refactor(pera): extract auto-connect logic into private method Extract auto-connect logic from constructor into a private async method for better error handling and testability. Update tests to use prototype mocking pattern consistent with other wallet implementations. - Move auto-connect logic into private `autoConnect` method - Use async/await with try/catch for better error handling - Update tests to mock method on prototype before wallet creation - Align test patterns with other wallet implementations * refactor(pera): move Pera auto-connect to resumeSession Move auto-connect logic from constructor to `resumeSession` method in Pera wallet implementations to fix SSR compatibility issues. Auto-connect now only triggers when no other wallet is active and after client-side hydration. * refactor(pera): remove unused autoConnect method Remove private `autoConnect` method from Pera wallet implementations since the functionality is now handled directly in resumeSession.
- Loading branch information
Showing
4 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters