@nomicfoundation/hardhat-viem 2.0.6 → 3.0.0-next.1

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 (95) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +4 -16
  3. package/README.md +35 -247
  4. package/dist/src/index.d.ts +5 -0
  5. package/dist/src/index.d.ts.map +1 -0
  6. package/dist/src/index.js +10 -0
  7. package/dist/src/index.js.map +1 -0
  8. package/dist/src/internal/accounts.d.ts +4 -0
  9. package/dist/src/internal/accounts.d.ts.map +1 -0
  10. package/dist/src/internal/accounts.js +15 -0
  11. package/dist/src/internal/accounts.js.map +1 -0
  12. package/dist/src/internal/chains.d.ts +11 -0
  13. package/dist/src/internal/chains.d.ts.map +1 -0
  14. package/dist/src/internal/chains.js +116 -0
  15. package/dist/src/internal/chains.js.map +1 -0
  16. package/dist/src/internal/clients.d.ts +10 -0
  17. package/dist/src/internal/clients.d.ts.map +1 -0
  18. package/dist/src/internal/clients.js +91 -0
  19. package/dist/src/internal/clients.js.map +1 -0
  20. package/dist/src/internal/contracts.d.ts +11 -0
  21. package/dist/src/internal/contracts.d.ts.map +1 -0
  22. package/dist/src/internal/contracts.js +141 -0
  23. package/dist/src/internal/contracts.js.map +1 -0
  24. package/dist/src/internal/hook-handlers/network.d.ts +4 -0
  25. package/dist/src/internal/hook-handlers/network.d.ts.map +1 -0
  26. package/dist/src/internal/hook-handlers/network.js +12 -0
  27. package/dist/src/internal/hook-handlers/network.js.map +1 -0
  28. package/dist/src/internal/initialization.d.ts +6 -0
  29. package/dist/src/internal/initialization.d.ts.map +1 -0
  30. package/dist/src/internal/initialization.js +14 -0
  31. package/dist/src/internal/initialization.js.map +1 -0
  32. package/dist/src/type-extensions.d.ts +8 -0
  33. package/dist/src/type-extensions.d.ts.map +1 -0
  34. package/dist/src/type-extensions.js +2 -0
  35. package/dist/src/type-extensions.js.map +1 -0
  36. package/dist/src/types.d.ts +166 -0
  37. package/dist/src/types.d.ts.map +1 -0
  38. package/dist/src/types.js +2 -0
  39. package/dist/src/types.js.map +1 -0
  40. package/package.json +46 -51
  41. package/src/index.ts +10 -39
  42. package/src/internal/accounts.ts +20 -7
  43. package/src/internal/chains.ts +122 -62
  44. package/src/internal/clients.ts +135 -141
  45. package/src/internal/contracts.ts +126 -150
  46. package/src/internal/hook-handlers/network.ts +27 -0
  47. package/src/internal/initialization.ts +67 -0
  48. package/src/type-extensions.ts +10 -0
  49. package/src/types.ts +237 -72
  50. package/.eslintrc.js +0 -24
  51. package/index.d.ts +0 -3
  52. package/index.d.ts.map +0 -1
  53. package/index.js +0 -20
  54. package/index.js.map +0 -1
  55. package/internal/accounts.d.ts +0 -5
  56. package/internal/accounts.d.ts.map +0 -1
  57. package/internal/accounts.js +0 -9
  58. package/internal/accounts.js.map +0 -1
  59. package/internal/bytecode.d.ts +0 -13
  60. package/internal/bytecode.d.ts.map +0 -1
  61. package/internal/bytecode.js +0 -94
  62. package/internal/bytecode.js.map +0 -1
  63. package/internal/chains.d.ts +0 -7
  64. package/internal/chains.d.ts.map +0 -1
  65. package/internal/chains.js +0 -80
  66. package/internal/chains.js.map +0 -1
  67. package/internal/clients.d.ts +0 -45
  68. package/internal/clients.d.ts.map +0 -1
  69. package/internal/clients.js +0 -136
  70. package/internal/clients.js.map +0 -1
  71. package/internal/contracts.d.ts +0 -11
  72. package/internal/contracts.d.ts.map +0 -1
  73. package/internal/contracts.js +0 -164
  74. package/internal/contracts.js.map +0 -1
  75. package/internal/errors.d.ts +0 -36
  76. package/internal/errors.d.ts.map +0 -1
  77. package/internal/errors.js +0 -102
  78. package/internal/errors.js.map +0 -1
  79. package/internal/tasks.d.ts +0 -2
  80. package/internal/tasks.d.ts.map +0 -1
  81. package/internal/tasks.js +0 -240
  82. package/internal/tasks.js.map +0 -1
  83. package/internal/type-extensions.d.ts +0 -19
  84. package/internal/type-extensions.d.ts.map +0 -1
  85. package/internal/type-extensions.js +0 -5
  86. package/internal/type-extensions.js.map +0 -1
  87. package/src/internal/bytecode.ts +0 -138
  88. package/src/internal/errors.ts +0 -125
  89. package/src/internal/tasks.ts +0 -341
  90. package/src/internal/type-extensions.ts +0 -27
  91. package/src/tsconfig.json +0 -15
  92. package/types.d.ts +0 -52
  93. package/types.d.ts.map +0 -1
  94. package/types.js +0 -3
  95. package/types.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @nomicfoundation/hardhat-viem
