@wagmi/core 0.7.8 → 0.8.0

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 (36) hide show
  1. package/dist/{base-a32d0b91.d.ts → base-a82112a9.d.ts} +1 -1
  2. package/dist/chains.d.ts +1 -3
  3. package/dist/chains.js +13 -1
  4. package/dist/chunk-6KG5TOAU.js +42 -0
  5. package/dist/{chunk-HEIMP7HQ.js → chunk-F4A7FMUQ.js} +1166 -1126
  6. package/dist/chunk-J6DUE3KA.js +0 -0
  7. package/dist/chunk-VCRGL4ZG.js +191 -0
  8. package/dist/connectors/coinbaseWallet.d.ts +2 -2
  9. package/dist/connectors/coinbaseWallet.js +8 -5
  10. package/dist/connectors/metaMask.d.ts +4 -3
  11. package/dist/connectors/metaMask.js +2 -2
  12. package/dist/connectors/mock/index.d.ts +3 -2
  13. package/dist/connectors/mock/index.js +6 -185
  14. package/dist/connectors/walletConnect.d.ts +2 -2
  15. package/dist/connectors/walletConnect.js +8 -4
  16. package/dist/{index-58cffc47.d.ts → index-971cda79.d.ts} +2 -103
  17. package/dist/index.d.ts +51 -46
  18. package/dist/index.js +9 -20
  19. package/dist/{injected-82510902.d.ts → injected-610c34b6.d.ts} +3 -2
  20. package/dist/{internal.d.ts → internal/index.d.ts} +3 -2
  21. package/dist/internal/index.js +8 -0
  22. package/dist/internal/test.d.ts +12 -0
  23. package/dist/internal/test.js +142 -0
  24. package/dist/providers/alchemy.d.ts +2 -1
  25. package/dist/providers/alchemy.js +2 -2
  26. package/dist/providers/infura.d.ts +2 -1
  27. package/dist/providers/infura.js +2 -2
  28. package/dist/providers/jsonRpc.d.ts +2 -1
  29. package/dist/providers/jsonRpc.js +2 -2
  30. package/dist/providers/public.d.ts +2 -1
  31. package/dist/providers/public.js +2 -2
  32. package/internal/package.json +1 -1
  33. package/internal/test/package.json +4 -0
  34. package/package.json +12 -7
  35. package/dist/chunk-4DNFSL2K.js +0 -376
  36. package/dist/internal.js +0 -8
