Skip to content

Commit 830a785

Browse files
committed
Add readme section
1 parent 7625d6f commit 830a785

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/hardhat-viem/README.md

+12
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,18 @@ This allows you to deploy a contract linked to the `ExampleLib` library at the a
248248

249249
To deploy a contract, all libraries must be linked. An error will be thrown if any libraries are missing.
250250

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+
251263
## Usage
252264

253265
There are no additional steps you need to take for this plugin to work.

0 commit comments

Comments
 (0)