Skip to content

oliv3rdrt/hardhat-typescript-suite

Repository files navigation

hardhat-typescript-suite

TypeScript Hardhat workspace with TypeChain bindings, gas reporter, fixtures, console logging from Solidity, and mainnet forking.

Stack

  • Hardhat 2.22
  • TypeScript 5.x
  • Solidity 0.8.24
  • TypeChain, hardhat-gas-reporter, ethers v6

Prerequisites

Tool Version
Node.js 20.x LTS (18.x and 22.x work, 23+ shows a startup warning)
npm 9+

Quick start

npm install
npx hardhat compile
npx hardhat test

Expected: 10 tests passing across Lock.test.ts and SimpleStorage.test.ts.

What's in here

File Purpose
contracts/Lock.sol Time-locked withdrawals with owner check
contracts/SimpleStorage.sol Per-address key-value storage with events
test/*.test.ts Fixture-based tests using loadFixture
hardhat.config.ts Networks, gas reporter, TypeChain setup
scripts/deploy.ts TypeScript deploy script

Mainnet forking

Set MAINNET_RPC_URL in .env to an archive-capable endpoint. Recommended: an Infura URL from MetaMask Developer. Then:

npx hardhat test --network hardhat

Tests run against a fork of mainnet at the latest block. Archive access is needed to fork at a pinned historical block.

Gas report

REPORT_GAS=true npx hardhat test

About

TypeScript Hardhat workspace with TypeChain bindings, gas reporter, fixtures, console logging from Solidity, and mainnet forking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors