Skip to content

Update Hardhat tutorial to ethers v6 API#615

Open
CryptAm wants to merge 1 commit into
inkonchain:mainfrom
CryptAm:patch-2
Open

Update Hardhat tutorial to ethers v6 API#615
CryptAm wants to merge 1 commit into
inkonchain:mainfrom
CryptAm:patch-2

Conversation

@CryptAm
Copy link
Copy Markdown

@CryptAm CryptAm commented May 25, 2026

The examples use ethers v5 API (contract.deployed(), contract.address), but @nomicfoundation/hardhat-toolbox ships with ethers v6. Copy-pasting causes tests and deployment to fail with TypeError: contract.deployed is not a function. Also, hardhat.config.js calls require("dotenv"), but dotenv is not installed in the dependency setup step.

Fixes:

  • Added dotenv to the npm install command
  • await contract.deployed() > await contract.waitForDeployment()
  • contract.address > await contract.getAddress()

Result: The tutorial now matches the current Hardhat Toolbox, users can run setup, tests, and deployment without API fixes.

The examples use ethers v5 API (`contract.deployed()`, `contract.address`), but `@nomicfoundation/hardhat-toolbox` ships with ethers v6. Copy-pasting causes tests and deployment to fail with `TypeError: contract.deployed is not a function`. Also, `hardhat.config.js` calls `require("dotenv")`, but dotenv is not installed in the dependency setup step.

Fixes:
- Added `dotenv` to the `npm install` command 
- `await contract.deployed()` > `await contract.waitForDeployment()`
- `contract.address` > `await contract.getAddress()`

**Result:** The tutorial now matches the current Hardhat Toolbox, users can run setup, tests, and deployment without API fixes.
@CryptAm CryptAm requested a review from a team as a code owner May 25, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant