-
-
Notifications
You must be signed in to change notification settings - Fork 139
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: improves the react connected hook when using extension & emit terminate when using extension #1186
feat: improves the react connected hook when using extension & emit terminate when using extension #1186
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1186 +/- ##
==========================================
+ Coverage 74.40% 74.58% +0.18%
==========================================
Files 181 182 +1
Lines 4306 4321 +15
Branches 1057 1059 +2
==========================================
+ Hits 3204 3223 +19
+ Misses 1102 1098 -4 ☔ View full report in Codecov by Sentry. |
Quality Gate passedIssues Measures |
Explanation
This PR aims to improve the react connected hook when using the extension. Previously, the connected hook would always be true when using extension because
window.ethereum.isConnected
is always true as long as the extension is being detected. This now verifies if we have an account present meaning that it is actually connected to extension. If no account is present then it assumes it has been disconnected like mobile does (even though mobile relies on socket events to do this).Main changes:
connecting
andconnected
connected
based on the existence of an account or not sincewindow.ethereum.isConnected
is always true if extension is installedBefore
Screen.Recording.2025-01-08.at.4.15.33.PM.mov
After
Screen.Recording.2025-01-08.at.4.14.26.PM.mov
The Terminate event can also be caught from the dapp side when using extension:
References
Checklist