hardhat 2.9.8 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/internal/cli/cli.js +37 -7
- package/internal/cli/cli.js.map +1 -1
- package/internal/cli/hardhat-vscode-installation.d.ts +8 -0
- package/internal/cli/hardhat-vscode-installation.d.ts.map +1 -0
- package/internal/cli/hardhat-vscode-installation.js +41 -0
- package/internal/cli/hardhat-vscode-installation.js.map +1 -0
- package/internal/cli/project-creation.d.ts +0 -1
- package/internal/cli/project-creation.d.ts.map +1 -1
- package/internal/cli/project-creation.js +87 -179
- package/internal/cli/project-creation.js.map +1 -1
- package/internal/cli/prompt.d.ts +14 -0
- package/internal/cli/prompt.d.ts.map +1 -0
- package/internal/cli/prompt.js +120 -0
- package/internal/cli/prompt.js.map +1 -0
- package/internal/cli/types.d.ts +4 -0
- package/internal/cli/types.d.ts.map +1 -0
- package/internal/cli/types.js +3 -0
- package/internal/cli/types.js.map +1 -0
- package/internal/core/config/config-loading.js +1 -1
- package/internal/core/errors-list.js +4 -4
- package/internal/core/errors-list.js.map +1 -1
- package/internal/core/providers/construction.d.ts.map +1 -1
- package/internal/core/providers/construction.js +0 -4
- package/internal/core/providers/construction.js.map +1 -1
- package/internal/core/providers/gas-providers.d.ts +0 -15
- package/internal/core/providers/gas-providers.d.ts.map +1 -1
- package/internal/core/providers/gas-providers.js +1 -33
- package/internal/core/providers/gas-providers.js.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.js +1 -1
- package/internal/hardhat-network/provider/modules/logger.js.map +1 -1
- package/internal/hardhat-network/provider/node.js +1 -1
- package/internal/hardhat-network/provider/node.js.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.js +5 -0
- package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.js +1 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
- package/internal/util/global-dir.d.ts +5 -0
- package/internal/util/global-dir.d.ts.map +1 -1
- package/internal/util/global-dir.js +17 -1
- package/internal/util/global-dir.js.map +1 -1
- package/internal/util/keys-derivation.d.ts.map +1 -1
- package/internal/util/keys-derivation.js +3 -1
- package/internal/util/keys-derivation.js.map +1 -1
- package/package.json +19 -9
- package/recommended-gitignore.txt +2 -0
- package/sample-projects/{basic → javascript}/LICENSE.md +1 -1
- package/sample-projects/javascript/README.md +13 -0
- package/sample-projects/javascript/contracts/Lock.sol +34 -0
- package/sample-projects/javascript/hardhat.config.js +6 -0
- package/sample-projects/javascript/scripts/deploy.js +29 -0
- package/sample-projects/javascript/test/Lock.js +126 -0
- package/sample-projects/typescript/LICENSE.md +11 -0
- package/sample-projects/typescript/README.md +13 -0
- package/sample-projects/typescript/contracts/Lock.sol +34 -0
- package/sample-projects/typescript/hardhat.config.ts +8 -0
- package/sample-projects/typescript/scripts/deploy.ts +23 -0
- package/sample-projects/typescript/test/Lock.ts +124 -0
- package/sample-projects/typescript/tsconfig.json +10 -0
- package/src/internal/cli/cli.ts +55 -7
- package/src/internal/cli/hardhat-vscode-installation.ts +43 -0
- package/src/internal/cli/project-creation.ts +124 -290
- package/src/internal/cli/prompt.ts +143 -0
- package/src/internal/cli/types.ts +3 -0
- package/src/internal/core/config/config-loading.ts +1 -1
- package/src/internal/core/errors-list.ts +4 -4
- package/src/internal/core/providers/construction.ts +0 -9
- package/src/internal/core/providers/gas-providers.ts +0 -39
- package/src/internal/hardhat-network/provider/modules/logger.ts +1 -1
- package/src/internal/hardhat-network/provider/node.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +6 -0
- package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +1 -1
- package/src/internal/util/global-dir.ts +19 -0
- package/src/internal/util/keys-derivation.ts +3 -1
- package/sample-projects/advanced/.env.example +0 -3
- package/sample-projects/advanced/.eslintignore +0 -4
- package/sample-projects/advanced/.eslintrc.js +0 -22
- package/sample-projects/advanced/.prettierignore +0 -5
- package/sample-projects/advanced/.prettierrc +0 -1
- package/sample-projects/advanced/.solhint.json +0 -7
- package/sample-projects/advanced/.solhintignore +0 -1
- package/sample-projects/advanced/README.md +0 -42
- package/sample-projects/advanced/hardhat.config.js +0 -40
- package/sample-projects/advanced/npmignore +0 -3
- package/sample-projects/advanced/scripts/deploy.js +0 -30
- package/sample-projects/advanced-ts/.eslintrc.js +0 -24
- package/sample-projects/advanced-ts/README.md +0 -46
- package/sample-projects/advanced-ts/hardhat.config.ts +0 -43
- package/sample-projects/advanced-ts/npmignore +0 -3
- package/sample-projects/advanced-ts/scripts/deploy.ts +0 -30
- package/sample-projects/advanced-ts/test/index.ts +0 -19
- package/sample-projects/advanced-ts/tsconfig.json +0 -12
- package/sample-projects/basic/README.md +0 -15
- package/sample-projects/basic/contracts/Greeter.sol +0 -22
- package/sample-projects/basic/hardhat.config.js +0 -21
- package/sample-projects/basic/scripts/sample-script.js +0 -32
- package/sample-projects/basic/test/sample-test.js +0 -19
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// We require the Hardhat Runtime Environment explicitly here. This is optional
|
|
2
|
-
// but useful for running the script in a standalone fashion through `node <script>`.
|
|
3
|
-
//
|
|
4
|
-
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
|
|
5
|
-
// Runtime Environment's members available in the global scope.
|
|
6
|
-
import { ethers } from "hardhat";
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
// Hardhat always runs the compile task when running scripts with its command
|
|
10
|
-
// line interface.
|
|
11
|
-
//
|
|
12
|
-
// If this script is run directly using `node` you may want to call compile
|
|
13
|
-
// manually to make sure everything is compiled
|
|
14
|
-
// await hre.run('compile');
|
|
15
|
-
|
|
16
|
-
// We get the contract to deploy
|
|
17
|
-
const Greeter = await ethers.getContractFactory("Greeter");
|
|
18
|
-
const greeter = await Greeter.deploy("Hello, Hardhat!");
|
|
19
|
-
|
|
20
|
-
await greeter.deployed();
|
|
21
|
-
|
|
22
|
-
console.log("Greeter deployed to:", greeter.address);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// We recommend this pattern to be able to use async/await everywhere
|
|
26
|
-
// and properly handle errors.
|
|
27
|
-
main().catch((error) => {
|
|
28
|
-
console.error(error);
|
|
29
|
-
process.exitCode = 1;
|
|
30
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { expect } from "chai";
|
|
2
|
-
import { ethers } from "hardhat";
|
|
3
|
-
|
|
4
|
-
describe("Greeter", function () {
|
|
5
|
-
it("Should return the new greeting once it's changed", async function () {
|
|
6
|
-
const Greeter = await ethers.getContractFactory("Greeter");
|
|
7
|
-
const greeter = await Greeter.deploy("Hello, world!");
|
|
8
|
-
await greeter.deployed();
|
|
9
|
-
|
|
10
|
-
expect(await greeter.greet()).to.equal("Hello, world!");
|
|
11
|
-
|
|
12
|
-
const setGreetingTx = await greeter.setGreeting("Hola, mundo!");
|
|
13
|
-
|
|
14
|
-
// wait until the transaction is mined
|
|
15
|
-
await setGreetingTx.wait();
|
|
16
|
-
|
|
17
|
-
expect(await greeter.greet()).to.equal("Hola, mundo!");
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2018",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"strict": true,
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"outDir": "dist",
|
|
8
|
-
"declaration": true
|
|
9
|
-
},
|
|
10
|
-
"include": ["./scripts", "./test", "./typechain"],
|
|
11
|
-
"files": ["./hardhat.config.ts"]
|
|
12
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Basic Sample Hardhat Project
|
|
2
|
-
|
|
3
|
-
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts.
|
|
4
|
-
|
|
5
|
-
Try running some of the following tasks:
|
|
6
|
-
|
|
7
|
-
```shell
|
|
8
|
-
npx hardhat accounts
|
|
9
|
-
npx hardhat compile
|
|
10
|
-
npx hardhat clean
|
|
11
|
-
npx hardhat test
|
|
12
|
-
npx hardhat node
|
|
13
|
-
node scripts/sample-script.js
|
|
14
|
-
npx hardhat help
|
|
15
|
-
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//SPDX-License-Identifier: Unlicense
|
|
2
|
-
pragma solidity ^0.8.0;
|
|
3
|
-
|
|
4
|
-
import "hardhat/console.sol";
|
|
5
|
-
|
|
6
|
-
contract Greeter {
|
|
7
|
-
string private greeting;
|
|
8
|
-
|
|
9
|
-
constructor(string memory _greeting) {
|
|
10
|
-
console.log("Deploying a Greeter with greeting:", _greeting);
|
|
11
|
-
greeting = _greeting;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function greet() public view returns (string memory) {
|
|
15
|
-
return greeting;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function setGreeting(string memory _greeting) public {
|
|
19
|
-
console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
|
|
20
|
-
greeting = _greeting;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require("@nomiclabs/hardhat-waffle");
|
|
2
|
-
|
|
3
|
-
// This is a sample Hardhat task. To learn how to create your own go to
|
|
4
|
-
// https://hardhat.org/guides/create-task.html
|
|
5
|
-
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
|
|
6
|
-
const accounts = await hre.ethers.getSigners();
|
|
7
|
-
|
|
8
|
-
for (const account of accounts) {
|
|
9
|
-
console.log(account.address);
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// You need to export an object to set up your config
|
|
14
|
-
// Go to https://hardhat.org/config/ to learn more
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @type import('hardhat/config').HardhatUserConfig
|
|
18
|
-
*/
|
|
19
|
-
module.exports = {
|
|
20
|
-
solidity: "0.8.4",
|
|
21
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// We require the Hardhat Runtime Environment explicitly here. This is optional
|
|
2
|
-
// but useful for running the script in a standalone fashion through `node <script>`.
|
|
3
|
-
//
|
|
4
|
-
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
|
|
5
|
-
// Runtime Environment's members available in the global scope.
|
|
6
|
-
const hre = require("hardhat");
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
// Hardhat always runs the compile task when running scripts with its command
|
|
10
|
-
// line interface.
|
|
11
|
-
//
|
|
12
|
-
// If this script is run directly using `node` you may want to call compile
|
|
13
|
-
// manually to make sure everything is compiled
|
|
14
|
-
// await hre.run('compile');
|
|
15
|
-
|
|
16
|
-
// We get the contract to deploy
|
|
17
|
-
const Greeter = await hre.ethers.getContractFactory("Greeter");
|
|
18
|
-
const greeter = await Greeter.deploy("Hello, Hardhat!");
|
|
19
|
-
|
|
20
|
-
await greeter.deployed();
|
|
21
|
-
|
|
22
|
-
console.log("Greeter deployed to:", greeter.address);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// We recommend this pattern to be able to use async/await everywhere
|
|
26
|
-
// and properly handle errors.
|
|
27
|
-
main()
|
|
28
|
-
.then(() => process.exit(0))
|
|
29
|
-
.catch((error) => {
|
|
30
|
-
console.error(error);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const { expect } = require("chai");
|
|
2
|
-
const { ethers } = require("hardhat");
|
|
3
|
-
|
|
4
|
-
describe("Greeter", function () {
|
|
5
|
-
it("Should return the new greeting once it's changed", async function () {
|
|
6
|
-
const Greeter = await ethers.getContractFactory("Greeter");
|
|
7
|
-
const greeter = await Greeter.deploy("Hello, world!");
|
|
8
|
-
await greeter.deployed();
|
|
9
|
-
|
|
10
|
-
expect(await greeter.greet()).to.equal("Hello, world!");
|
|
11
|
-
|
|
12
|
-
const setGreetingTx = await greeter.setGreeting("Hola, mundo!");
|
|
13
|
-
|
|
14
|
-
// wait until the transaction is mined
|
|
15
|
-
await setGreetingTx.wait();
|
|
16
|
-
|
|
17
|
-
expect(await greeter.greet()).to.equal("Hola, mundo!");
|
|
18
|
-
});
|
|
19
|
-
});
|