@wagmi/core 0.5.0-prepare-hooks.0 → 0.5.0

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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/chains/dist/wagmi-core-chains.cjs.dev.js +2 -2
  3. package/chains/dist/wagmi-core-chains.cjs.prod.js +2 -2
  4. package/chains/dist/wagmi-core-chains.esm.js +2 -2
  5. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +4 -4
  6. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +4 -4
  7. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +4 -4
  8. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +4 -4
  9. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +4 -4
  10. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +4 -4
  11. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +5 -5
  12. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +5 -5
  13. package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +5 -5
  14. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +4 -4
  15. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +4 -4
  16. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +4 -4
  17. package/dist/{chains-b8e32454.cjs.prod.js → chains-13baf029.cjs.prod.js} +1 -1
  18. package/dist/{chains-174cf4b4.esm.js → chains-4b1a6cf8.esm.js} +1 -1
  19. package/dist/{chains-ba6218fb.cjs.dev.js → chains-a1aae67e.cjs.dev.js} +1 -1
  20. package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +0 -1
  21. package/dist/declarations/src/actions/contracts/deprecatedWriteContract.d.ts +16 -0
  22. package/dist/declarations/src/actions/{tokens → contracts}/fetchToken.d.ts +0 -0
  23. package/dist/declarations/src/actions/contracts/index.d.ts +2 -0
  24. package/dist/declarations/src/actions/contracts/writeContract.d.ts +2 -2
  25. package/dist/declarations/src/actions/index.d.ts +2 -3
  26. package/dist/declarations/src/actions/transactions/deprecatedSendTransaction.d.ts +12 -0
  27. package/dist/declarations/src/actions/transactions/fetchTransaction.d.ts +21 -0
  28. package/dist/declarations/src/actions/transactions/index.d.ts +2 -0
  29. package/dist/declarations/src/actions/transactions/sendTransaction.d.ts +2 -2
  30. package/dist/declarations/src/connectors/coinbaseWallet.d.ts +1 -1
  31. package/dist/declarations/src/connectors/mock/connector.d.ts +1 -1
  32. package/dist/declarations/src/connectors/mock/provider.d.ts +4 -3
  33. package/dist/declarations/src/connectors/walletConnect.d.ts +1 -1
  34. package/dist/declarations/src/constants/index.d.ts +1 -1
  35. package/dist/declarations/src/constants/rpcs.d.ts +2 -2
  36. package/dist/declarations/src/index.d.ts +2 -2
  37. package/dist/declarations/src/providers/alchemy.d.ts +2 -2
  38. package/dist/declarations/src/providers/infura.d.ts +2 -2
  39. package/dist/declarations/src/types/index.d.ts +1 -0
  40. package/dist/{getProvider-ec251513.cjs.dev.js → getProvider-5b369460.cjs.prod.js} +57 -55
  41. package/dist/{getProvider-048a69c4.esm.js → getProvider-dda5b21b.esm.js} +58 -56
  42. package/dist/{getProvider-27edfd38.cjs.prod.js → getProvider-e4848469.cjs.dev.js} +57 -55
  43. package/dist/{rpcs-1fd0a12f.cjs.prod.js → rpcs-3d4e8104.cjs.dev.js} +9 -9
  44. package/dist/{rpcs-f1d24f0e.cjs.dev.js → rpcs-4b3a7778.cjs.prod.js} +9 -9
  45. package/dist/{rpcs-b73a8f60.esm.js → rpcs-5dc0ea1f.esm.js} +8 -8
  46. package/dist/wagmi-core.cjs.dev.js +166 -49
  47. package/dist/wagmi-core.cjs.prod.js +166 -49
  48. package/dist/wagmi-core.esm.js +166 -52
  49. package/package.json +8 -4
  50. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.dev.js +5 -5
  51. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.prod.js +5 -5
  52. package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +5 -5
  53. package/providers/infura/dist/wagmi-core-providers-infura.cjs.dev.js +5 -5
  54. package/providers/infura/dist/wagmi-core-providers-infura.cjs.prod.js +5 -5
  55. package/providers/infura/dist/wagmi-core-providers-infura.esm.js +5 -5
  56. package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.d.ts +0 -1
  57. package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.dev.js +0 -200
  58. package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.js +0 -7
  59. package/connectors/injected/dist/wagmi-core-connectors-injected.cjs.prod.js +0 -200
  60. package/connectors/injected/dist/wagmi-core-connectors-injected.esm.js +0 -196
  61. package/connectors/walletLink/dist/wagmi-core-connectors-walletLink.cjs.d.ts +0 -11
  62. package/connectors/walletLink/dist/wagmi-core-connectors-walletLink.cjs.js +0 -16
  63. package/dist/declarations/src/actions/tokens/index.d.ts +0 -1
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var create = require('zustand/vanilla');
4
3
  var middleware = require('zustand/middleware');
