-
Notifications
You must be signed in to change notification settings - Fork 295
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(clerk-js): Always invoke an injected Web3 Wallet provider #4734
fix(clerk-js): Always invoke an injected Web3 Wallet provider #4734
Conversation
🦋 Changeset detectedLatest commit: e1ae09e The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
const ethProvider = this.#providers.find(p => p.info.name === this.#providerIdMap[provider])?.provider; | ||
if (ethProvider !== undefined) { | ||
return ethProvider; | ||
} | ||
return this.#providers.find(p => p.info.name === this.#providerIdMap[provider])?.provider; | ||
|
||
// In case we weren't able to find the requested provider, fallback to the | ||
// global injected provider instead, if any, to allow the user to continue | ||
// the flow rather than be a no-op | ||
return window.ethereum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Maybe i'm mistaken, but i think we were doing this and we removed it.
- Is there a scenario where if want to request with metamask but the browser does not have it i should throw an error instead ? If yes, maybe the fallback needs to happen at the component level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- That's not what we were doing before. We were explicitly trying to find the requested provider (e.g. MetaMask, OKX Wallet etc) and if we couldn't, we weren't initiated the flow, giving the user the impression that the application is broken. If you mean even before the injected web3 provider logic, that was needed in order to avoid multiple web3 wallets to conflict
- Maybe we are looking to throw an error if there isn't a web3 provider available, but we are looking to investigate that in a different effort
When the requested Web3 provider cannot be found, use any other available injected Web3 Wallet provider, instead of blocking the sign-in/sign-up flow
78283ea
to
e1ae09e
Compare
Description
If we weren't able to find the exact requested Web3 Wallet provider, then we should fallback and use the injected provider in order for the user to be able to continue the flow
Before
before.mov
After
after.mov
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change