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: resolves #3165 #3779

Merged
merged 2 commits into from
Apr 1, 2024
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
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
Loading