Skip to content

Commit

Permalink
Fix a bug where injected wallets with an empty providers array could …
Browse files Browse the repository at this point in the history
…not connect (#3220)
  • Loading branch information
rkalis authored Nov 15, 2023
1 parent 9cf46fa commit a195044
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hot-mails-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wagmi/connectors": patch
---

Fixed a bug where injected walets with an empty providers array could not connect
3 changes: 2 additions & 1 deletion packages/connectors/src/injected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class InjectedConnector extends Connector<
if (typeof window === 'undefined') return
const ethereum = (window as unknown as { ethereum?: WindowProvider })
.ethereum
if (ethereum?.providers) return ethereum.providers[0]
if (ethereum?.providers && ethereum.providers.length > 0)
return ethereum.providers[0]
return ethereum
},
...options_,
Expand Down

1 comment on commit a195044

@vercel
Copy link

@vercel vercel bot commented on a195044 Nov 15, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.