hardhat 2.13.0-dev.2 → 2.13.0-dev.3
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/builtin-tasks/compile.js +16 -6
- package/builtin-tasks/compile.js.map +1 -1
- package/builtin-tasks/flatten.js +1 -1
- package/builtin-tasks/flatten.js.map +1 -1
- package/builtin-tasks/help.js +2 -4
- package/builtin-tasks/help.js.map +1 -1
- package/builtin-tasks/task-names.d.ts +1 -0
- package/builtin-tasks/task-names.d.ts.map +1 -1
- package/builtin-tasks/task-names.js +3 -2
- package/builtin-tasks/task-names.js.map +1 -1
- package/builtin-tasks/test.js +22 -1
- package/builtin-tasks/test.js.map +1 -1
- package/internal/cli/bootstrap.d.ts +1 -0
- package/internal/cli/bootstrap.js +12 -20
- package/internal/cli/bootstrap.js.map +1 -1
- package/internal/cli/cli.d.ts +0 -1
- package/internal/cli/cli.d.ts.map +1 -1
- package/internal/cli/cli.js +20 -29
- package/internal/cli/cli.js.map +1 -1
- package/internal/cli/project-creation.d.ts +1 -2
- package/internal/cli/project-creation.d.ts.map +1 -1
- package/internal/cli/project-creation.js +105 -36
- package/internal/cli/project-creation.js.map +1 -1
- package/internal/cli/prompt.d.ts +2 -2
- package/internal/cli/prompt.d.ts.map +1 -1
- package/internal/cli/prompt.js +1 -2
- package/internal/cli/prompt.js.map +1 -1
- package/internal/cli/types.d.ts +1 -0
- package/internal/cli/types.d.ts.map +1 -1
- package/internal/core/config/config-env.d.ts +5 -11
- package/internal/core/config/config-env.d.ts.map +1 -1
- package/internal/core/config/config-env.js +2 -13
- package/internal/core/config/config-env.js.map +1 -1
- package/internal/core/config/config-loading.d.ts +2 -1
- package/internal/core/config/config-loading.d.ts.map +1 -1
- package/internal/core/config/config-loading.js +25 -7
- package/internal/core/config/config-loading.js.map +1 -1
- package/internal/core/config/config-validation.d.ts +2 -0
- package/internal/core/config/config-validation.d.ts.map +1 -1
- package/internal/core/config/config-validation.js +18 -1
- package/internal/core/config/config-validation.js.map +1 -1
- package/internal/core/config/extenders.d.ts +4 -7
- package/internal/core/config/extenders.d.ts.map +1 -1
- package/internal/core/config/extenders.js +5 -12
- package/internal/core/config/extenders.js.map +1 -1
- package/internal/core/errors-list.d.ts +28 -7
- package/internal/core/errors-list.d.ts.map +1 -1
- package/internal/core/errors-list.js +33 -10
- package/internal/core/errors-list.js.map +1 -1
- package/internal/core/jsonrpc/types/input/blockTag.d.ts +3 -3
- package/internal/core/jsonrpc/types/input/blockTag.d.ts.map +1 -1
- package/internal/core/project-structure.d.ts.map +1 -1
- package/internal/core/project-structure.js +6 -0
- package/internal/core/project-structure.js.map +1 -1
- package/internal/core/providers/construction.d.ts.map +1 -1
- package/internal/core/providers/construction.js +25 -5
- package/internal/core/providers/construction.js.map +1 -1
- package/internal/core/providers/http.d.ts +2 -2
- package/internal/core/providers/http.d.ts.map +1 -1
- package/internal/core/providers/http.js +41 -19
- package/internal/core/providers/http.js.map +1 -1
- package/internal/core/runtime-environment.d.ts +4 -2
- package/internal/core/runtime-environment.d.ts.map +1 -1
- package/internal/core/runtime-environment.js +39 -47
- package/internal/core/runtime-environment.js.map +1 -1
- package/internal/core/tasks/dsl.d.ts +6 -6
- package/internal/core/tasks/dsl.d.ts.map +1 -1
- package/internal/core/tasks/dsl.js.map +1 -1
- package/internal/core/tasks/task-definitions.d.ts +2 -2
- package/internal/core/tasks/task-definitions.d.ts.map +1 -1
- package/internal/core/tasks/task-definitions.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/handler.d.ts +1 -0
- package/internal/hardhat-network/jsonrpc/handler.d.ts.map +1 -1
- package/internal/hardhat-network/jsonrpc/handler.js +13 -18
- package/internal/hardhat-network/jsonrpc/handler.js.map +1 -1
- package/internal/hardhat-network/provider/RethnetState.d.ts +26 -0
- package/internal/hardhat-network/provider/RethnetState.d.ts.map +1 -0
- package/internal/hardhat-network/provider/RethnetState.js +84 -0
- package/internal/hardhat-network/provider/RethnetState.js.map +1 -0
- package/internal/hardhat-network/provider/modules/evm.d.ts +2 -1
- package/internal/hardhat-network/provider/modules/evm.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/evm.js +10 -4
- package/internal/hardhat-network/provider/modules/evm.js.map +1 -1
- package/internal/hardhat-network/provider/node-types.d.ts +1 -1
- package/internal/hardhat-network/provider/node-types.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.d.ts +1 -0
- package/internal/hardhat-network/provider/node.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.js +6 -4
- package/internal/hardhat-network/provider/node.js.map +1 -1
- package/internal/hardhat-network/provider/provider.d.ts +25 -21
- package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
- package/internal/hardhat-network/provider/provider.js +25 -42
- package/internal/hardhat-network/provider/provider.js.map +1 -1
- package/internal/hardhat-network/provider/return-data.js +2 -2
- package/internal/hardhat-network/provider/return-data.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js +4 -2
- package/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js +4 -2
- package/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.js.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.d.ts.map +1 -1
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js +4 -2
- package/internal/hardhat-network/provider/transactions/FakeSenderTransaction.js.map +1 -1
- package/internal/hardhat-network/provider/utils/bloom.d.ts +32 -0
- package/internal/hardhat-network/provider/utils/bloom.d.ts.map +1 -0
- package/internal/hardhat-network/provider/utils/bloom.js +79 -0
- package/internal/hardhat-network/provider/utils/bloom.js.map +1 -0
- package/internal/hardhat-network/provider/utils/convertToRethnet.d.ts +12 -0
- package/internal/hardhat-network/provider/utils/convertToRethnet.d.ts.map +1 -0
- package/internal/hardhat-network/provider/utils/convertToRethnet.js +162 -0
- package/internal/hardhat-network/provider/utils/convertToRethnet.js.map +1 -0
- package/internal/hardhat-network/provider/utils/makeFakeSignature.d.ts +7 -0
- package/internal/hardhat-network/provider/utils/makeFakeSignature.d.ts.map +1 -0
- package/internal/hardhat-network/provider/utils/makeFakeSignature.js +31 -0
- package/internal/hardhat-network/provider/utils/makeFakeSignature.js.map +1 -0
- package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts +1 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.js +2 -2
- package/internal/hardhat-network/provider/utils/putGenesisBlock.js.map +1 -1
- package/internal/hardhat-network/provider/vm/block-builder.d.ts +31 -0
- package/internal/hardhat-network/provider/vm/block-builder.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/block-builder.js +151 -0
- package/internal/hardhat-network/provider/vm/block-builder.js.map +1 -0
- package/internal/hardhat-network/provider/vm/creation.d.ts +10 -0
- package/internal/hardhat-network/provider/vm/creation.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/creation.js +29 -0
- package/internal/hardhat-network/provider/vm/creation.js.map +1 -0
- package/internal/hardhat-network/provider/vm/dual.d.ts +43 -0
- package/internal/hardhat-network/provider/vm/dual.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/dual.js +488 -0
- package/internal/hardhat-network/provider/vm/dual.js.map +1 -0
- package/internal/hardhat-network/provider/vm/ethereumjs.d.ts +56 -0
- package/internal/hardhat-network/provider/vm/ethereumjs.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/ethereumjs.js +416 -0
- package/internal/hardhat-network/provider/vm/ethereumjs.js.map +1 -0
- package/internal/hardhat-network/provider/vm/exit.d.ts +23 -0
- package/internal/hardhat-network/provider/vm/exit.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/exit.js +130 -0
- package/internal/hardhat-network/provider/vm/exit.js.map +1 -0
- package/internal/hardhat-network/provider/vm/rethnet.d.ts +99 -0
- package/internal/hardhat-network/provider/vm/rethnet.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/rethnet.js +284 -0
- package/internal/hardhat-network/provider/vm/rethnet.js.map +1 -0
- package/internal/hardhat-network/provider/vm/vm-adapter.d.ts +52 -0
- package/internal/hardhat-network/provider/vm/vm-adapter.d.ts.map +1 -0
- package/internal/hardhat-network/provider/vm/vm-adapter.js +3 -0
- package/internal/hardhat-network/provider/vm/vm-adapter.js.map +1 -0
- package/internal/hardhat-network/stack-traces/compiler-to-model.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/compiler-to-model.js +37 -11
- package/internal/hardhat-network/stack-traces/compiler-to-model.js.map +1 -1
- package/internal/hardhat-network/stack-traces/consoleLogger.js.map +1 -1
- package/internal/hardhat-network/stack-traces/constants.d.ts +1 -1
- package/internal/hardhat-network/stack-traces/constants.js +1 -1
- package/internal/hardhat-network/stack-traces/debug.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/debug.js +6 -2
- package/internal/hardhat-network/stack-traces/debug.js.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts +1 -0
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.js +85 -55
- package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/model.d.ts +3 -1
- package/internal/hardhat-network/stack-traces/model.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/model.js +9 -1
- package/internal/hardhat-network/stack-traces/model.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.js +2 -2
- package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts +2 -2
- package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.js +1 -0
- package/internal/hardhat-network/stack-traces/solidityTracer.js.map +1 -1
- package/internal/lib/hardhat-lib.d.ts.map +1 -1
- package/internal/lib/hardhat-lib.js +1 -4
- package/internal/lib/hardhat-lib.js.map +1 -1
- package/internal/solidity/compiler/downloader.js +2 -2
- package/internal/solidity/compiler/downloader.js.map +1 -1
- package/internal/solidity/compiler/index.js +1 -1
- package/internal/solidity/compiler/index.js.map +1 -1
- package/internal/solidity/resolver.d.ts +4 -3
- package/internal/solidity/resolver.d.ts.map +1 -1
- package/internal/solidity/resolver.js +18 -7
- package/internal/solidity/resolver.js.map +1 -1
- package/internal/util/abi-helpers.d.ts +1 -0
- package/internal/util/abi-helpers.d.ts.map +1 -1
- package/internal/util/abi-helpers.js +9 -0
- package/internal/util/abi-helpers.js.map +1 -1
- package/internal/util/download.d.ts.map +1 -1
- package/internal/util/download.js +12 -11
- package/internal/util/download.js.map +1 -1
- package/internal/util/packageInfo.d.ts +6 -1
- package/internal/util/packageInfo.d.ts.map +1 -1
- package/internal/util/packageInfo.js +14 -11
- package/internal/util/packageInfo.js.map +1 -1
- package/internal/util/proxy.d.ts +2 -0
- package/internal/util/proxy.d.ts.map +1 -0
- package/internal/util/proxy.js +19 -0
- package/internal/util/proxy.js.map +1 -0
- package/package.json +9 -10
- package/register.js +1 -4
- package/register.js.map +1 -1
- package/sample-projects/javascript/hardhat.config.js +1 -1
- package/sample-projects/javascript/scripts/deploy.js +2 -2
- package/sample-projects/javascript-esm/LICENSE.md +11 -0
- package/sample-projects/javascript-esm/README.md +13 -0
- package/sample-projects/javascript-esm/contracts/Lock.sol +34 -0
- package/sample-projects/javascript-esm/hardhat.config.cjs +6 -0
- package/sample-projects/javascript-esm/scripts/deploy.js +22 -0
- package/sample-projects/javascript-esm/test/Lock.js +123 -0
- package/sample-projects/typescript/hardhat.config.ts +1 -1
- package/sample-projects/typescript/scripts/deploy.ts +2 -2
- package/sample-projects/typescript/tsconfig.json +2 -1
- package/src/builtin-tasks/compile.ts +28 -7
- package/src/builtin-tasks/flatten.ts +4 -1
- package/src/builtin-tasks/help.ts +15 -16
- package/src/builtin-tasks/task-names.ts +2 -0
- package/src/builtin-tasks/test.ts +30 -2
- package/src/internal/artifacts.ts +947 -0
- package/src/internal/cli/bootstrap.ts +14 -36
- package/src/internal/cli/cli.ts +38 -43
- package/src/internal/cli/project-creation.ts +128 -47
- package/src/internal/cli/prompt.ts +2 -4
- package/src/internal/cli/types.ts +2 -0
- package/src/internal/core/config/config-env.ts +15 -27
- package/src/internal/core/config/config-loading.ts +35 -11
- package/src/internal/core/config/config-validation.ts +20 -0
- package/src/internal/core/config/extenders.ts +6 -15
- package/src/internal/core/errors-list.ts +36 -10
- package/src/internal/core/project-structure.ts +8 -0
- package/src/internal/core/providers/construction.ts +29 -24
- package/src/internal/core/providers/http.ts +38 -26
- package/src/internal/core/runtime-environment.ts +65 -60
- package/src/internal/core/tasks/dsl.ts +17 -17
- package/src/internal/core/tasks/task-definitions.ts +6 -2
- package/src/internal/hardhat-network/jsonrpc/handler.ts +31 -28
- package/src/internal/hardhat-network/provider/modules/evm.ts +15 -3
- package/src/internal/hardhat-network/provider/node-types.ts +1 -1
- package/src/internal/hardhat-network/provider/node.ts +5 -1
- package/src/internal/hardhat-network/provider/provider.ts +60 -49
- package/src/internal/hardhat-network/provider/return-data.ts +2 -2
- package/src/internal/hardhat-network/provider/transactions/FakeSenderAccessListEIP2930Transaction.ts +5 -2
- package/src/internal/hardhat-network/provider/transactions/FakeSenderEIP1559Transaction.ts +5 -2
- package/src/internal/hardhat-network/provider/transactions/FakeSenderTransaction.ts +5 -2
- package/src/internal/hardhat-network/provider/utils/makeFakeSignature.ts +46 -0
- package/src/internal/hardhat-network/provider/utils/putGenesisBlock.ts +2 -2
- package/src/internal/hardhat-network/stack-traces/compiler-to-model.ts +71 -9
- package/src/internal/hardhat-network/stack-traces/consoleLogger.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/constants.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/debug.ts +9 -2
- package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +177 -89
- package/src/internal/hardhat-network/stack-traces/model.ts +11 -1
- package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +2 -2
- package/src/internal/hardhat-network/stack-traces/solidity-stack-trace.ts +2 -2
- package/src/internal/hardhat-network/stack-traces/solidityTracer.ts +3 -0
- package/src/internal/lib/hardhat-lib.ts +1 -6
- package/src/internal/solidity/compiler/downloader.ts +2 -2
- package/src/internal/solidity/compiler/index.ts +1 -1
- package/src/internal/solidity/resolver.ts +28 -11
- package/src/internal/util/abi-helpers.ts +9 -0
- package/src/internal/util/download.ts +13 -15
- package/src/internal/util/packageInfo.ts +24 -10
- package/src/internal/util/proxy.ts +18 -0
- package/src/register.ts +1 -6
- package/src/types/artifacts.ts +14 -112
- package/src/types/config.ts +2 -0
- package/src/types/runtime.ts +16 -13
- package/types/artifacts.d.ts +10 -96
- package/types/artifacts.d.ts.map +1 -1
- package/types/config.d.ts +2 -0
- package/types/config.d.ts.map +1 -1
- package/types/runtime.d.ts +9 -10
- package/types/runtime.d.ts.map +1 -1
- package/internal/artifacts/caching.d.ts +0 -28
- package/internal/artifacts/caching.d.ts.map +0 -1
- package/internal/artifacts/caching.js +0 -178
- package/internal/artifacts/caching.js.map +0 -1
- package/internal/artifacts/index.d.ts +0 -45
- package/internal/artifacts/index.d.ts.map +0 -1
- package/internal/artifacts/index.js +0 -191
- package/internal/artifacts/index.js.map +0 -1
- package/internal/artifacts/mutable.d.ts +0 -29
- package/internal/artifacts/mutable.d.ts.map +0 -1
- package/internal/artifacts/mutable.js +0 -226
- package/internal/artifacts/mutable.js.map +0 -1
- package/internal/artifacts/readonly.d.ts +0 -94
- package/internal/artifacts/readonly.d.ts.map +0 -1
- package/internal/artifacts/readonly.js +0 -343
- package/internal/artifacts/readonly.js.map +0 -1
- package/src/internal/artifacts/caching.ts +0 -259
- package/src/internal/artifacts/index.ts +0 -302
- package/src/internal/artifacts/mutable.ts +0 -330
- package/src/internal/artifacts/readonly.ts +0 -470
|
@@ -1,38 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const envVariableArguments = getEnvHardhatArguments(
|
|
15
|
-
HARDHAT_PARAM_DEFINITIONS,
|
|
16
|
-
process.env
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const argumentsParser = new ArgumentsParser();
|
|
20
|
-
|
|
21
|
-
const { hardhatArguments } = argumentsParser.parseHardhatArguments(
|
|
22
|
-
HARDHAT_PARAM_DEFINITIONS,
|
|
23
|
-
envVariableArguments,
|
|
24
|
-
process.argv.slice(2)
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
if (hardhatArguments.maxMemory !== undefined) {
|
|
28
|
-
nodeArgs.push(`--max-old-space-size=${hardhatArguments.maxMemory}`);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import semver from "semver";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
|
|
5
|
+
const SUPPORTED_NODE_VERSIONS = ["^14.0.0", "^16.0.0", "^18.0.0"];
|
|
6
|
+
|
|
7
|
+
if (!semver.satisfies(process.version, SUPPORTED_NODE_VERSIONS.join(" || "))) {
|
|
8
|
+
console.warn(
|
|
9
|
+
chalk.yellow.bold(`WARNING:`),
|
|
10
|
+
`You are using a version of Node.js that is not supported, and it may work incorrectly, or not work at all. See https://hardhat.org/nodejs-versions`
|
|
11
|
+
);
|
|
12
|
+
console.log();
|
|
13
|
+
console.log();
|
|
29
14
|
}
|
|
30
15
|
|
|
31
|
-
|
|
32
|
-
stdio: "inherit" as any, // There's an error in the TS definition of ForkOptions
|
|
33
|
-
execArgv: nodeArgs,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
childProcess.once("close", (status) => {
|
|
37
|
-
process.exit(status as number);
|
|
38
|
-
});
|
|
16
|
+
require("./cli");
|
package/src/internal/cli/cli.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
import chalk from "chalk";
|
|
3
2
|
import debug from "debug";
|
|
4
|
-
import semver from "semver";
|
|
5
3
|
import "source-map-support/register";
|
|
6
4
|
|
|
7
5
|
import {
|
|
@@ -9,10 +7,13 @@ import {
|
|
|
9
7
|
TASK_HELP,
|
|
10
8
|
TASK_TEST,
|
|
11
9
|
} from "../../builtin-tasks/task-names";
|
|
12
|
-
import { TaskArguments } from "../../types";
|
|
10
|
+
import { HardhatConfig, TaskArguments } from "../../types";
|
|
13
11
|
import { HARDHAT_NAME } from "../constants";
|
|
14
12
|
import { HardhatContext } from "../context";
|
|
15
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
getConfiguredCompilers,
|
|
15
|
+
loadConfigAndTasks,
|
|
16
|
+
} from "../core/config/config-loading";
|
|
16
17
|
import {
|
|
17
18
|
assertHardhatInvariant,
|
|
18
19
|
HardhatError,
|
|
@@ -33,13 +34,13 @@ import {
|
|
|
33
34
|
writePromptedForHHVSCode,
|
|
34
35
|
writeTelemetryConsent,
|
|
35
36
|
} from "../util/global-dir";
|
|
36
|
-
import { getPackageJson
|
|
37
|
+
import { getPackageJson } from "../util/packageInfo";
|
|
37
38
|
|
|
38
39
|
import { saveFlamegraph } from "../core/flamegraph";
|
|
39
40
|
import { Analytics } from "./analytics";
|
|
40
41
|
import { ArgumentsParser } from "./ArgumentsParser";
|
|
41
42
|
import { enableEmoji } from "./emoji";
|
|
42
|
-
import { createProject
|
|
43
|
+
import { createProject } from "./project-creation";
|
|
43
44
|
import { confirmHHVSCodeInstallation, confirmTelemetryConsent } from "./prompt";
|
|
44
45
|
import {
|
|
45
46
|
InstallationState,
|
|
@@ -52,25 +53,11 @@ const log = debug("hardhat:core:cli");
|
|
|
52
53
|
const ANALYTICS_SLOW_TASK_THRESHOLD = 300;
|
|
53
54
|
const SHOULD_SHOW_STACK_TRACES_BY_DEFAULT = isRunningOnCiServer();
|
|
54
55
|
|
|
55
|
-
async function printVersionMessage(
|
|
56
|
+
async function printVersionMessage() {
|
|
57
|
+
const packageJson = await getPackageJson();
|
|
56
58
|
console.log(packageJson.version);
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
function printWarningAboutNodeJsVersionIfNecessary(packageJson: PackageJson) {
|
|
60
|
-
const requirement = packageJson.engines.node;
|
|
61
|
-
if (!semver.satisfies(process.version, requirement)) {
|
|
62
|
-
console.warn(
|
|
63
|
-
chalk.yellow(
|
|
64
|
-
`You are using a version of Node.js that is not supported by Hardhat, and it may work incorrectly, or not work at all.
|
|
65
|
-
|
|
66
|
-
Please, make sure you are using a supported version of Node.js.
|
|
67
|
-
|
|
68
|
-
To learn more about which versions of Node.js are supported go to https://hardhat.org/nodejs-versions`
|
|
69
|
-
)
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
61
|
async function suggestInstallingHardhatVscode() {
|
|
75
62
|
const alreadyPrompted = hasPromptedForHHVSCode();
|
|
76
63
|
if (alreadyPrompted) {
|
|
@@ -104,6 +91,24 @@ async function suggestInstallingHardhatVscode() {
|
|
|
104
91
|
}
|
|
105
92
|
}
|
|
106
93
|
|
|
94
|
+
function showViaIRWarning(resolvedConfig: HardhatConfig) {
|
|
95
|
+
const configuredCompilers = getConfiguredCompilers(resolvedConfig.solidity);
|
|
96
|
+
const viaIREnabled = configuredCompilers.some(
|
|
97
|
+
(compiler) => compiler.settings?.viaIR === true
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (viaIREnabled) {
|
|
101
|
+
console.warn();
|
|
102
|
+
console.warn(
|
|
103
|
+
chalk.yellow(
|
|
104
|
+
`Your solidity settings have viaIR enabled, which is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.
|
|
105
|
+
|
|
106
|
+
Learn more at https://hardhat.org/solc-viair`
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
async function main() {
|
|
108
113
|
// We first accept this argument anywhere, so we know if the user wants
|
|
109
114
|
// stack traces before really parsing the arguments.
|
|
@@ -112,10 +117,6 @@ async function main() {
|
|
|
112
117
|
SHOULD_SHOW_STACK_TRACES_BY_DEFAULT;
|
|
113
118
|
|
|
114
119
|
try {
|
|
115
|
-
const packageJson = await getPackageJson();
|
|
116
|
-
|
|
117
|
-
printWarningAboutNodeJsVersionIfNecessary(packageJson);
|
|
118
|
-
|
|
119
120
|
const envVariableArguments = getEnvHardhatArguments(
|
|
120
121
|
HARDHAT_PARAM_DEFINITIONS,
|
|
121
122
|
process.env
|
|
@@ -146,7 +147,7 @@ async function main() {
|
|
|
146
147
|
|
|
147
148
|
// --version is a special case
|
|
148
149
|
if (hardhatArguments.version) {
|
|
149
|
-
await printVersionMessage(
|
|
150
|
+
await printVersionMessage();
|
|
150
151
|
return;
|
|
151
152
|
}
|
|
152
153
|
|
|
@@ -227,7 +228,7 @@ async function main() {
|
|
|
227
228
|
Reporter.setEnabled(true);
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
const envExtenders = ctx.extendersManager.
|
|
231
|
+
const envExtenders = ctx.extendersManager.getExtenders();
|
|
231
232
|
const taskDefinitions = ctx.tasksDSL.getTaskDefinitions();
|
|
232
233
|
|
|
233
234
|
const [abortAnalytics, hitPromise] = await analytics.sendTaskHit(taskName);
|
|
@@ -259,16 +260,11 @@ async function main() {
|
|
|
259
260
|
);
|
|
260
261
|
}
|
|
261
262
|
|
|
262
|
-
const artifactsExtensions = ctx.extendersManager
|
|
263
|
-
.getArtifactsExtenders()
|
|
264
|
-
.map((artifactsExtender) => artifactsExtender(resolvedConfig));
|
|
265
|
-
|
|
266
263
|
const env = new Environment(
|
|
267
264
|
resolvedConfig,
|
|
268
265
|
hardhatArguments,
|
|
269
266
|
taskDefinitions,
|
|
270
267
|
envExtenders,
|
|
271
|
-
artifactsExtensions,
|
|
272
268
|
ctx.experimentalHardhatNetworkMessageTraceHooks,
|
|
273
269
|
userConfig
|
|
274
270
|
);
|
|
@@ -311,14 +307,9 @@ async function main() {
|
|
|
311
307
|
) {
|
|
312
308
|
await suggestInstallingHardhatVscode();
|
|
313
309
|
|
|
314
|
-
// we show the
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
process.exitCode !== 0 &&
|
|
318
|
-
Math.random() < 0.3333 &&
|
|
319
|
-
process.env.HARDHAT_HIDE_SOLIDITY_SURVEY_MESSAGE !== "true"
|
|
320
|
-
) {
|
|
321
|
-
showSoliditySurveyMessage();
|
|
310
|
+
// we show the viaIR warning only if the tests failed
|
|
311
|
+
if (process.exitCode !== 0) {
|
|
312
|
+
showViaIRWarning(resolvedConfig);
|
|
322
313
|
}
|
|
323
314
|
}
|
|
324
315
|
|
|
@@ -328,11 +319,15 @@ async function main() {
|
|
|
328
319
|
|
|
329
320
|
if (HardhatError.isHardhatError(error)) {
|
|
330
321
|
isHardhatError = true;
|
|
331
|
-
console.error(
|
|
322
|
+
console.error(
|
|
323
|
+
chalk.red.bold("Error"),
|
|
324
|
+
error.message.replace(/^\w+:/, (t) => chalk.red.bold(t))
|
|
325
|
+
);
|
|
332
326
|
} else if (HardhatPluginError.isHardhatPluginError(error)) {
|
|
333
327
|
isHardhatError = true;
|
|
334
328
|
console.error(
|
|
335
|
-
chalk.red(`Error in plugin ${error.pluginName}
|
|
329
|
+
chalk.red.bold(`Error in plugin ${error.pluginName}:`),
|
|
330
|
+
error.message
|
|
336
331
|
);
|
|
337
332
|
} else if (error instanceof Error) {
|
|
338
333
|
console.error(chalk.red("An unexpected error occurred:"));
|
|
@@ -4,15 +4,20 @@ import os from "os";
|
|
|
4
4
|
import path from "path";
|
|
5
5
|
|
|
6
6
|
import { HARDHAT_NAME } from "../constants";
|
|
7
|
-
import { HardhatError } from "../core/errors";
|
|
7
|
+
import { assertHardhatInvariant, HardhatError } from "../core/errors";
|
|
8
8
|
import { ERRORS } from "../core/errors-list";
|
|
9
9
|
import { getRecommendedGitIgnore } from "../core/project-structure";
|
|
10
|
+
import { getAllFilesMatching } from "../util/fs-utils";
|
|
10
11
|
import {
|
|
11
12
|
hasConsentedTelemetry,
|
|
12
13
|
writeTelemetryConsent,
|
|
13
14
|
} from "../util/global-dir";
|
|
14
15
|
import { fromEntries } from "../util/lang";
|
|
15
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
getPackageJson,
|
|
18
|
+
getPackageRoot,
|
|
19
|
+
PackageJson,
|
|
20
|
+
} from "../util/packageInfo";
|
|
16
21
|
import { pluralize } from "../util/strings";
|
|
17
22
|
import {
|
|
18
23
|
confirmRecommendedDepsInstallation,
|
|
@@ -20,7 +25,7 @@ import {
|
|
|
20
25
|
confirmProjectCreation,
|
|
21
26
|
} from "./prompt";
|
|
22
27
|
import { emoji } from "./emoji";
|
|
23
|
-
import { Dependencies } from "./types";
|
|
28
|
+
import { Dependencies, PackageManager } from "./types";
|
|
24
29
|
|
|
25
30
|
enum Action {
|
|
26
31
|
CREATE_JAVASCRIPT_PROJECT_ACTION = "Create a JavaScript project",
|
|
@@ -60,7 +65,7 @@ const TYPESCRIPT_DEPENDENCIES: Dependencies = {};
|
|
|
60
65
|
|
|
61
66
|
const TYPESCRIPT_PEER_DEPENDENCIES: Dependencies = {
|
|
62
67
|
"@types/chai": "^4.2.0",
|
|
63
|
-
"@types/mocha": "
|
|
68
|
+
"@types/mocha": ">=9.1.0",
|
|
64
69
|
"@types/node": ">=12.0.0",
|
|
65
70
|
"ts-node": ">=8.0.0",
|
|
66
71
|
typescript: ">=4.5.0",
|
|
@@ -109,14 +114,28 @@ async function printWelcomeMessage() {
|
|
|
109
114
|
|
|
110
115
|
async function copySampleProject(
|
|
111
116
|
projectRoot: string,
|
|
112
|
-
projectType: SampleProjectTypeCreationAction
|
|
117
|
+
projectType: SampleProjectTypeCreationAction,
|
|
118
|
+
isEsm: boolean
|
|
113
119
|
) {
|
|
114
120
|
const packageRoot = getPackageRoot();
|
|
115
121
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
let sampleProjectName: string;
|
|
123
|
+
if (projectType === Action.CREATE_JAVASCRIPT_PROJECT_ACTION) {
|
|
124
|
+
if (isEsm) {
|
|
125
|
+
sampleProjectName = "javascript-esm";
|
|
126
|
+
} else {
|
|
127
|
+
sampleProjectName = "javascript";
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
if (isEsm) {
|
|
131
|
+
assertHardhatInvariant(
|
|
132
|
+
false,
|
|
133
|
+
"Shouldn't try to create a TypeScript project in an ESM based project"
|
|
134
|
+
);
|
|
135
|
+
} else {
|
|
136
|
+
sampleProjectName = "typescript";
|
|
137
|
+
}
|
|
138
|
+
}
|
|
120
139
|
|
|
121
140
|
await fsExtra.ensureDir(projectRoot);
|
|
122
141
|
|
|
@@ -126,11 +145,23 @@ async function copySampleProject(
|
|
|
126
145
|
sampleProjectName
|
|
127
146
|
);
|
|
128
147
|
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
148
|
+
// relative paths to all the sample project files
|
|
149
|
+
const sampleProjectFiles = (await getAllFilesMatching(sampleProjectPath)).map(
|
|
150
|
+
(file) => path.relative(sampleProjectPath, file)
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
// check if the target directory already has files that clash with the sample
|
|
154
|
+
// project files
|
|
155
|
+
const existingFiles: string[] = [];
|
|
156
|
+
for (const file of sampleProjectFiles) {
|
|
157
|
+
const targetProjectFile = path.resolve(projectRoot, file);
|
|
158
|
+
|
|
159
|
+
// if the project already has a README.md file, we'll skip it when
|
|
160
|
+
// we copy the files
|
|
161
|
+
if (file !== "README.md" && fsExtra.existsSync(targetProjectFile)) {
|
|
162
|
+
existingFiles.push(file);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
134
165
|
|
|
135
166
|
if (existingFiles.length > 0) {
|
|
136
167
|
const errorMsg = `We couldn't initialize the sample project because ${pluralize(
|
|
@@ -139,17 +170,32 @@ async function copySampleProject(
|
|
|
139
170
|
"these files already exist"
|
|
140
171
|
)}: ${existingFiles.join(", ")}
|
|
141
172
|
|
|
142
|
-
Please delete or
|
|
173
|
+
Please delete or rename ${pluralize(
|
|
174
|
+
existingFiles.length,
|
|
175
|
+
"it",
|
|
176
|
+
"them"
|
|
177
|
+
)} and try again.`;
|
|
143
178
|
console.log(chalk.red(errorMsg));
|
|
144
179
|
process.exit(1);
|
|
145
180
|
}
|
|
146
181
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
182
|
+
// copy the files
|
|
183
|
+
for (const file of sampleProjectFiles) {
|
|
184
|
+
const sampleProjectFile = path.resolve(sampleProjectPath, file);
|
|
185
|
+
const targetProjectFile = path.resolve(projectRoot, file);
|
|
186
|
+
|
|
187
|
+
if (file === "README.md" && fsExtra.existsSync(targetProjectFile)) {
|
|
188
|
+
// we don't override the readme if it exists
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (file === "LICENSE.md") {
|
|
193
|
+
// we don't copy the license
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
151
196
|
|
|
152
|
-
|
|
197
|
+
fsExtra.copySync(sampleProjectFile, targetProjectFile);
|
|
198
|
+
}
|
|
153
199
|
}
|
|
154
200
|
|
|
155
201
|
async function addGitIgnore(projectRoot: string) {
|
|
@@ -183,15 +229,23 @@ async function printRecommendedDepsInstallationInstructions(
|
|
|
183
229
|
// exported so we can test that it uses the latest supported version of solidity
|
|
184
230
|
export const EMPTY_HARDHAT_CONFIG = `/** @type import('hardhat/config').HardhatUserConfig */
|
|
185
231
|
module.exports = {
|
|
186
|
-
solidity: "0.8.
|
|
232
|
+
solidity: "0.8.18",
|
|
187
233
|
};
|
|
188
234
|
`;
|
|
189
235
|
|
|
190
|
-
async function writeEmptyHardhatConfig() {
|
|
191
|
-
|
|
236
|
+
async function writeEmptyHardhatConfig(isEsm: boolean) {
|
|
237
|
+
const hardhatConfigFilename = isEsm
|
|
238
|
+
? "hardhat.config.cjs"
|
|
239
|
+
: "hardhat.config.js";
|
|
240
|
+
|
|
241
|
+
return fsExtra.writeFile(
|
|
242
|
+
hardhatConfigFilename,
|
|
243
|
+
EMPTY_HARDHAT_CONFIG,
|
|
244
|
+
"utf-8"
|
|
245
|
+
);
|
|
192
246
|
}
|
|
193
247
|
|
|
194
|
-
async function getAction(): Promise<Action> {
|
|
248
|
+
async function getAction(isEsm: boolean): Promise<Action> {
|
|
195
249
|
if (
|
|
196
250
|
process.env.HARDHAT_CREATE_JAVASCRIPT_PROJECT_WITH_DEFAULTS !== undefined
|
|
197
251
|
) {
|
|
@@ -211,7 +265,24 @@ async function getAction(): Promise<Action> {
|
|
|
211
265
|
message: "What do you want to do?",
|
|
212
266
|
initial: 0,
|
|
213
267
|
choices: Object.values(Action).map((a: Action) => {
|
|
214
|
-
|
|
268
|
+
let message: string;
|
|
269
|
+
if (isEsm) {
|
|
270
|
+
if (a === Action.CREATE_EMPTY_HARDHAT_CONFIG_ACTION) {
|
|
271
|
+
message = a.replace(".js", ".cjs");
|
|
272
|
+
} else if (a === Action.CREATE_TYPESCRIPT_PROJECT_ACTION) {
|
|
273
|
+
message = `${a} (not available for ESM projects)`;
|
|
274
|
+
} else {
|
|
275
|
+
message = a;
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
message = a;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return {
|
|
282
|
+
name: a,
|
|
283
|
+
message,
|
|
284
|
+
value: a,
|
|
285
|
+
};
|
|
215
286
|
}),
|
|
216
287
|
},
|
|
217
288
|
]);
|
|
@@ -252,37 +323,33 @@ function showStarOnGitHubMessage() {
|
|
|
252
323
|
console.log(chalk.cyan(" https://github.com/NomicFoundation/hardhat"));
|
|
253
324
|
}
|
|
254
325
|
|
|
255
|
-
export function showSoliditySurveyMessage() {
|
|
256
|
-
if (new Date() > new Date("2023-07-01 23:39")) {
|
|
257
|
-
// the survey has finished
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
console.log();
|
|
262
|
-
console.log(
|
|
263
|
-
chalk.cyan(
|
|
264
|
-
"Please take a moment to complete the 2022 Solidity Survey: https://hardhat.org/solidity-survey-2022"
|
|
265
|
-
)
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
326
|
export async function createProject() {
|
|
270
327
|
printAsciiLogo();
|
|
271
328
|
|
|
272
329
|
await printWelcomeMessage();
|
|
273
330
|
|
|
274
|
-
|
|
331
|
+
let packageJson: PackageJson | undefined;
|
|
332
|
+
if (await fsExtra.pathExists("package.json")) {
|
|
333
|
+
packageJson = await fsExtra.readJson("package.json");
|
|
334
|
+
}
|
|
335
|
+
const isEsm = packageJson?.type === "module";
|
|
336
|
+
|
|
337
|
+
const action = await getAction(isEsm);
|
|
275
338
|
|
|
276
339
|
if (action === Action.QUIT_ACTION) {
|
|
277
340
|
return;
|
|
278
341
|
}
|
|
279
342
|
|
|
280
|
-
if (
|
|
343
|
+
if (isEsm && action === Action.CREATE_TYPESCRIPT_PROJECT_ACTION) {
|
|
344
|
+
throw new HardhatError(ERRORS.GENERAL.ESM_TYPESCRIPT_PROJECT_CREATION);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (packageJson === undefined) {
|
|
281
348
|
await createPackageJson();
|
|
282
349
|
}
|
|
283
350
|
|
|
284
351
|
if (action === Action.CREATE_EMPTY_HARDHAT_CONFIG_ACTION) {
|
|
285
|
-
await writeEmptyHardhatConfig();
|
|
352
|
+
await writeEmptyHardhatConfig(isEsm);
|
|
286
353
|
console.log(
|
|
287
354
|
`${emoji("✨ ")}${chalk.cyan(`Config file created`)}${emoji(" ✨")}`
|
|
288
355
|
);
|
|
@@ -301,7 +368,6 @@ export async function createProject() {
|
|
|
301
368
|
|
|
302
369
|
console.log();
|
|
303
370
|
showStarOnGitHubMessage();
|
|
304
|
-
showSoliditySurveyMessage();
|
|
305
371
|
|
|
306
372
|
return;
|
|
307
373
|
}
|
|
@@ -347,7 +413,7 @@ export async function createProject() {
|
|
|
347
413
|
}
|
|
348
414
|
}
|
|
349
415
|
|
|
350
|
-
await copySampleProject(projectRoot, action);
|
|
416
|
+
await copySampleProject(projectRoot, action, isEsm);
|
|
351
417
|
|
|
352
418
|
let shouldShowInstallationInstructions = true;
|
|
353
419
|
|
|
@@ -372,7 +438,7 @@ export async function createProject() {
|
|
|
372
438
|
useDefaultPromptResponses ||
|
|
373
439
|
(await confirmRecommendedDepsInstallation(
|
|
374
440
|
dependenciesToInstall,
|
|
375
|
-
await
|
|
441
|
+
await getProjectPackageManager()
|
|
376
442
|
));
|
|
377
443
|
if (shouldInstall) {
|
|
378
444
|
const installed = await installRecommendedDependencies(
|
|
@@ -402,7 +468,6 @@ export async function createProject() {
|
|
|
402
468
|
console.log("See the README.md file for some example tasks you can run");
|
|
403
469
|
console.log();
|
|
404
470
|
showStarOnGitHubMessage();
|
|
405
|
-
showSoliditySurveyMessage();
|
|
406
471
|
}
|
|
407
472
|
|
|
408
473
|
async function canInstallRecommendedDeps() {
|
|
@@ -430,6 +495,16 @@ async function isYarnProject() {
|
|
|
430
495
|
return fsExtra.pathExists("yarn.lock");
|
|
431
496
|
}
|
|
432
497
|
|
|
498
|
+
async function isPnpmProject() {
|
|
499
|
+
return fsExtra.pathExists("pnpm-lock.yaml");
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
async function getProjectPackageManager(): Promise<PackageManager> {
|
|
503
|
+
if (await isYarnProject()) return "yarn";
|
|
504
|
+
if (await isPnpmProject()) return "pnpm";
|
|
505
|
+
return "npm";
|
|
506
|
+
}
|
|
507
|
+
|
|
433
508
|
async function doesNpmAutoInstallPeerDependencies() {
|
|
434
509
|
const { execSync } = require("child_process");
|
|
435
510
|
try {
|
|
@@ -496,6 +571,10 @@ async function getRecommendedDependenciesInstallationCommand(
|
|
|
496
571
|
return ["yarn", "add", "--dev", ...deps];
|
|
497
572
|
}
|
|
498
573
|
|
|
574
|
+
if (await isPnpmProject()) {
|
|
575
|
+
return ["pnpm", "add", "-D", ...deps];
|
|
576
|
+
}
|
|
577
|
+
|
|
499
578
|
return ["npm", "install", "--save-dev", ...deps];
|
|
500
579
|
}
|
|
501
580
|
|
|
@@ -503,7 +582,9 @@ async function getDependencies(
|
|
|
503
582
|
projectType: SampleProjectTypeCreationAction
|
|
504
583
|
): Promise<Dependencies> {
|
|
505
584
|
const shouldInstallPeerDependencies =
|
|
506
|
-
(await isYarnProject()) ||
|
|
585
|
+
(await isYarnProject()) ||
|
|
586
|
+
(await isPnpmProject()) ||
|
|
587
|
+
!(await doesNpmAutoInstallPeerDependencies());
|
|
507
588
|
|
|
508
589
|
const shouldInstallTypescriptDependencies =
|
|
509
590
|
projectType === Action.CREATE_TYPESCRIPT_PROJECT_ACTION;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dependencies } from "./types";
|
|
1
|
+
import { Dependencies, PackageManager } from "./types";
|
|
2
2
|
|
|
3
3
|
function createConfirmationPrompt(name: string, message: string) {
|
|
4
4
|
return {
|
|
@@ -36,7 +36,7 @@ function createConfirmationPrompt(name: string, message: string) {
|
|
|
36
36
|
|
|
37
37
|
export async function confirmRecommendedDepsInstallation(
|
|
38
38
|
depsToInstall: Dependencies,
|
|
39
|
-
|
|
39
|
+
packageManager: PackageManager
|
|
40
40
|
): Promise<boolean> {
|
|
41
41
|
const { default: enquirer } = await import("enquirer");
|
|
42
42
|
|
|
@@ -44,8 +44,6 @@ export async function confirmRecommendedDepsInstallation(
|
|
|
44
44
|
shouldInstallPlugin: boolean;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const packageManager = useYarn ? "yarn" : "npm";
|
|
48
|
-
|
|
49
47
|
try {
|
|
50
48
|
responses = await enquirer.prompt<typeof responses>([
|
|
51
49
|
createConfirmationPrompt(
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionType,
|
|
3
|
-
ArtifactsExtender,
|
|
4
3
|
ConfigExtender,
|
|
5
4
|
ConfigurableTaskDefinition,
|
|
6
5
|
EnvironmentExtender,
|
|
@@ -20,10 +19,10 @@ import * as argumentTypes from "../params/argumentTypes";
|
|
|
20
19
|
* @param action The task's action.
|
|
21
20
|
* @returns A task definition.
|
|
22
21
|
*/
|
|
23
|
-
export function task<
|
|
22
|
+
export function task<TaskArgumentsT extends TaskArguments>(
|
|
24
23
|
name: string,
|
|
25
24
|
description?: string,
|
|
26
|
-
action?: ActionType<
|
|
25
|
+
action?: ActionType<TaskArgumentsT>
|
|
27
26
|
): ConfigurableTaskDefinition;
|
|
28
27
|
|
|
29
28
|
/**
|
|
@@ -37,15 +36,15 @@ export function task<ArgsT extends TaskArguments>(
|
|
|
37
36
|
*
|
|
38
37
|
* @returns A task definition.
|
|
39
38
|
*/
|
|
40
|
-
export function task<
|
|
39
|
+
export function task<TaskArgumentsT extends TaskArguments>(
|
|
41
40
|
name: string,
|
|
42
|
-
action: ActionType<
|
|
41
|
+
action: ActionType<TaskArgumentsT>
|
|
43
42
|
): ConfigurableTaskDefinition;
|
|
44
43
|
|
|
45
|
-
export function task<
|
|
44
|
+
export function task<TaskArgumentsT extends TaskArguments>(
|
|
46
45
|
name: string,
|
|
47
|
-
descriptionOrAction?: string | ActionType<
|
|
48
|
-
action?: ActionType<
|
|
46
|
+
descriptionOrAction?: string | ActionType<TaskArgumentsT>,
|
|
47
|
+
action?: ActionType<TaskArgumentsT>
|
|
49
48
|
): ConfigurableTaskDefinition {
|
|
50
49
|
const ctx = HardhatContext.getHardhatContext();
|
|
51
50
|
const dsl = ctx.tasksDSL;
|
|
@@ -72,10 +71,10 @@ export function task<ArgsT extends TaskArguments>(
|
|
|
72
71
|
* @param action The task's action.
|
|
73
72
|
* @returns A task definition.
|
|
74
73
|
*/
|
|
75
|
-
export function subtask<
|
|
74
|
+
export function subtask<TaskArgumentsT extends TaskArguments>(
|
|
76
75
|
name: string,
|
|
77
76
|
description?: string,
|
|
78
|
-
action?: ActionType<
|
|
77
|
+
action?: ActionType<TaskArgumentsT>
|
|
79
78
|
): ConfigurableTaskDefinition;
|
|
80
79
|
|
|
81
80
|
/**
|
|
@@ -89,15 +88,15 @@ export function subtask<ArgsT extends TaskArguments>(
|
|
|
89
88
|
* @param action The task's action.
|
|
90
89
|
* @returns A task definition.
|
|
91
90
|
*/
|
|
92
|
-
export function subtask<
|
|
91
|
+
export function subtask<TaskArgumentsT extends TaskArguments>(
|
|
93
92
|
name: string,
|
|
94
|
-
action: ActionType<
|
|
93
|
+
action: ActionType<TaskArgumentsT>
|
|
95
94
|
): ConfigurableTaskDefinition;
|
|
96
95
|
|
|
97
|
-
export function subtask<
|
|
96
|
+
export function subtask<TaskArgumentsT extends TaskArguments>(
|
|
98
97
|
name: string,
|
|
99
|
-
descriptionOrAction?: string | ActionType<
|
|
100
|
-
action?: ActionType<
|
|
98
|
+
descriptionOrAction?: string | ActionType<TaskArgumentsT>,
|
|
99
|
+
action?: ActionType<TaskArgumentsT>
|
|
101
100
|
): ConfigurableTaskDefinition {
|
|
102
101
|
const ctx = HardhatContext.getHardhatContext();
|
|
103
102
|
const dsl = ctx.tasksDSL;
|
|
@@ -128,7 +127,7 @@ export const types = argumentTypes;
|
|
|
128
127
|
export function extendEnvironment(extender: EnvironmentExtender) {
|
|
129
128
|
const ctx = HardhatContext.getHardhatContext();
|
|
130
129
|
const extenderManager = ctx.extendersManager;
|
|
131
|
-
extenderManager.
|
|
130
|
+
extenderManager.add(extender);
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
export function extendConfig(extender: ConfigExtender) {
|
|
@@ -136,17 +135,6 @@ export function extendConfig(extender: ConfigExtender) {
|
|
|
136
135
|
ctx.configExtenders.push(extender);
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
/**
|
|
140
|
-
* Accepts a function that receives the resolved configuration and returns an
|
|
141
|
-
* extra source of artifacts. This source has to implement the ArtifactsSource
|
|
142
|
-
* interface.
|
|
143
|
-
*/
|
|
144
|
-
export function extendArtifacts(artifactsExtender: ArtifactsExtender) {
|
|
145
|
-
const ctx = HardhatContext.getHardhatContext();
|
|
146
|
-
const extenderManager = ctx.extendersManager;
|
|
147
|
-
extenderManager.addArtifactsExtender(artifactsExtender);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
138
|
// NOTE: This is experimental and will be removed. Please contact our team
|
|
151
139
|
// if you are planning to use it.
|
|
152
140
|
export function experimentalAddHardhatNetworkMessageTraceHook(
|