File without changes
@@ -0,0 +1,191 @@
1
+ import {
2
+ Connector,
3
+ UserRejectedRequestError,
4
+ normalizeChainId
5
+ } from "./chunk-F4A7FMUQ.js";
6
+ import {
7
+ __privateAdd,
8
+ __privateGet,
9
+ __privateMethod,
10
+ __privateSet
11
+ } from "./chunk-MQXBDTVK.js";
12
+
13
+ // src/connectors/mock/connector.ts
14
+ import { getAddress as getAddress2 } from "ethers/lib/utils.js";
15
+
16
+ // src/connectors/mock/provider.ts
17
+ import { providers } from "ethers";
18
+ import { getAddress } from "ethers/lib/utils.js";
19
+ import { default as EventEmitter } from "eventemitter3";
20
+ var _options, _signer;
21
+ var MockProvider = class extends providers.BaseProvider {
22
+ constructor(options) {
23
+ super({ name: "Network", chainId: options.chainId ?? 1 });
24
+ this.events = new EventEmitter();
25
+ __privateAdd(this, _options, void 0);
26
+ __privateAdd(this, _signer, void 0);
27
+ __privateSet(this, _options, options);
28
+ }
29
+ async enable() {
30
+ if (__privateGet(this, _options).flags?.failConnect)
31
+ throw new UserRejectedRequestError(new Error("Failed to connect"));
32
+ if (!__privateGet(this, _signer))
33
+ __privateSet(this, _signer, __privateGet(this, _options).signer);
34
+ const address = await __privateGet(this, _signer).getAddress();
35
+ this.events.emit("accountsChanged", [address]);
36
+ return [address];
37
+ }
38
+ async disconnect() {
39
+ this.events.emit("disconnect");
40
+ __privateSet(this, _signer, void 0);
41
+ }
42
+ async getAccounts() {
43
+ const address = await __privateGet(this, _signer)?.getAddress();
44
+ if (!address)
45
+ return [];
46
+ return [getAddress(address)];
47
+ }
48
+ getSigner() {
49
+ const signer = __privateGet(this, _signer);
50
+ if (!signer)
51
+ throw new Error("Signer not found");
52
+ return signer;
53
+ }
54
+ async switchChain(chainId) {
55
+ if (__privateGet(this, _options).flags?.failSwitchChain)
56
+ throw new UserRejectedRequestError(new Error("Failed to switch chain"));
57
+ __privateGet(this, _options).chainId = chainId;
58
+ this.network.chainId = chainId;
59
+ this.events.emit("chainChanged", chainId);
60
+ }
61
+ async watchAsset(_asset) {
62
+ return true;
63
+ }
64
+ on(event, listener) {
65
+ this.events.on(event, listener);
66
+ return this;
67
+ }
68
+ once(event, listener) {
69
+ this.events.once(event, listener);
70
+ return this;
71
+ }
72
+ removeListener(event, listener) {
73
+ this.events.removeListener(event, listener);
74
+ return this;
75
+ }
76
+ off(event, listener) {
77
+ this.events.off(event, listener);
78
+ return this;
79
+ }
80
+ toJSON() {
81
+ return "<MockProvider>";
82
+ }
83
+ };
84
+ _options = new WeakMap();
85
+ _signer = new WeakMap();
86
+
87
+ // src/connectors/mock/connector.ts
88
+ var _provider, _switchChain, switchChain_fn;
89
+ var MockConnector = class extends Connector {
90
+ constructor(config) {
91
+ super(config);
92
+ __privateAdd(this, _switchChain);
93
+ this.id = "mock";
94
+ this.name = "Mock";
95
+ this.ready = true;
96
+ __privateAdd(this, _provider, void 0);
97
+ this.onAccountsChanged = (accounts) => {
98
+ if (accounts.length === 0)
99
+ this.emit("disconnect");
100
+ else
101
+ this.emit("change", { account: getAddress2(accounts[0]) });
102
+ };
103
+ this.onChainChanged = (chainId) => {
104
+ const id = normalizeChainId(chainId);
105
+ const unsupported = this.isChainUnsupported(id);
106
+ this.emit("change", { chain: { id, unsupported } });
107
+ };
108
+ this.onDisconnect = () => {
109
+ this.emit("disconnect");
110
+ };
111
+ }
112
+ async connect({ chainId } = {}) {
113
+ const provider = await this.getProvider({ chainId });
114
+ provider.on("accountsChanged", this.onAccountsChanged);
115
+ provider.on("chainChanged", this.onChainChanged);
116
+ provider.on("disconnect", this.onDisconnect);
117
+ this.emit("message", { type: "connecting" });
118
+ const accounts = await provider.enable();
119
+ const account = getAddress2(accounts[0]);
120
+ const id = normalizeChainId(provider._network.chainId);
121
+ const unsupported = this.isChainUnsupported(id);
122
+ const data = { account, chain: { id, unsupported }, provider };
123
+ if (!this.options.flags?.noSwitchChain)
124
+ this.switchChain = __privateMethod(this, _switchChain, switchChain_fn);
125
+ return new Promise(
126
+ (res) => setTimeout(() => res(data), 100)
127
+ );
128
+ }
129
+ async disconnect() {
130
+ const provider = await this.getProvider();
131
+ await provider.disconnect();
132
+ provider.removeListener("accountsChanged", this.onAccountsChanged);
133
+ provider.removeListener("chainChanged", this.onChainChanged);
134
+ provider.removeListener("disconnect", this.onDisconnect);
135
+ }
136
+ async getAccount() {
137
+ const provider = await this.getProvider();
138
+ const accounts = await provider.getAccounts();
139
+ const account = accounts[0];
140
+ if (!account)
141
+ throw new Error("Failed to get account");
142
+ return getAddress2(account);
143
+ }
144
+ async getChainId() {
145
+ const provider = await this.getProvider();
146
+ return normalizeChainId(provider.network.chainId);
147
+ }
148
+ async getProvider({ chainId } = {}) {
149
+ if (!__privateGet(this, _provider) || chainId)
150
+ __privateSet(this, _provider, new MockProvider({ ...this.options, chainId }));
151
+ return __privateGet(this, _provider);
152
+ }
153
+ async getSigner() {
154
+ const provider = await this.getProvider();
155
+ return provider.getSigner();
156
+ }
157
+ async isAuthorized() {
158
+ try {
159
+ const provider = await this.getProvider();
160
+ const account = await provider.getAccounts();
161
+ return this.options.flags?.isAuthorized ?? !!account;
162
+ } catch {
163
+ return false;
164
+ }
165
+ }
166
+ async watchAsset(asset) {
167
+ const provider = await this.getProvider();
168
+ return provider.watchAsset(asset);
169
+ }
170
+ toJSON() {
171
+ return "<MockConnector>";
172
+ }
173
+ };
174
+ _provider = new WeakMap();
175
+ _switchChain = new WeakSet();
176
+ switchChain_fn = async function(chainId) {
177
+ const provider = await this.getProvider();
178
+ await provider.switchChain(chainId);
179
+ return this.chains.find((x) => x.id === chainId) ?? {
180
+ id: chainId,
181
+ name: `Chain ${chainId}`,
182
+ network: `${chainId}`,
183
+ nativeCurrency: { name: "Ether", decimals: 18, symbol: "ETH" },
184
+ rpcUrls: { default: { http: [""] } }
185
+ };
186
+ };
187
+
188
+ export {
189
+ MockProvider,
190
+ MockConnector
191
+ };
@@ -1,8 +1,8 @@
1
1
  import { CoinbaseWalletProvider } from '@coinbase/wallet-sdk';
