This repository is a template for creating a Hardhat 3 plugin.
This repository is structured as a pnpm monorepo, so make sure you have
pnpminstalled first
To get started, clone the repository and run:
pnpm install
pnpm buildThis will install all the dependencies and build the plugin.
You can now run the tests of the plugin with:
pnpm testAnd try the plugin out in packages/example-project with:
cd packages/example-project
pnpm hardhat nodeThis will automatically:
- Launch the OpenScan Explorer webapp on http://localhost:3030
- Open your browser to the explorer
- Log transaction links with OpenScan URLs
This repository is structured as a pnpm monorepo with the following packages:
packages/plugin: The plugin itself.packages/example-project: An example Hardhat 3 project that uses the plugin.
All the development will happen in the packages/plugin directory, while packages/example-project is a playground to experiment with your plugin, and manually test it.
The packages/plugin directory has a complete plugin example. It includes:
- A
README.mdfile that documents the plugin. - A
src/index.tsfile that defines and exports the plugin. - A network Hook Handler, which is in
src/hooks/network.ts, which shows how to define them, and prints OpenScan links.
This repository is setup with a Github Actions workflow. You don't need to do anything to set it up, it runs on every push to main, on pull requests, and when manually triggered.
The workflow is equivalent to running this steps in the root of the repository:
pnpm install
pnpm build
pnpm test
pnpm lintIt runs using Node.js 24, on an ubuntu-latest runner.
- This repository includes a setup of typescript and eslint, based on the official recommendation of each project, and a a few custom rules that help building Hardhat plugins.
- It also includes
prettierto format the code, with its default configuration. - There are npm scripts in the root that should be enough to build, lint, test, etc.
- Running
pnpm watchcan be helpful when using the example project. If you keep a terminal running it, things will normally be rebuilt by the time you try them out inpackages/example-project.
- Running
