hardhat

Guides writing and running Solidity and TypeScript tests in Hardhat 3 projects.

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/manjilagamacharyya-glitch/Blockchain-Lost-and-Found-App --skill hardhat-manjilagamacharyya-glitch
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hardhat
Source: https://github.com/manjilagamacharyya-glitch/Blockchain-Lost-and-Found-App/tree/main/contracts/.agents/skills/hardhat
Command: npx skills add https://github.com/manjilagamacharyya-glitch/Blockchain-Lost-and-Found-App --skill hardhat-manjilagamacharyya-glitch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Hardhat 3 introduces a dual test-layer model (Solidity tests and TypeScript tests), a new network connection API, and ESM-only constraints that differ significantly from Hardhat 2. This Skill helps developers choose the right test layer, use forge-std cheatcodes and networkHelpers correctly, and avoid common mistakes like typechecking before compiling. ## Core Features & Use Cases - Test Layer Selection: Decide between Solidity tests (.t.sol, EVM-native, fuzz support) and TypeScript tests (test/*.ts, off-chain orchestration) based on what the test actually needs. - EVM State Manipulation: Use forge-std cheatcodes (vm.prank, vm.deal, vm.warp, vm.expectRevert) in Solidity tests and networkHelpers (time, mining, impersonation, fixtures, snapshots) in TypeScript tests. - Compile-then-Typecheck Workflow: Run hardhat build before tsc --noEmit so generated contract types catch wrong arguments and invalid options early. - Use Case: You are writing tests for a Solidity contract and need to simulate different callers and time passage. The Skill directs you to a Solidity test with vm.startPrank and vm.warp, or to networkHelpers.time.increase in a TypeScript integration test. ## Quick Start Ask the assistant to write a Hardhat 3 test for your contract, specifying whether you want a Solidity unit test or a TypeScript integration test.

Frequently Asked Questions about hardhat

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write tests in Hardhat 3?▼

Hardhat 3 supports two test layers: Solidity tests (`.t.sol` files with `test*` functions, run in the EVM with forge-std cheatcodes) and TypeScript tests (`.ts` files in `test/` using `network.create()`). Use Solidity tests for contract unit logic and TypeScript for multi-contract or off-chain orchestration.

Should I use Solidity tests or TypeScript tests in Hardhat?▼

Use Solidity tests by default for unit tests on individual contracts since they run directly in the EVM with cheatcodes and fuzzing. Reach for TypeScript tests only when you need off-chain orchestration, fixture reuse across suites, or external balance and gas assertions.

How do I use cheatcodes like vm.prank in Hardhat 3?▼

Import `Test` from `forge-std/Test.sol` in your Solidity test contract to access the `vm` object. Common cheatcodes include `vm.prank(addr)` for the next call's sender, `vm.deal` for balances, `vm.warp` for timestamps, and `vm.expectRevert` for revert assertions.

What is networkHelpers in Hardhat 3 TypeScript tests?▼

networkHelpers is obtained from `network.create()` and wraps Hardhat's development helpers in a typed API. It provides time manipulation, block mining, account impersonation, loadFixture for snapshot-based setup caching, and manual snapshot/restore.

Why does TypeScript typechecking fail on Hardhat contract calls?▼

Generated contract types are derived from the compiled ABI, so running `tsc` before compiling produces stale or missing types. Always run `npx hardhat build && npx tsc --noEmit` so the compiler can catch wrong argument types and invalid options.

Does Hardhat 3 support CommonJS or top-level await?▼

Hardhat 3 only works with ESM, so top-level `await` is available in TypeScript test files. Each call to `network.create()` produces an isolated blockchain state, which you can scope per file, suite, or test case.