@nomicfoundation/hardhat-viem 1.0.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 (50) hide show
  1. package/.eslintrc.js +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +237 -0
  4. package/index.d.ts +3 -0
  5. package/index.d.ts.map +1 -0
  6. package/index.js +20 -0
  7. package/index.js.map +1 -0
  8. package/internal/accounts.d.ts +5 -0
  9. package/internal/accounts.d.ts.map +1 -0
  10. package/internal/accounts.js +9 -0
  11. package/internal/accounts.js.map +1 -0
  12. package/internal/chains.d.ts +7 -0
  13. package/internal/chains.d.ts.map +1 -0
  14. package/internal/chains.js +74 -0
  15. package/internal/chains.js.map +1 -0
  16. package/internal/clients.d.ts +45 -0
  17. package/internal/clients.d.ts.map +1 -0
  18. package/internal/clients.js +127 -0
  19. package/internal/clients.js.map +1 -0
  20. package/internal/contracts.d.ts +11 -0
  21. package/internal/contracts.d.ts.map +1 -0
  22. package/internal/contracts.js +155 -0
  23. package/internal/contracts.js.map +1 -0
  24. package/internal/errors.d.ts +23 -0
  25. package/internal/errors.d.ts.map +1 -0
  26. package/internal/errors.js +70 -0
  27. package/internal/errors.js.map +1 -0
  28. package/internal/tasks.d.ts +2 -0
  29. package/internal/tasks.d.ts.map +1 -0
  30. package/internal/tasks.js +224 -0
  31. package/internal/tasks.js.map +1 -0
  32. package/internal/type-extensions.d.ts +26 -0
  33. package/internal/type-extensions.d.ts.map +1 -0
  34. package/internal/type-extensions.js +5 -0
  35. package/internal/type-extensions.js.map +1 -0
  36. package/package.json +75 -0
  37. package/src/index.ts +42 -0
  38. package/src/internal/accounts.ts +9 -0
  39. package/src/internal/chains.ts +91 -0
  40. package/src/internal/clients.ts +152 -0
  41. package/src/internal/contracts.ts +243 -0
  42. package/src/internal/errors.ts +76 -0
  43. package/src/internal/tasks.ts +319 -0
  44. package/src/internal/type-extensions.ts +54 -0
  45. package/src/tsconfig.json +15 -0
  46. package/src/types.ts +77 -0
  47. package/types.d.ts +32 -0
  48. package/types.d.ts.map +1 -0
  49. package/types.js +3 -0
  50. package/types.js.map +1 -0
