chore: removes sdk terminate when accountsChanged comes in empty #1148
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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