@wagmi/core 0.9.2-cjs → 0.9.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.
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-KX4UEHS5.js');
2
- require('../chunk-55IO54NW.js');
3
-
4
-
5
-
6
-
7
-
8
-
9
- var _chunk4XWPOWOLjs = require('../chunk-4XWPOWOL.js');
10
- require('../chunk-BVC4KGLQ.js');
11
- require('../chunk-EQOEZP46.js');
12
- require('../chunk-KFW652VN.js');
13
- require('../chunk-MQXBDTVK.js');
1
+ import "../chunk-KX4UEHS5.js";
2
+ import "../chunk-55IO54NW.js";
3
+ import {
4
+ foundry,
5
+ goerli,
6
+ mainnet,
7
+ optimism,
8
+ polygon
9
+ } from "../chunk-LH5WKLUU.js";
10
+ import "../chunk-BVC4KGLQ.js";
11
+ import "../chunk-EQOEZP46.js";
12
+ import "../chunk-KFW652VN.js";
13
+ import "../chunk-MQXBDTVK.js";
14
14
 
15
15
  // test/utils.ts
16
- var _ethers = require('ethers');
16
+ import { BigNumber, Wallet, providers } from "ethers";
17
17
  function getNetwork(chain) {
18
18
  return {
19
19
  chainId: chain.id,
@@ -22,11 +22,11 @@ function getNetwork(chain) {
22
22
  };
23
23
  }
24
24
  var foundryMainnet = {
25
- ..._chunk4XWPOWOLjs.mainnet,
26
- rpcUrls: _chunk4XWPOWOLjs.foundry.rpcUrls
25
+ ...mainnet,
26
+ rpcUrls: foundry.rpcUrls
27
27
  };
28
- var testChains = [foundryMainnet, _chunk4XWPOWOLjs.mainnet, _chunk4XWPOWOLjs.goerli, _chunk4XWPOWOLjs.optimism, _chunk4XWPOWOLjs.polygon];
29
- var EthersProviderWrapper = class extends _ethers.providers.StaticJsonRpcProvider {
28
+ var testChains = [foundryMainnet, mainnet, goerli, optimism, polygon];
29
+ var EthersProviderWrapper = class extends providers.StaticJsonRpcProvider {
30
30
  toJSON() {
31
31
  return `<Provider network={${this.network.chainId}} />`;
32
32
  }
@@ -35,13 +35,13 @@ function getProvider({
35
35
  chains = testChains,
36
36
  chainId
37
37
  } = {}) {
38
- const chain = _nullishCoalesce(testChains.find((x) => x.id === chainId), () => ( foundryMainnet));
38
+ const chain = testChains.find((x) => x.id === chainId) ?? foundryMainnet;
39
39
  const url = foundryMainnet.rpcUrls.default.http[0];
40
40
  const provider = new EthersProviderWrapper(url, getNetwork(chain));
41
41
  provider.pollingInterval = 1e3;
42
42
  return Object.assign(provider, { chains });
43
43
  }
44
- var EthersWebSocketProviderWrapper = class extends _ethers.providers.WebSocketProvider {
44
+ var EthersWebSocketProviderWrapper = class extends providers.WebSocketProvider {
45
45
  toJSON() {
46
46
  return `<WebSocketProvider network={${this.network.chainId}} />`;
47
47
  }
@@ -128,7 +128,7 @@ var accounts = [
128
128
  balance: "10000000000000000000000"
129
129
  }
130
130
  ];
131
- var WalletSigner = class extends _ethers.Wallet {
131
+ var WalletSigner = class extends Wallet {
132
132
  connectUnchecked() {
133
133
  const uncheckedSigner = this.provider.getUncheckedSigner(this.address);
134
134
  return uncheckedSigner;
@@ -138,7 +138,7 @@ function getSigners() {
138
138
  const provider = getProvider();
139
139
  return accounts.map((x) => new WalletSigner(x.privateKey, provider));
140
140
  }
141
-
142
-
143
-
144
- exports.getSigners = getSigners; exports.testChains = testChains;
141
+ export {
142
+ getSigners,
143
+ testChains
144
+ };
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-MQXBDTVK.js');
1
+ import "../chunk-MQXBDTVK.js";
2
2
 
3
3
  // src/providers/alchemy.ts
4
- var _ethers = require('ethers');
4
+ import { providers } from "ethers";
5
5
  function alchemyProvider({
6
6
  apiKey,
7
7
  priority,
@@ -9,38 +9,38 @@ function alchemyProvider({
9
9
  weight
10
10
  }) {
11
11
  return function(chain) {
12
- if (!_optionalChain([chain, 'access', _ => _.rpcUrls, 'access', _2 => _2.alchemy, 'optionalAccess', _3 => _3.http, 'access', _4 => _4[0]]))
12
+ if (!chain.rpcUrls.alchemy?.http[0])
13
13
  return null;
14
14
  return {
15
15
  chain: {
16
16
  ...chain,
17
17
  rpcUrls: {
18
18
  ...chain.rpcUrls,
19
- default: { http: [`${_optionalChain([chain, 'access', _5 => _5.rpcUrls, 'access', _6 => _6.alchemy, 'optionalAccess', _7 => _7.http, 'access', _8 => _8[0]])}/${apiKey}`] }
19
+ default: { http: [`${chain.rpcUrls.alchemy?.http[0]}/${apiKey}`] }
20
20
  }
21
21
  },
22
22
  provider: () => {
23
- const provider = new _ethers.providers.AlchemyProvider(
23
+ const provider = new providers.AlchemyProvider(
24
24
  {
25
25
  chainId: chain.id,
26
26
  name: chain.network,
27
- ensAddress: _optionalChain([chain, 'access', _9 => _9.contracts, 'optionalAccess', _10 => _10.ensRegistry, 'optionalAccess', _11 => _11.address])
27
+ ensAddress: chain.contracts?.ensRegistry?.address
28
28
  },
29
29
  apiKey
30
30
  );
31
31
  return Object.assign(provider, { priority, stallTimeout, weight });
32
32
  },
33
- webSocketProvider: () => new _ethers.providers.AlchemyWebSocketProvider(
33
+ webSocketProvider: () => new providers.AlchemyWebSocketProvider(
34
34
  {
35
35
  chainId: chain.id,
36
36
  name: chain.network,
37
- ensAddress: _optionalChain([chain, 'access', _12 => _12.contracts, 'optionalAccess', _13 => _13.ensRegistry, 'optionalAccess', _14 => _14.address])
37
+ ensAddress: chain.contracts?.ensRegistry?.address
38
38
  },
39
39
  apiKey
40
40
  )
41
41
  };
42
42
  };
43
43
  }
44
-
45
-
46
- exports.alchemyProvider = alchemyProvider;
44
+ export {
45
+ alchemyProvider
46
+ };
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-MQXBDTVK.js');
1
+ import "../chunk-MQXBDTVK.js";
2
2
 
3
3
  // src/providers/infura.ts
4
- var _ethers = require('ethers');
4
+ import { providers } from "ethers";
5
5
  function infuraProvider({
6
6
  apiKey,
7
7
  priority,
@@ -9,38 +9,38 @@ function infuraProvider({
9
9
  weight
10
10
  }) {
11
11
  return function(chain) {
12
- if (!_optionalChain([chain, 'access', _ => _.rpcUrls, 'access', _2 => _2.infura, 'optionalAccess', _3 => _3.http, 'access', _4 => _4[0]]))
12
+ if (!chain.rpcUrls.infura?.http[0])
13
13
  return null;
14
14
  return {
15
15
  chain: {
16
16
  ...chain,
17
17
  rpcUrls: {
18
18
  ...chain.rpcUrls,
19
- default: { http: [`${_optionalChain([chain, 'access', _5 => _5.rpcUrls, 'access', _6 => _6.infura, 'optionalAccess', _7 => _7.http, 'access', _8 => _8[0]])}/${apiKey}`] }
19
+ default: { http: [`${chain.rpcUrls.infura?.http[0]}/${apiKey}`] }
20
20
  }
21
21
  },
22
22
  provider: () => {
23
- const provider = new _ethers.providers.InfuraProvider(
23
+ const provider = new providers.InfuraProvider(
24
24
  {
25
25
  chainId: chain.id,
26
26
  name: chain.network,
27
- ensAddress: _optionalChain([chain, 'access', _9 => _9.contracts, 'optionalAccess', _10 => _10.ensRegistry, 'optionalAccess', _11 => _11.address])
27
+ ensAddress: chain.contracts?.ensRegistry?.address
28
28
  },
29
29
  apiKey
30
30
  );
31
31
  return Object.assign(provider, { priority, stallTimeout, weight });
32
32
  },
33
- webSocketProvider: () => new _ethers.providers.InfuraWebSocketProvider(
33
+ webSocketProvider: () => new providers.InfuraWebSocketProvider(
34
34
  {
35
35
  chainId: chain.id,
36
36
  name: chain.network,
37
- ensAddress: _optionalChain([chain, 'access', _12 => _12.contracts, 'optionalAccess', _13 => _13.ensRegistry, 'optionalAccess', _14 => _14.address])
37
+ ensAddress: chain.contracts?.ensRegistry?.address
38
38
  },
39
39
  apiKey
40
40
  )
41
41
  };
42
42
  };
43
43
  }
44
-
45
-
46
- exports.infuraProvider = infuraProvider;
44
+ export {
45
+ infuraProvider
46
+ };
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-MQXBDTVK.js');
1
+ import "../chunk-MQXBDTVK.js";
2
2
 
3
3
  // src/providers/jsonRpc.ts
4
- var _ethers = require('ethers');
4
+ import { providers } from "ethers";
5
5
  function jsonRpcProvider({
6
6
  priority,
7
7
  rpc,
@@ -22,16 +22,16 @@ function jsonRpcProvider({
22
22
  }
23
23
  },
24
24
  provider: () => {
25
- const RpcProvider = static_ ? _ethers.providers.StaticJsonRpcProvider : _ethers.providers.JsonRpcProvider;
25
+ const RpcProvider = static_ ? providers.StaticJsonRpcProvider : providers.JsonRpcProvider;
26
26
  const provider = new RpcProvider(rpcConfig.http, {
27
- ensAddress: _optionalChain([chain, 'access', _ => _.contracts, 'optionalAccess', _2 => _2.ensRegistry, 'optionalAccess', _3 => _3.address]),
27
+ ensAddress: chain.contracts?.ensRegistry?.address,
28
28
  chainId: chain.id,
29
29
  name: chain.network
30
30
  });
31
31
  return Object.assign(provider, { priority, stallTimeout, weight });
32
32
  },
33
33
  ...rpcConfig.webSocket && {
34
- webSocketProvider: () => new _ethers.providers.WebSocketProvider(
34
+ webSocketProvider: () => new providers.WebSocketProvider(
35
35
  rpcConfig.webSocket,
36
36
  chain.id
37
37
  )
@@ -39,6 +39,6 @@ function jsonRpcProvider({
39
39
  };
40
40
  };
41
41
  }
42
-
43
-
44
- exports.jsonRpcProvider = jsonRpcProvider;
42
+ export {
43
+ jsonRpcProvider
44
+ };
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('../chunk-MQXBDTVK.js');
1
+ import "../chunk-MQXBDTVK.js";
2
2
 
3
3
  // src/providers/public.ts
4
- var _ethers = require('ethers');
4
+ import { providers } from "ethers";
5
5
  function publicProvider({
6
6
  priority,
7
7
  stallTimeout,
@@ -13,12 +13,12 @@ function publicProvider({
13
13
  return {
14
14
  chain,
15
15
  provider: () => {
16
- const provider = new _ethers.providers.StaticJsonRpcProvider(
16
+ const provider = new providers.StaticJsonRpcProvider(
17
17
  chain.rpcUrls.default.http[0],
18
18
  {
19
19
  chainId: chain.id,
20
20
  name: chain.network,
21
- ensAddress: _optionalChain([chain, 'access', _ => _.contracts, 'optionalAccess', _2 => _2.ensRegistry, 'optionalAccess', _3 => _3.address])
21
+ ensAddress: chain.contracts?.ensRegistry?.address
22
22
  }
23
23
  );
24
24
  return Object.assign(provider, { priority, stallTimeout, weight });
@@ -26,6 +26,6 @@ function publicProvider({
26
26
  };
27
27
  };
28
28
  }
29
-
30
-
31
- exports.publicProvider = publicProvider;
29
+ export {
30
+ publicProvider
31
+ };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@wagmi/core",
3
3
  "description": "Vanilla JS library for Ethereum",
4
4
  "license": "MIT",
5
- "version": "0.9.2-cjs",
5
+ "version": "0.9.3",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/wagmi-dev/wagmi.git",
@@ -23,6 +23,7 @@
23
23
  "url": "https://github.com/sponsors/wagmi-dev"
24
24
  }
25
25
  ],
26
+ "type": "module",
26
27
  "main": "dist/index.js",
27
28
  "types": "dist/index.d.ts",
28
29
  "exports": {
@@ -106,11 +107,11 @@
106
107
  }
107
108
  },
108
109
  "dependencies": {
109
- "@wagmi/chains": "0.2.4-cjs",
110
- "@wagmi/connectors": "0.2.2-cjs",
111
110
  "abitype": "^0.3.0",
112
111
  "eventemitter3": "^4.0.7",
113
- "zustand": "^4.3.1"
112
+ "zustand": "^4.3.1",
113
+ "@wagmi/chains": "0.2.5",
114
+ "@wagmi/connectors": "0.2.3"
114
115
  },
115
116
  "devDependencies": {
116
117
  "ethers": "^5.7.1"
@@ -1,88 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/chains.ts
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
- var _chains = require('@wagmi/chains');
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
- exports.arbitrum = _chains.arbitrum; exports.arbitrumGoerli = _chains.arbitrumGoerli; exports.aurora = _chains.aurora; exports.auroraTestnet = _chains.auroraTestnet; exports.avalanche = _chains.avalanche; exports.avalancheFuji = _chains.avalancheFuji; exports.bronos = _chains.bronos; exports.bronosTestnet = _chains.bronosTestnet; exports.bsc = _chains.bsc; exports.bscTestnet = _chains.bscTestnet; exports.canto = _chains.canto; exports.celo = _chains.celo; exports.celoAlfajores = _chains.celoAlfajores; exports.crossbell = _chains.crossbell; exports.evmos = _chains.evmos; exports.evmosTestnet = _chains.evmosTestnet; exports.fantom = _chains.fantom; exports.fantomTestnet = _chains.fantomTestnet; exports.filecoin = _chains.filecoin; exports.filecoinHyperspace = _chains.filecoinHyperspace; exports.foundry = _chains.foundry; exports.goerli = _chains.goerli; exports.gnosis = _chains.gnosis; exports.gnosisChiado = _chains.gnosisChiado; exports.hardhat = _chains.hardhat; exports.iotex = _chains.iotex; exports.iotexTestnet = _chains.iotexTestnet; exports.localhost = _chains.localhost; exports.mainnet = _chains.mainnet; exports.metis = _chains.metis; exports.metisGoerli = _chains.metisGoerli; exports.okc = _chains.okc; exports.optimism = _chains.optimism; exports.optimismGoerli = _chains.optimismGoerli; exports.polygon = _chains.polygon; exports.polygonMumbai = _chains.polygonMumbai; exports.sepolia = _chains.sepolia; exports.taraxa = _chains.taraxa; exports.taraxaTestnet = _chains.taraxaTestnet; exports.zkSync = _chains.zkSync; exports.zkSyncTestnet = _chains.zkSyncTestnet;