package/.eslintrc.js ADDED
@@ -0,0 +1,24 @@
1
+ const {
2
+ slowImportsCommonIgnoredModules,
3
+ } = require("../../config/eslint/constants");
4
+
5
+ module.exports = {
6
+ extends: [`${__dirname}/../../config/eslint/eslintrc.js`],
7
+ parserOptions: {
8
+ project: `${__dirname}/src/tsconfig.json`,
9
+ sourceType: "module",
10
+ },
11
+ overrides: [
12
+ {
13
+ files: ["src/index.ts"],
14
+ rules: {
15
+ "@nomicfoundation/slow-imports/no-top-level-external-import": [
16
+ "error",
17
+ {
18
+ ignoreModules: [...slowImportsCommonIgnoredModules],
19
+ },
20
+ ],
21
+ },
22
+ },
23
+ ],
24
+ };
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Nomic Foundation
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:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
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.
package/README.md ADDED
@@ -0,0 +1,237 @@
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)
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`.
14
+
15
+ ## Installation
16
+
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();
61
+
62
+ const balance = await publicClient.getBalance({
63
+ address: "0xA0Cf798816D4b9b9866b5330EEa46a18382f251e",
64
+ });
65
+ ```
66
+
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).
70
+
71
+ ```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
+ ```
81
+
82
+ ```typescript
83
+ import hre from "hardhat";
84
+
85
+ const walletClient = await hre.viem.getWalletClient(
86
+ "0xA0Cf798816D4b9b9866b5330EEa46a18382f251e"
87
+ );
88
+
89
+ const signature = await walletClient.signMessage({
90
+ account,
91
+ message: "hello world",
92
+ });
93
+ ```
94
+
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
110
+
111
+ You can pass options to the `getPublicClient`, `getWalletClient`, and `getTestClient` methods to customize the client's behavior.
112
+
113
+ ```typescript
114
+ import hre from "hardhat";
115
+
116
+ const publicClient = await hre.viem.getPublicClient({
117
+ pollingInterval: 1000,
118
+ cacheTime: 2000,
119
+ });
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
+
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
+ walletClient: 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
+ { walletClient: 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
+ walletClient: 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,
228
+ });
229
+ ```
230
+
231
+ ## Usage
232
+
233
+ There are no additional steps you need to take for this plugin to work.
234
+
235
+ Install it and access Viem through the Hardhat Runtime Environment anywhere you need it (tasks, scripts, tests, etc).
236
+
237
+ 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.
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import "./internal/type-extensions";
2
+ import "./internal/tasks";
3
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAaA,OAAO,4BAA4B,CAAC;AACpC,OAAO,kBAAkB,CAAC"}
package/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_1 = require("hardhat/config");
4
+ const clients_1 = require("./internal/clients");
5
+ const contracts_1 = require("./internal/contracts");
6
+ require("./internal/type-extensions");
7
+ require("./internal/tasks");
8
+ (0, config_1.extendEnvironment)((hre) => {
9
+ const { provider } = hre.network;
10
+ hre.viem = {
11
+ getPublicClient: (publicClientConfig) => (0, clients_1.getPublicClient)(provider, publicClientConfig),
12
+ getWalletClients: (walletClientConfig) => (0, clients_1.getWalletClients)(provider, walletClientConfig),
13
+ getWalletClient: (address, walletClientConfig) => (0, clients_1.getWalletClient)(provider, address, walletClientConfig),
14
+ getTestClient: (testClientConfig) => (0, clients_1.getTestClient)(provider, testClientConfig),
15
+ deployContract: (contractName, constructorArgs, config) => (0, contracts_1.deployContract)(hre, contractName, constructorArgs, config),
16
+ sendDeploymentTransaction: (contractName, constructorArgs, config) => (0, contracts_1.sendDeploymentTransaction)(hre, contractName, constructorArgs, config),
17
+ getContractAt: (contractName, address, config) => (0, contracts_1.getContractAt)(hre, contractName, address, config),
18
+ };
19
+ });
20
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;AAAA,2CAAmD;AAEnD,gDAK4B;AAC5B,oDAI8B;AAC9B,sCAAoC;AACpC,4BAA0B;AAE1B,IAAA,0BAAiB,EAAC,CAAC,GAAG,EAAE,EAAE;IACxB,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;IAEjC,GAAG,CAAC,IAAI,GAAG;QACT,eAAe,EAAE,CAAC,kBAAkB,EAAE,EAAE,CACtC,IAAA,yBAAe,EAAC,QAAQ,EAAE,kBAAkB,CAAC;QAE/C,gBAAgB,EAAE,CAAC,kBAAkB,EAAE,EAAE,CACvC,IAAA,0BAAgB,EAAC,QAAQ,EAAE,kBAAkB,CAAC;QAEhD,eAAe,EAAE,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,CAC/C,IAAA,yBAAe,EAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,CAAC;QAExD,aAAa,EAAE,CAAC,gBAAgB,EAAE,EAAE,CAClC,IAAA,uBAAa,EAAC,QAAQ,EAAE,gBAAgB,CAAC;QAE3C,cAAc,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,CACxD,IAAA,0BAAc,EAAC,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,CAAC;QAE5D,yBAAyB,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,CACnE,IAAA,qCAAyB,EAAC,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,CAAC;QAEvE,aAAa,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAC/C,IAAA,yBAAa,EAAC,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC;KACpD,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="lodash" />
2
+ import type { EthereumProvider } from "hardhat/types";
3
+ import type { Address } from "viem";
4
+ export declare const getAccounts: ((provider: EthereumProvider) => Promise<Address[]>) & import("lodash").MemoizedFunction;
5
+ //# 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,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,eAAO,MAAM,WAAW,cACL,gBAAgB,KAAG,QAAQ,OAAO,EAAE,CAAC,qCAEvD,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAccounts = void 0;
7
+ const lodash_memoize_1 = __importDefault(require("lodash.memoize"));
8
+ exports.getAccounts = (0, lodash_memoize_1.default)(async (provider) => provider.send("eth_accounts"));
9
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../src/internal/accounts.ts"],"names":[],"mappings":";;;;;;AAGA,oEAAqC;AAExB,QAAA,WAAW,GAAG,IAAA,wBAAO,EAChC,KAAK,EAAE,QAA0B,EAAsB,EAAE,CACvD,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAChC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { EthereumProvider } from "hardhat/types";
2
+ import type { Chain } from "viem";
3
+ import type { TestClientMode } from "../types";
4
+ export declare function getChain(provider: EthereumProvider): Promise<Chain>;
5
+ export declare function isDevelopmentNetwork(chainId: number): boolean;
6
+ export declare function getMode(provider: EthereumProvider): Promise<TestClientMode>;
7
+ //# 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,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAU/C,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,CAiCzE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,WAEnD;AAED,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,cAAc,CAAC,CAQzB"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getMode = exports.isDevelopmentNetwork = exports.getChain = void 0;
7
+ const lodash_memoize_1 = __importDefault(require("lodash.memoize"));
8
+ const errors_1 = require("./errors");
9
+ async function getChain(provider) {
10
+ const chains = require("viem/chains");
11
+ const chainId = await getChainId(provider);
12
+ if (isDevelopmentNetwork(chainId)) {
13
+ if (await isHardhatNetwork(provider)) {
14
+ return chains.hardhat;
15
+ }
16
+ else if (await isFoundryNetwork(provider)) {
17
+ return chains.foundry;
18
+ }
19
+ else {
20
+ throw new errors_1.UnknownDevelopmentNetworkError();
21
+ }
22
+ }
23
+ const matchingChains = Object.values(chains).filter(({ id }) => id === chainId);
24
+ if (matchingChains.length === 0) {
25
+ if (await isHardhatNetwork(provider)) {
26
+ return chains.hardhat;
27
+ }
28
+ else if (await isFoundryNetwork(provider)) {
29
+ return chains.foundry;
30
+ }
31
+ else {
32
+ throw new errors_1.NetworkNotFoundError(chainId);
33
+ }
34
+ }
35
+ if (matchingChains.length > 1) {
36
+ throw new errors_1.MultipleMatchingNetworksError(chainId);
37
+ }
38
+ return matchingChains[0];
39
+ }
40
+ exports.getChain = getChain;
41
+ function isDevelopmentNetwork(chainId) {
42
+ return chainId === 31337;
43
+ }
44
+ exports.isDevelopmentNetwork = isDevelopmentNetwork;
45
+ async function getMode(provider) {
46
+ if (await isHardhatNetwork(provider)) {
47
+ return "hardhat";
48
+ }
49
+ else if (await isFoundryNetwork(provider)) {
50
+ return "anvil";
51
+ }
52
+ else {
53
+ throw new errors_1.UnknownDevelopmentNetworkError();
54
+ }
55
+ }
56
+ exports.getMode = getMode;
57
+ const getChainId = (0, lodash_memoize_1.default)(async (provider) => Number(await provider.send("eth_chainId")));
58
+ const isHardhatNetwork = (0, lodash_memoize_1.default)(async (provider) => detectNetworkByMethodName(provider, NetworkMethod.HARDHAT_METADATA));
59
+ const isFoundryNetwork = (0, lodash_memoize_1.default)(async (provider) => detectNetworkByMethodName(provider, NetworkMethod.ANVIL_NODE_INFO));
60
+ var NetworkMethod;
61
+ (function (NetworkMethod) {
62
+ NetworkMethod["HARDHAT_METADATA"] = "hardhat_metadata";
63
+ NetworkMethod["ANVIL_NODE_INFO"] = "anvil_nodeInfo";
64
+ })(NetworkMethod || (NetworkMethod = {}));
65
+ async function detectNetworkByMethodName(provider, methodName) {
66
+ try {
67
+ await provider.send(methodName);
68
+ return true;
69
+ }
70
+ catch {
71
+ return false;
72
+ }
73
+ }
74
+ //# sourceMappingURL=chains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.js","sourceRoot":"","sources":["../src/internal/chains.ts"],"names":[],"mappings":";;;;;;AAIA,oEAAqC;AAErC,qCAIkB;AAEX,KAAK,UAAU,QAAQ,CAAC,QAA0B;IACvD,MAAM,MAAM,GAA0B,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;IAE3C,IAAI,oBAAoB,CAAC,OAAO,CAAC,EAAE;QACjC,IAAI,MAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE;YACpC,OAAO,MAAM,CAAC,OAAO,CAAC;SACvB;aAAM,IAAI,MAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE;YAC3C,OAAO,MAAM,CAAC,OAAO,CAAC;SACvB;aAAM;YACL,MAAM,IAAI,uCAA8B,EAAE,CAAC;SAC5C;KACF;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CACjD,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,OAAO,CAC3B,CAAC;IAEF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;QAC/B,IAAI,MAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE;YACpC,OAAO,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B,sDAAqC,CAAA;IACrC,mDAAkC,CAAA;AACpC,CAAC,EAHI,aAAa,KAAb,aAAa,QAGjB;AAED,KAAK,UAAU,yBAAyB,CACtC,QAA0B,EAC1B,UAAkB;IAElB,IAAI;QACF,MAAM,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { EthereumProvider } from "hardhat/types";
2
+ import type { Address, Chain, PublicClientConfig, WalletClientConfig, TestClientConfig } from "viem";
3
+ import type { PublicClient, TestClient, TestClientMode, WalletClient } from "../types";
4
+ /**
5
+ * Get a PublicClient instance. This is a read-only client that can be used to
6
+ * query the blockchain.
7
+ *
8
+ * @param provider The Ethereum provider used to connect to the blockchain.
9
+ * @param publicClientConfig Optional configuration for the PublicClient instance. See the viem documentation for more information.
10
+ * @returns A PublicClient instance.
11
+ */
12
+ export declare function getPublicClient(provider: EthereumProvider, publicClientConfig?: Partial<PublicClientConfig>): Promise<PublicClient>;
13
+ export declare function innerGetPublicClient(provider: EthereumProvider, chain: Chain, publicClientConfig?: Partial<PublicClientConfig>): Promise<PublicClient>;
14
+ /**
15
+ * Get a list of WalletClient instances. These are read-write clients that can
16
+ * be used to send transactions to the blockchain. Each client is associated
17
+ * with a an account obtained from the provider using `eth_accounts`.
18
+ *
19
+ * @param provider The Ethereum provider used to connect to the blockchain.
20
+ * @param walletClientConfig Optional configuration for the WalletClient instances. See the viem documentation for more information.
21
+ * @returns A list of WalletClient instances.
22
+ */
23
+ export declare function getWalletClients(provider: EthereumProvider, walletClientConfig?: Partial<WalletClientConfig>): Promise<WalletClient[]>;
24
+ export declare function innerGetWalletClients(provider: EthereumProvider, chain: Chain, accounts: Address[], walletClientConfig?: Partial<WalletClientConfig>): Promise<WalletClient[]>;
25
+ /**
26
+ * Get a WalletClient instance for a specific address. This is a read-write
27
+ * client that can be used to send transactions to the blockchain.
28
+ *
29
+ * @param provider The Ethereum provider used to connect to the blockchain.
30
+ * @param address The public address of the account to use.
31
+ * @param walletClientConfig Optional configuration for the WalletClient instance. See the viem documentation for more information.
32
+ * @returns A WalletClient instance.
33
+ */
34
+ export declare function getWalletClient(provider: EthereumProvider, address: Address, walletClientConfig?: Partial<WalletClientConfig>): Promise<WalletClient>;
35
+ /**
36
+ * Get a TestClient instance. This is a read-write client that can be used to
37
+ * perform actions only available on test nodes such as hardhat or anvil.
38
+ *
39
+ * @param provider The Ethereum provider used to connect to the blockchain.
40
+ * @param testClientConfig Optional configuration for the TestClient instance. See the viem documentation for more information.
41
+ * @returns A TestClient instance.
42
+ */
43
+ export declare function getTestClient(provider: EthereumProvider, testClientConfig?: Partial<TestClientConfig>): Promise<TestClient>;
44
+ export declare function innerGetTestClient(provider: EthereumProvider, chain: Chain, mode: TestClientMode, testClientConfig?: Partial<TestClientConfig>): Promise<TestClient>;
45
+ //# sourceMappingURL=clients.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/internal/clients.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EACV,OAAO,EACP,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACb,MAAM,UAAU,CAAC;AAKlB;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAC/C,OAAO,CAAC,YAAY,CAAC,CAGvB;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,KAAK,EACZ,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAC/C,OAAO,CAAC,YAAY,CAAC,CAcvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAC/C,OAAO,CAAC,YAAY,EAAE,CAAC,CAIzB;AAED,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAC/C,OAAO,CAAC,YAAY,EAAE,CAAC,CAiBzB;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,OAAO,EAChB,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAC/C,OAAO,CAAC,YAAY,CAAC,CAKvB;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,gBAAgB,EAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAC3C,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,cAAc,EACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAC3C,OAAO,CAAC,UAAU,CAAC,CAarB"}
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.innerGetTestClient = exports.getTestClient = exports.getWalletClient = exports.innerGetWalletClients = exports.getWalletClients = exports.innerGetPublicClient = exports.getPublicClient = void 0;
27
+ const chains_1 = require("./chains");
28
+ const accounts_1 = require("./accounts");
29
+ /**
30
+ * Get a PublicClient instance. This is a read-only client that can be used to
31
+ * query the blockchain.
32
+ *
33
+ * @param provider The Ethereum provider used to connect to the blockchain.
34
+ * @param publicClientConfig Optional configuration for the PublicClient instance. See the viem documentation for more information.
35
+ * @returns A PublicClient instance.
36
+ */
37
+ async function getPublicClient(provider, publicClientConfig) {
38
+ const chain = publicClientConfig?.chain ?? (await (0, chains_1.getChain)(provider));
39
+ return innerGetPublicClient(provider, chain, publicClientConfig);
40
+ }
41
+ exports.getPublicClient = getPublicClient;
42
+ async function innerGetPublicClient(provider, chain, publicClientConfig) {
43
+ const viem = await Promise.resolve().then(() => __importStar(require("viem")));
44
+ const defaultParameters = (0, chains_1.isDevelopmentNetwork)(chain.id)
45
+ ? { pollingInterval: 50, cacheTime: 0 }
46
+ : {};
47
+ const parameters = { ...defaultParameters, ...publicClientConfig };
48
+ const publicClient = viem.createPublicClient({
49
+ chain,
50
+ transport: viem.custom(provider),
51
+ ...parameters,
52
+ });
53
+ return publicClient;
54
+ }
55
+ exports.innerGetPublicClient = innerGetPublicClient;
56
+ /**
57
+ * Get a list of WalletClient instances. These are read-write clients that can
58
+ * be used to send transactions to the blockchain. Each client is associated
59
+ * with a an account obtained from the provider using `eth_accounts`.
60
+ *
61
+ * @param provider The Ethereum provider used to connect to the blockchain.
62
+ * @param walletClientConfig Optional configuration for the WalletClient instances. See the viem documentation for more information.
63
+ * @returns A list of WalletClient instances.
64
+ */
65
+ async function getWalletClients(provider, walletClientConfig) {
66
+ const chain = walletClientConfig?.chain ?? (await (0, chains_1.getChain)(provider));
67
+ const accounts = await (0, accounts_1.getAccounts)(provider);
68
+ return innerGetWalletClients(provider, chain, accounts, walletClientConfig);
69
+ }
70
+ exports.getWalletClients = getWalletClients;
71
+ async function innerGetWalletClients(provider, chain, accounts, walletClientConfig) {
72
+ const viem = await Promise.resolve().then(() => __importStar(require("viem")));
73
+ const defaultParameters = (0, chains_1.isDevelopmentNetwork)(chain.id)
74
+ ? { pollingInterval: 50, cacheTime: 0 }
75
+ : {};
76
+ const parameters = { ...defaultParameters, ...walletClientConfig };
77
+ const walletClients = accounts.map((account) => viem.createWalletClient({
78
+ chain,
79
+ account,
80
+ transport: viem.custom(provider),
81
+ ...parameters,
82
+ }));
83
+ return walletClients;
84
+ }
85
+ exports.innerGetWalletClients = innerGetWalletClients;
86
+ /**
87
+ * Get a WalletClient instance for a specific address. This is a read-write
88
+ * client that can be used to send transactions to the blockchain.
89
+ *
90
+ * @param provider The Ethereum provider used to connect to the blockchain.
91
+ * @param address The public address of the account to use.
92
+ * @param walletClientConfig Optional configuration for the WalletClient instance. See the viem documentation for more information.
93
+ * @returns A WalletClient instance.
94
+ */
95
+ async function getWalletClient(provider, address, walletClientConfig) {
96
+ const chain = walletClientConfig?.chain ?? (await (0, chains_1.getChain)(provider));
97
+ return (await innerGetWalletClients(provider, chain, [address], walletClientConfig))[0];
98
+ }
99
+ exports.getWalletClient = getWalletClient;
100
+ /**
101
+ * Get a TestClient instance. This is a read-write client that can be used to
102
+ * perform actions only available on test nodes such as hardhat or anvil.
103
+ *
104
+ * @param provider The Ethereum provider used to connect to the blockchain.
105
+ * @param testClientConfig Optional configuration for the TestClient instance. See the viem documentation for more information.
106
+ * @returns A TestClient instance.
107
+ */
108
+ async function getTestClient(provider, testClientConfig) {
109
+ const chain = testClientConfig?.chain ?? (await (0, chains_1.getChain)(provider));
110
+ const mode = await (0, chains_1.getMode)(provider);
111
+ return innerGetTestClient(provider, chain, mode, testClientConfig);
112
+ }
113
+ exports.getTestClient = getTestClient;
114
+ async function innerGetTestClient(provider, chain, mode, testClientConfig) {
115
+ const viem = await Promise.resolve().then(() => __importStar(require("viem")));
116
+ const defaultParameters = { pollingInterval: 50, cacheTime: 0 };
117
+ const parameters = { ...defaultParameters, ...testClientConfig };
118
+ const testClient = viem.createTestClient({
119
+ mode,
120
+ chain,
121
+ transport: viem.custom(provider),
122
+ ...parameters,
123
+ });
124
+ return testClient;
125
+ }
126
+ exports.innerGetTestClient = innerGetTestClient;
127
+ //# sourceMappingURL=clients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.js","sourceRoot":"","sources":["../src/internal/clients.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,qCAAmE;AACnE,yCAAyC;AAEzC;;;;;;;GAOG;AACI,KAAK,UAAU,eAAe,CACnC,QAA0B,EAC1B,kBAAgD;IAEhD,MAAM,KAAK,GAAG,kBAAkB,EAAE,KAAK,IAAI,CAAC,MAAM,IAAA,iBAAQ,EAAC,QAAQ,CAAC,CAAC,CAAC;IACtE,OAAO,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;AACnE,CAAC;AAND,0CAMC;AAEM,KAAK,UAAU,oBAAoB,CACxC,QAA0B,EAC1B,KAAY,EACZ,kBAAgD;IAEhD,MAAM,IAAI,GAAG,wDAAa,MAAM,GAAC,CAAC;IAClC,MAAM,iBAAiB,GAAG,IAAA,6BAAoB,EAAC,KAAK,CAAC,EAAE,CAAC;QACtD,CAAC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,KAAK;QACL,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChC,GAAG,UAAU;KACd,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC;AAlBD,gDAkBC"}
@@ -0,0 +1,11 @@
1
+ import type { HardhatRuntimeEnvironment } from "hardhat/types";
2
+ import type { Abi, Address, Hex } from "viem";
3
+ import type { DeployContractConfig, GetContractAtConfig, GetContractReturnType, GetTransactionReturnType, PublicClient, SendDeploymentTransactionConfig, WalletClient } from "../types";
4
+ export declare function deployContract({ artifacts, network }: HardhatRuntimeEnvironment, contractName: string, constructorArgs?: any[], config?: DeployContractConfig): Promise<GetContractReturnType>;
5
+ export declare function innerDeployContract(publicClient: PublicClient, walletClient: WalletClient, contractAbi: Abi, contractBytecode: Hex, constructorArgs: any[], deployContractParameters?: DeployContractConfig, confirmations?: number): Promise<GetContractReturnType>;
6
+ export declare function sendDeploymentTransaction({ artifacts, network }: HardhatRuntimeEnvironment, contractName: string, constructorArgs?: any[], config?: SendDeploymentTransactionConfig): Promise<{
7
+ contract: GetContractReturnType;
8
+ deploymentTransaction: GetTransactionReturnType;
9
+ }>;
10
+ export declare function getContractAt({ artifacts, network }: HardhatRuntimeEnvironment, contractName: string, address: Address, config?: GetContractAtConfig): Promise<GetContractReturnType>;
11
+ //# sourceMappingURL=contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/internal/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,YAAY,EACZ,+BAA+B,EAC/B,YAAY,EACb,MAAM,UAAU,CAAC;AAUlB,wBAAsB,cAA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