@wagmi/core 0.3.2 → 0.3.3

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 (41) hide show
  1. package/chains/dist/wagmi-core-chains.cjs.d.ts +1 -0
  2. package/chains/dist/wagmi-core-chains.cjs.dev.js +22 -0
  3. package/chains/dist/wagmi-core-chains.cjs.js +7 -0
  4. package/chains/dist/wagmi-core-chains.cjs.prod.js +22 -0
  5. package/chains/dist/wagmi-core-chains.esm.js +2 -0
  6. package/chains/package.json +4 -0
  7. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.dev.js +4 -3
  8. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.cjs.prod.js +4 -3
  9. package/connectors/coinbaseWallet/dist/wagmi-core-connectors-coinbaseWallet.esm.js +2 -1
  10. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.dev.js +3 -2
  11. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.cjs.prod.js +3 -2
  12. package/connectors/metaMask/dist/wagmi-core-connectors-metaMask.esm.js +3 -2
  13. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.dev.js +4 -3
  14. package/connectors/mock/dist/wagmi-core-connectors-mock.cjs.prod.js +4 -3
  15. package/connectors/mock/dist/wagmi-core-connectors-mock.esm.js +2 -1
  16. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.dev.js +4 -3
  17. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.cjs.prod.js +4 -3
  18. package/connectors/walletConnect/dist/wagmi-core-connectors-walletConnect.esm.js +2 -1
  19. package/dist/base-321ac87a.cjs.dev.js +288 -0
  20. package/dist/base-41fb6637.esm.js +265 -0
  21. package/dist/base-6841ebe0.cjs.prod.js +288 -0
  22. package/dist/chains-0dd661ab.cjs.prod.js +349 -0
  23. package/dist/chains-98e2e613.cjs.dev.js +349 -0
  24. package/dist/chains-a0a80d94.esm.js +329 -0
  25. package/dist/{client-edc73358.cjs.prod.js → client-4172f963.cjs.dev.js} +4 -3
  26. package/dist/{client-1ab99bf8.esm.js → client-87c1ff8b.esm.js} +2 -1
  27. package/dist/{client-db513093.cjs.dev.js → client-a06c45f3.cjs.prod.js} +4 -3
  28. package/dist/declarations/src/chains.d.ts +1 -0
  29. package/dist/declarations/src/constants/chains.d.ts +33 -2
  30. package/dist/declarations/src/index.d.ts +2 -3
  31. package/dist/declarations/src/types/index.d.ts +9 -2
  32. package/dist/declarations/src/{chains → utils}/configureChains.d.ts +0 -0
  33. package/dist/declarations/src/utils/index.d.ts +2 -0
  34. package/dist/wagmi-core.cjs.dev.js +118 -117
  35. package/dist/wagmi-core.cjs.prod.js +118 -117
  36. package/dist/wagmi-core.esm.js +108 -106
  37. package/package.json +11 -5
  38. package/dist/base-3a506159.cjs.dev.js +0 -602
  39. package/dist/base-997b4fec.esm.js +0 -573
  40. package/dist/base-cb4198f3.cjs.prod.js +0 -602
  41. package/dist/declarations/src/chains/index.d.ts +0 -2
@@ -1,573 +0,0 @@
1
- import EventEmitter from 'eventemitter3';
2
- import { a as alchemyRpcUrls, i as infuraRpcUrls, d as defaultAlchemyId } from './rpcs-7cfbd91c.esm.js';
3
-
4
- function _checkPrivateRedeclaration(obj, privateCollection) {
5
- if (privateCollection.has(obj)) {
6
- throw new TypeError("Cannot initialize the same private elements twice on an object");
7
- }
8
- }
9
-
10
- function _classPrivateMethodInitSpec(obj, privateSet) {
11
- _checkPrivateRedeclaration(obj, privateSet);
12
- privateSet.add(obj);
13
- }
14
-
15
- function _classPrivateFieldInitSpec(obj, privateMap, value) {
16
- _checkPrivateRedeclaration(obj, privateMap);
17
- privateMap.set(obj, value);
18
- }
19
-
20
- function _defineProperty(obj, key, value) {
21
- if (key in obj) {
22
- Object.defineProperty(obj, key, {
23
- value: value,
24
- enumerable: true,
25
- configurable: true,
26
- writable: true
27
- });
28
- } else {
29
- obj[key] = value;
30
- }
31
-
32
- return obj;
33
- }
34
-
35
- function _classApplyDescriptorGet(receiver, descriptor) {
36
- if (descriptor.get) {
37
- return descriptor.get.call(receiver);
38
- }
39
-
40
- return descriptor.value;
41
- }
42
-
43
- function _classExtractFieldDescriptor(receiver, privateMap, action) {
44
- if (!privateMap.has(receiver)) {
45
- throw new TypeError("attempted to " + action + " private field on non-instance");
46
- }
47
-
48
- return privateMap.get(receiver);
49
- }
50
-
51
- function _classPrivateFieldGet(receiver, privateMap) {
52
- var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get");
53
- return _classApplyDescriptorGet(receiver, descriptor);
54
- }
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
-
64
- function _classApplyDescriptorSet(receiver, descriptor, value) {
65
- if (descriptor.set) {
66
- descriptor.set.call(receiver, value);
67
- } else {
68
- if (!descriptor.writable) {
69
- throw new TypeError("attempted to set read only private field");
70
- }
71
-
72
- descriptor.value = value;
73
- }
74
- }
75
-
76
- function _classPrivateFieldSet(receiver, privateMap, value) {
77
- var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set");
78
- _classApplyDescriptorSet(receiver, descriptor, value);
79
- return value;
80
- }
81
-
82
- const etherscanBlockExplorers = {
83
- mainnet: {
84
- name: 'Etherscan',
85
- url: 'https://etherscan.io'
86
- },
87
- ropsten: {
88
- name: 'Etherscan',
89
- url: 'https://ropsten.etherscan.io'
90
- },
91
- rinkeby: {
92
- name: 'Etherscan',
93
- url: 'https://rinkeby.etherscan.io'
94
- },
95
- goerli: {
96
- name: 'Etherscan',
97
- url: 'https://goerli.etherscan.io'
98
- },
99
- kovan: {
100
- name: 'Etherscan',
101
- url: 'https://kovan.etherscan.io'
102
- },
103
- optimism: {
104
- name: 'Etherscan',
105
- url: 'https://optimistic.etherscan.io'
106
- },
107
- optimismKovan: {
108
- name: 'Etherscan',
109
- url: 'https://kovan-optimistic.etherscan.io'
110
- },
111
- polygon: {
112
- name: 'PolygonScan',
113
- url: 'https://polygonscan.com'
114
- },
115
- polygonMumbai: {
116
- name: 'PolygonScan',
117
- url: 'https://mumbai.polygonscan.com'
118
- },
119
- arbitrum: {
120
- name: 'Arbiscan',
121
- url: 'https://arbiscan.io'
122
- },
123
- arbitrumRinkeby: {
124
- name: 'Arbiscan',
125
- url: 'https://testnet.arbiscan.io'
126
- }
127
- };
128
-
129
- const chainId = {
130
- mainnet: 1,
131
- ropsten: 3,
132
- rinkeby: 4,
133
- goerli: 5,
134
- kovan: 42,
135
- optimism: 10,
136
- optimismKovan: 69,
137
- polygon: 137,
138
- polygonMumbai: 80001,
139
- arbitrum: 42161,
140
- arbitrumRinkeby: 421611,
141
- localhost: 1337,
142
- hardhat: 31337
143
- };
144
- const chain = {
145
- mainnet: {
146
- id: chainId.mainnet,
147
- name: 'Ethereum',
148
- network: 'homestead',
149
- nativeCurrency: {
150
- name: 'Ether',
151
- symbol: 'ETH',
152
- decimals: 18
153
- },
154
- rpcUrls: {
155
- alchemy: alchemyRpcUrls.mainnet,
156
- infura: infuraRpcUrls.mainnet,
157
- default: "".concat(alchemyRpcUrls.mainnet, "/").concat(defaultAlchemyId)
158
- },
159
- blockExplorers: {
160
- etherscan: etherscanBlockExplorers.mainnet,
161
- default: etherscanBlockExplorers.mainnet
162
- }
163
- },
164
- ropsten: {
165
- id: chainId.ropsten,
166
- name: 'Ropsten',
167
- network: 'ropsten',
168
- nativeCurrency: {
169
- name: 'Ropsten Ether',
170
- symbol: 'ropETH',
171
- decimals: 18
172
- },
173
- rpcUrls: {
174
- alchemy: alchemyRpcUrls.ropsten,
175
- infura: infuraRpcUrls.ropsten,
176
- default: "".concat(alchemyRpcUrls.ropsten, "/").concat(defaultAlchemyId)
177
- },
178
- blockExplorers: {
179
- etherscan: etherscanBlockExplorers.ropsten,
180
- default: etherscanBlockExplorers.ropsten
181
- },
182
- testnet: true
183
- },
184
- rinkeby: {
185
- id: chainId.rinkeby,
186
- name: 'Rinkeby',
187
- network: 'rinkeby',
188
- nativeCurrency: {
189
- name: 'Rinkeby Ether',
190
- symbol: 'rETH',
191
- decimals: 18
192
- },
193
- rpcUrls: {
194
- alchemy: alchemyRpcUrls.rinkeby,
195
- infura: infuraRpcUrls.rinkeby,
196
- default: "".concat(alchemyRpcUrls.rinkeby, "/").concat(defaultAlchemyId)
197
- },
198
- blockExplorers: {
199
- etherscan: etherscanBlockExplorers.rinkeby,
200
- default: etherscanBlockExplorers.rinkeby
201
- },
202
- testnet: true
203
- },
204
- goerli: {
205
- id: chainId.goerli,
206
- name: 'Goerli',
207
- network: 'goerli',
208
- nativeCurrency: {
209
- name: 'Goerli Ether',
210
- symbol: 'gETH',
211
- decimals: 18
212
- },
213
- rpcUrls: {
214
- alchemy: alchemyRpcUrls.goerli,
215
- infura: infuraRpcUrls.goerli,
216
- default: "".concat(alchemyRpcUrls.goerli, "/").concat(defaultAlchemyId)
217
- },
218
- blockExplorers: {
219
- etherscan: etherscanBlockExplorers.goerli,
220
- default: etherscanBlockExplorers.goerli
221
- },
222
- testnet: true
223
- },
224
- kovan: {
225
- id: chainId.kovan,
226
- name: 'Kovan',
227
- network: 'kovan',
228
- nativeCurrency: {
229
- name: 'Kovan Ether',
230
- symbol: 'kETH',
231
- decimals: 18
232
- },
233
- rpcUrls: {
234
- alchemy: alchemyRpcUrls.kovan,
235
- infura: infuraRpcUrls.kovan,
236
- default: "".concat(alchemyRpcUrls.kovan, "/").concat(defaultAlchemyId)
237
- },
238
- blockExplorers: {
239
- etherscan: etherscanBlockExplorers.kovan,
240
- default: etherscanBlockExplorers.kovan
241
- },
242
- testnet: true
243
- },
244
- optimism: {
245
- id: chainId.optimism,
246
- name: 'Optimism',
247
- network: 'optimism',
248
- nativeCurrency: {
249
- name: 'Ether',
250
- symbol: 'ETH',
251
- decimals: 18
252
- },
253
- rpcUrls: {
254
- alchemy: alchemyRpcUrls.optimism,
255
- infura: infuraRpcUrls.optimism,
256
- default: 'https://mainnet.optimism.io'
257
- },
258
- blockExplorers: {
259
- etherscan: etherscanBlockExplorers.optimism,
260
- default: etherscanBlockExplorers.optimism
261
- }
262
- },
263
- optimismKovan: {
264
- id: chainId.optimismKovan,
265
- name: 'Optimism Kovan',
266
- network: 'optimism-kovan',
267
- nativeCurrency: {
268
- name: 'Kovan Ether',
269
- symbol: 'KOR',
270
- decimals: 18
271
- },
272
- rpcUrls: {
273
- alchemy: alchemyRpcUrls.optimismKovan,
274
- infura: infuraRpcUrls.optimismKovan,
275
- default: 'https://kovan.optimism.io'
276
- },
277
- blockExplorers: {
278
- etherscan: etherscanBlockExplorers.optimismKovan,
279
- default: etherscanBlockExplorers.optimismKovan
280
- },
281
- testnet: true
282
- },
283
- polygon: {
284
- id: chainId.polygon,
285
- name: 'Polygon',
286
- network: 'matic',
287
- nativeCurrency: {
288
- name: 'MATIC',
289
- symbol: 'MATIC',
290
- decimals: 18
291
- },
292
- rpcUrls: {
293
- alchemy: alchemyRpcUrls.polygon,
294
- infura: infuraRpcUrls.polygon,
295
- default: 'https://polygon-rpc.com'
296
- },
297
- blockExplorers: {
298
- etherscan: etherscanBlockExplorers.polygon,
299
- default: etherscanBlockExplorers.polygon
300
- }
301
- },
302
- polygonMumbai: {
303
- id: chainId.polygonMumbai,
304
- name: 'Polygon Mumbai',
305
- network: 'maticmum',
306
- nativeCurrency: {
307
- name: 'MATIC',
308
- symbol: 'MATIC',
309
- decimals: 18
310
- },
311
- rpcUrls: {
312
- alchemy: alchemyRpcUrls.polygonMumbai,
313
- infura: infuraRpcUrls.polygonMumbai,
314
- default: 'https://matic-mumbai.chainstacklabs.com'
315
- },
316
- blockExplorers: {
317
- etherscan: etherscanBlockExplorers.polygonMumbai,
318
- default: etherscanBlockExplorers.polygonMumbai
319
- },
320
- testnet: true
321
- },
322
- arbitrum: {
323
- id: chainId.arbitrum,
324
- name: 'Arbitrum',
325
- network: 'arbitrum',
326
- nativeCurrency: {
327
- name: 'Ether',
328
- symbol: 'AETH',
329
- decimals: 18
330
- },
331
- rpcUrls: {
332
- alchemy: alchemyRpcUrls.arbitrum,
333
- infura: infuraRpcUrls.arbitrum,
334
- default: 'https://arb1.arbitrum.io/rpc'
335
- },
336
- blockExplorers: {
337
- arbitrum: {
338
- name: 'Arbitrum Explorer',
339
- url: 'https://explorer.arbitrum.io'
340
- },
341
- etherscan: etherscanBlockExplorers.arbitrum,
342
- default: etherscanBlockExplorers.arbitrum
343
- }
344
- },
345
- arbitrumRinkeby: {
346
- id: chainId.arbitrumRinkeby,
347
- name: 'Arbitrum Rinkeby',
348
- network: 'arbitrum-rinkeby',
349
- nativeCurrency: {
350
- name: 'Arbitrum Rinkeby Ether',
351
- symbol: 'ARETH',
352
- decimals: 18
353
- },
354
- rpcUrls: {
355
- alchemy: alchemyRpcUrls.arbitrumRinkeby,
356
- infura: infuraRpcUrls.arbitrumRinkeby,
357
- default: 'https://rinkeby.arbitrum.io/rpc'
358
- },
359
- blockExplorers: {
360
- arbitrum: {
361
- name: 'Arbitrum Explorer',
362
- url: 'https://rinkeby-explorer.arbitrum.io'
363
- },
364
- etherscan: etherscanBlockExplorers.arbitrumRinkeby,
365
- default: etherscanBlockExplorers.arbitrumRinkeby
366
- },
367
- testnet: true
368
- },
369
- localhost: {
370
- id: chainId.localhost,
371
- name: 'Localhost',
372
- network: 'localhost',
373
- rpcUrls: {
374
- default: 'http://127.0.0.1:8545'
375
- }
376
- },
377
- hardhat: {
378
- id: chainId.hardhat,
379
- name: 'Hardhat',
380
- network: '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
- /**
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
- }
452
- class AddChainError extends Error {
453
- constructor() {
454
- super(...arguments);
455
-
456
- _defineProperty(this, "name", 'AddChainError');
457
-
458
- _defineProperty(this, "message", 'Error adding chain');
459
- }
460
-
461
- }
462
- class ChainNotConfiguredError extends Error {
463
- constructor() {
464
- super(...arguments);
465
-
466
- _defineProperty(this, "name", 'ChainNotConfigured');
467
-
468
- _defineProperty(this, "message", 'Chain not configured');
469
- }
470
-
471
- }
472
- class ConnectorAlreadyConnectedError extends Error {
473
- constructor() {
474
- super(...arguments);
475
-
476
- _defineProperty(this, "name", 'ConnectorAlreadyConnectedError');
477
-
478
- _defineProperty(this, "message", 'Connector already connected');
479
- }
480
-
481
- }
482
- class ConnectorNotFoundError extends Error {
483
- constructor() {
484
- super(...arguments);
485
-
486
- _defineProperty(this, "name", 'ConnectorNotFoundError');
487
-
488
- _defineProperty(this, "message", 'Connector not found');
489
- }
490
-
491
- }
492
- class SwitchChainError extends ProviderRpcError {
493
- constructor(error) {
494
- super(4902, 'Error switching chain', error);
495
-
496
- _defineProperty(this, "name", 'SwitchChainError');
497
- }
498
-
499
- }
500
- class SwitchChainNotSupportedError extends Error {
501
- constructor() {
502
- super(...arguments);
503
-
504
- _defineProperty(this, "name", 'SwitchChainNotSupportedError');
505
-
506
- _defineProperty(this, "message", 'Switch chain not supported by connector');
507
- }
508
-
509
- }
510
- class UserRejectedRequestError extends ProviderRpcError {
511
- constructor(error) {
512
- super(4001, 'User rejected request', error);
513
-
514
- _defineProperty(this, "name", 'UserRejectedRequestError');
515
- }
516
-
517
- }
518
- class ResourceUnavailableError extends RpcError {
519
- constructor(error) {
520
- super(-32002, 'Resource unavailable', error);
521
-
522
- _defineProperty(this, "name", 'ResourceUnavailable');
523
- }
524
-
525
- }
526
-
527
- class Connector extends EventEmitter {
528
- /** Unique connector id */
529
-
530
- /** Connector name */
531
-
532
- /** Chains connector supports */
533
-
534
- /** Options to use with connector */
535
-
536
- /** Whether connector is usable */
537
- constructor(_ref) {
538
- let {
539
- chains = defaultChains,
540
- options
541
- } = _ref;
542
- super();
543
-
544
- _defineProperty(this, "id", void 0);
545
-
546
- _defineProperty(this, "name", void 0);
547
-
548
- _defineProperty(this, "chains", void 0);
549
-
550
- _defineProperty(this, "options", void 0);
551
-
552
- _defineProperty(this, "ready", void 0);
553
-
554
- this.chains = chains;
555
- this.options = options;
556
- }
557
-
558
- getBlockExplorerUrls(chain) {
559
- var _chain$blockExplorers;
560
-
561
- const blockExplorer = (_chain$blockExplorers = chain.blockExplorers) === null || _chain$blockExplorers === void 0 ? void 0 : _chain$blockExplorers.default;
562
- if (Array.isArray(blockExplorer)) return blockExplorer.map(x => x.url);
563
- if (blockExplorer !== null && blockExplorer !== void 0 && blockExplorer.url) return [blockExplorer.url];
564
- return [];
565
- }
566
-
567
- isChainUnsupported(chainId) {
568
- return !this.chains.some(x => x.id === chainId);
569
- }
570
-
571
- }
572
-
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 };