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

chore: removes sdk terminate when accountsChanged comes in empty #1148

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

christopherferreira9
Copy link
Collaborator

Explanation

Historically, when creating the initial versions of the SDK we wanted to create a mechanism to detect when a connection was terminated while the dapp was not on focus both on mobile and extension.
On mobile to mobile and mobile - desktop interactions we're able to do this async via socket server but with extension since we're wrapping the already existent injected provider, we don't make use of socket.io code so for the initial versions of the MMSDK we assumed that getting an event accountsChanged=[] would mean that the permitted accounts were removed from extension and thus the connection is no longer valid.
The problem with this approach is that when MetaMask extension is simply locked while keeping permissions it sends an accountsChanged=[] event as required by EIP-1193.

This PR addresses this issue removing the terminate from extension following the same behavior as when using wallet_api.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@christopherferreira9 christopherferreira9 requested a review from a team as a code owner November 27, 2024 15:59
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.16%. Comparing base (8ab1cf1) to head (fa15fcf).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...DK/InitializerManager/setupExtensionPreferences.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1148      +/-   ##
==========================================
- Coverage   74.26%   74.16%   -0.10%     
==========================================
  Files         181      181              
  Lines        4297     4296       -1     
  Branches     1052     1052              
==========================================
- Hits         3191     3186       -5     
- Misses       1106     1110       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@christopherferreira9 christopherferreira9 added the deploy Deploys the test dapps label Nov 27, 2024
@abretonc7s abretonc7s merged commit a535262 into main Nov 28, 2024
35 of 37 checks passed
@abretonc7s abretonc7s deleted the chore/remove-extension-terminate-accounts-changed branch November 28, 2024 04:53
@abretonc7s abretonc7s mentioned this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Deploys the test dapps
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants