@wagmi/core 0.2.5 → 0.3.2

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 (74) hide show
  1. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +28 -19
  2. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +28 -19
  3. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +28 -19
  4. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +17 -12
  5. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +17 -12
  6. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +11 -6
  7. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +7 -6
  8. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +7 -6
  9. package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +5 -4
  10. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +18 -7
  11. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +18 -7
  12. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +16 -5
  13. package/dist/{base-5812b724.cjs.dev.js → base-3a506159.cjs.dev.js} +129 -67
  14. package/dist/{base-159de546.esm.js → base-997b4fec.esm.js} +98 -38
  15. package/dist/{base-59f3457e.cjs.prod.js → base-cb4198f3.cjs.prod.js} +129 -67
  16. package/dist/{client-3a56f061.esm.js → client-1ab99bf8.esm.js} +52 -45
  17. package/dist/{client-72d69b8e.cjs.dev.js → client-db513093.cjs.dev.js} +54 -47
  18. package/dist/{client-1f6fd5b6.cjs.prod.js → client-edc73358.cjs.prod.js} +54 -47
  19. package/dist/declarations/src/actions/accounts/connect.d.ts +4 -4
  20. package/dist/declarations/src/actions/accounts/getAccount.d.ts +3 -3
  21. package/dist/declarations/src/actions/accounts/signTypedData.d.ts +15 -6
  22. package/dist/declarations/src/actions/accounts/watchAccount.d.ts +3 -3
  23. package/dist/declarations/src/actions/providers/getProvider.d.ts +3 -3
  24. package/dist/declarations/src/actions/providers/getWebSocketProvider.d.ts +3 -3
  25. package/dist/declarations/src/actions/providers/watchProvider.d.ts +3 -3
  26. package/dist/declarations/src/actions/providers/watchWebSocketProvider.d.ts +3 -3
  27. package/dist/declarations/src/chains/configureChains.d.ts +20 -0
  28. package/dist/declarations/src/chains/index.d.ts +2 -0
  29. package/dist/declarations/src/client.d.ts +12 -12
  30. package/dist/declarations/src/connectors/injected.d.ts +1 -1
  31. package/dist/declarations/src/connectors/metaMask.d.ts +1 -1
  32. package/dist/declarations/src/constants/index.d.ts +1 -1
  33. package/dist/declarations/src/errors.d.ts +48 -4
  34. package/dist/declarations/src/index.d.ts +8 -6
  35. package/dist/declarations/src/providers/alchemy.d.ts +7 -0
  36. package/dist/declarations/src/providers/infura.d.ts +7 -0
  37. package/dist/declarations/src/providers/jsonRpc.d.ts +11 -0
  38. package/dist/declarations/src/providers/public.d.ts +6 -0
  39. package/dist/declarations/src/storage.d.ts +2 -2
  40. package/dist/declarations/src/types/index.d.ts +44 -14
  41. package/dist/rpcs-7cfbd91c.esm.js +30 -0
  42. package/dist/rpcs-9c4eb960.cjs.dev.js +35 -0
  43. package/dist/rpcs-b3c52116.cjs.prod.js +35 -0
  44. package/dist/wagmi-core.cjs.dev.js +124 -25
  45. package/dist/wagmi-core.cjs.prod.js +124 -25
  46. package/dist/wagmi-core.esm.js +122 -24
  47. package/package.json +27 -6
  48. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.d.ts +1 -0
  49. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.dev.js +38 -0
  50. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.js +7 -0
  51. package/providers/alchemy/dist/wagmi-core-providers-alchemy.cjs.prod.js +38 -0
  52. package/providers/alchemy/dist/wagmi-core-providers-alchemy.esm.js +34 -0
  53. package/providers/alchemy/package.json +4 -0
  54. package/providers/infura/dist/wagmi-core-providers-infura.cjs.d.ts +1 -0
  55. package/providers/infura/dist/wagmi-core-providers-infura.cjs.dev.js +38 -0
  56. package/providers/infura/dist/wagmi-core-providers-infura.cjs.js +7 -0
  57. package/providers/infura/dist/wagmi-core-providers-infura.cjs.prod.js +38 -0
  58. package/providers/infura/dist/wagmi-core-providers-infura.esm.js +34 -0
  59. package/providers/infura/package.json +4 -0
  60. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.d.ts +1 -0
  61. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.dev.js +45 -0
  62. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.js +7 -0
  63. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.cjs.prod.js +45 -0
  64. package/providers/jsonRpc/dist/wagmi-core-providers-jsonRpc.esm.js +41 -0
  65. package/providers/jsonRpc/package.json +4 -0
  66. package/providers/public/dist/wagmi-core-providers-public.cjs.d.ts +1 -0
  67. package/providers/public/dist/wagmi-core-providers-public.cjs.dev.js +34 -0
  68. package/providers/public/dist/wagmi-core-providers-public.cjs.js +7 -0
  69. package/providers/public/dist/wagmi-core-providers-public.cjs.prod.js +34 -0
  70. package/providers/public/dist/wagmi-core-providers-public.esm.js +30 -0
  71. package/providers/public/package.json +4 -0
  72. package/dist/classPrivateMethodGet-55c9909f.esm.js +0 -16
  73. package/dist/classPrivateMethodGet-976c8120.cjs.dev.js +0 -19
  74. package/dist/classPrivateMethodGet-d7330ed7.cjs.prod.js +0 -19
@@ -1,4 +1,5 @@
1
1
  import EventEmitter from 'eventemitter3';
2
+ import { a as alchemyRpcUrls, i as infuraRpcUrls, d as defaultAlchemyId } from './rpcs-7cfbd91c.esm.js';
2
3
 
3
4
  function _checkPrivateRedeclaration(obj, privateCollection) {
4
5
  if (privateCollection.has(obj)) {
@@ -6,6 +7,11 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
6
7
  }
7
8
  }
8
9
 
10
+ function _classPrivateMethodInitSpec(obj, privateSet) {
11
+ _checkPrivateRedeclaration(obj, privateSet);
12
+ privateSet.add(obj);
13
+ }
14
+
9
15
  function _classPrivateFieldInitSpec(obj, privateMap, value) {
10
16
  _checkPrivateRedeclaration(obj, privateMap);
11
17
  privateMap.set(obj, value);
@@ -47,6 +53,14 @@ function _classPrivateFieldGet(receiver, privateMap) {
47
53
  return _classApplyDescriptorGet(receiver, descriptor);
48
54
  }
49
55
 
56
+ function _classPrivateMethodGet(receiver, privateSet, fn) {
57
+ if (!privateSet.has(receiver)) {
58
+ throw new TypeError("attempted to get private field on non-instance");
59
+ }
60
+
61
+ return fn;
62
+ }
63
+
50
64
  function _classApplyDescriptorSet(receiver, descriptor, value) {
51
65
  if (descriptor.set) {
52
66
  descriptor.set.call(receiver, value);
@@ -112,34 +126,6 @@ const etherscanBlockExplorers = {
112
126
  }
113
127
  };
114
128
 
115
- const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
116
- const alchemyRpcUrls = {
117
- mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
118
- ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
119
- rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2',
120
- goerli: 'https://eth-goerli.alchemyapi.io/v2',
121
- kovan: 'https://eth-kovan.alchemyapi.io/v2',
122
- optimism: 'https://opt-mainnet.g.alchemy.com/v2',
123
- optimismKovan: 'https://opt-kovan.g.alchemy.com/v2',
124
- polygon: 'https://polygon-mainnet.g.alchemy.com/v2',
125
- polygonMumbai: 'https://polygon-mumbai.g.alchemy.com/v2',
126
- arbitrum: 'https://arb-mainnet.g.alchemy.com/v2',
127
- arbitrumRinkeby: 'https://arb-rinkeby.g.alchemy.com/v2'
128
- };
129
- const infuraRpcUrls = {
130
- mainnet: 'https://mainnet.infura.io/v3',
131
- ropsten: 'https://ropsten.infura.io/v3',
132
- rinkeby: 'https://rinkeby.infura.io/v3',
133
- goerli: 'https://goerli.infura.io/v3',
134
- kovan: 'https://kovan.infura.io/v3',
135
- optimism: 'https://optimism-mainnet.infura.io/v3',
136
- optimismKovan: 'https://optimism-kovan.infura.io/v3',
137
- polygon: 'https://polygon-mainnet.infura.io/v3',
138
- polygonMumbai: 'https://polygon-mumbai.infura.io/v3',
139
- arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
140
- arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
141
- };
142
-
143
129
  const chainId = {
144
130
  mainnet: 1,
145
131
  ropsten: 3,
@@ -159,6 +145,7 @@ const chain = {
159
145
  mainnet: {
160
146
  id: chainId.mainnet,
161
147
  name: 'Ethereum',
148
+ network: 'homestead',
162
149
  nativeCurrency: {
163
150
  name: 'Ether',
164
151
  symbol: 'ETH',
@@ -177,6 +164,7 @@ const chain = {
177
164
  ropsten: {
178
165
  id: chainId.ropsten,
179
166
  name: 'Ropsten',
167
+ network: 'ropsten',
180
168
  nativeCurrency: {
181
169
  name: 'Ropsten Ether',
182
170
  symbol: 'ropETH',
@@ -196,6 +184,7 @@ const chain = {
196
184
  rinkeby: {
197
185
  id: chainId.rinkeby,
198
186
  name: 'Rinkeby',
187
+ network: 'rinkeby',
199
188
  nativeCurrency: {
200
189
  name: 'Rinkeby Ether',
201
190
  symbol: 'rETH',
@@ -215,6 +204,7 @@ const chain = {
215
204
  goerli: {
216
205
  id: chainId.goerli,
217
206
  name: 'Goerli',
207
+ network: 'goerli',
218
208
  nativeCurrency: {
219
209
  name: 'Goerli Ether',
220
210
  symbol: 'gETH',
@@ -234,6 +224,7 @@ const chain = {
234
224
  kovan: {
235
225
  id: chainId.kovan,
236
226
  name: 'Kovan',
227
+ network: 'kovan',
237
228
  nativeCurrency: {
238
229
  name: 'Kovan Ether',
239
230
  symbol: 'kETH',
@@ -253,6 +244,7 @@ const chain = {
253
244
  optimism: {
254
245
  id: chainId.optimism,
255
246
  name: 'Optimism',
247
+ network: 'optimism',
256
248
  nativeCurrency: {
257
249
  name: 'Ether',
258
250
  symbol: 'ETH',
@@ -271,6 +263,7 @@ const chain = {
271
263
  optimismKovan: {
272
264
  id: chainId.optimismKovan,
273
265
  name: 'Optimism Kovan',
266
+ network: 'optimism-kovan',
274
267
  nativeCurrency: {
275
268
  name: 'Kovan Ether',
276
269
  symbol: 'KOR',
@@ -290,6 +283,7 @@ const chain = {
290
283
  polygon: {
291
284
  id: chainId.polygon,
292
285
  name: 'Polygon',
286
+ network: 'matic',
293
287
  nativeCurrency: {
294
288
  name: 'MATIC',
295
289
  symbol: 'MATIC',
@@ -308,6 +302,7 @@ const chain = {
308
302
  polygonMumbai: {
309
303
  id: chainId.polygonMumbai,
310
304
  name: 'Polygon Mumbai',
305
+ network: 'maticmum',
311
306
  nativeCurrency: {
312
307
  name: 'MATIC',
313
308
  symbol: 'MATIC',
@@ -327,6 +322,7 @@ const chain = {
327
322
  arbitrum: {
328
323
  id: chainId.arbitrum,
329
324
  name: 'Arbitrum',
325
+ network: 'arbitrum',
330
326
  nativeCurrency: {
331
327
  name: 'Ether',
332
328
  symbol: 'AETH',
@@ -349,6 +345,7 @@ const chain = {
349
345
  arbitrumRinkeby: {
350
346
  id: chainId.arbitrumRinkeby,
351
347
  name: 'Arbitrum Rinkeby',
348
+ network: 'arbitrum-rinkeby',
352
349
  nativeCurrency: {
353
350
  name: 'Arbitrum Rinkeby Ether',
354
351
  symbol: 'ARETH',
@@ -372,6 +369,7 @@ const chain = {
372
369
  localhost: {
373
370
  id: chainId.localhost,
374
371
  name: 'Localhost',
372
+ network: 'localhost',
375
373
  rpcUrls: {
376
374
  default: 'http://127.0.0.1:8545'
377
375
  }
@@ -379,6 +377,7 @@ const chain = {
379
377
  hardhat: {
380
378
  id: chainId.hardhat,
381
379
  name: 'Hardhat',
380
+ network: 'hardhat',
382
381
  rpcUrls: {
383
382
  default: 'http://127.0.0.1:8545'
384
383
  }
@@ -393,6 +392,63 @@ function normalizeChainId(chainId) {
393
392
  return chainId;
394
393
  }
395
394
 
395
+ /**
396
+ * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors per EIP-1474.
397
+ * @see https://eips.ethereum.org/EIPS/eip-1474
398
+ */
399
+ class RpcError extends Error {
400
+ constructor(
401
+ /** Number error code */
402
+ code,
403
+ /** Human-readable string */
404
+ message,
405
+ /** Low-level error */
406
+ internal,
407
+ /** Other useful information about error */
408
+ data) {
409
+ if (!Number.isInteger(code)) throw new Error('"code" must be an integer.');
410
+ if (!message || typeof message !== 'string') throw new Error('"message" must be a nonempty string.');
411
+ super(message);
412
+
413
+ _defineProperty(this, "code", void 0);
414
+
415
+ _defineProperty(this, "data", void 0);
416
+
417
+ _defineProperty(this, "internal", void 0);
418
+
419
+ this.code = code;
420
+ this.data = data;
421
+ this.internal = internal;
422
+ }
423
+
424
+ }
425
+ /**
426
+ * Error subclass implementing Ethereum Provider errors per EIP-1193.
427
+ * @see https://eips.ethereum.org/EIPS/eip-1193
428
+ */
429
+
430
+ class ProviderRpcError extends RpcError {
431
+ /**
432
+ * Create an Ethereum Provider JSON-RPC error.
433
+ * `code` must be an integer in the 1000 <= 4999 range.
434
+ */
435
+ constructor(
436
+ /**
437
+ * Number error code
438
+ * @see https://eips.ethereum.org/EIPS/eip-1193#error-standards
439
+ */
440
+ code,
441
+ /** Human-readable string */
442
+ message,
443
+ /** Low-level error */
444
+ internal,
445
+ /** Other useful information about error */
446
+ data) {
447
+ if (!(Number.isInteger(code) && code >= 1000 && code <= 4999)) throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');
448
+ super(code, message, internal, data);
449
+ }
450
+
451
+ }
396
452
  class AddChainError extends Error {
397
453
  constructor() {
398
454
  super(...arguments);
@@ -433,13 +489,11 @@ class ConnectorNotFoundError extends Error {
433
489
  }
434
490
 
435
491
  }
436
- class SwitchChainError extends Error {
437
- constructor() {
438
- super(...arguments);
492
+ class SwitchChainError extends ProviderRpcError {
493
+ constructor(error) {
494
+ super(4902, 'Error switching chain', error);
439
495
 
440
496
  _defineProperty(this, "name", 'SwitchChainError');
441
-
442
- _defineProperty(this, "message", 'Error switching chain');
443
497
  }
444
498
 
445
499
  }
@@ -453,13 +507,19 @@ class SwitchChainNotSupportedError extends Error {
453
507
  }
454
508
 
455
509
  }
456
- class UserRejectedRequestError extends Error {
457
- constructor() {
458
- super(...arguments);
510
+ class UserRejectedRequestError extends ProviderRpcError {
511
+ constructor(error) {
512
+ super(4001, 'User rejected request', error);
459
513
 
460
514
  _defineProperty(this, "name", 'UserRejectedRequestError');
515
+ }
516
+
517
+ }
518
+ class ResourceUnavailableError extends RpcError {
519
+ constructor(error) {
520
+ super(-32002, 'Resource unavailable', error);
461
521
 
462
- _defineProperty(this, "message", 'User rejected request');
522
+ _defineProperty(this, "name", 'ResourceUnavailable');
463
523
  }
464
524
 
465
525
  }
@@ -510,4 +570,4 @@ class Connector extends EventEmitter {
510
570
 
511
571
  }
512
572
 
513
- export { AddChainError as A, ConnectorAlreadyConnectedError as C, SwitchChainNotSupportedError as S, UserRejectedRequestError as U, _defineProperty as _, allChains as a, ConnectorNotFoundError as b, Connector as c, alchemyRpcUrls as d, chain as e, chainId as f, defaultChains as g, defaultL2Chains as h, etherscanBlockExplorers as i, infuraRpcUrls as j, ChainNotConfiguredError as k, SwitchChainError as l, _classPrivateFieldInitSpec as m, normalizeChainId as n, _classPrivateFieldSet as o, _classPrivateFieldGet as p, _checkPrivateRedeclaration as q };
573
+ export { AddChainError as A, ConnectorAlreadyConnectedError as C, ProviderRpcError as P, ResourceUnavailableError as R, SwitchChainNotSupportedError as S, UserRejectedRequestError as U, _classPrivateMethodInitSpec as _, allChains as a, ConnectorNotFoundError as b, Connector as c, chain as d, chainId as e, defaultChains as f, defaultL2Chains as g, etherscanBlockExplorers as h, ChainNotConfiguredError as i, RpcError as j, SwitchChainError as k, _defineProperty as l, _classPrivateFieldInitSpec as m, normalizeChainId as n, _classPrivateMethodGet as o, _classPrivateFieldSet as p, _classPrivateFieldGet as q };
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var EventEmitter = require('eventemitter3');
4
+ var rpcs = require('./rpcs-b3c52116.cjs.prod.js');
4
5
 
5
6
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
6
7
 
@@ -12,6 +13,11 @@ function _checkPrivateRedeclaration(obj, privateCollection) {
12
13
  }
13
14
  }
14
15
 
16
+ function _classPrivateMethodInitSpec(obj, privateSet) {
17
+ _checkPrivateRedeclaration(obj, privateSet);
18
+ privateSet.add(obj);
19
+ }
20
+
15
21
  function _classPrivateFieldInitSpec(obj, privateMap, value) {
16
22
  _checkPrivateRedeclaration(obj, privateMap);
17
23
  privateMap.set(obj, value);
@@ -53,6 +59,14 @@ function _classPrivateFieldGet(receiver, privateMap) {
53
59
  return _classApplyDescriptorGet(receiver, descriptor);
54
60
  }
55
61
 
62
+ function _classPrivateMethodGet(receiver, privateSet, fn) {
63
+ if (!privateSet.has(receiver)) {
64
+ throw new TypeError("attempted to get private field on non-instance");
65
+ }
66
+
67
+ return fn;
68
+ }
69
+
56
70
  function _classApplyDescriptorSet(receiver, descriptor, value) {
57
71
  if (descriptor.set) {
58
72
  descriptor.set.call(receiver, value);
@@ -118,34 +132,6 @@ const etherscanBlockExplorers = {
118
132
  }
119
133
  };
120
134
 
121
- const defaultAlchemyId = '_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC';
122
- const alchemyRpcUrls = {
123
- mainnet: 'https://eth-mainnet.alchemyapi.io/v2',
124
- ropsten: 'https://eth-ropsten.alchemyapi.io/v2',
125
- rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2',
126
- goerli: 'https://eth-goerli.alchemyapi.io/v2',
127
- kovan: 'https://eth-kovan.alchemyapi.io/v2',
128
- optimism: 'https://opt-mainnet.g.alchemy.com/v2',
129
- optimismKovan: 'https://opt-kovan.g.alchemy.com/v2',
130
- polygon: 'https://polygon-mainnet.g.alchemy.com/v2',
131
- polygonMumbai: 'https://polygon-mumbai.g.alchemy.com/v2',
132
- arbitrum: 'https://arb-mainnet.g.alchemy.com/v2',
133
- arbitrumRinkeby: 'https://arb-rinkeby.g.alchemy.com/v2'
134
- };
135
- const infuraRpcUrls = {
136
- mainnet: 'https://mainnet.infura.io/v3',
137
- ropsten: 'https://ropsten.infura.io/v3',
138
- rinkeby: 'https://rinkeby.infura.io/v3',
139
- goerli: 'https://goerli.infura.io/v3',
140
- kovan: 'https://kovan.infura.io/v3',
141
- optimism: 'https://optimism-mainnet.infura.io/v3',
142
- optimismKovan: 'https://optimism-kovan.infura.io/v3',
143
- polygon: 'https://polygon-mainnet.infura.io/v3',
144
- polygonMumbai: 'https://polygon-mumbai.infura.io/v3',
145
- arbitrum: 'https://arbitrum-mainnet.infura.io/v3',
146
- arbitrumRinkeby: 'https://arbitrum-rinkeby.infura.io/v3'
147
- };
148
-
149
135
  const chainId = {
150
136
  mainnet: 1,
151
137
  ropsten: 3,
@@ -165,15 +151,16 @@ const chain = {
165
151
  mainnet: {
166
152
  id: chainId.mainnet,
167
153
  name: 'Ethereum',
154
+ network: 'homestead',
168
155
  nativeCurrency: {
169
156
  name: 'Ether',
170
157
  symbol: 'ETH',
171
158
  decimals: 18
172
159
  },
173
160
  rpcUrls: {
174
- alchemy: alchemyRpcUrls.mainnet,
175
- infura: infuraRpcUrls.mainnet,
176
- default: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId)
161
+ alchemy: rpcs.alchemyRpcUrls.mainnet,
162
+ infura: rpcs.infuraRpcUrls.mainnet,
163
+ default: "".concat(rpcs.alchemyRpcUrls.mainnet, "/").concat(rpcs.defaultAlchemyId)
177
164
  },
178
165
  blockExplorers: {
179
166
  etherscan: etherscanBlockExplorers.mainnet,
@@ -183,15 +170,16 @@ const chain = {
183
170
  ropsten: {
184
171
  id: chainId.ropsten,
185
172
  name: 'Ropsten',
173
+ network: 'ropsten',
186
174
  nativeCurrency: {
187
175
  name: 'Ropsten Ether',
188
176
  symbol: 'ropETH',
189
177
  decimals: 18
190
178
  },
191
179
  rpcUrls: {
192
- alchemy: alchemyRpcUrls.ropsten,
193
- infura: infuraRpcUrls.ropsten,
194
- default: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId)
180
+ alchemy: rpcs.alchemyRpcUrls.ropsten,
181
+ infura: rpcs.infuraRpcUrls.ropsten,
182
+ default: "".concat(rpcs.alchemyRpcUrls.ropsten, "/").concat(rpcs.defaultAlchemyId)
195
183
  },
196
184
  blockExplorers: {
197
185
  etherscan: etherscanBlockExplorers.ropsten,
@@ -202,15 +190,16 @@ const chain = {
202
190
  rinkeby: {
203
191
  id: chainId.rinkeby,
204
192
  name: 'Rinkeby',
193
+ network: 'rinkeby',
205
194
  nativeCurrency: {
206
195
  name: 'Rinkeby Ether',
207
196
  symbol: 'rETH',
208
197
  decimals: 18
209
198
  },
210
199
  rpcUrls: {
211
- alchemy: alchemyRpcUrls.rinkeby,
212
- infura: infuraRpcUrls.rinkeby,
213
- default: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId)
200
+ alchemy: rpcs.alchemyRpcUrls.rinkeby,
201
+ infura: rpcs.infuraRpcUrls.rinkeby,
202
+ default: "".concat(rpcs.alchemyRpcUrls.rinkeby, "/").concat(rpcs.defaultAlchemyId)
214
203
  },
215
204
  blockExplorers: {
216
205
  etherscan: etherscanBlockExplorers.rinkeby,
@@ -221,15 +210,16 @@ const chain = {
221
210
  goerli: {
222
211
  id: chainId.goerli,
223
212
  name: 'Goerli',
213
+ network: 'goerli',
224
214
  nativeCurrency: {
225
215
  name: 'Goerli Ether',
226
216
  symbol: 'gETH',
227
217
  decimals: 18
228
218
  },
229
219
  rpcUrls: {
230
- alchemy: alchemyRpcUrls.goerli,
231
- infura: infuraRpcUrls.goerli,
232
- default: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId)
220
+ alchemy: rpcs.alchemyRpcUrls.goerli,
221
+ infura: rpcs.infuraRpcUrls.goerli,
222
+ default: "".concat(rpcs.alchemyRpcUrls.goerli, "/").concat(rpcs.defaultAlchemyId)
233
223
  },
234
224
  blockExplorers: {
235
225
  etherscan: etherscanBlockExplorers.goerli,
@@ -240,15 +230,16 @@ const chain = {
240
230
  kovan: {
241
231
  id: chainId.kovan,
242
232
  name: 'Kovan',
233
+ network: 'kovan',
243
234
  nativeCurrency: {
244
235
  name: 'Kovan Ether',
245
236
  symbol: 'kETH',
246
237
  decimals: 18
247
238
  },
248
239
  rpcUrls: {
249
- alchemy: alchemyRpcUrls.kovan,
250
- infura: infuraRpcUrls.kovan,
251
- default: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId)
240
+ alchemy: rpcs.alchemyRpcUrls.kovan,
241
+ infura: rpcs.infuraRpcUrls.kovan,
242
+ default: "".concat(rpcs.alchemyRpcUrls.kovan, "/").concat(rpcs.defaultAlchemyId)
252
243
  },
253
244
  blockExplorers: {
254
245
  etherscan: etherscanBlockExplorers.kovan,
@@ -259,14 +250,15 @@ const chain = {
259
250
  optimism: {
260
251
  id: chainId.optimism,
261
252
  name: 'Optimism',
253
+ network: 'optimism',
262
254
  nativeCurrency: {
263
255
  name: 'Ether',
264
256
  symbol: 'ETH',
265
257
  decimals: 18
266
258
  },
267
259
  rpcUrls: {
268
- alchemy: alchemyRpcUrls.optimism,
269
- infura: infuraRpcUrls.optimism,
260
+ alchemy: rpcs.alchemyRpcUrls.optimism,
261
+ infura: rpcs.infuraRpcUrls.optimism,
270
262
  default: 'https://mainnet.optimism.io'
271
263
  },
272
264
  blockExplorers: {
@@ -277,14 +269,15 @@ const chain = {
277
269
  optimismKovan: {
278
270
  id: chainId.optimismKovan,
279
271
  name: 'Optimism Kovan',
272
+ network: 'optimism-kovan',
280
273
  nativeCurrency: {
281
274
  name: 'Kovan Ether',
282
275
  symbol: 'KOR',
283
276
  decimals: 18
284
277
  },
285
278
  rpcUrls: {
286
- alchemy: alchemyRpcUrls.optimismKovan,
287
- infura: infuraRpcUrls.optimismKovan,
279
+ alchemy: rpcs.alchemyRpcUrls.optimismKovan,
280
+ infura: rpcs.infuraRpcUrls.optimismKovan,
288
281
  default: 'https://kovan.optimism.io'
289
282
  },
290
283
  blockExplorers: {
@@ -296,14 +289,15 @@ const chain = {
296
289
  polygon: {
297
290
  id: chainId.polygon,
298
291
  name: 'Polygon',
292
+ network: 'matic',
299
293
  nativeCurrency: {
300
294
  name: 'MATIC',
301
295
  symbol: 'MATIC',
302
296
  decimals: 18
303
297
  },
304
298
  rpcUrls: {
305
- alchemy: alchemyRpcUrls.polygon,
306
- infura: infuraRpcUrls.polygon,
299
+ alchemy: rpcs.alchemyRpcUrls.polygon,
300
+ infura: rpcs.infuraRpcUrls.polygon,
307
301
  default: 'https://polygon-rpc.com'
308
302
  },
309
303
  blockExplorers: {
@@ -314,14 +308,15 @@ const chain = {
314
308
  polygonMumbai: {
315
309
  id: chainId.polygonMumbai,
316
310
  name: 'Polygon Mumbai',
311
+ network: 'maticmum',
317
312
  nativeCurrency: {
318
313
  name: 'MATIC',
319
314
  symbol: 'MATIC',
320
315
  decimals: 18
321
316
  },
322
317
  rpcUrls: {
323
- alchemy: alchemyRpcUrls.polygonMumbai,
324
- infura: infuraRpcUrls.polygonMumbai,
318
+ alchemy: rpcs.alchemyRpcUrls.polygonMumbai,
319
+ infura: rpcs.infuraRpcUrls.polygonMumbai,
325
320
  default: 'https://matic-mumbai.chainstacklabs.com'
326
321
  },
327
322
  blockExplorers: {
@@ -333,14 +328,15 @@ const chain = {
333
328
  arbitrum: {
334
329
  id: chainId.arbitrum,
335
330
  name: 'Arbitrum',
331
+ network: 'arbitrum',
336
332
  nativeCurrency: {
337
333
  name: 'Ether',
338
334
  symbol: 'AETH',
339
335
  decimals: 18
340
336
  },
341
337
  rpcUrls: {
342
- alchemy: alchemyRpcUrls.arbitrum,
343
- infura: infuraRpcUrls.arbitrum,
338
+ alchemy: rpcs.alchemyRpcUrls.arbitrum,
339
+ infura: rpcs.infuraRpcUrls.arbitrum,
344
340
  default: 'https://arb1.arbitrum.io/rpc'
345
341
  },
346
342
  blockExplorers: {
@@ -355,14 +351,15 @@ const chain = {
355
351
  arbitrumRinkeby: {
356
352
  id: chainId.arbitrumRinkeby,
357
353
  name: 'Arbitrum Rinkeby',
354
+ network: 'arbitrum-rinkeby',
358
355
  nativeCurrency: {
359
356
  name: 'Arbitrum Rinkeby Ether',
360
357
  symbol: 'ARETH',
361
358
  decimals: 18
362
359
  },
363
360
  rpcUrls: {
364
- alchemy: alchemyRpcUrls.arbitrumRinkeby,
365
- infura: infuraRpcUrls.arbitrumRinkeby,
361
+ alchemy: rpcs.alchemyRpcUrls.arbitrumRinkeby,
362
+ infura: rpcs.infuraRpcUrls.arbitrumRinkeby,
366
363
  default: 'https://rinkeby.arbitrum.io/rpc'
367
364
  },
368
365
  blockExplorers: {
@@ -378,6 +375,7 @@ const chain = {
378
375
  localhost: {
379
376
  id: chainId.localhost,
380
377
  name: 'Localhost',
378
+ network: 'localhost',
381
379
  rpcUrls: {
382
380
  default: 'http://127.0.0.1:8545'
383
381
  }
@@ -385,6 +383,7 @@ const chain = {
385
383
  hardhat: {
386
384
  id: chainId.hardhat,
387
385
  name: 'Hardhat',
386
+ network: 'hardhat',
388
387
  rpcUrls: {
389
388
  default: 'http://127.0.0.1:8545'
390
389
  }
@@ -399,6 +398,63 @@ function normalizeChainId(chainId) {
399
398
  return chainId;
400
399
  }
401
400
 
401
+ /**
402
+ * Error subclass implementing JSON RPC 2.0 errors and Ethereum RPC errors per EIP-1474.
403
+ * @see https://eips.ethereum.org/EIPS/eip-1474
404
+ */
405
+ class RpcError extends Error {
406
+ constructor(
407
+ /** Number error code */
408
+ code,
409
+ /** Human-readable string */
410
+ message,
411
+ /** Low-level error */
412
+ internal,
413
+ /** Other useful information about error */
414
+ data) {
415
+ if (!Number.isInteger(code)) throw new Error('"code" must be an integer.');
416
+ if (!message || typeof message !== 'string') throw new Error('"message" must be a nonempty string.');
417
+ super(message);
418
+
419
+ _defineProperty(this, "code", void 0);
420
+
421
+ _defineProperty(this, "data", void 0);
422
+
423
+ _defineProperty(this, "internal", void 0);
424
+
425
+ this.code = code;
426
+ this.data = data;
427
+ this.internal = internal;
428
+ }
429
+
430
+ }
431
+ /**
432
+ * Error subclass implementing Ethereum Provider errors per EIP-1193.
433
+ * @see https://eips.ethereum.org/EIPS/eip-1193
434
+ */
435
+
436
+ class ProviderRpcError extends RpcError {
437
+ /**
438
+ * Create an Ethereum Provider JSON-RPC error.
439
+ * `code` must be an integer in the 1000 <= 4999 range.
440
+ */
441
+ constructor(
442
+ /**
443
+ * Number error code
444
+ * @see https://eips.ethereum.org/EIPS/eip-1193#error-standards
445
+ */
446
+ code,
447
+ /** Human-readable string */
448
+ message,
449
+ /** Low-level error */
450
+ internal,
451
+ /** Other useful information about error */
452
+ data) {
453
+ if (!(Number.isInteger(code) && code >= 1000 && code <= 4999)) throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');
454
+ super(code, message, internal, data);
455
+ }
456
+
457
+ }
402
458
  class AddChainError extends Error {
403
459
  constructor() {
404
460
  super(...arguments);
@@ -439,13 +495,11 @@ class ConnectorNotFoundError extends Error {
439
495
  }
440
496
 
441
497
  }
442
- class SwitchChainError extends Error {
443
- constructor() {
444
- super(...arguments);
498
+ class SwitchChainError extends ProviderRpcError {
499
+ constructor(error) {
500
+ super(4902, 'Error switching chain', error);
445
501
 
446
502
  _defineProperty(this, "name", 'SwitchChainError');
447
-
448
- _defineProperty(this, "message", 'Error switching chain');
449
503
  }
450
504
 
451
505
  }
@@ -459,13 +513,19 @@ class SwitchChainNotSupportedError extends Error {
459
513
  }
460
514
 
461
515
  }
462
- class UserRejectedRequestError extends Error {
463
- constructor() {
464
- super(...arguments);
516
+ class UserRejectedRequestError extends ProviderRpcError {
517
+ constructor(error) {
518
+ super(4001, 'User rejected request', error);
465
519
 
466
520
  _defineProperty(this, "name", 'UserRejectedRequestError');
521
+ }
522
+
523
+ }
524
+ class ResourceUnavailableError extends RpcError {
525
+ constructor(error) {
526
+ super(-32002, 'Resource unavailable', error);
467
527
 
468
- _defineProperty(this, "message", 'User rejected request');
528
+ _defineProperty(this, "name", 'ResourceUnavailable');
469
529
  }
470
530
 
471
531
  }
@@ -521,20 +581,22 @@ exports.ChainNotConfiguredError = ChainNotConfiguredError;
521
581
  exports.Connector = Connector;
522
582
  exports.ConnectorAlreadyConnectedError = ConnectorAlreadyConnectedError;
523
583
  exports.ConnectorNotFoundError = ConnectorNotFoundError;
584
+ exports.ProviderRpcError = ProviderRpcError;
585
+ exports.ResourceUnavailableError = ResourceUnavailableError;
586
+ exports.RpcError = RpcError;
524
587
  exports.SwitchChainError = SwitchChainError;
525
588
  exports.SwitchChainNotSupportedError = SwitchChainNotSupportedError;
526
589
  exports.UserRejectedRequestError = UserRejectedRequestError;
527
- exports._checkPrivateRedeclaration = _checkPrivateRedeclaration;
528
590
  exports._classPrivateFieldGet = _classPrivateFieldGet;
529
591
  exports._classPrivateFieldInitSpec = _classPrivateFieldInitSpec;
530
592
  exports._classPrivateFieldSet = _classPrivateFieldSet;
593
+ exports._classPrivateMethodGet = _classPrivateMethodGet;
594
+ exports._classPrivateMethodInitSpec = _classPrivateMethodInitSpec;
531
595
  exports._defineProperty = _defineProperty;
532
- exports.alchemyRpcUrls = alchemyRpcUrls;
533
596
  exports.allChains = allChains;
534
597
  exports.chain = chain;
535
598
  exports.chainId = chainId;
536
599
  exports.defaultChains = defaultChains;
537
600
  exports.defaultL2Chains = defaultL2Chains;
538
601
  exports.etherscanBlockExplorers = etherscanBlockExplorers;
539
- exports.infuraRpcUrls = infuraRpcUrls;
540
602
  exports.normalizeChainId = normalizeChainId;