@wagmi/core 0.2.0-next.1 → 0.2.0-next.12

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/LICENSE +1 -1
  2. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +135 -151
  3. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +135 -151
  4. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +136 -152
  5. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +96 -153
  6. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +96 -153
  7. package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +96 -153
  8. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +91 -124
  9. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +91 -124
  10. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +91 -124
  11. package/dist/base-83fd83c6.cjs.dev.js +543 -0
  12. package/dist/base-9b2942ee.cjs.prod.js +543 -0
  13. package/dist/base-b052e615.esm.js +516 -0
  14. package/dist/{classPrivateMethodGet-38b54c7a.cjs.dev.js → classPrivateMethodGet-45a38143.cjs.dev.js} +1 -1
  15. package/dist/{classPrivateMethodGet-c9db96d6.esm.js → classPrivateMethodGet-7c370e43.esm.js} +1 -1
  16. package/dist/{classPrivateMethodGet-0e9a7925.cjs.prod.js → classPrivateMethodGet-a1e1a4aa.cjs.prod.js} +1 -1
  17. package/dist/declarations/src/actions/accounts/connect.d.ts +14 -5
  18. package/dist/declarations/src/actions/accounts/fetchBalance.d.ts +3 -1
  19. package/dist/declarations/src/actions/accounts/getAccount.d.ts +5 -4
  20. package/dist/declarations/src/actions/accounts/index.d.ts +1 -1
  21. package/dist/declarations/src/actions/accounts/switchNetwork.d.ts +1 -1
  22. package/dist/declarations/src/actions/accounts/watchAccount.d.ts +3 -2
  23. package/dist/declarations/src/actions/contracts/readContract.d.ts +4 -1
  24. package/dist/declarations/src/actions/contracts/watchContractEvent.d.ts +3 -1
  25. package/dist/declarations/src/actions/ens/fetchEnsAddress.d.ts +3 -1
  26. package/dist/declarations/src/actions/ens/fetchEnsAvatar.d.ts +3 -1
  27. package/dist/declarations/src/actions/ens/fetchEnsName.d.ts +3 -1
  28. package/dist/declarations/src/actions/ens/fetchEnsResolver.d.ts +3 -1
  29. package/dist/declarations/src/actions/index.d.ts +3 -3
  30. package/dist/declarations/src/actions/network-status/fetchBlockNumber.d.ts +4 -1
  31. package/dist/declarations/src/actions/network-status/fetchFeeData.d.ts +3 -1
  32. package/dist/declarations/src/actions/network-status/index.d.ts +1 -1
  33. package/dist/declarations/src/actions/providers/getProvider.d.ts +6 -2
  34. package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +6 -2
  35. package/dist/declarations/src/actions/providers/index.d.ts +2 -2
  36. package/dist/declarations/src/actions/providers/watchProvider.d.ts +3 -2
  37. package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +3 -2
  38. package/dist/declarations/src/actions/tokens/fetchToken.d.ts +6 -10
  39. package/dist/declarations/src/client.d.ts +25 -22
  40. package/dist/declarations/src/connectors/base.d.ts +7 -1
  41. package/dist/declarations/src/connectors/coinbaseWallet.d.ts +9 -0
  42. package/dist/declarations/src/connectors/injected.d.ts +2 -10
  43. package/dist/declarations/src/constants/abis.d.ts +2 -0
  44. package/dist/declarations/src/constants/blockExplorers.d.ts +9 -0
  45. package/dist/declarations/src/constants/chains.d.ts +17 -6
  46. package/dist/declarations/src/constants/index.d.ts +6 -2
  47. package/dist/declarations/src/constants/keys.d.ts +2 -0
  48. package/dist/declarations/src/constants/rpcs.d.ts +7 -0
  49. package/dist/declarations/src/index.d.ts +8 -5
  50. package/dist/declarations/src/types/index.d.ts +75 -6
  51. package/dist/declarations/src/utils/getInjectedName.d.ts +1 -1
  52. package/dist/wagmi-core.cjs.dev.js +659 -1068
  53. package/dist/wagmi-core.cjs.prod.js +659 -1068
  54. package/dist/wagmi-core.esm.js +656 -1069
  55. package/package.json +3 -4
  56. package/dist/base-09a653f3.cjs.dev.js +0 -453
  57. package/dist/base-824c3b6d.esm.js +0 -430
  58. package/dist/base-d8123d5f.cjs.prod.js +0 -453
  59. package/dist/declarations/src/constants/abis/erc1155.d.ts +0 -17
  60. package/dist/declarations/src/constants/abis/erc20.d.ts +0 -38
  61. package/dist/declarations/src/constants/abis/erc721.d.ts +0 -15
  62. package/dist/declarations/src/constants/abis/index.d.ts +0 -3
  63. package/dist/declarations/src/types/declarations.d.ts +0 -52
