Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nine-penguins-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-js': patch
---

Bug fix: 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.
14 changes: 8 additions & 6 deletions packages/clerk-js/src/utils/injectedWeb3Providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ class InjectedWeb3Providers {
}

get = (provider: InjectedWeb3Provider) => {
// In case there is a single injected provider, use that directly.
// This is needed in order to support other compatible Web3 Wallets (e.g. Rabby Wallet)
// and maintain the previous behavior
if (this.#providers.length === 1) {
return this.#providers[0].provider;
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 blocking it
return window.ethereum;
};

#onAnnouncement = (event: EIP6963AnnounceProviderEvent) => {
Expand Down
Loading