2
2
  import { CoinbaseWalletSDKOptions } from '@coinbase/wallet-sdk/dist/CoinbaseWalletSDK';
3
3
  import { providers } from 'ethers';
4
- import { C as Chain } from '../index-58cffc47.js';
5
- import { C as Connector } from '../base-a32d0b91.js';
4
+ import { Chain } from '@wagmi/chains';
5
+ import { C as Connector } from '../base-a82112a9.js';
6
6
  import 'abitype';
7
7
  import 'eventemitter3';
8
8
 
@@ -5,8 +5,8 @@ import {
5
5
  SwitchChainError,
6
6
  UserRejectedRequestError,
7
7
  normalizeChainId
8
- } from "../chunk-HEIMP7HQ.js";
9
- import "../chunk-4DNFSL2K.js";
8
+ } from "../chunk-F4A7FMUQ.js";
9
+ import "../chunk-6KG5TOAU.js";
10
10
  import {
11
11
  __privateAdd,
12
12
  __privateGet,
@@ -116,7 +116,7 @@ var CoinbaseWalletConnector = class extends Connector {
116
116
  (chain2) => this.options.chainId ? chain2.id === this.options.chainId : chain2.id === walletExtensionChainId
117
117
  ) || this.chains[0];
118
118
  const chainId = this.options.chainId || chain?.id;
119
- const jsonRpcUrl = this.options.jsonRpcUrl || chain?.rpcUrls.default;
119
+ const jsonRpcUrl = this.options.jsonRpcUrl || chain?.rpcUrls.default.http[0];
120
120
  __privateSet(this, _provider, __privateGet(this, _client).makeWeb3Provider(jsonRpcUrl, chainId));
121
121
  }
122
122
  return __privateGet(this, _provider);
@@ -151,7 +151,8 @@ var CoinbaseWalletConnector = class extends Connector {
151
151
  id: chainId,
152
152
  name: `Chain ${id}`,
153
153
  network: `${id}`,
154
- rpcUrls: { default: "" }
154
+ nativeCurrency: { name: "Ether", decimals: 18, symbol: "ETH" },
155
+ rpcUrls: { default: { http: [""] } }
155
156
  };
156
157
  } catch (error) {
157
158
  const chain = this.chains.find((x) => x.id === chainId);
@@ -166,7 +167,9 @@ var CoinbaseWalletConnector = class extends Connector {
166
167
  chainId: id,
167
168
  chainName: chain.name,
168
169
  nativeCurrency: chain.nativeCurrency,
169
- rpcUrls: [chain.rpcUrls.public ?? chain.rpcUrls.default],
170
+ rpcUrls: [
171
+ chain.rpcUrls.public?.http[0] ?? chain.rpcUrls.default.http[0]
172
+ ],
170
173
  blockExplorerUrls: this.getBlockExplorerUrls(chain)
171
174
  }
172
175
  ]