4
+ var create = require('zustand/vanilla');
5
5
  var ethers = require('ethers');
6
6
  var utils = require('ethers/lib/utils');
7
7
  var EventEmitter = require('eventemitter3');
8
- var chains = require('./chains-ba6218fb.cjs.dev.js');
8
+ var chains = require('./chains-13baf029.cjs.prod.js');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
11
11
 
@@ -90,58 +90,6 @@ function _classPrivateFieldSet(receiver, privateMap, value) {
90
90
  return value;
91
91
  }
92
92
 
93
- function getInjectedName(ethereum) {
94
- var _ethereum$providers, _getName;
95
-
96
- if (!ethereum) return 'Injected';
97
-
98
- const getName = provider => {
99
- if (provider.isBraveWallet) return 'Brave Wallet';
100
- if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
101
- if (provider.isExodus) return 'Exodus';
102
- if (provider.isFrame) return 'Frame';
103
- if (provider.isOpera) return 'Opera';
104
- if (provider.isTally) return 'Tally';
105
- if (provider.isTokenPocket) return 'TokenPocket';
106
- if (provider.isTokenary) return 'Tokenary';
107
- if (provider.isTrust) return 'Trust Wallet';
108
- if (provider.isMetaMask) return 'MetaMask';
109
- }; // Some injected providers detect multiple other providers and create a list at `ethers.providers`
110
-
111
-
112
- if ((_ethereum$providers = ethereum.providers) !== null && _ethereum$providers !== void 0 && _ethereum$providers.length) {
113
- var _names$;
114
-
115
- // Deduplicate names using Set
116
- // Coinbase Wallet puts multiple providers in `ethereum.providers`
117
- const nameSet = new Set();
118
- let unknownCount = 1;
119
-
120
- for (const provider of ethereum.providers) {
121
- let name = getName(provider);
122
-
123
- if (!name) {
124
- name = "Unknown Wallet #".concat(unknownCount);
125
- unknownCount += 1;
126
- }
127
-
128
- nameSet.add(name);
129
- }
130
-
131
- const names = [...nameSet];
132
- if (names.length) return names;
133
- return (_names$ = names[0]) !== null && _names$ !== void 0 ? _names$ : 'Injected';
134
- }
135
-
136
- return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
137
- }
138
-
139
- function normalizeChainId(chainId) {
140
- if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
141
- if (typeof chainId === 'bigint') return Number(chainId);
142
- return chainId;
143
- }
144
-
145
93
  /**
146
94
  * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors per EIP-1474.
147
95
  * @see https://eips.ethereum.org/EIPS/eip-1474
@@ -227,7 +175,7 @@ class ChainMismatchError extends Error {
227
175
  activeChain,
228
176
  targetChain
229
177
  } = _ref2;
230
- super("Chain mismatch: Expected \"".concat(targetChain, "\", received \"").concat(activeChain, "."));
178
+ super("Chain mismatch: Expected \"".concat(targetChain, "\", received \"").concat(activeChain, "\"."));
231
179
 
232
180
  _defineProperty(this, "name", 'ChainMismatchError');
233
181
  }
@@ -361,6 +309,58 @@ class UserRejectedRequestError extends ProviderRpcError {
361
309
 
362
310
  }
363
311
 
312
+ function getInjectedName(ethereum) {
313
+ var _ethereum$providers, _getName;
314
+
315
+ if (!ethereum) return 'Injected';
316
+
317
+ const getName = provider => {
318
+ if (provider.isBraveWallet) return 'Brave Wallet';
319
+ if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
320
+ if (provider.isExodus) return 'Exodus';
321
+ if (provider.isFrame) return 'Frame';
322
+ if (provider.isOpera) return 'Opera';
323
+ if (provider.isTally) return 'Tally';
324
+ if (provider.isTokenPocket) return 'TokenPocket';
325
+ if (provider.isTokenary) return 'Tokenary';
326
+ if (provider.isTrust) return 'Trust Wallet';
327
+ if (provider.isMetaMask) return 'MetaMask';
328
+ }; // Some injected providers detect multiple other providers and create a list at `ethers.providers`
329
+
330
+
331
+ if ((_ethereum$providers = ethereum.providers) !== null && _ethereum$providers !== void 0 && _ethereum$providers.length) {
332
+ var _names$;
333
+
334
+ // Deduplicate names using Set
335
+ // Coinbase Wallet puts multiple providers in `ethereum.providers`
336
+ const nameSet = new Set();
337
+ let unknownCount = 1;
338
+
339
+ for (const provider of ethereum.providers) {
340
+ let name = getName(provider);
341
+
342
+ if (!name) {
343
+ name = "Unknown Wallet #".concat(unknownCount);
344
+ unknownCount += 1;
345
+ }
346
+
347
+ nameSet.add(name);
348
+ }
349
+
350
+ const names = [...nameSet];
351
+ if (names.length) return names;
352
+ return (_names$ = names[0]) !== null && _names$ !== void 0 ? _names$ : 'Injected';
353
+ }
354
+
355
+ return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
356
+ }
357
+
358
+ function normalizeChainId(chainId) {
359
+ if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
360
+ if (typeof chainId === 'bigint') return Number(chainId);
361
+ return chainId;
362
+ }
363
+
364
364
  class Connector extends EventEmitter__default["default"] {
365
365
  /** Unique connector id */