2
+
3
+ ## 3.0.0-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5fbea0d: A small bug fix release for the Hardhat 3 Alpha.
package/LICENSE CHANGED
@@ -1,21 +1,9 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Nomic Foundation
3
+ Copyright (c) 2024 Nomic Foundation
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
6
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
8
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,269 +1,57 @@
1
- [![npm](https://img.shields.io/npm/v/@nomicfoundation/hardhat-viem.svg)](https://www.npmjs.com/package/@nomicfoundation/hardhat-viem) [![hardhat](https://hardhat.org/buidler-plugin-badge.svg?1)](https://hardhat.org)
1
+ # Hardhat Viem plugin
2
2
 
3
- # hardhat-viem
4
-
5
- [Hardhat](https://hardhat.org) plugin for integration with [Viem](https://github.com/wagmi-dev/viem), a lightweight, composable, and type-safe Ethereum library.
6
-
7
- ## What
8
-
9
- This plugin integrates the Viem Ethereum library into your Hardhat development environment. Viem is an alternative to [ethers.js](https://docs.ethers.io/) that offers developers a different way to interact with the Ethereum blockchain.
10
-
11
- By installing and configuring `hardhat-viem`, you gain access to the capabilities of the Viem library directly within your Hardhat projects. This integration enables you to perform various Ethereum-related tasks using Viem's features and functionalities.
12
-
13
- Note: This plugin relies on the Viem library, so familiarity with [Viem's documentation](https://viem.sh/docs/getting-started.html) can enhance your experience when working with `hardhat-viem`.
3
+ This plugin integrates [Viem](https://viem.sh) into Hardhat, adding a `viem` object to each network connection.
14
4
 
15
5
  ## Installation
16
6
 
17
- ```bash
18
- npm install --save-dev @nomicfoundation/hardhat-viem viem
19
- ```
20
-
21
- And add the following statement to your `hardhat.config.js`:
22
-
23
- ```js
24
- require("@nomicfoundation/hardhat-viem");
25
- ```
26
-
27
- Or, if you are using TypeScript, add this to your `hardhat.config.ts`:
28
-
29
- ```js
30
- import "@nomicfoundation/hardhat-viem";
31
- ```
32
-
33
- **Note:** you might want to pin Viem-related dependencies because Viem does not strictly follow semantic versioning for type changes. You can read more [here](https://hardhat.org/hardhat-runner/docs/advanced/using-viem#managing-types-and-version-stability).
34
-
35
- ## Required plugins
36
-
37
- No plugins dependencies.
38
-
39
- ## Tasks
40
-
41
- This plugin creates no additional tasks.
42
-
43
- ## Environment extensions
44
-
45
- This plugins adds a `viem` object to the Hardhat Runtime Environment which provides a minimal set of capabilities for interacting with the blockchain.
46
-
47
- ### Clients
48
-
49
- Viem supports three types of clients:
50
-
51
- #### Public client
52
-
53
- A Public Client is an interface to "public" JSON-RPC API methods such as retrieving block numbers, transactions, reading from smart contracts, etc through [Public Actions](https://viem.sh/docs/actions/public/introduction.html).
54
-
55
- ```typescript
56
- import hre from "hardhat";
57
-
58
- const publicClient = await hre.viem.getPublicClient();
59
-
60
- const blockNumber = await publicClient.getBlockNumber();
7
+ To install this plugin, run the following command:
61
8
 
62
- const balance = await publicClient.getBalance({
63
- address: "0xA0Cf798816D4b9b9866b5330EEa46a18382f251e",
64
- });
9
+ ```bash
10
+ npm install --save-dev @nomicfoundation/hardhat-viem@next
65
11
  ```
66
12
 
67
- #### Wallet client
68
-
69
- A Wallet Client is an interface to interact with Ethereum Accounts and provides the ability to retrieve accounts, execute transactions, sign messages, etc. through [Wallet Actions](https://viem.sh/docs/actions/wallet/introduction.html).
13
+ and add the following statements to your `hardhat.config.ts` file:
70
14
 
71
15
  ```typescript
72
- import hre from "hardhat";
73
-
74
- const [fromWalletClient, toWalletClient] = await hre.viem.getWalletClients();
75
-
76
- const hash = await fromWalletClient.sendTransaction({
77
- to: toWalletClient.account.address,
78
- value: parseEther("0.0001"),
79
- });
80
- ```
16
+ // ...
17
+ import viemPlugin from "@nomicfoundation/hardhat-viem";
81
18
 
82
- ```typescript
83
- import hre from "hardhat";
19
+ // ...
84
20
 
85
- const walletClient = await hre.viem.getWalletClient(
86
- "0xA0Cf798816D4b9b9866b5330EEa46a18382f251e"
87
- );
21
+ export default {
22
+ // ...
23
+ plugins: [
24
+ // ...
25
+ viemPlugin,
26
+ ],
88
27
 
89
- const signature = await walletClient.signMessage({
90
- account,
91
- message: "hello world",
92
- });
28
+ // ...
29
+ };
93
30
  ```
94
31
 
95
- #### Test client
96
-
97
- A Test Client is an interface to "test" JSON-RPC API methods such as mining blocks, impersonating accounts, setting fees, etc. through [Test Actions](https://viem.sh/docs/actions/test/introduction.html).
98
-
99
- ```typescript
100
- import hre from "hardhat";
101
-
102
- const testClient = await hre.viem.getTestClient();
103
-
104
- await testClient.mine({
105
- blocks: 1000000,
106
- });
107
- ```
108
-
109
- #### Client options
32
+ ## Usage
110
33
 
111
- You can pass options to the `getPublicClient`, `getWalletClient`, and `getTestClient` methods to customize the client's behavior.
34
+ This plugin defines a new `viem` property on every `NetworkConnection` object.
112
35
 
113
- ```typescript
114
- import hre from "hardhat";
36
+ ```ts
37
+ const { viem } = await hre.network.connect();
115
38
 
116
- const publicClient = await hre.viem.getPublicClient({
117
- pollingInterval: 1000,
118
- cacheTime: 2000,
39
+ // public client
40
+ const publicClient = await networkConnection.viem.getPublicClient();
41
+ const balance = await publicClient.getBalance({
42
+ address: "0x...",
119
43
  });
120
- ```
121
-
122
- For a complete list of options, see:
123
-
124
- - [Public client parameters](https://viem.sh/docs/clients/public.html#parameters)
125
- - [Wallet client parameters](https://viem.sh/docs/clients/wallet.html#parameters)
126
- - [Test client parameters](https://viem.sh/docs/clients/test.html#parameters)
127
-
128
- ### Contracts
129
-
130
- The `viem` object provides convenient methods for deploying and interacting with smart contracts on the blockchain.
131
-
132
- #### Deploying a Contract
133
44
 
134
- To deploy a contract to the blockchain, use the `deployContract` method:
135
-
136
- ```typescript
137
- import hre from "hardhat";
138
-
139
- const contract = await hre.viem.deployContract("contractName", [
140
- "arg1",
141
- 50,
142
- "arg3",
143
- ]);
144
- ```
145
-
146
- By default, the first wallet client retrieved by `hre.viem.getWalletClients()` is used to deploy the contract. You can also specify a different wallet client by passing a third parameter, along with other properties, such as `gas` and `value`:
147
-
148
- ```typescript
149
- import hre from "hardhat";
150
-
151
- const [_, secondWalletClient] = await hre.viem.getWalletClients();
152
-
153
- const contractA = await hre.viem.deployContract(
154
- "contractName",
155
- ["arg1", 50, "arg3"],
156
- {
157
- client: { wallet: secondWalletClient }
158
- gas: 1000000,
159
- value: parseEther("0.0001"),
160
- confirmations: 5, // 1 by default
161
- }
162
- );
163
- ```
164
-
165
- #### Retrieving an Existing Contract
166
-
167
- If the contract is already deployed, you can retrieve an instance of it using the `getContractAt` method:
168
-
169
- ```typescript
170
- import hre from "hardhat";
171
-
172
- const contract = await hre.viem.getContractAt(
173
- "contractName",
174
- "0x1234567890123456789012345678901234567890"
175
- );
176
- ```
177
-
178
- By default, the first wallet client retrieved by `hre.viem.getWalletClients()` will be used for interacting with the contract. If you want to specify a different wallet client, you can do so by passing it as a third parameter, just like when deploying a contract:
179
-
180
- ```typescript
181
- import hre from "hardhat";
182
-
183
- const [_, secondWalletClient] = await hre.viem.getWalletClients();
184
-
185
- const contract = await hre.viem.getContractAt(
186
- "contractName",
187
- "0x1234567890123456789012345678901234567890",
188
- { client: { wallet: secondWalletClient } }
189
- );
190
- ```
191
-
192
- #### Interacting with Contracts
193
-
194
- Once you have an instance of a contract, you can interact with it by calling its methods:
195
-
196
- ```typescript
197
- let response = await contract.read.method1();
198
- await contract.write.method2([10, "arg2"]);
199
- ```
200
-
201
- ##### Send deployment transaction
202
-
203
- By default, the `deployContract` method sends a deployment transaction to the blockchain and waits for the transaction to be mined. If you want to send the transaction without waiting for it to be mined, you can do so by using `sendDeploymentTransaction`:
204
-
205
- ```typescript
206
- import hre from "hardhat";
207
-
208
- const { contract: contractName, deploymentTransaction } =
209
- await hre.viem.sendDeploymentTransaction(
210
- "contractName",
211
- ["arg1", 50, "arg3"],
212
- {
213
- client: { wallet: secondWalletClient },
214
- gas: 1000000,
215
- value: parseEther("0.0001"),
216
- }
217
- );
218
- ```
219
-
220
- Then, if you want to wait for the transaction to be mined, you can do:
221
-
222
- ```typescript
223
- import hre from "hardhat";
224
-
225
- const publicClient = await hre.viem.getPublicClient();
226
- const { contractAddress } = await publicClient.waitForTransactionReceipt({
227
- hash: deploymentTransaction.hash,
45
+ // wallet client
46
+ const [walletClient1] = await networkConnection.viem.getWalletClients();
47
+ const hash = await walletClient1.sendTransaction({
48
+ to: "0x...",
49
+ value: "1000000000000000000",
228
50
  });
229
- ```
230
-
231
- ##### Library linking
232
51
 
233
- Some contracts need to be linked with libraries before they are deployed. You can pass the addresses of their libraries to the `deployContract` and `sendDeploymentTransaction` functions with an object like this:
234
-
235
- ```typescript
236
- const contractA = await hre.viem.deployContract(
237
- "contractName",
238
- ["arg1", 50, "arg3"],
239
- {
240
- libraries: {
241
- ExampleLib: "0x...",
242
- },
243
- }
244
- );
52
+ // contracts
53
+ const counter = await viem.deployContract("Counter");
54
+ const x = await counter.read.x();
55
+ await counter.write.inc();
56
+ const xPlus1 = await counter.read.x();
245
57
  ```
246
-
247
- This allows you to deploy a contract linked to the `ExampleLib` library at the address `"0x..."`.
248
-
249
- To deploy a contract, all libraries must be linked. An error will be thrown if any libraries are missing.
250
-
251
- #### Using `ContractTypesMap` for easier contract type imports
252
-
253
- To simplify importing contract types in `hardhat-viem`, you can use the `ContractTypesMap`. This map contains the contract types of all contracts in your project, indexed by their names.
254
-
255
- ```typescript
256
- import { ContractTypesMap } from "hardhat/types/artifacts";
257
-
258
- const contract: ContractTypesMap["ContractName"];
259
- ```
260
-
261
- This reduces the need for multiple imports and makes your code cleaner and easier to manage.
262
-
263
- ## Usage
264
-
265
- There are no additional steps you need to take for this plugin to work.
266
-
267
- Install it and access Viem through the Hardhat Runtime Environment anywhere you need it (tasks, scripts, tests, etc).
268
-
269
- Read the documentation on the [Hardhat Runtime Environment](https://hardhat.org/hardhat-runner/docs/advanced/hardhat-runtime-environment) to learn how to access the HRE in different ways to use Viem from anywhere the HRE is accessible.
@@ -0,0 +1,5 @@
1
+ import type { HardhatPlugin } from "hardhat/types/plugins";
2
+ import "./type-extensions.js";
3
+ declare const hardhatPlugin: HardhatPlugin;
4
+ export default hardhatPlugin;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,sBAAsB,CAAC;AAE9B,QAAA,MAAM,aAAa,EAAE,aAMpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ import "./type-extensions.js";
2
+ const hardhatPlugin = {
3
+ id: "hardhat-viem",
4
+ hookHandlers: {
5
+ network: import.meta.resolve("./internal/hook-handlers/network.js"),
6
+ },
7
+ npmPackage: "@nomicfoundation/hardhat-viem",
8
+ };
9
+ export default hardhatPlugin;
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,sBAAsB,CAAC;AAE9B,MAAM,aAAa,GAAkB;IACnC,EAAE,EAAE,cAAc;IAClB,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,qCAAqC,CAAC;KACpE;IACD,UAAU,EAAE,+BAA+B;CAC5C,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { EthereumProvider } from "hardhat/types/providers";
2
+ import type { Address as ViemAddress } from "viem";
3
+ export declare function getAccounts(provider: EthereumProvider): Promise<ViemAddress[]>;
4
+ //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/internal/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAInD,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC,CAcxB"}
@@ -0,0 +1,15 @@
1
+ const accountsCache = new WeakMap();
2
+ export async function getAccounts(provider) {
3
+ const cachedAccounts = accountsCache.get(provider);
4
+ if (cachedAccounts !== undefined) {
5
+ return cachedAccounts;
6
+ }
7
+ /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions
8
+ -- We know that the provider is going to return an array of accounts */
9
+ const accounts = (await provider.request({
10
+ method: "eth_accounts",
11
+ }));
12
+ accountsCache.set(provider, accounts);
13
+ return accounts;
14
+ }
15
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../src/internal/accounts.ts"],"names":[],"mappings":"AAGA,MAAM,aAAa,GAAG,IAAI,OAAO,EAAmC,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAA0B;IAE1B,MAAM,cAAc,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;2EACuE;IACvE,MAAM,QAAQ,GAAG,CAAC,MAAM,QAAQ,CAAC,OAAO,CAAC;QACvC,MAAM,EAAE,cAAc;KACvB,CAAC,CAAkB,CAAC;IACrB,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEtC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { TestClientMode } from "../types.js";
2
+ import type { ChainType } from "hardhat/types/network";
3
+ import type { EthereumProvider } from "hardhat/types/providers";
4
+ import type { Chain as ViemChain } from "viem";
5
+ export declare function getChain(provider: EthereumProvider, chainType: ChainType | string): Promise<ViemChain>;
6
+ export declare function getChainId(provider: EthereumProvider): Promise<number>;
7
+ export declare function isDevelopmentNetwork(provider: EthereumProvider): Promise<boolean>;
8
+ export declare function isHardhatNetwork(provider: EthereumProvider): Promise<boolean>;
9
+ export declare function isAnvilNetwork(provider: EthereumProvider): Promise<boolean>;
10
+ export declare function getMode(provider: EthereumProvider): Promise<TestClientMode>;
11
+ //# sourceMappingURL=chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../src/internal/chains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAsB/C,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,SAAS,GAAG,MAAM,GAC5B,OAAO,CAAC,SAAS,CAAC,CAmDpB;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAU5E;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,cAAc,CAAC,CAUzB"}
@@ -0,0 +1,116 @@
1
+ import { assertHardhatInvariant, HardhatError, } from "@nomicfoundation/hardhat-errors";
2
+ import { extractChain } from "viem";
3
+ import * as chainsModule from "viem/chains";
4
+ import { hardhat, anvil, optimism } from "viem/chains";
5
+ /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions
6
+ -- TODO: this assertion should not be necessary */
7
+ const chains = Object.values(chainsModule);
8
+ const chainCache = new WeakMap();
9
+ const chainIdCache = new WeakMap();
10
+ const isHardhatNetworkCache = new WeakMap();
11
+ const isAnvilNetworkCache = new WeakMap();
12
+ const HARDHAT_METADATA_METHOD = "hardhat_metadata";
13
+ const ANVIL_NODE_INFO_METHOD = "anvil_nodeInfo";
14
+ export async function getChain(provider, chainType) {
15
+ const cachedChain = chainCache.get(provider);
16
+ if (cachedChain !== undefined) {
17
+ return cachedChain;
18
+ }
19
+ const chainId = await getChainId(provider);
20
+ let chain = extractChain({
21
+ chains,
22
+ id: chainId,
23
+ });
24
+ if ((await isDevelopmentNetwork(provider)) || chain === undefined) {
25
+ if (await isHardhatNetwork(provider)) {
26
+ // TODO: We shoud improve how we handle the chains for the different chain
27
+ // types, as this is both a hardhat and an optimism chain.
28
+ //
29
+ // We are currently creating our chain based off optimism's, but that's
30
+ // not always the correct behavior, as the user may be connecting to
31
+ // a different chain.
32
+ if (chainType === "optimism") {
33
+ chain = { ...optimism, id: chainId };
34
+ }
35
+ else {
36
+ chain = {
37
+ ...hardhat,
38
+ id: chainId,
39
+ };
40
+ }
41
+ }
42
+ else if (await isAnvilNetwork(provider)) {
43
+ chain = {
44
+ ...anvil,
45
+ id: chainId,
46
+ };
47
+ }
48
+ else if (chain === undefined) {
49
+ // If the chain couldn't be found and we can't detect the development
50
+ // network we throw an error.
51
+ throw new HardhatError(HardhatError.ERRORS.VIEM.NETWORK_NOT_FOUND, {
52
+ chainId,
53
+ });
54
+ }
55
+ else {
56
+ assertHardhatInvariant(false, "This should not happen, as we check in isDevelopmentNetwork that it's either hardhat or anvil");
57
+ }
58
+ }
59
+ chainCache.set(provider, chain);
60
+ return chain;
61
+ }
62
+ export async function getChainId(provider) {
63
+ const cachedChainId = chainIdCache.get(provider);
64
+ if (cachedChainId !== undefined) {
65
+ return cachedChainId;
66
+ }
67
+ const chainId = Number(await provider.request({ method: "eth_chainId" }));
68
+ chainIdCache.set(provider, chainId);
69
+ return chainId;
70
+ }
71
+ export async function isDevelopmentNetwork(provider) {
72
+ if (await isHardhatNetwork(provider)) {
73
+ return true;
74
+ }
75
+ if (await isAnvilNetwork(provider)) {
76
+ return true;
77
+ }
78
+ return false;
79
+ }
80
+ export async function isHardhatNetwork(provider) {
81
+ const cachedIsHardhat = isHardhatNetworkCache.get(provider);
82
+ if (cachedIsHardhat !== undefined) {
83
+ return cachedIsHardhat;
84
+ }
85
+ const isHardhat = await isMethodSupported(provider, HARDHAT_METADATA_METHOD);
86
+ isHardhatNetworkCache.set(provider, isHardhat);
87
+ return isHardhat;
88
+ }
89
+ export async function isAnvilNetwork(provider) {
90
+ const cachedIsAnvil = isAnvilNetworkCache.get(provider);
91
+ if (cachedIsAnvil !== undefined) {
92
+ return cachedIsAnvil;
93
+ }
94
+ const isAnvil = await isMethodSupported(provider, ANVIL_NODE_INFO_METHOD);
95
+ isAnvilNetworkCache.set(provider, isAnvil);
96
+ return isAnvil;
97
+ }
98
+ export async function getMode(provider) {
99
+ if (await isHardhatNetwork(provider)) {
100
+ return "hardhat";
101
+ }
102
+ if (await isAnvilNetwork(provider)) {
103
+ return "anvil";
104
+ }
105
+ throw new HardhatError(HardhatError.ERRORS.VIEM.UNSUPPORTED_DEVELOPMENT_NETWORK);
106
+ }
107
+ async function isMethodSupported(provider, method) {
108
+ try {
109
+ await provider.request({ method });
110
+ return true;
111
+ }
112
+ catch {
113
+ return false;
114
+ }
115
+ }
116
+ //# sourceMappingURL=chains.js.map
@@ -0,0 +1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C;IACD,MAAM,IAAI,YAAY,CACpB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,CACzD,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,QAA0B,EAAE,MAAc;IACzE,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { GetPublicClientReturnType, GetWalletClientReturnType, TestClient } from "../types.js";
2
+ import type { ChainType } from "hardhat/types/network";
3
+ import type { EthereumProvider } from "hardhat/types/providers";
4
+ import type { Address as ViemAddress, PublicClientConfig as ViemPublicClientConfig, TestClientConfig as ViemTestClientConfig, WalletClientConfig as ViemWalletClientConfig } from "viem";
5
+ export declare function getPublicClient<ChainTypeT extends ChainType | string>(provider: EthereumProvider, chainType: ChainTypeT, publicClientConfig?: Partial<ViemPublicClientConfig>): Promise<GetPublicClientReturnType<ChainTypeT>>;
6
+ export declare function getWalletClients<ChainTypeT extends ChainType | string>(provider: EthereumProvider, chainType: ChainTypeT, walletClientConfig?: Partial<ViemWalletClientConfig>): Promise<Array<GetWalletClientReturnType<ChainTypeT>>>;
7
+ export declare function getWalletClient<ChainTypeT extends ChainType | string>(provider: EthereumProvider, chainType: ChainTypeT, address: ViemAddress, walletClientConfig?: Partial<ViemWalletClientConfig>): Promise<GetWalletClientReturnType<ChainTypeT>>;
8
+ export declare function getDefaultWalletClient<ChainTypeT extends ChainType | string>(provider: EthereumProvider, chainType: ChainTypeT, walletClientConfig?: Partial<ViemWalletClientConfig>): Promise<GetWalletClientReturnType<ChainTypeT>>;
9
+ export declare function getTestClient<ChainTypeT extends ChainType | string>(provider: EthereumProvider, chainType: ChainTypeT, testClientConfig?: Partial<ViemTestClientConfig>): Promise<TestClient>;
10
+ //# sourceMapping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Q,EAAE,gBAAgB,EAC1B,SAAS,EAAE,UAAU,EACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC,sBAAsB,CAAC,GACnD,OAAO,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC,CAoBhD;AAED,wBAAsB,aAAa,CAAC,UAAU,SAAS,SAAS,GAAG,MAAM,EACvE,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,UAAU,EACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAC/C,OAAO,CAAC,UAAU,CAAC,CAcrB"}
@@ -0,0 +1,91 @@
1
+ import { HardhatError } from "@nomicfoundation/hardhat-errors";
2
+ import { createPublicClient, createWalletClient, createTestClient, custom as customTransport, } from "viem";
3
+ import { publicActionsL2, walletActionsL2 } from "viem/op-stack";
4
+ import { getAccounts } from "./accounts.js";
5
+ import { getChain, getMode, isDevelopmentNetwork } from "./chains.js";
6
+ export async function getPublicClient(provider, chainType, publicClientConfig) {
7
+ const chain = publicClientConfig?.chain ?? (await getChain(provider, chainType));
8
+ const parameters = {
9
+ ...(await getDefaultClientParameters(provider)),
10
+ ...publicClientConfig,
11
+ };
12
+ let publicClient = createPublicClient({
13
+ chain,
14
+ transport: customTransport(provider),
15
+ ...parameters,
16
+ });
17
+ if (chainType === "optimism") {
18
+ publicClient = publicClient.extend(publicActionsL2());
19
+ }
20
+ /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions --
21
+ We need to assert the type because TS gets confused with the conditional type */
22
+ return publicClient;
23
+ }
24
+ export async function getWalletClients(provider, chainType, walletClientConfig) {
25
+ const chain = walletClientConfig?.chain ?? (await getChain(provider, chainType));
26
+ const accounts = await getAccounts(provider);
27
+ const parameters = {
28
+ ...(await getDefaultClientParameters(provider)),
29
+ ...walletClientConfig,
30
+ };
31
+ let walletClients = accounts.map((account) => createWalletClient({
32
+ chain,
33
+ account,
34
+ transport: customTransport(provider),
35
+ ...parameters,
36
+ }));
37
+ if (chainType === "optimism") {
38
+ walletClients = walletClients.map((walletClient) => walletClient.extend(walletActionsL2()));
39
+ }
40
+ /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions --
41
+ We need to assert the type because TS gets confused with the conditional type */
42
+ return walletClients;
43
+ }
44
+ export async function getWalletClient(provider, chainType, address, walletClientConfig) {
45
+ const chain = walletClientConfig?.chain ?? (await getChain(provider, chainType));
46
+ const parameters = {
47
+ ...(await getDefaultClientParameters(provider)),
48
+ ...walletClientConfig,
49
+ };
50
+ let walletClient = createWalletClient({
51
+ chain,
52
+ account: address,
53
+ transport: customTransport(provider),
54
+ ...parameters,
55
+ });
56
+ if (chainType === "optimism") {
57
+ walletClient = walletClient.extend(walletActionsL2());
58
+ }
59
+ /* eslint-disable-next-line @typescript-eslint/consistent-type-assertions --
60
+ We need to assert the type because TS gets confused with the conditional type */
61
+ return walletClient;
62
+ }
63
+ export async function getDefaultWalletClient(provider, chainType, walletClientConfig) {
64
+ const chain = walletClientConfig?.chain ?? (await getChain(provider, chainType));
65
+ const [defaultAccount] = await getAccounts(provider);
66
+ if (defaultAccount === undefined) {
67
+ throw new HardhatError(HardhatError.ERRORS.VIEM.DEFAULT_WALLET_CLIENT_NOT_FOUND, {
68
+ chainId: chain.id,
69
+ });
70
+ }
71
+ return getWalletClient(provider, chainType, defaultAccount, walletClientConfig);
72
+ }
73
+ export async function getTestClient(provider, chainType, testClientConfig) {
74
+ const chain = testClientConfig?.chain ?? (await getChain(provider, chainType));
75
+ const mode = await getMode(provider);
76
+ const parameters = { ...DEFAULT_CLIENT_PARAMETERS, ...testClientConfig };
77
+ const testClient = createTestClient({
78
+ chain,
79
+ mode,
80
+ transport: customTransport(provider),
81
+ ...parameters,
82
+ });
83
+ return testClient;
84
+ }
85
+ const DEFAULT_CLIENT_PARAMETERS = { pollingInterval: 50, cacheTime: 0 };
86
+ async function getDefaultClientParameters(provider) {
87
+ return (await isDevelopmentNetwork(provider))
88
+ ? DEFAULT_CLIENT_PARAMETERS
89
+ : {};
90
+ }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