@@ -1,8 +1,9 @@
1
- import { C as Chain, E as Ethereum } from '../index-58cffc47.js';
2
- import { a as InjectedConnectorOptions, I as InjectedConnector } from '../injected-82510902.js';
1
+ import { Chain } from '@wagmi/chains';
2
+ import { E as Ethereum } from '../index-971cda79.js';
3
+ import { a as InjectedConnectorOptions, I as InjectedConnector } from '../injected-610c34b6.js';
3
4
  import 'abitype';
4
5
  import 'ethers';
5
- import '../base-a32d0b91.js';
6
+ import '../base-a82112a9.js';
6
7
  import 'eventemitter3';
7
8
 
8
9
  type MetaMaskConnectorOptions = Pick<InjectedConnectorOptions, 'shimChainChangedDisconnect' | 'shimDisconnect'> & {
@@ -4,8 +4,8 @@ import {
4
4
  ResourceUnavailableError,
5
5
  UserRejectedRequestError,
6
6
  getClient
7
- } from "../chunk-HEIMP7HQ.js";
8
- import "../chunk-4DNFSL2K.js";
7
+ } from "../chunk-F4A7FMUQ.js";
8
+ import "../chunk-6KG5TOAU.js";
9
9
  import {
10
10
  __privateAdd,
11
11
  __privateGet,
@@ -1,8 +1,9 @@
1
1
  import * as ethers from 'ethers';
2
2
  import { providers } from 'ethers';
3
- import { S as Signer, C as Chain } from '../../index-58cffc47.js';
4
- import { C as Connector, a as ConnectorData } from '../../base-a32d0b91.js';
3
+ import { Chain } from '@wagmi/chains';
4
+ import { C as Connector, a as ConnectorData } from '../../base-a82112a9.js';
5
5
  import EventEmitter from 'eventemitter3';
6
+ import { S as Signer } from '../../index-971cda79.js';
6
7
  import 'abitype';
7
8
 
8
9
  type MockProviderOptions = {
@@ -1,189 +1,10 @@
1
1
  import {
2
- Connector,
3
- UserRejectedRequestError,
4
- normalizeChainId
5
- } from "../../chunk-HEIMP7HQ.js";
6
- import "../../chunk-4DNFSL2K.js";
7
- import {
8
- __privateAdd,
9
- __privateGet,
10
- __privateMethod,
11
- __privateSet
12
- } from "../../chunk-MQXBDTVK.js";
13
-
14
- // src/connectors/mock/connector.ts
15
- import { getAddress as getAddress2 } from "ethers/lib/utils.js";
16
-
17
- // src/connectors/mock/provider.ts
18
- import { providers } from "ethers";
19
- import { getAddress } from "ethers/lib/utils.js";
20
- import { default as EventEmitter } from "eventemitter3";
21
- var _options, _signer;
22
- var MockProvider = class extends providers.BaseProvider {
23
- constructor(options) {
24
- super({ name: "Network", chainId: options.chainId ?? 1 });
25
- this.events = new EventEmitter();
26
- __privateAdd(this, _options, void 0);
27
- __privateAdd(this, _signer, void 0);
28
- __privateSet(this, _options, options);
29
- }
30
- async enable() {
31
- if (__privateGet(this, _options).flags?.failConnect)
32
- throw new UserRejectedRequestError(new Error("Failed to connect"));
33
- if (!__privateGet(this, _signer))
34
- __privateSet(this, _signer, __privateGet(this, _options).signer);
35
- const address = await __privateGet(this, _signer).getAddress();
36
- this.events.emit("accountsChanged", [address]);
37
- return [address];
38
- }
39
- async disconnect() {
40
- this.events.emit("disconnect");
41
- __privateSet(this, _signer, void 0);
42
- }
43
- async getAccounts() {
44
- const address = await __privateGet(this, _signer)?.getAddress();
45
- if (!address)
46
- return [];
47
- return [getAddress(address)];
48
- }
49
- getSigner() {
50
- const signer = __privateGet(this, _signer);
51
- if (!signer)
52
- throw new Error("Signer not found");
53
- return signer;
54
- }
55
- async switchChain(chainId) {
56
- if (__privateGet(this, _options).flags?.failSwitchChain)
57
- throw new UserRejectedRequestError(new Error("Failed to switch chain"));
58
- __privateGet(this, _options).chainId = chainId;
59
- this.network.chainId = chainId;
60
- this.events.emit("chainChanged", chainId);
61
- }
62
- async watchAsset(_asset) {
63
- return true;
64
- }
65
- on(event, listener) {
66
- this.events.on(event, listener);
67
- return this;
68
- }
69
- once(event, listener) {
70
- this.events.once(event, listener);
71
- return this;
72
- }
73
- removeListener(event, listener) {
74
- this.events.removeListener(event, listener);
75
- return this;
76
- }
77
- off(event, listener) {
78
- this.events.off(event, listener);
79
- return this;
80
- }
81
- toJSON() {
82
- return "<MockProvider>";
83
- }
84
- };
85
- _options = new WeakMap();
86
- _signer = new WeakMap();
87
-
88
- // src/connectors/mock/connector.ts
89
- var _provider, _switchChain, switchChain_fn;
90
- var MockConnector = class extends Connector {
91
- constructor(config) {
92
- super(config);
93
- __privateAdd(this, _switchChain);
94
- this.id = "mock";
95
- this.name = "Mock";
96
- this.ready = true;
97
- __privateAdd(this, _provider, void 0);
98
- this.onAccountsChanged = (accounts) => {
99
- if (accounts.length === 0)
100
- this.emit("disconnect");
101
- else
102
- this.emit("change", { account: getAddress2(accounts[0]) });
103
- };
104
- this.onChainChanged = (chainId) => {
105
- const id = normalizeChainId(chainId);
106
- const unsupported = this.isChainUnsupported(id);
107
- this.emit("change", { chain: { id, unsupported } });
108
- };
109
- this.onDisconnect = () => {
110
- this.emit("disconnect");
111
- };
112
- }
113
- async connect({ chainId } = {}) {
114
- const provider = await this.getProvider({ chainId });
115
- provider.on("accountsChanged", this.onAccountsChanged);
116
- provider.on("chainChanged", this.onChainChanged);
117
- provider.on("disconnect", this.onDisconnect);
118
- this.emit("message", { type: "connecting" });
119
- const accounts = await provider.enable();
120
- const account = getAddress2(accounts[0]);
121
- const id = normalizeChainId(provider._network.chainId);
122
- const unsupported = this.isChainUnsupported(id);
123
- const data = { account, chain: { id, unsupported }, provider };
124
- if (!this.options.flags?.noSwitchChain)
125
- this.switchChain = __privateMethod(this, _switchChain, switchChain_fn);
126
- return new Promise(
127
- (res) => setTimeout(() => res(data), 100)
128
- );
129
- }
130
- async disconnect() {
131
- const provider = await this.getProvider();
132
- await provider.disconnect();
133
- provider.removeListener("accountsChanged", this.onAccountsChanged);
134
- provider.removeListener("chainChanged", this.onChainChanged);
135
- provider.removeListener("disconnect", this.onDisconnect);
136
- }
137
- async getAccount() {
138
- const provider = await this.getProvider();
139
- const accounts = await provider.getAccounts();
140
- const account = accounts[0];
141
- if (!account)
142
- throw new Error("Failed to get account");
143
- return getAddress2(account);
144
- }
145
- async getChainId() {
146
- const provider = await this.getProvider();
147
- return normalizeChainId(provider.network.chainId);
148
- }
149
- async getProvider({ chainId } = {}) {
150
- if (!__privateGet(this, _provider) || chainId)
151
- __privateSet(this, _provider, new MockProvider({ ...this.options, chainId }));
152
- return __privateGet(this, _provider);
153
- }
154
- async getSigner() {
155
- const provider = await this.getProvider();
156
- return provider.getSigner();
157
- }
158
- async isAuthorized() {
159
- try {
160
- const provider = await this.getProvider();
161
- const account = await provider.getAccounts();
162
- return this.options.flags?.isAuthorized ?? !!account;
163
- } catch {
164
- return false;
165
- }
166
- }
167
- async watchAsset(asset) {
168
- const provider = await this.getProvider();
169
- return provider.watchAsset(asset);
170
- }
171
- toJSON() {
172
- return "<MockConnector>";
173
- }
174
- };
175
- _provider = new WeakMap();
176
- _switchChain = new WeakSet();
177
- switchChain_fn = async function(chainId) {
178
- const provider = await this.getProvider();
179
- await provider.switchChain(chainId);
180
- return this.chains.find((x) => x.id === chainId) ?? {
181
- id: chainId,
182
- name: `Chain ${chainId}`,
183
- network: `${chainId}`,
184
- rpcUrls: { default: "" }
185
- };
186
- };
2
+ MockConnector,
3
+ MockProvider
4
+ } from "../../chunk-VCRGL4ZG.js";
5
+ import "../../chunk-F4A7FMUQ.js";
6
+ import "../../chunk-6KG5TOAU.js";
7
+ import "../../chunk-MQXBDTVK.js";
187
8
  export {
188
9
  MockConnector,
189
10
  MockProvider
@@ -1,7 +1,7 @@
1
1
  import WalletConnectProvider from '@walletconnect/ethereum-provider';
2
2
  import { providers } from 'ethers';
3
- import { C as Chain } from '../index-58cffc47.js';
4
- import { C as Connector } from '../base-a32d0b91.js';
3
+ import { Chain } from '@wagmi/chains';
4
+ import { C as Connector } from '../base-a82112a9.js';
5
5
  import 'abitype';
6
6
  import 'eventemitter3';
7
7
 
@@ -4,8 +4,8 @@ import {
4
4
  UserRejectedRequestError,
5
5
  getClient,
6
6
  normalizeChainId
7
- } from "../chunk-HEIMP7HQ.js";
8
- import "../chunk-4DNFSL2K.js";
7
+ } from "../chunk-F4A7FMUQ.js";
8
+ import "../chunk-6KG5TOAU.js";
9
9
  import {
10
10
  __privateAdd,
11
11
  __privateGet,
@@ -101,7 +101,10 @@ var WalletConnectConnector = class extends Connector {
101
101
  } = {}) {
102
102
  if (!__privateGet(this, _provider) || chainId || create) {
103
103
  const rpc = !this.options?.infuraId ? this.chains.reduce(
104
- (rpc2, chain) => ({ ...rpc2, [chain.id]: chain.rpcUrls.default }),
104
+ (rpc2, chain) => ({
105
+ ...rpc2,
106
+ [chain.id]: chain.rpcUrls.default.http[0]
107
+ }),
105
108
  {}
106
109
  ) : {};
107
110
  const WalletConnectProvider = (await import("@walletconnect/ethereum-provider")).default;
@@ -154,7 +157,8 @@ switchChain_fn = async function(chainId) {
154
157
  id: chainId,
155
158
  name: `Chain ${id}`,
156
159
  network: `${id}`,
157
- rpcUrls: { default: "" }
160
+ nativeCurrency: { name: "Ether", decimals: 18, symbol: "ETH" },
161
+ rpcUrls: { default: { http: [""] } }
158
162
  };
159
163
  } catch (error) {
160
164
  const message = typeof error === "string" ? error : error?.message;
@@ -1,70 +1,6 @@
1
1
  import { Address, TypedData, TypedDataToPrimitiveTypes, TypedDataDomain, ResolvedConfig } from 'abitype';
2
2
  import { BigNumber, providers, Signer as Signer$1 } from 'ethers';
3
-
4
- declare const chainId: {
5
- readonly mainnet: 1;
6
- readonly goerli: 5;
7
- readonly sepolia: 11155111;
8
- readonly optimism: 10;
9
- readonly optimismGoerli: 420;
10
- readonly polygon: 137;
11
- readonly polygonMumbai: 80001;
12
- readonly arbitrum: 42161;
13
- readonly arbitrumGoerli: 421613;
14
- readonly localhost: 1337;
15
- readonly hardhat: 31337;
16
- readonly foundry: 31337;
17
- };
18
- type ChainName = keyof typeof chainId;
19
- declare const mainnet: Chain;
20
- declare const goerli: Chain;
21
- declare const sepolia: Chain;
22
- declare const optimism: Chain;
23
- declare const optimismGoerli: Chain;
24
- declare const polygon: Chain;
25
- declare const polygonMumbai: Chain;
26
- declare const arbitrum: Chain;
27
- declare const arbitrumGoerli: Chain;
28
- declare const localhost: Chain;
29
- declare const hardhat: Chain;
30
- declare const foundry: Chain;
31
- /**
32
- * Common chains for convenience
33
- * Should not contain all possible chains
34
- */
35
- declare const chain: {
36
- readonly mainnet: Chain;
37
- readonly goerli: Chain;
38
- readonly sepolia: Chain;
39
- readonly optimism: Chain;
40
- readonly optimismGoerli: Chain;
41
- readonly polygon: Chain;
42
- readonly polygonMumbai: Chain;
43
- readonly arbitrum: Chain;
44
- readonly arbitrumGoerli: Chain;
45
- readonly localhost: Chain;
46
- readonly hardhat: Chain;
47
- readonly foundry: Chain;
48
- };
49
- declare const allChains: Chain[];
50
- declare const defaultChains: Chain[];
51
- declare const defaultL2Chains: Chain[];
52
-
53
- type BlockExplorerName = 'etherscan';
54
- type BlockExplorer = {
55
- name: string;
56
- url: string;
57
- };
58
- type EtherscanChains = Extract<ChainName, 'mainnet' | 'goerli' | 'sepolia' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
59
- declare const etherscanBlockExplorers: Record<EtherscanChains, BlockExplorer>;
60
-
61
- type RpcProviderName = 'alchemy' | 'infura' | 'public';
62
- type AlchemyChains = Extract<ChainName, 'mainnet' | 'goerli' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
63
- declare const alchemyRpcUrls: Record<AlchemyChains, string>;
64
- type InfuraChains = Extract<ChainName, 'mainnet' | 'goerli' | 'sepolia' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
65
- declare const infuraRpcUrls: Record<InfuraChains, string>;
66
- type PublicChains = Extract<ChainName, 'mainnet' | 'goerli' | 'sepolia' | 'optimism' | 'optimismGoerli' | 'polygon' | 'polygonMumbai' | 'arbitrum' | 'arbitrumGoerli'>;
67
- declare const publicRpcUrls: Record<PublicChains, string>;
3
+ import { Chain } from '@wagmi/chains';
68
4
 
69
5
  declare const units: readonly ["wei", "kwei", "mwei", "gwei", "szabo", "finney", "ether"];
70
6
 
@@ -88,43 +24,6 @@ declare module 'ethers/lib/utils.js' {
88
24
  } | ResolvedConfig['BytesType'] | string): string;
89
25
  }
90
26
  type Hash = `0x${string}`;
91
- type Chain = {
92
- /** ID in number form */
93
- id: number;
94
- /** Human-readable name */
95
- name: string;
96
- /** Internal network name */
97
- network: string;
98
- /** Currency used by chain */
99
- nativeCurrency?: AddEthereumChainParameter['nativeCurrency'];
100
- /** Collection of RPC endpoints */
101
- rpcUrls: {
102
- [key in RpcProviderName]?: string;
103
- } & {
104
- [key: string]: string;
105
- default: string;
106
- };
107
- /** Collection of block explorers */
108
- blockExplorers?: {
109
- [key in BlockExplorerName]?: BlockExplorer;
110
- } & {
111
- [key: string]: BlockExplorer;
112
- default: BlockExplorer;
113
- };
114
- /** ENS registry */
115
- ens?: {
116
- address: Address;
117
- };
118
- /**
119
- * Chain [multicall3 contract](https://github.com/mds1/multicall)
120
- */
121
- multicall?: {
122
- address: Address;
123
- blockCreated: number;
124
- };
125
- /** Flag for test networks */
126
- testnet?: boolean;
127
- };
128
27
  type ChainProviderFn<TProvider extends Provider = providers.BaseProvider, TWebSocketProvider extends WebSocketProvider = providers.WebSocketProvider, TChain extends Chain = Chain> = (chain: TChain) => {
129
28
  chain: TChain;
130
29
  provider: () => ProviderWithFallbackConfig<TProvider>;
@@ -285,4 +184,4 @@ declare global {
285
184
  }
286
185
  }
287
186
 
288
- export { Chain as C, Ethereum as E, FallbackProviderConfig as F, Hash as H, Provider as P, Signer as S, Unit as U, WebSocketProvider as W, ChainProviderFn as a, ProviderWithFallbackConfig as b, alchemyRpcUrls as c, allChains as d, chain as e, chainId as f, defaultChains as g, defaultL2Chains as h, etherscanBlockExplorers as i, infuraRpcUrls as j, arbitrum as k, arbitrumGoerli as l, foundry as m, goerli as n, hardhat as o, publicRpcUrls as p, localhost as q, mainnet as r, sepolia as s, optimism as t, units as u, optimismGoerli as v, polygon as w, polygonMumbai as x };
187
+ export { ChainProviderFn as C, Ethereum as E, FallbackProviderConfig as F, Hash as H, Provider as P, Signer as S, Unit as U, WebSocketProvider as W, ProviderWithFallbackConfig as a, units as u };