366
366
 
@@ -813,6 +813,8 @@ class Client {
813
813
  _classPrivateFieldSet(this, _lastUsedConnector, storage === null || storage === void 0 ? void 0 : storage.getItem('wallet'));
814
814
 
815
815
  _classPrivateMethodGet(this, _addEffects, _addEffects2).call(this);
816
+
817
+ if (autoConnect && typeof window !== 'undefined') setTimeout(async () => await this.autoConnect(), 0);
816
818
  }
817
819
 
818
820
  get chains() {
@@ -1,9 +1,9 @@
1
- import create from 'zustand/vanilla';
2
1
  import { subscribeWithSelector, persist } from 'zustand/middleware';
2
+ import create from 'zustand/vanilla';
3
3
  import { providers } from 'ethers';
4
4
  import { getAddress, hexValue } from 'ethers/lib/utils';
5
5
  import EventEmitter from 'eventemitter3';
6
- import { d as defaultChains } from './chains-174cf4b4.esm.js';
6
+ import { d as defaultChains } from './chains-4b1a6cf8.esm.js';
7
7
 
8
8
  function _checkPrivateRedeclaration(obj, privateCollection) {
9
9
  if (privateCollection.has(obj)) {
@@ -83,58 +83,6 @@ function _classPrivateFieldSet(receiver, privateMap, value) {
83
83
  return value;
84
84
  }
85
85
 
86
- function getInjectedName(ethereum) {
87
- var _ethereum$providers, _getName;
88
-
89
- if (!ethereum) return 'Injected';
90
-
91
- const getName = provider => {
92
- if (provider.isBraveWallet) return 'Brave Wallet';
93
- if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
94
- if (provider.isExodus) return 'Exodus';
95
- if (provider.isFrame) return 'Frame';
96
- if (provider.isOpera) return 'Opera';
97
- if (provider.isTally) return 'Tally';
98
- if (provider.isTokenPocket) return 'TokenPocket';
99
- if (provider.isTokenary) return 'Tokenary';
100
- if (provider.isTrust) return 'Trust Wallet';
101
- if (provider.isMetaMask) return 'MetaMask';
102
- }; // Some injected providers detect multiple other providers and create a list at `ethers.providers`
103
-
104
-
105
- if ((_ethereum$providers = ethereum.providers) !== null && _ethereum$providers !== void 0 && _ethereum$providers.length) {
106
- var _names$;
107
-
108
- // Deduplicate names using Set
109
- // Coinbase Wallet puts multiple providers in `ethereum.providers`
110
- const nameSet = new Set();
111
- let unknownCount = 1;
112
-
113
- for (const provider of ethereum.providers) {
114
- let name = getName(provider);
115
-
116
- if (!name) {
117
- name = "Unknown Wallet #".concat(unknownCount);
118
- unknownCount += 1;
119
- }
120
-
121
- nameSet.add(name);
122
- }
123
-
124
- const names = [...nameSet];
125
- if (names.length) return names;
126
- return (_names$ = names[0]) !== null && _names$ !== void 0 ? _names$ : 'Injected';
127
- }
128
-
129
- return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
130
- }
131
-
132
- function normalizeChainId(chainId) {
133
- if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
134
- if (typeof chainId === 'bigint') return Number(chainId);
135
- return chainId;
136
- }
137
-
138
86
  /**
139
87
  * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors per EIP-1474.
140
88
  * @see https://eips.ethereum.org/EIPS/eip-1474
@@ -220,7 +168,7 @@ class ChainMismatchError extends Error {
220
168
  activeChain,
221
169
  targetChain
222
170
  } = _ref2;
223
- super("Chain mismatch: Expected \"".concat(targetChain, "\", received \"").concat(activeChain, "."));
171
+ super("Chain mismatch: Expected \"".concat(targetChain, "\", received \"").concat(activeChain, "\"."));
224
172
 
225
173
  _defineProperty(this, "name", 'ChainMismatchError');
226
174
  }
@@ -354,6 +302,58 @@ class UserRejectedRequestError extends ProviderRpcError {
354
302
 
355
303
  }
356
304
 
305
+ function getInjectedName(ethereum) {
306
+ var _ethereum$providers, _getName;
307
+
308
+ if (!ethereum) return 'Injected';
309
+
310
+ const getName = provider => {
311
+ if (provider.isBraveWallet) return 'Brave Wallet';
312
+ if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
313
+ if (provider.isExodus) return 'Exodus';
314
+ if (provider.isFrame) return 'Frame';
315
+ if (provider.isOpera) return 'Opera';
316
+ if (provider.isTally) return 'Tally';
317
+ if (provider.isTokenPocket) return 'TokenPocket';
318
+ if (provider.isTokenary) return 'Tokenary';
319
+ if (provider.isTrust) return 'Trust Wallet';
320
+ if (provider.isMetaMask) return 'MetaMask';
321
+ }; // Some injected providers detect multiple other providers and create a list at `ethers.providers`
322
+
323
+
324
+ if ((_ethereum$providers = ethereum.providers) !== null && _ethereum$providers !== void 0 && _ethereum$providers.length) {
325
+ var _names$;
326
+
327
+ // Deduplicate names using Set
328
+ // Coinbase Wallet puts multiple providers in `ethereum.providers`
329
+ const nameSet = new Set();
330
+ let unknownCount = 1;
331
+
332
+ for (const provider of ethereum.providers) {
333
+ let name = getName(provider);
334
+
335
+ if (!name) {
336
+ name = "Unknown Wallet #".concat(unknownCount);
337
+ unknownCount += 1;
338
+ }
339
+
340
+ nameSet.add(name);
341
+ }
342
+
343
+ const names = [...nameSet];
344
+ if (names.length) return names;
345
+ return (_names$ = names[0]) !== null && _names$ !== void 0 ? _names$ : 'Injected';
346
+ }
347
+
348
+ return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
349
+ }
350
+
351
+ function normalizeChainId(chainId) {
352
+ if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
353
+ if (typeof chainId === 'bigint') return Number(chainId);
354
+ return chainId;
355
+ }
356
+
357
357
  class Connector extends EventEmitter {
358
358
  /** Unique connector id */
359
359
 
@@ -806,6 +806,8 @@ class Client {
806
806
  _classPrivateFieldSet(this, _lastUsedConnector, storage === null || storage === void 0 ? void 0 : storage.getItem('wallet'));
807
807
 
808
808
  _classPrivateMethodGet(this, _addEffects, _addEffects2).call(this);
809
+
810
+ if (autoConnect && typeof window !== 'undefined') setTimeout(async () => await this.autoConnect(), 0);
809
811
  }
810
812
 
811
813
  get chains() {
@@ -1011,4 +1013,4 @@ function getProvider() {
1011
1013
  return client.provider;
1012
1014
  }
1013
1015
 
1014
- export { AddChainError as A, ConnectorAlreadyConnectedError as C, InjectedConnector as I, ProviderChainsNotFound as P, ResourceUnavailableError as R, SwitchChainNotSupportedError as S, UserRejectedRequestError as U, _classPrivateMethodInitSpec as _, ConnectorNotFoundError as a, ContractMethodDoesNotExistError as b, getProvider as c, ChainDoesNotSupportMulticallError as d, ContractMethodNoResultError as e, ChainMismatchError as f, getClient as g, createClient as h, Client as i, Connector as j, ChainNotConfiguredError as k, ProviderRpcError as l, RpcError as m, normalizeChainId as n, SwitchChainError as o, createStorage as p, noopStorage as q, _defineProperty as r, _classPrivateFieldInitSpec as s, _classPrivateFieldGet as t, _classPrivateFieldSet as u, _classPrivateMethodGet as v };
1016
+ export { AddChainError as A, ConnectorAlreadyConnectedError as C, InjectedConnector as I, ProviderChainsNotFound as P, ResourceUnavailableError as R, SwitchChainNotSupportedError as S, UserRejectedRequestError as U, _classPrivateMethodInitSpec as _, ConnectorNotFoundError as a, ChainMismatchError as b, ContractMethodDoesNotExistError as c, getProvider as d, ChainDoesNotSupportMulticallError as e, ContractMethodNoResultError as f, getClient as g, createClient as h, Client as i, Connector as j, ChainNotConfiguredError as k, ProviderRpcError as l, RpcError as m, normalizeChainId as n, SwitchChainError as o, createStorage as p, noopStorage as q, _defineProperty as r, _classPrivateFieldInitSpec as s, _classPrivateFieldGet as t, _classPrivateFieldSet as u, _classPrivateMethodGet as v };
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var create = require('zustand/vanilla');
4
3
  var middleware = require('zustand/middleware');
4
+ var create = require('zustand/vanilla');
5
5
  var ethers = require('ethers');
6
6
  var utils = require('ethers/lib/utils');
7
7
  var EventEmitter = require('eventemitter3');
8
- var chains = require('./chains-b8e32454.cjs.prod.js');
8
+ var chains = require('./chains-a1aae67e.cjs.dev.js');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
11
11
 
@@ -90,58 +90,6 @@ function _classPrivateFieldSet(receiver, privateMap, value) {
90
90
  return value;
91
91
  }
92
92
 
93
- function getInjectedName(ethereum) {
94
- var _ethereum$providers, _getName;
95
-
96
- if (!ethereum) return 'Injected';
97
-
98
- const getName = provider => {
99
- if (provider.isBraveWallet) return 'Brave Wallet';
100
- if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
101
- if (provider.isExodus) return 'Exodus';
102
- if (provider.isFrame) return 'Frame';
103
- if (provider.isOpera) return 'Opera';
104
- if (provider.isTally) return 'Tally';
105
- if (provider.isTokenPocket) return 'TokenPocket';
106
- if (provider.isTokenary) return 'Tokenary';
107
- if (provider.isTrust) return 'Trust Wallet';
108
- if (provider.isMetaMask) return 'MetaMask';
109
- }; // Some injected providers detect multiple other providers and create a list at `ethers.providers`
110
-
111
-
112
- if ((_ethereum$providers = ethereum.providers) !== null && _ethereum$providers !== void 0 && _ethereum$providers.length) {
113
- var _names$;
114
-
115
- // Deduplicate names using Set
116
- // Coinbase Wallet puts multiple providers in `ethereum.providers`
117
- const nameSet = new Set();
118
- let unknownCount = 1;
119
-
120
- for (const provider of ethereum.providers) {
121
- let name = getName(provider);
122
-
123
- if (!name) {
124
- name = "Unknown Wallet #".concat(unknownCount);
125
- unknownCount += 1;
126
- }
127
-
128
- nameSet.add(name);
129
- }
130
-
131
- const names = [...nameSet];
132
- if (names.length) return names;
133
- return (_names$ = names[0]) !== null && _names$ !== void 0 ? _names$ : 'Injected';
134
- }
135
-
136
- return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
137
- }
138
-
139
- function normalizeChainId(chainId) {
140
- if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
141
- if (typeof chainId === 'bigint') return Number(chainId);
142
- return chainId;
143
- }
144
-
145
93
  /**
146
94
  * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors per EIP-1474.
147
95
  * @see https://eips.ethereum.org/EIPS/eip-1474
@@ -227,7 +175,7 @@ class ChainMismatchError extends Error {
227
175
  activeChain,
228
176
  targetChain
229
177
  } = _ref2;
230
- super("Chain mismatch: Expected \"".concat(targetChain, "\", received \"").concat(activeChain, "."));
178
+ super("Chain mismatch: Expected \"".concat(targetChain, "\", received \"").concat(activeChain, "\"."));
231
179
 
232
180
  _defineProperty(this, "name", 'ChainMismatchError');
233
181
  }
@@ -361,6 +309,58 @@ class UserRejectedRequestError extends ProviderRpcError {
361
309
 
362
310
  }
363
311
 
312
+ function getInjectedName(ethereum) {
313
+ var _ethereum$providers, _getName;
314
+
315
+ if (!ethereum) return 'Injected';
316
+
317
+ const getName = provider => {
318
+ if (provider.isBraveWallet) return 'Brave Wallet';
319
+ if (provider.isCoinbaseWallet) return 'Coinbase Wallet';
320
+ if (provider.isExodus) return 'Exodus';
321
+ if (provider.isFrame) return 'Frame';
322
+ if (provider.isOpera) return 'Opera';
323
+ if (provider.isTally) return 'Tally';
324
+ if (provider.isTokenPocket) return 'TokenPocket';
325
+ if (provider.isTokenary) return 'Tokenary';
326
+ if (provider.isTrust) return 'Trust Wallet';
327
+ if (provider.isMetaMask) return 'MetaMask';
328
+ }; // Some injected providers detect multiple other providers and create a list at `ethers.providers`
329
+
330
+
331
+ if ((_ethereum$providers = ethereum.providers) !== null && _ethereum$providers !== void 0 && _ethereum$providers.length) {
332
+ var _names$;
333
+
334
+ // Deduplicate names using Set
335
+ // Coinbase Wallet puts multiple providers in `ethereum.providers`
336
+ const nameSet = new Set();
337
+ let unknownCount = 1;
338
+
339
+ for (const provider of ethereum.providers) {
340
+ let name = getName(provider);
341
+
342
+ if (!name) {
343
+ name = "Unknown Wallet #".concat(unknownCount);
344
+ unknownCount += 1;
345
+ }
346
+
347
+ nameSet.add(name);
348
+ }
349
+
350
+ const names = [...nameSet];
351
+ if (names.length) return names;
352
+ return (_names$ = names[0]) !== null && _names$ !== void 0 ? _names$ : 'Injected';
353
+ }
354
+
355
+ return (_getName = getName(ethereum)) !== null && _getName !== void 0 ? _getName : 'Injected';
356
+ }
357
+
358
+ function normalizeChainId(chainId) {
359
+ if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
360
+ if (typeof chainId === 'bigint') return Number(chainId);
361
+ return chainId;
362
+ }
363
+
364
364
  class Connector extends EventEmitter__default["default"] {
365
365
  /** Unique connector id */
366
366
 
@@ -813,6 +813,8 @@ class Client {
813
813
  _classPrivateFieldSet(this, _lastUsedConnector, storage === null || storage === void 0 ? void 0 : storage.getItem('wallet'));
814
814
 
815
815
  _classPrivateMethodGet(this, _addEffects, _addEffects2).call(this);
816
+
817
+ if (autoConnect && typeof window !== 'undefined') setTimeout(async () => await this.autoConnect(), 0);
816
818
  }
817
819
 
818
820
  get chains() {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
4
- const defaultInfuraId = '84842078b09946638c03157f83405213';
3
+ const defaultAlchemyApiKey = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
4
+ const defaultInfuraApiKey = '84842078b09946638c03157f83405213';
5
5
  const alchemyRpcUrls = {
6
6
  mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
7
7
  ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
@@ -29,11 +29,11 @@ const infuraRpcUrls = {
29
29
  arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
30
30
  };
31
31
  const publicRpcUrls = {
32
- mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId),
33
- ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId),
34
- rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId),
35
- goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId),
36
- kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId),
32
+ mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyApiKey),
33
+ ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyApiKey),
34
+ rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyApiKey),
35
+ goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyApiKey),
36
+ kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyApiKey),
37
37
  optimism: 'https://mainnet.optimism.io',
