@wagmi/core 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1771,7 +1771,10 @@ var InjectedConnector = class extends Connector {
1771
1771
  provider.on("disconnect", this.onDisconnect);
1772
1772
  }
1773
1773
  this.emit("message", { type: "connecting" });
1774
- const account = await this.getAccount();
1774
+ const accounts = await provider.request({
1775
+ method: "eth_requestAccounts"
1776
+ });
1777
+ const account = getAddress(accounts[0]);
1775
1778
  let id = await this.getChainId();
1776
1779
  let unsupported = this.isChainUnsupported(id);
1777
1780
  if (chainId2 && id !== chainId2) {
@@ -1805,7 +1808,7 @@ var InjectedConnector = class extends Connector {
1805
1808
  if (!provider)
1806
1809
  throw new ConnectorNotFoundError();
1807
1810
  const accounts = await provider.request({
1808
- method: "eth_requestAccounts"
1811
+ method: "eth_accounts"
1809
1812
  });
1810
1813
  return getAddress(accounts[0]);
1811
1814
  }
@@ -1837,10 +1840,7 @@ var InjectedConnector = class extends Connector {
1837
1840
  const provider = await this.getProvider();
1838
1841
  if (!provider)
1839
1842
  throw new ConnectorNotFoundError();
1840
- const accounts = await provider.request({
1841
- method: "eth_accounts"
1842
- });
1843
- const account = accounts[0];
1843
+ const account = await this.getAccount();
1844
1844
  return !!account;
1845
1845
  } catch {
1846
1846
  return false;
@@ -5,7 +5,7 @@ import {
5
5
  SwitchChainError,
6
6
  UserRejectedRequestError,
7
7
  normalizeChainId
8
- } from "../chunk-FJTAQ7YO.js";
8
+ } from "../chunk-MS4CUBFJ.js";
9
9
  import "../chunk-4DNFSL2K.js";
10
10
  import {
11
11
  __privateAdd,
@@ -4,7 +4,7 @@ import {
4
4
  ResourceUnavailableError,
5
5
  UserRejectedRequestError,
6
6
  getClient
7
- } from "../chunk-FJTAQ7YO.js";
7
+ } from "../chunk-MS4CUBFJ.js";
8
8
  import "../chunk-4DNFSL2K.js";
9
9
  import {
10
10
  __privateAdd,
@@ -14,6 +14,7 @@ import {
14
14
  } from "../chunk-MQXBDTVK.js";
15
15
 
16
16
  // src/connectors/metaMask.ts
17
+ import { getAddress } from "ethers/lib/utils.js";
17
18
  var _provider, _UNSTABLE_shimOnConnectSelectAccount, _getReady, getReady_fn, _findProvider, findProvider_fn;
18
19
  var MetaMaskConnector = class extends InjectedConnector {
19
20
  constructor({
@@ -46,18 +47,22 @@ var MetaMaskConnector = class extends InjectedConnector {
46
47
  provider.on("disconnect", this.onDisconnect);
47
48
  }
48
49
  this.emit("message", { type: "connecting" });
50
+ let account = null;
49
51
  if (__privateGet(this, _UNSTABLE_shimOnConnectSelectAccount) && this.options?.shimDisconnect && !getClient().storage?.getItem(this.shimDisconnectKey)) {
50
- const accounts = await provider.request({
51
- method: "eth_accounts"
52
- }).catch(() => []);
53
- const isConnected = !!accounts[0];
52
+ account = await this.getAccount().catch(() => null);
53
+ const isConnected = !!account;
54
54
  if (isConnected)
55
55
  await provider.request({
56
56
  method: "wallet_requestPermissions",
57
57
  params: [{ eth_accounts: {} }]
58
58
  });
59
59
  }
60
- const account = await this.getAccount();
60
+ if (!account) {
61
+ const accounts = await provider.request({
62
+ method: "eth_requestAccounts"
63
+ });
64
+ account = getAddress(accounts[0]);
65
+ }
61
66
  let id = await this.getChainId();
62
67
  let unsupported = this.isChainUnsupported(id);
63
68
  if (chainId && id !== chainId) {
@@ -2,7 +2,7 @@ import {
2
2
  Connector,
3
3
  UserRejectedRequestError,
4
4
  normalizeChainId
5
- } from "../../chunk-FJTAQ7YO.js";
5
+ } from "../../chunk-MS4CUBFJ.js";
6
6
  import "../../chunk-4DNFSL2K.js";
7
7
  import {
8
8
  __privateAdd,
@@ -4,7 +4,7 @@ import {
4
4
  UserRejectedRequestError,
5
5
  getClient,
6
6
  normalizeChainId
7
- } from "../chunk-FJTAQ7YO.js";
7
+ } from "../chunk-MS4CUBFJ.js";
8
8
  import "../chunk-4DNFSL2K.js";
9
9
  import {
10
10
  __privateAdd,
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ import {
69
69
  watchSigner,
70
70
  watchWebSocketProvider,
71
71
  writeContract
72
- } from "./chunk-FJTAQ7YO.js";
72
+ } from "./chunk-MS4CUBFJ.js";
73
73
  import {
74
74
  alchemyRpcUrls,
75
75
  allChains,
package/dist/internal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  debounce
3
- } from "./chunk-FJTAQ7YO.js";
3
+ } from "./chunk-MS4CUBFJ.js";
4
4
  import "./chunk-4DNFSL2K.js";
5
5
  import "./chunk-MQXBDTVK.js";
6
6
  export {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wagmi/core",
3
3
  "description": "Vanilla JS library for Ethereum",
4
4
  "license": "MIT",
5
- "version": "0.7.4",
5
+ "version": "0.7.5",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/wagmi-dev/wagmi.git",