-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5753 from NomicFoundation/feature/move-hardhat-ne…
…twork-helpers V3 hardhat-network-helpers
- Loading branch information
Showing
79 changed files
with
3,855 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* How to run this script: | ||
* 1) Start a Hardhat V2 node (until the V3 node is ready) | ||
* 3) Run this script with `npx hardhat run scripts/network-helpers.ts`. | ||
*/ | ||
|
||
import hre from "@ignored/hardhat-vnext"; | ||
// Example on how to import load fixture | ||
// import { loadFixture } from "@ignored/hardhat-vnext-network-helpers/load-fixture"; | ||
|
||
const { networkHelpers } = await hre.network.connect(); | ||
|
||
await networkHelpers.mine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { createConfig } = require("../../config-v-next/eslint.cjs"); | ||
|
||
module.exports = createConfig(__filename); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Node modules | ||
/node_modules | ||
|
||
# Compilation output | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/node_modules | ||
/dist | ||
/coverage | ||
CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Nomic Foundation | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Hardhat Network Helpers | ||
|
||
Hardhat Network Helpers is a library that provides a set of utility functions to interact with the [Hardhat Network](https://hardhat.org/hardhat-network/docs). | ||
|
||
### Usage | ||
|
||
```javascript | ||
const { networkHelpers } = await hre.network.connect(); | ||
|
||
// Network helpers methods exposed via `networkHelpers` | ||
await networkHelpers.mine(); | ||
|
||
// Time methods exposed via `time` | ||
await networkHelpers.time.increase(1); | ||
|
||
// Duration methods exposed via `duration` | ||
networkHelpers.time.duration.days(1); | ||
``` | ||
|
||
### Tests | ||
|
||
Temporary solution to run manual tests until the V3 node is ready. | ||
|
||
1. Start a node in Hardhat V2: `npx hardhat node` | ||
2. Run the tests: `pnpm test:tmp` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"name": "@ignored/hardhat-vnext-network-helpers", | ||
"version": "3.0.0-next.2", | ||
"description": "Hardhat utils for testing", | ||
"homepage": "https://github.com/nomicfoundation/hardhat/tree/v-next/v-next/network-helpers", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/NomicFoundation/hardhat", | ||
"directory": "v-next/network-helpers" | ||
}, | ||
"author": "Nomic Foundation", | ||
"license": "MIT", | ||
"type": "module", | ||
"exports": { | ||
".": "./dist/src/index.js", | ||
"./load-fixture": "./dist/src/load-fixture.js" | ||
}, | ||
"keywords": [ | ||
"ethereum", | ||
"smart-contracts", | ||
"hardhat", | ||
"testing" | ||
], | ||
"scripts": { | ||
"lint": "pnpm prettier --check && pnpm eslint", | ||
"lint:fix": "pnpm prettier --write && pnpm eslint --fix", | ||
"eslint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"", | ||
"prettier": "prettier \"**/*.{ts,js,md,json}\"", | ||
"test": "node --import tsx/esm --test --test-reporter=@ignored/hardhat-vnext-node-test-reporter \"test/*.ts\" \"test/!(fixture-projects|helpers)/**/*.ts\"", | ||
"test:tmp": "node --import tsx/esm --test --test-reporter=@ignored/hardhat-vnext-node-test-reporter \"test-tmp/*.ts\" \"test-tmp/duration/*.ts\" && node --import tsx/esm ./run-tests.ts", | ||
"test:only": "node --import tsx/esm --test --test-only --test-reporter=@ignored/hardhat-vnext-node-test-reporter \"test/*.ts\" \"test/!(fixture-projects|helpers)/**/*.ts\"", | ||
"test:coverage": "c8 --reporter html --reporter text --all --exclude test --exclude src/internal/types.ts --exclude src/internal/ui/direct-user-interruption-manager.ts --src src node --import tsx/esm --test --test-reporter=@ignored/hardhat-vnext-node-test-reporter \"test/!(fixture-projects|helpers)/**/*.ts\"", | ||
"pretest": "pnpm build", | ||
"pretest:only": "pnpm build", | ||
"build": "tsc --build .", | ||
"prepublishOnly": "pnpm build", | ||
"clean": "rimraf dist" | ||
}, | ||
"files": [ | ||
"dist/src/", | ||
"src/", | ||
"CHANGELOG.md", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"devDependencies": { | ||
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0", | ||
"@ignored/hardhat-vnext-node-test-reporter": "workspace:^3.0.0-next.2", | ||
"@nomicfoundation/hardhat-test-utils": "workspace:^", | ||
"@types/debug": "^4.1.4", | ||
"@types/node": "^20.14.9", | ||
"@typescript-eslint/eslint-plugin": "^7.7.1", | ||
"@typescript-eslint/parser": "^7.7.1", | ||
"c8": "^9.1.0", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-import-resolver-typescript": "^3.6.1", | ||
"eslint-plugin-import": "2.29.1", | ||
"eslint-plugin-no-only-tests": "3.1.0", | ||
"expect-type": "^0.19.0", | ||
"prettier": "3.2.5", | ||
"rimraf": "^5.0.5", | ||
"tsx": "^4.11.0", | ||
"typescript": "~5.5.0", | ||
"typescript-eslint": "7.7.1" | ||
}, | ||
"dependencies": { | ||
"@ignored/hardhat-vnext-errors": "workspace:^3.0.0-next.2", | ||
"@ignored/hardhat-vnext-utils": "workspace:^3.0.0-next.2" | ||
}, | ||
"peerDependencies": { | ||
"@ignored/hardhat-vnext": "workspace:^3.0.0-next.2" | ||
} | ||
} |
Oops, something went wrong.