38
38
  optimismKovan: 'https://kovan.optimism.io',
39
39
  polygon: 'https://polygon-rpc.com',
@@ -43,7 +43,7 @@ const publicRpcUrls = {
43
43
  };
44
44
 
45
45
  exports.alchemyRpcUrls = alchemyRpcUrls;
46
- exports.defaultAlchemyId = defaultAlchemyId;
47
- exports.defaultInfuraId = defaultInfuraId;
46
+ exports.defaultAlchemyApiKey = defaultAlchemyApiKey;
47
+ exports.defaultInfuraApiKey = defaultInfuraApiKey;
48
48
  exports.infuraRpcUrls = infuraRpcUrls;
49
49
  exports.publicRpcUrls = publicRpcUrls;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
4
- const defaultInfuraId = '84842078b09946638c03157f83405213';
3
+ const defaultAlchemyApiKey = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
4
+ const defaultInfuraApiKey = '84842078b09946638c03157f83405213';
5
5
  const alchemyRpcUrls = {
6
6
  mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
7
7
  ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
@@ -29,11 +29,11 @@ const infuraRpcUrls = {
29
29
  arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
30
30
  };
31
31
  const publicRpcUrls = {
32
- mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId),
33
- ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId),
34
- rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId),
35
- goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId),
36
- kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId),
32
+ mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyApiKey),
33
+ ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyApiKey),
34
+ rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyApiKey),
35
+ goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyApiKey),
36
+ kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyApiKey),
37
37
  optimism: 'https://mainnet.optimism.io',
38
38
  optimismKovan: 'https://kovan.optimism.io',
39
39
  polygon: 'https://polygon-rpc.com',
@@ -43,7 +43,7 @@ const publicRpcUrls = {
43
43
  };
44
44
 
45
45
  exports.alchemyRpcUrls = alchemyRpcUrls;
46
- exports.defaultAlchemyId = defaultAlchemyId;
47
- exports.defaultInfuraId = defaultInfuraId;
46
+ exports.defaultAlchemyApiKey = defaultAlchemyApiKey;
47
+ exports.defaultInfuraApiKey = defaultInfuraApiKey;
48
48
  exports.infuraRpcUrls = infuraRpcUrls;
49
49
  exports.publicRpcUrls = publicRpcUrls;
@@ -1,5 +1,5 @@
1
- const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
2
- const defaultInfuraId = '84842078b09946638c03157f83405213';
1
+ const defaultAlchemyApiKey = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
2
+ const defaultInfuraApiKey = '84842078b09946638c03157f83405213';
3
3
  const alchemyRpcUrls = {
4
4
  mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
5
5
  ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
@@ -27,11 +27,11 @@ const infuraRpcUrls = {
27
27
  arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
28
28
  };
29
29
  const publicRpcUrls = {
30
- mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId),
31
- ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId),
32
- rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId),
33
- goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId),
34
- kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId),
30
+ mainnet: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyApiKey),
31
+ ropsten: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyApiKey),
32
+ rinkeby: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyApiKey),
33
+ goerli: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyApiKey),
34
+ kovan: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyApiKey),
35
35
  optimism: 'https://mainnet.optimism.io',
36
36
  optimismKovan: 'https://kovan.optimism.io',
37
37
  polygon: 'https://polygon-rpc.com',
@@ -40,4 +40,4 @@ const publicRpcUrls = {
40
40
  arbitrumRinkeby: 'https://rinkeby.arbitrum.io/rpc'
41
41
  };
42
42
 
43
- export { alchemyRpcUrls as a, defaultInfuraId as b, defaultAlchemyId as d, infuraRpcUrls as i, publicRpcUrls as p };
43
+ export { alchemyRpcUrls as a, defaultInfuraApiKey as b, defaultAlchemyApiKey as d, infuraRpcUrls as i, publicRpcUrls as p };