@@ -0,0 +1,516 @@
1
+ import EventEmitter from 'eventemitter3';
2
+
3
+ function _checkPrivateRedeclaration(obj, privateCollection) {
4
+ if (privateCollection.has(obj)) {
5
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
6
+ }
7
+ }
8
+
9
+ function _classPrivateFieldInitSpec(obj, privateMap, value) {
10
+ _checkPrivateRedeclaration(obj, privateMap);
11
+ privateMap.set(obj, value);
12
+ }
13
+
14
+ function _defineProperty(obj, key, value) {
15
+ if (key in obj) {
16
+ Object.defineProperty(obj, key, {
17
+ value: value,
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true
21
+ });
22
+ } else {
23
+ obj[key] = value;
24
+ }
25
+
26
+ return obj;
27
+ }
28
+
29
+ function _classApplyDescriptorGet(receiver, descriptor) {
30
+ if (descriptor.get) {
31
+ return descriptor.get.call(receiver);
32
+ }
33
+
34
+ return descriptor.value;
35
+ }
36
+
37
+ function _classExtractFieldDescriptor(receiver, privateMap, action) {
38
+ if (!privateMap.has(receiver)) {
39
+ throw new TypeError("attempted to " + action + " private field on non-instance");
40
+ }
41
+
42
+ return privateMap.get(receiver);
43
+ }
44
+
45
+ function _classPrivateFieldGet(receiver, privateMap) {
46
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
47
+ return _classApplyDescriptorGet(receiver, descriptor);
48
+ }
49
+
50
+ function _classApplyDescriptorSet(receiver, descriptor, value) {
51
+ if (descriptor.set) {
52
+ descriptor.set.call(receiver, value);
53
+ } else {
54
+ if (!descriptor.writable) {
55
+ throw new TypeError("attempted to set read only private field");
56
+ }
57
+
58
+ descriptor.value = value;
59
+ }
60
+ }
61
+
62
+ function _classPrivateFieldSet(receiver, privateMap, value) {
63
+ var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
64
+ _classApplyDescriptorSet(receiver, descriptor, value);
65
+ return value;
66
+ }
67
+
68
+ const etherscanBlockExplorers = {
69
+ mainnet: {
70
+ name: 'Etherscan',
71
+ url: 'https://etherscan.io'
72
+ },
73
+ ropsten: {
74
+ name: 'Etherscan',
75
+ url: 'https://ropsten.etherscan.io'
76
+ },
77
+ rinkeby: {
78
+ name: 'Etherscan',
79
+ url: 'https://rinkeby.etherscan.io'
80
+ },
81
+ goerli: {
82
+ name: 'Etherscan',
83
+ url: 'https://goerli.etherscan.io'
84
+ },
85
+ kovan: {
86
+ name: 'Etherscan',
87
+ url: 'https://kovan.etherscan.io'
88
+ },
89
+ optimism: {
90
+ name: 'Etherscan',
91
+ url: 'https://optimistic.etherscan.io'
92
+ },
93
+ optimismKovan: {
94
+ name: 'Etherscan',
95
+ url: 'https://kovan-optimistic.etherscan.io'
96
+ },
97
+ polygon: {
98
+ name: 'PolygonScan',
99
+ url: 'https://polygonscan.com'
100
+ },
101
+ polygonMumbai: {
102
+ name: 'PolygonScan',
103
+ url: 'https://mumbai.polygonscan.com'
104
+ },
105
+ arbitrum: {
106
+ name: 'Arbiscan',
107
+ url: 'https://arbiscan.io'
108
+ },
109
+ arbitrumRinkeby: {
110
+ name: 'Arbiscan',
111
+ url: 'https://testnet.arbiscan.io'
112
+ }
113
+ };
114
+
115
+ const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
116
+
117
+ const alchemyRpcUrls = {
118
+ mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
119
+ ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
120
+ rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2',
121
+ goerli: 'https://eth-goerli.alchemyapi.io/v2',
122
+ kovan: 'https://eth-kovan.alchemyapi.io/v2',
123
+ optimism: 'https://opt-mainnet.g.alchemy.com/v2',
124
+ optimismKovan: 'https://opt-kovan.g.alchemy.com/v2',
125
+ polygon: 'https://polygon-mainnet.g.alchemy.com/v2',
126
+ polygonMumbai: 'https://polygon-mumbai.g.alchemy.com/v2',
127
+ arbitrum: 'https://arb-mainnet.g.alchemy.com/v2',
128
+ arbitrumRinkeby: 'https://arb-rinkeby.g.alchemy.com/v2'
129
+ };
130
+ const infuraRpcUrls = {
131
+ mainnet: 'https://mainnet.infura.io/v3',
132
+ ropsten: 'https://ropsten.infura.io/v3',
133
+ rinkeby: 'https://rinkeby.infura.io/v3',
134
+ goerli: 'https://goerli.infura.io/v3',
135
+ kovan: 'https://kovan.infura.io/v3',
136
+ optimism: 'https://optimism-mainnet.infura.io/v3',
137
+ optimismKovan: 'https://optimism-kovan.infura.io/v3',
138
+ polygon: 'https://polygon-mainnet.infura.io/v3',
139
+ polygonMumbai: 'https://polygon-mumbai.infura.io/v3',
140
+ arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
141
+ arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
142
+ };
143
+
144
+ const chainId = {
145
+ mainnet: 1,
146
+ ropsten: 3,
147
+ rinkeby: 4,
148
+ goerli: 5,
149
+ kovan: 42,
150
+ optimism: 10,
151
+ optimismKovan: 69,
152
+ polygon: 137,
153
+ polygonMumbai: 80001,
154
+ arbitrum: 42161,
155
+ arbitrumRinkeby: 421611,
156
+ localhost: 1337,
157
+ hardhat: 31337
158
+ };
159
+ const chain = {
160
+ mainnet: {
161
+ id: chainId.mainnet,
162
+ name: 'Ethereum',
163
+ nativeCurrency: {
164
+ name: 'Ether',
165
+ symbol: 'ETH',
166
+ decimals: 18
167
+ },
168
+ rpcUrls: {
169
+ alchemy: alchemyRpcUrls.mainnet,
170
+ infura: infuraRpcUrls.mainnet,
171
+ default: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId)
172
+ },
173
+ blockExplorers: {
174
+ etherscan: etherscanBlockExplorers.mainnet,
175
+ default: etherscanBlockExplorers.mainnet
176
+ }
177
+ },
178
+ ropsten: {
179
+ id: chainId.ropsten,
180
+ name: 'Ropsten',
181
+ nativeCurrency: {
182
+ name: 'Ropsten Ether',
183
+ symbol: 'ropETH',
184
+ decimals: 18
185
+ },
186
+ rpcUrls: {
187
+ alchemy: alchemyRpcUrls.ropsten,
188
+ infura: infuraRpcUrls.ropsten,
189
+ default: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId)
190
+ },
191
+ blockExplorers: {
192
+ etherscan: etherscanBlockExplorers.ropsten,
193
+ default: etherscanBlockExplorers.ropsten
194
+ },
195
+ testnet: true
196
+ },
197
+ rinkeby: {
198
+ id: chainId.rinkeby,
199
+ name: 'Rinkeby',
200
+ nativeCurrency: {
201
+ name: 'Rinkeby Ether',
202
+ symbol: 'rETH',
203
+ decimals: 18
204
+ },
205
+ rpcUrls: {
206
+ alchemy: alchemyRpcUrls.rinkeby,
207
+ infura: infuraRpcUrls.rinkeby,
208
+ default: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId)
209
+ },
210
+ blockExplorers: {
211
+ etherscan: etherscanBlockExplorers.rinkeby,
212
+ default: etherscanBlockExplorers.rinkeby
213
+ },
214
+ testnet: true
215
+ },
216
+ goerli: {
217
+ id: chainId.goerli,
218
+ name: 'Goerli',
219
+ nativeCurrency: {
220
+ name: 'Goerli Ether',
221
+ symbol: 'gETH',
222
+ decimals: 18
223
+ },
224
+ rpcUrls: {
225
+ alchemy: alchemyRpcUrls.goerli,
226
+ infura: infuraRpcUrls.goerli,
227
+ default: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId)
228
+ },
229
+ blockExplorers: {
230
+ etherscan: etherscanBlockExplorers.goerli,
231
+ default: etherscanBlockExplorers.goerli
232
+ },
233
+ testnet: true
234
+ },
235
+ kovan: {
236
+ id: chainId.kovan,
237
+ name: 'Kovan',
238
+ nativeCurrency: {
239
+ name: 'Kovan Ether',
240
+ symbol: 'kETH',
241
+ decimals: 18
242
+ },
243
+ rpcUrls: {
244
+ alchemy: alchemyRpcUrls.kovan,
245
+ infura: infuraRpcUrls.kovan,
246
+ default: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId)
247
+ },
248
+ blockExplorers: {
249
+ etherscan: etherscanBlockExplorers.kovan,
250
+ default: etherscanBlockExplorers.kovan
251
+ },
252
+ testnet: true
253
+ },
254
+ optimism: {
255
+ id: chainId.optimism,
256
+ name: 'Optimism',
257
+ nativeCurrency: {
258
+ name: 'Ether',
259
+ symbol: 'ETH',
260
+ decimals: 18
261
+ },
262
+ rpcUrls: {
263
+ alchemy: alchemyRpcUrls.optimism,
264
+ infura: infuraRpcUrls.optimism,
265
+ default: ['https://mainnet.optimism.io']
266
+ },
267
+ blockExplorers: {
268
+ etherscan: etherscanBlockExplorers.optimism,
269
+ default: etherscanBlockExplorers.optimism
270
+ }
271
+ },
272
+ optimismKovan: {
273
+ id: chainId.optimismKovan,
274
+ name: 'Optimism Kovan',
275
+ nativeCurrency: {
276
+ name: 'Kovan Ether',
277
+ symbol: 'KOR',
278
+ decimals: 18
279
+ },
280
+ rpcUrls: {
281
+ alchemy: alchemyRpcUrls.optimismKovan,
282
+ infura: infuraRpcUrls.optimismKovan,
283
+ default: ['https://kovan.optimism.io']
284
+ },
285
+ blockExplorers: {
286
+ etherscan: etherscanBlockExplorers.optimismKovan,
287
+ default: etherscanBlockExplorers.optimismKovan
288
+ },
289
+ testnet: true
290
+ },
291
+ polygon: {
292
+ id: chainId.polygon,
293
+ name: 'Polygon',
294
+ nativeCurrency: {
295
+ name: 'MATIC',
296
+ symbol: 'MATIC',
297
+ decimals: 18
298
+ },
299
+ rpcUrls: {
300
+ alchemy: alchemyRpcUrls.polygon,
301
+ infura: infuraRpcUrls.polygon,
302
+ default: ['https://polygon-rpc.com', 'https://rpc-mainnet.matic.network', 'https://matic-mainnet.chainstacklabs.com', 'https://rpc-mainnet.maticvigil.com', 'https://rpc-mainnet.matic.quiknode.pro', 'https://matic-mainnet-full-rpc.bwarelabs.com']
303
+ },
304
+ blockExplorers: {
305
+ etherscan: etherscanBlockExplorers.polygon,
306
+ default: etherscanBlockExplorers.polygon
307
+ }
308
+ },
309
+ polygonMumbai: {
310
+ id: chainId.polygonMumbai,
311
+ name: 'Mumbai',
312
+ nativeCurrency: {
313
+ name: 'MATIC',
314
+ symbol: 'MATIC',
315
+ decimals: 18
316
+ },
317
+ rpcUrls: {
318
+ alchemy: alchemyRpcUrls.polygonMumbai,
319
+ infura: infuraRpcUrls.polygonMumbai,
320
+ default: ['https://matic-mumbai.chainstacklabs.com', 'https://rpc-mumbai.maticvigil.com', 'https://matic-testnet-archive-rpc.bwarelabs.com']
321
+ },
322
+ blockExplorers: {
323
+ etherscan: etherscanBlockExplorers.polygonMumbai,
324
+ default: etherscanBlockExplorers.polygonMumbai
325
+ },
326
+ testnet: true
327
+ },
328
+ arbitrum: {
329
+ id: chainId.arbitrum,
330
+ name: 'Arbitrum',
331
+ nativeCurrency: {
332
+ name: 'Ether',
333
+ symbol: 'AETH',
334
+ decimals: 18
335
+ },
336
+ rpcUrls: {
337
+ alchemy: alchemyRpcUrls.arbitrum,
338
+ infura: infuraRpcUrls.arbitrum,
339
+ default: ['https://arb1.arbitrum.io/rpc']
340
+ },
341
+ blockExplorers: {
342
+ etherscan: etherscanBlockExplorers.arbitrum,
343
+ default: [etherscanBlockExplorers.arbitrum, {
344
+ name: 'Arbitrum Explorer',
345
+ url: 'https://explorer.arbitrum.io'
346
+ }]
347
+ }
348
+ },
349
+ arbitrumRinkeby: {
350
+ id: chainId.arbitrumRinkeby,
351
+ name: 'Arbitrum Rinkeby',
352
+ nativeCurrency: {
353
+ name: 'Arbitrum Rinkeby Ether',
354
+ symbol: 'ARETH',
355
+ decimals: 18
356
+ },
357
+ rpcUrls: {
358
+ alchemy: alchemyRpcUrls.arbitrumRinkeby,
359
+ infura: infuraRpcUrls.arbitrumRinkeby,
360
+ default: ['https://rinkeby.arbitrum.io/rpc']
361
+ },
362
+ blockExplorers: {
363
+ etherscan: etherscanBlockExplorers.arbitrumRinkeby,
364
+ default: [etherscanBlockExplorers.arbitrumRinkeby, {
365
+ name: 'Arbitrum Explorer',
366
+ url: 'https://rinkeby-explorer.arbitrum.io'
367
+ }]
368
+ },
369
+ testnet: true
370
+ },
371
+ localhost: {
372
+ id: chainId.localhost,
373
+ name: 'Localhost',
374
+ rpcUrls: {
375
+ default: 'http://127.0.0.1:8545'
376
+ }
377
+ },
378
+ hardhat: {
379
+ id: chainId.hardhat,
380
+ name: 'Hardhat',
381
+ rpcUrls: {
382
+ default: 'http://127.0.0.1:8545'
383
+ }
384
+ }
385
+ };
386
+ const allChains = Object.values(chain);
387
+ const defaultChains = [chain.mainnet, chain.ropsten, chain.rinkeby, chain.goerli, chain.kovan];
388
+ const defaultL2Chains = [chain.arbitrum, chain.arbitrumRinkeby, chain.optimism, chain.optimismKovan];
389
+
390
+ function normalizeChainId(chainId) {
391
+ if (typeof chainId === 'string') return Number.parseInt(chainId, chainId.trim().substring(0, 2) === '0x' ? 16 : 10);
392
+ return chainId;
393
+ }
394
+
395
+ class AddChainError extends Error {
396
+ constructor() {
397
+ super(...arguments);
398
+
399
+ _defineProperty(this, "name", 'AddChainError');
400
+
401
+ _defineProperty(this, "message", 'Error adding chain');
402
+ }
403
+
404
+ }
405
+ class ChainNotConfiguredError extends Error {
406
+ constructor() {
407
+ super(...arguments);
408
+
409
+ _defineProperty(this, "name", 'ChainNotConfigured');
410
+
411
+ _defineProperty(this, "message", 'Chain not configured');
412
+ }
413
+
414
+ }
415
+ class ConnectorAlreadyConnectedError extends Error {
416
+ constructor() {
417
+ super(...arguments);
418
+
419
+ _defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
420
+
421
+ _defineProperty(this, "message", 'Connector already connected');
422
+ }
423
+
424
+ }
425
+ class ConnectorNotFoundError extends Error {
426
+ constructor() {
427
+ super(...arguments);
428
+
429
+ _defineProperty(this, "name", 'ConnectorNotFoundError');
430
+
431
+ _defineProperty(this, "message", 'Connector not found');
432
+ }
433
+
434
+ }
435
+ class SwitchChainError extends Error {
436
+ constructor() {
437
+ super(...arguments);
438
+
439
+ _defineProperty(this, "name", 'SwitchChainError');
440
+
441
+ _defineProperty(this, "message", 'Error switching chain');
442
+ }
443
+
444
+ }
445
+ class SwitchChainNotSupportedError extends Error {
446
+ constructor() {
447
+ super(...arguments);
448
+
449
+ _defineProperty(this, "name", 'SwitchChainNotSupportedError');
450
+
451
+ _defineProperty(this, "message", 'Switch chain not supported by connector');
452
+ }
453
+
454
+ }
455
+ class UserRejectedRequestError extends Error {
456
+ constructor() {
457
+ super(...arguments);
458
+
459
+ _defineProperty(this, "name", 'UserRejectedRequestError');
460
+
461
+ _defineProperty(this, "message", 'User rejected request');
462
+ }
463
+
464
+ }
465
+
466
+ class Connector extends EventEmitter {
467
+ /** Unique connector id */
468
+
469
+ /** Connector name */
470
+
471
+ /** Chains connector supports */
472
+
473
+ /** Options to use with connector */
474
+
475
+ /** Whether connector is usable */
476
+ constructor(_ref) {
477
+ let {
478
+ chains = defaultChains,
479
+ options
480
+ } = _ref;
481
+ super();
482
+
483
+ _defineProperty(this, "id", void 0);
484
+
485
+ _defineProperty(this, "name", void 0);
486
+
487
+ _defineProperty(this, "chains", void 0);
488
+
489
+ _defineProperty(this, "options", void 0);
490
+
491
+ _defineProperty(this, "ready", void 0);
492
+
493
+ this.chains = chains;
494
+ this.options = options;
495
+ }
496
+
497
+ getBlockExplorerUrls(chain) {
498
+ var _chain$blockExplorers;
499
+
500
+ const blockExplorer = (_chain$blockExplorers = chain.blockExplorers) === null || _chain$blockExplorers === void 0 ? void 0 : _chain$blockExplorers.default;
501
+ if (Array.isArray(blockExplorer)) return blockExplorer.map(x => x.url);
502
+ if (blockExplorer !== null && blockExplorer !== void 0 && blockExplorer.url) return [blockExplorer.url];
503
+ return [];
504
+ }
505
+
506
+ getRpcUrls(chain) {
507
+ return typeof chain.rpcUrls.default === 'string' ? [chain.rpcUrls.default] : chain.rpcUrls.default;
508
+ }
509
+
510
+ isChainUnsupported(chainId) {
511
+ return !this.chains.some(x => x.id === chainId);
512
+ }
513
+
514
+ }
515
+
516
+ export { AddChainError as A, Connector as C, SwitchChainError as S, UserRejectedRequestError as U, _defineProperty as _, _classPrivateFieldInitSpec as a, ConnectorNotFoundError as b, _classPrivateFieldSet as c, _classPrivateFieldGet as d, allChains as e, ChainNotConfiguredError as f, ConnectorAlreadyConnectedError as g, SwitchChainNotSupportedError as h, alchemyRpcUrls as i, chain as j, chainId as k, defaultChains as l, defaultL2Chains as m, normalizeChainId as n, etherscanBlockExplorers as o, infuraRpcUrls as p, _checkPrivateRedeclaration as q };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var base = require('./base-09a653f3.cjs.dev.js');
3
+ var base = require('./base-83fd83c6.cjs.dev.js');
4
4
 
