@wagmi/core 0.9.2-cjs → 0.9.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.
@@ -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.2",
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.4",
114
+ "@wagmi/connectors": "0.2.2"
114
115
  },
115
116
  "devDependencies": {
116
117
  "ethers": "^5.7.1"