Skip to content

Commit

Permalink
fix: resolves #3165 (#3779)
Browse files Browse the repository at this point in the history
* fix: resolves #3165

* Create dull-pants-juggle.md
  • Loading branch information
jxom committed Apr 1, 2024
1 parent b3b54ef commit 3da20bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/dull-pants-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wagmi/core": patch
"wagmi": patch
---

Fixed an issue where `eth_requestAccounts` would be called upon reconnect instead of `eth_accounts`.
4 changes: 1 addition & 3 deletions packages/core/src/connectors/injected.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
type Address,
type EIP1193Provider,
type ProviderConnectInfo,
ProviderRpcError,
Expand Down Expand Up @@ -145,9 +144,8 @@ export function injected(parameters: InjectedParameters = {}) {
const provider = await this.getProvider()
if (!provider) throw new ProviderNotFoundError()

let accounts: readonly Address[] | null = null
let accounts = await this.getAccounts().catch(() => null)
if (!isReconnecting) {
accounts = await this.getAccounts().catch(() => null)
// Attempt to show another prompt for selecting account if already connected and `shimDisconnect` flag is enabled
const isAuthorized = shimDisconnect && !!accounts?.length
if (isAuthorized)
Expand Down

0 comments on commit 3da20bb

Please sign in to comment.