5
5
  function _classPrivateMethodInitSpec(obj, privateSet) {
6
6
  base._checkPrivateRedeclaration(obj, privateSet);
@@ -1,4 +1,4 @@
1
- import { l as _checkPrivateRedeclaration } from './base-824c3b6d.esm.js';
1
+ import { q as _checkPrivateRedeclaration } from './base-b052e615.esm.js';
2
2
 
3
3
  function _classPrivateMethodInitSpec(obj, privateSet) {
4
4
  _checkPrivateRedeclaration(obj, privateSet);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var base = require('./base-d8123d5f.cjs.prod.js');
3
+ var base = require('./base-9b2942ee.cjs.prod.js');
4
4
 
5
5
  function _classPrivateMethodInitSpec(obj, privateSet) {
6
6
  base._checkPrivateRedeclaration(obj, privateSet);
@@ -1,7 +1,16 @@
1
+ import type { BaseProvider } from '@ethersproject/providers';
1
2
  import { Client } from '../../client';
2
- import { Connector } from '../../connectors';
3
- export declare type ConnectResult = {
4
- data: Client['data'];
5
- connector: Client['connector'];
3
+ import { Connector, ConnectorData } from '../../connectors';
4
+ export declare type ConnectArgs = {
5
+ /** Connector to connect */
6
+ connector: Connector;
6
7
  };
7
- export declare function connect(connector: Connector): Promise<ConnectResult>;
8
+ declare type Data<TProvider extends BaseProvider = BaseProvider> = Required<ConnectorData<TProvider>>;
9
+ export declare type ConnectResult<TProvider extends BaseProvider = BaseProvider> = {
10
+ account: Data<TProvider>['account'];
11
+ chain: Data<TProvider>['chain'];
12
+ connector: Client<TProvider>['connector'];
13
+ provider: Data<TProvider>['provider'];
14
+ };
15
+ export declare function connect<TProvider extends BaseProvider>({ connector, }: ConnectArgs): Promise<ConnectResult<TProvider>>;
16
+ export {};
@@ -3,6 +3,8 @@ import { Unit } from '../../types';
3
3
  export declare type FetchBalanceArgs = {
4
4
  /** Address or ENS name */
5
5
  addressOrName: string;
6
+ /** Chain id to use for provider */
7
+ chainId?: number;
6
8
  /** Units for formatting output */
7
9
  formatUnits?: Unit | number;
8
10
  /** ERC-20 address */
@@ -15,4 +17,4 @@ export declare type FetchBalanceResult = {
15
17
  unit: Unit | number;
16
18
  value: BigNumber;
17
19
  };
18
- export declare function fetchBalance({ addressOrName, formatUnits: unit, token, }: FetchBalanceArgs): Promise<FetchBalanceResult>;
20
+ export declare function fetchBalance({ addressOrName, chainId, formatUnits: unit, token, }: FetchBalanceArgs): Promise<FetchBalanceResult>;
@@ -1,6 +1,7 @@
1
+ import type { BaseProvider } from '@ethersproject/providers';
1
2
  import { Client, Data } from '../../client';
2
- export declare type GetAccountResult = {
3
- address?: Data['account'];
4
- connector?: Client['connector'];
3
+ export declare type GetAccountResult<TProvider extends BaseProvider = BaseProvider> = {
4
+ address?: Data<TProvider>['account'];
5
+ connector?: Client<TProvider>['connector'];
5
6
  };
6
- export declare function getAccount(): GetAccountResult;
7
+ export declare function getAccount<TProvider extends BaseProvider>(): GetAccountResult<TProvider>;
@@ -1,4 +1,4 @@
1
- export { connect, type ConnectResult } from './connect';
1
+ export { connect, type ConnectArgs, type ConnectResult } from './connect';
2
2
  export { disconnect } from './disconnect';
3
3
  export { fetchBalance, type FetchBalanceArgs, type FetchBalanceResult, } from './fetchBalance';
4
4
  export { fetchSigner, type FetchSignerResult } from './fetchSigner';
@@ -3,4 +3,4 @@ export declare type SwitchNetworkArgs = {
3
3
  chainId: number;
4
4
  };
5
5
  export declare type SwitchNetworkResult = Chain;
6
- export declare function switchNetwork(args: SwitchNetworkArgs): Promise<SwitchNetworkResult>;
6
+ export declare function switchNetwork({ chainId, }: SwitchNetworkArgs): Promise<SwitchNetworkResult>;
@@ -1,3 +1,4 @@
1
+ import type { BaseProvider } from '@ethersproject/providers';
1
2
  import { GetAccountResult } from './getAccount';
2
- export declare type WatchAccountCallback = (data: GetAccountResult) => void;
3
- export declare function watchAccount(callback: WatchAccountCallback): () => void;
3
+ export declare type WatchAccountCallback<TProvider extends BaseProvider = BaseProvider> = (data: GetAccountResult<TProvider>) => void;
4
+ export declare function watchAccount<TProvider extends BaseProvider>(callback: WatchAccountCallback<TProvider>): () => void;
@@ -5,7 +5,10 @@ export declare type ReadContractArgs = GetContractArgs;
5
5
  export declare type ReadContractConfig = {
6
6
  /** Arguments to pass contract method */
7
7
  args?: any | any[];
8
+ /** Chain id to use for provider */
9
+ chainId?: number;
10
+ /** Call overrides */
8
11
  overrides?: CallOverrides;
9
12
  };
10
13
  export declare type ReadContractResult = Result;
11
- export declare function readContract<Contract extends EthersContract = EthersContract>(contractConfig: ReadContractArgs, functionName: string, { args, overrides }?: ReadContractConfig): Promise<Result>;
14
+ export declare function readContract<Contract extends EthersContract = EthersContract>(contractConfig: ReadContractArgs, functionName: string, { args, chainId, overrides }?: ReadContractConfig): Promise<Result>;
@@ -1,6 +1,8 @@
1
1
  import { Contract as EthersContract } from 'ethers/lib/ethers';
2
2
  import { GetContractArgs } from './getContract';
3
3
  declare type Config = {
4
+ /** Chain id to use for provider */
5
+ chainId?: number;
4
6
  /** Receive only a single event */
5
7
  once?: boolean;
6
8
  };
@@ -8,5 +10,5 @@ export declare function watchContractEvent<Contract extends EthersContract = Eth
8
10
  /** Contract configuration */
9
11
  contractArgs: GetContractArgs,
10
12
  /** Event name to listen to */
11
- eventName: Parameters<Contract['on']>[0], callback: Parameters<Contract['on']>[1], { once }?: Config): () => void;
13
+ eventName: Parameters<Contract['on']>[0], callback: Parameters<Contract['on']>[1], { chainId, once }?: Config): () => void;
12
14
  export {};
@@ -1,6 +1,8 @@
1
1
  export declare type FetchEnsAddressArgs = {
2
+ /** Chain id to use for provider */
3
+ chainId?: number;
2
4
  /** ENS name to resolve */
3
5
  name: string;
4
6
  };
5
7
  export declare type FetchEnsAddressResult = string | null;
6
- export declare function fetchEnsAddress({ name, }: FetchEnsAddressArgs): Promise<FetchEnsAddressResult>;
8
+ export declare function fetchEnsAddress({ chainId, name, }: FetchEnsAddressArgs): Promise<FetchEnsAddressResult>;
@@ -1,6 +1,8 @@
1
1
  export declare type FetchEnsAvatarArgs = {
2
2
  /** Address or ENS name */
3
3
  addressOrName: string;
4
+ /** Chain id to use for provider */
5
+ chainId?: number;
4
6
  };
5
7
  export declare type FetchEnsAvatarResult = string | null;
6
- export declare function fetchEnsAvatar({ addressOrName, }: FetchEnsAvatarArgs): Promise<FetchEnsAvatarResult>;
8
+ export declare function fetchEnsAvatar({ addressOrName, chainId, }: FetchEnsAvatarArgs): Promise<FetchEnsAvatarResult>;
@@ -1,6 +1,8 @@
1
1
  export declare type FetchEnsNameArgs = {
2
2
  /** Address to lookup */
3
3
  address: string;
4
+ /** Chain id to use for provider */
5
+ chainId?: number;
4
6
  };
5
7
  export declare type FetchEnsNameResult = string | null;
6
- export declare function fetchEnsName({ address, }: FetchEnsNameArgs): Promise<FetchEnsNameResult>;
8
+ export declare function fetchEnsName({ address, chainId, }: FetchEnsNameArgs): Promise<FetchEnsNameResult>;
@@ -1,7 +1,9 @@
1
1
  import type { Resolver } from '@ethersproject/providers';
2
2
  export declare type FetchEnsResolverArgs = {
3
+ /** Chain id to use for provider */
4
+ chainId?: number;
3
5
  /** ENS name to resolve */
4
6
  name: string;
5
7
  };
6
8
  export declare type FetchEnsResolverResult = Resolver | null;
7
- export declare function fetchEnsResolver({ name, }: FetchEnsResolverArgs): Promise<FetchEnsResolverResult>;
9
+ export declare function fetchEnsResolver({ chainId, name, }: FetchEnsResolverArgs): Promise<FetchEnsResolverResult>;