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

fix: mm request permissions on request accounts pending #656

Merged
merged 3 commits into from
Dec 12, 2023

Conversation

gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Dec 8, 2023

See MetaMask/metamask-extension#10085 for reference

tl;dr is MM API doesn't make any sense, and doesn't allow for eth_requestAccounts requests if there's already a pending one. This will throw errors and make users unable to unlock their wallet, effectively being in an infinite loop.

Having request/s pending could happen if users dismissed previous connection requests and/or wallet unlock, or worse, if MM popup never properly popped up and discretely went with a notification instead (which can sometimes happen and is out of our control).

This PR uses wallet_requestPermissions instead when the former failed. That will ensure MM properly pops up when it should, the downside of this being users will have to "reconnect" accounts even if they're already connected.

Screenshots

(Don't mind the slowness / snap UI missing, this was with localhost debugging)

Untitled.mov

Issue

Relates to web's shapeshift/web#5453

Copy link

vercel bot commented Dec 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hdwallet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2023 8:55am

@gomesalexandre gomesalexandre changed the title fix: mm requesdt permissions on request accounts pending" fix: mm request permissions on request accounts pending" Dec 8, 2023
Copy link
Contributor Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@gomesalexandre gomesalexandre changed the title fix: mm request permissions on request accounts pending" fix: mm request permissions on request accounts pending Dec 8, 2023
@gomesalexandre gomesalexandre marked this pull request as ready for review December 9, 2023 16:17
@gomesalexandre gomesalexandre force-pushed the feat_mm_locked_request_ccounts branch 2 times, most recently from ef411a8 to 32b94e8 Compare December 11, 2023 08:37
Copy link
Contributor

@0xApotheosis 0xApotheosis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a really annoying UX moderately annoying 🙏

Played with wallet_requestPermissions and confirmed it does what we want it to do by forcing the Metamask window to open (albeit forcing the user to reselect accounts, but it's a definite improvement nonetheless!).

@gomesalexandre gomesalexandre merged commit f18450c into master Dec 12, 2023
6 checks passed
@gomesalexandre gomesalexandre deleted the feat_mm_locked_request_ccounts branch December 12, 2023 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants