hardhat 3.4.4 → 3.5.0
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/CHANGELOG.md +61 -0
- package/dist/src/config.d.ts +0 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +0 -3
- package/dist/src/config.js.map +1 -1
- package/dist/src/hre.d.ts +0 -1
- package/dist/src/hre.d.ts.map +1 -1
- package/dist/src/hre.js +0 -3
- package/dist/src/hre.js.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/builtin-global-options.d.ts.map +1 -1
- package/dist/src/internal/builtin-global-options.js +1 -1
- package/dist/src/internal/builtin-global-options.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/index.js +0 -1
- package/dist/src/internal/builtin-plugins/artifacts/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.js +0 -1
- package/dist/src/internal/builtin-plugins/clean/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/clean/type-extensions.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/clean/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/clean/type-extensions.js +1 -1
- package/dist/src/internal/builtin-plugins/clean/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +7 -10
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/coverage/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/index.js +0 -1
- package/dist/src/internal/builtin-plugins/coverage/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts +1 -4
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +2 -4
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/type-extensions.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/coverage/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/type-extensions.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +0 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts +21 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +49 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +12 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.js +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/index.d.ts +8 -8
- package/dist/src/internal/builtin-plugins/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +9 -2
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +25 -5
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js +7 -6
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +16 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +28 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/index.d.ts +4 -4
- package/dist/src/internal/builtin-plugins/network-manager/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/index.js +0 -4
- package/dist/src/internal/builtin-plugins/network-manager/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +2 -6
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts +5 -4
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.d.ts +0 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.d.ts +0 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +3 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.d.ts +18 -0
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.js +27 -0
- package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.js.map +1 -0
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js +6 -5
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +22 -9
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +7 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.js +10 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.d.ts +9 -0
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.js +10 -0
- package/dist/src/internal/builtin-plugins/solidity/tasks/compile.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +0 -4
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.js +1 -4
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts +4 -3
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.js +55 -8
- package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.d.ts +58 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.js +226 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts +29 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js +244 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.js +204 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts +21 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js +77 -0
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +4 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +20 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +0 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts +4 -2
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js +5 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js +15 -3
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts +3 -2
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js +18 -4
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +5 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.d.ts +2 -0
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.js +2 -0
- package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +91 -33
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js +0 -1
- package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts +0 -1
- package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/type-extensions.js +1 -1
- package/dist/src/internal/builtin-plugins/test/type-extensions.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts +31 -6
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +121 -10
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +41 -1
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/types/arguments.d.ts +1 -0
- package/dist/src/types/arguments.d.ts.map +1 -1
- package/dist/src/types/arguments.js +1 -0
- package/dist/src/types/arguments.js.map +1 -1
- package/dist/src/types/artifacts.d.ts +1 -0
- package/dist/src/types/artifacts.d.ts.map +1 -1
- package/dist/src/types/artifacts.js +1 -1
- package/dist/src/types/artifacts.js.map +1 -1
- package/dist/src/types/builtin-plugin-type-extensions.d.ts +2 -0
- package/dist/src/types/builtin-plugin-type-extensions.d.ts.map +1 -0
- package/dist/src/types/builtin-plugin-type-extensions.js +2 -0
- package/dist/src/types/builtin-plugin-type-extensions.js.map +1 -0
- package/dist/src/types/config.d.ts +1 -1
- package/dist/src/types/config.d.ts.map +1 -1
- package/dist/src/types/config.js +1 -3
- package/dist/src/types/config.js.map +1 -1
- package/dist/src/types/global-options.d.ts +1 -0
- package/dist/src/types/global-options.d.ts.map +1 -1
- package/dist/src/types/global-options.js +1 -1
- package/dist/src/types/global-options.js.map +1 -1
- package/dist/src/types/hooks.d.ts +1 -0
- package/dist/src/types/hooks.d.ts.map +1 -1
- package/dist/src/types/hooks.js +1 -1
- package/dist/src/types/hooks.js.map +1 -1
- package/dist/src/types/hre.d.ts +1 -0
- package/dist/src/types/hre.d.ts.map +1 -1
- package/dist/src/types/hre.js +1 -1
- package/dist/src/types/hre.js.map +1 -1
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js +1 -0
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/network.d.ts +1 -0
- package/dist/src/types/network.d.ts.map +1 -1
- package/dist/src/types/network.js +1 -1
- package/dist/src/types/network.js.map +1 -1
- package/dist/src/types/plugins.d.ts +1 -1
- package/dist/src/types/plugins.d.ts.map +1 -1
- package/dist/src/types/plugins.js +1 -3
- package/dist/src/types/plugins.js.map +1 -1
- package/dist/src/types/providers.d.ts +1 -0
- package/dist/src/types/providers.d.ts.map +1 -1
- package/dist/src/types/providers.js +1 -1
- package/dist/src/types/providers.js.map +1 -1
- package/dist/src/types/solidity.d.ts +1 -0
- package/dist/src/types/solidity.d.ts.map +1 -1
- package/dist/src/types/solidity.js +1 -0
- package/dist/src/types/solidity.js.map +1 -1
- package/dist/src/types/tasks.d.ts +1 -0
- package/dist/src/types/tasks.d.ts.map +1 -1
- package/dist/src/types/tasks.js +1 -0
- package/dist/src/types/tasks.js.map +1 -1
- package/dist/src/types/test.d.ts +1 -0
- package/dist/src/types/test.d.ts.map +1 -1
- package/dist/src/types/test.js +1 -1
- package/dist/src/types/test.js.map +1 -1
- package/dist/src/types/user-interruptions.d.ts +1 -0
- package/dist/src/types/user-interruptions.d.ts.map +1 -1
- package/dist/src/types/user-interruptions.js +1 -1
- package/dist/src/types/user-interruptions.js.map +1 -1
- package/package.json +12 -12
- package/src/config.ts +0 -3
- package/src/hre.ts +0 -4
- package/src/index.ts +0 -4
- package/src/internal/builtin-global-options.ts +2 -1
- package/src/internal/builtin-plugins/artifacts/index.ts +1 -1
- package/src/internal/builtin-plugins/clean/index.ts +1 -1
- package/src/internal/builtin-plugins/clean/type-extensions.ts +0 -1
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +8 -13
- package/src/internal/builtin-plugins/coverage/index.ts +1 -1
- package/src/internal/builtin-plugins/coverage/instrumentation.ts +0 -5
- package/src/internal/builtin-plugins/coverage/type-extensions.ts +0 -1
- package/src/internal/builtin-plugins/gas-analytics/index.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +90 -1
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +24 -2
- package/src/internal/builtin-plugins/gas-analytics/type-extensions.ts +0 -1
- package/src/internal/builtin-plugins/index.ts +10 -10
- package/src/internal/builtin-plugins/network-manager/config-resolution.ts +11 -3
- package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +2 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +38 -8
- package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.ts +10 -11
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +43 -1
- package/src/internal/builtin-plugins/network-manager/index.ts +4 -4
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +5 -6
- package/src/internal/builtin-plugins/network-manager/type-extensions/config.ts +5 -4
- package/src/internal/builtin-plugins/network-manager/type-extensions/global-options.ts +0 -1
- package/src/internal/builtin-plugins/network-manager/type-extensions/hooks.ts +0 -1
- package/src/internal/builtin-plugins/network-manager/type-extensions/hre.ts +0 -1
- package/src/internal/builtin-plugins/network-manager/type-validation.ts +7 -1
- package/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.ts +32 -0
- package/src/internal/builtin-plugins/node/json-rpc/handler.ts +7 -5
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +32 -16
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +8 -2
- package/src/internal/builtin-plugins/solidity/constants.ts +11 -0
- package/src/internal/builtin-plugins/solidity/index.ts +2 -1
- package/src/internal/builtin-plugins/solidity/tasks/compile.ts +12 -0
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +0 -4
- package/src/internal/builtin-plugins/solidity-test/config.ts +85 -12
- package/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.ts +324 -0
- package/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.ts +317 -0
- package/src/internal/builtin-plugins/solidity-test/eip712/glob.ts +225 -0
- package/src/internal/builtin-plugins/solidity-test/eip712/index.ts +120 -0
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +28 -4
- package/src/internal/builtin-plugins/solidity-test/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/inline-config/constants.ts +6 -2
- package/src/internal/builtin-plugins/solidity-test/inline-config/helpers.ts +15 -4
- package/src/internal/builtin-plugins/solidity-test/inline-config/validation.ts +25 -4
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +12 -1
- package/src/internal/builtin-plugins/solidity-test/test-profiles.ts +1 -0
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +100 -34
- package/src/internal/builtin-plugins/test/index.ts +1 -1
- package/src/internal/builtin-plugins/test/type-extensions.ts +0 -1
- package/src/internal/cli/init/init.ts +198 -16
- package/src/internal/cli/main.ts +64 -1
- package/src/types/arguments.ts +2 -0
- package/src/types/artifacts.ts +2 -0
- package/src/types/builtin-plugin-type-extensions.ts +15 -0
- package/src/types/config.ts +1 -3
- package/src/types/global-options.ts +2 -0
- package/src/types/hooks.ts +2 -0
- package/src/types/hre.ts +2 -0
- package/src/types/index.ts +2 -0
- package/src/types/network.ts +2 -0
- package/src/types/plugins.ts +1 -3
- package/src/types/providers.ts +2 -0
- package/src/types/solidity.ts +2 -0
- package/src/types/tasks.ts +2 -0
- package/src/types/test.ts +2 -0
- package/src/types/user-interruptions.ts +2 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +12 -12
- package/templates/hardhat-3/01-node-test-runner-viem/tsconfig.json +4 -7
- package/templates/hardhat-3/02-mocha-ethers/package.json +15 -15
- package/templates/hardhat-3/02-mocha-ethers/tsconfig.json +4 -7
- package/templates/hardhat-3/03-minimal/package.json +2 -2
- package/templates/hardhat-3/03-minimal/tsconfig.json +4 -7
- package/coverage.sol +0 -38
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../../../types/config.js";
|
|
2
1
|
import type {
|
|
3
2
|
SensitiveString,
|
|
4
3
|
ResolvedConfigurationVariable,
|
|
@@ -15,7 +14,28 @@ declare module "../../../types/config.js" {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
declare module "../../../types/test.js" {
|
|
18
|
-
export interface
|
|
17
|
+
export interface SolidityTestFsPermissionsUserConfig {
|
|
18
|
+
readWriteFile?: string[];
|
|
19
|
+
readFile?: string[];
|
|
20
|
+
writeFile?: string[];
|
|
21
|
+
dangerouslyReadWriteDirectory?: string[];
|
|
22
|
+
readDirectory?: string[];
|
|
23
|
+
dangerouslyWriteDirectory?: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SolidityTestInvariantUserConfig {
|
|
27
|
+
failurePersistDir?: string;
|
|
28
|
+
runs?: number;
|
|
29
|
+
depth?: number;
|
|
30
|
+
failOnRevert?: boolean;
|
|
31
|
+
callOverride?: boolean;
|
|
32
|
+
dictionaryWeight?: number;
|
|
33
|
+
includeStorage?: boolean;
|
|
34
|
+
includePushBytes?: boolean;
|
|
35
|
+
shrinkRunLimit?: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SolidityTestFuzzUserConfig {
|
|
19
39
|
failurePersistDir?: string;
|
|
20
40
|
failurePersistFile?: string;
|
|
21
41
|
runs?: number;
|
|
@@ -27,19 +47,14 @@ declare module "../../../types/test.js" {
|
|
|
27
47
|
showLogs?: boolean;
|
|
28
48
|
}
|
|
29
49
|
|
|
30
|
-
export interface
|
|
31
|
-
|
|
50
|
+
export interface SolidityTestForkingUserConfig {
|
|
51
|
+
url?: SensitiveString;
|
|
52
|
+
blockNumber?: number | bigint;
|
|
53
|
+
rpcEndpoints?: Record<string, SensitiveString>;
|
|
32
54
|
}
|
|
33
55
|
|
|
34
|
-
export interface
|
|
35
|
-
fsPermissions?:
|
|
36
|
-
readWriteFile?: string[];
|
|
37
|
-
readFile?: string[];
|
|
38
|
-
writeFile?: string[];
|
|
39
|
-
dangerouslyReadWriteDirectory?: string[];
|
|
40
|
-
readDirectory?: string[];
|
|
41
|
-
dangerouslyWriteDirectory?: string[];
|
|
42
|
-
};
|
|
56
|
+
export interface SolidityTestProfileUserConfig {
|
|
57
|
+
fsPermissions?: SolidityTestFsPermissionsUserConfig;
|
|
43
58
|
isolate?: boolean;
|
|
44
59
|
ffi?: boolean;
|
|
45
60
|
allowInternalExpectRevert?: boolean;
|
|
@@ -51,46 +66,97 @@ declare module "../../../types/test.js" {
|
|
|
51
66
|
blockTimestamp?: bigint;
|
|
52
67
|
prevRandao?: bigint;
|
|
53
68
|
gasLimit?: bigint;
|
|
54
|
-
blockGasLimit?: bigint | false;
|
|
55
|
-
|
|
56
|
-
fuzz?:
|
|
57
|
-
invariant?:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
callOverride?: boolean;
|
|
63
|
-
dictionaryWeight?: number;
|
|
64
|
-
includeStorage?: boolean;
|
|
65
|
-
includePushBytes?: boolean;
|
|
66
|
-
shrinkRunLimit?: number;
|
|
69
|
+
blockGasLimit?: number | bigint | false;
|
|
70
|
+
transactionGasCap?: number | bigint | false;
|
|
71
|
+
fuzz?: SolidityTestFuzzUserConfig;
|
|
72
|
+
invariant?: SolidityTestInvariantUserConfig;
|
|
73
|
+
forking?: SolidityTestForkingUserConfig;
|
|
74
|
+
eip712Types?: {
|
|
75
|
+
include?: string[];
|
|
76
|
+
exclude?: string[];
|
|
67
77
|
};
|
|
68
78
|
}
|
|
69
79
|
|
|
70
|
-
export interface
|
|
71
|
-
|
|
72
|
-
blockNumber?: number | bigint;
|
|
73
|
-
rpcEndpoints?: Record<string, SensitiveString>;
|
|
80
|
+
export interface SolidityTestProfilesUserConfig {
|
|
81
|
+
profiles: Record<string, SolidityTestProfileUserConfig>;
|
|
74
82
|
}
|
|
75
83
|
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
export type SolidityTestUserConfig =
|
|
85
|
+
| SolidityTestProfileUserConfig
|
|
86
|
+
| SolidityTestProfilesUserConfig;
|
|
79
87
|
|
|
80
88
|
export interface HardhatTestUserConfig {
|
|
81
89
|
solidity?: SolidityTestUserConfig;
|
|
82
90
|
}
|
|
83
91
|
|
|
92
|
+
export interface SolidityTestFsPermissionsConfig {
|
|
93
|
+
readWriteFile?: string[];
|
|
94
|
+
readFile?: string[];
|
|
95
|
+
writeFile?: string[];
|
|
96
|
+
dangerouslyReadWriteDirectory?: string[];
|
|
97
|
+
readDirectory?: string[];
|
|
98
|
+
dangerouslyWriteDirectory?: string[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface SolidityTestInvariantConfig {
|
|
102
|
+
failurePersistDir?: string;
|
|
103
|
+
runs?: number;
|
|
104
|
+
depth?: number;
|
|
105
|
+
failOnRevert?: boolean;
|
|
106
|
+
callOverride?: boolean;
|
|
107
|
+
dictionaryWeight?: number;
|
|
108
|
+
includeStorage?: boolean;
|
|
109
|
+
includePushBytes?: boolean;
|
|
110
|
+
shrinkRunLimit?: number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface SolidityTestFuzzConfig {
|
|
114
|
+
failurePersistDir?: string;
|
|
115
|
+
failurePersistFile?: string;
|
|
116
|
+
runs?: number;
|
|
117
|
+
maxTestRejects?: number;
|
|
118
|
+
seed: string;
|
|
119
|
+
dictionaryWeight?: number;
|
|
120
|
+
includeStorage?: boolean;
|
|
121
|
+
includePushBytes?: boolean;
|
|
122
|
+
showLogs?: boolean;
|
|
123
|
+
}
|
|
124
|
+
|
|
84
125
|
export interface SolidityTestForkingConfig {
|
|
85
126
|
url?: ResolvedConfigurationVariable;
|
|
86
127
|
blockNumber?: bigint;
|
|
87
128
|
rpcEndpoints?: Record<string, ResolvedConfigurationVariable>;
|
|
88
129
|
}
|
|
89
130
|
|
|
90
|
-
export interface
|
|
131
|
+
export interface SolidityTestProfileConfig {
|
|
132
|
+
rpcCachePath: string;
|
|
133
|
+
fsPermissions?: SolidityTestFsPermissionsConfig;
|
|
134
|
+
isolate?: boolean;
|
|
135
|
+
ffi?: boolean;
|
|
136
|
+
allowInternalExpectRevert?: boolean;
|
|
137
|
+
from?: string; // 0x-prefixed hex string
|
|
138
|
+
txOrigin?: string; // 0x-prefixed hex string
|
|
139
|
+
initialBalance?: bigint;
|
|
140
|
+
blockBaseFeePerGas?: bigint;
|
|
141
|
+
coinbase?: string; // 0x-prefixed hex string
|
|
142
|
+
blockTimestamp?: bigint;
|
|
143
|
+
prevRandao?: bigint;
|
|
144
|
+
gasLimit?: bigint;
|
|
145
|
+
blockGasLimit?: number | bigint | false;
|
|
146
|
+
transactionGasCap?: number | bigint | false;
|
|
91
147
|
fuzz: SolidityTestFuzzConfig;
|
|
148
|
+
invariant?: SolidityTestInvariantConfig;
|
|
92
149
|
forking?: SolidityTestForkingConfig;
|
|
150
|
+
eip712Types: {
|
|
151
|
+
include: string[];
|
|
152
|
+
exclude: string[];
|
|
153
|
+
};
|
|
93
154
|
}
|
|
155
|
+
|
|
156
|
+
export interface SolidityTestConfig {
|
|
157
|
+
profiles: Record<string, SolidityTestProfileConfig>;
|
|
158
|
+
}
|
|
159
|
+
|
|
94
160
|
export interface HardhatTestConfig {
|
|
95
161
|
solidity: SolidityTestConfig;
|
|
96
162
|
}
|
|
@@ -3,7 +3,7 @@ import type { HardhatPlugin } from "../../../types/plugins.js";
|
|
|
3
3
|
import { ArgumentType } from "../../../types/arguments.js";
|
|
4
4
|
import { task } from "../../core/config.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export type * from "./type-extensions.js";
|
|
7
7
|
|
|
8
8
|
const hardhatPlugin: HardhatPlugin = {
|
|
9
9
|
id: "builtin:test",
|
|
@@ -49,6 +49,10 @@ import {
|
|
|
49
49
|
import { spawn } from "./subprocess.js";
|
|
50
50
|
import { getTemplates } from "./template.js";
|
|
51
51
|
|
|
52
|
+
export interface NonInteractiveInitHardhat3Options {
|
|
53
|
+
template: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
52
56
|
export interface InitHardhatOptions {
|
|
53
57
|
hardhatVersion?: "hardhat-2" | "hardhat-3";
|
|
54
58
|
workspace?: string;
|
|
@@ -60,6 +64,61 @@ export interface InitHardhatOptions {
|
|
|
60
64
|
|
|
61
65
|
const log = createDebug("hardhat:core:cli:init");
|
|
62
66
|
|
|
67
|
+
export async function initHardhat3NonInteractive(
|
|
68
|
+
options: NonInteractiveInitHardhat3Options,
|
|
69
|
+
): Promise<void> {
|
|
70
|
+
const [template, projectTypeAnalyticsPromise] = await getTemplate(
|
|
71
|
+
"hardhat-3",
|
|
72
|
+
options.template,
|
|
73
|
+
true,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const workspace = process.cwd();
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
const configFilePath = await findClosestHardhatConfig(workspace);
|
|
80
|
+
|
|
81
|
+
throw new HardhatError(
|
|
82
|
+
HardhatError.ERRORS.CORE.GENERAL.HARDHAT_PROJECT_ALREADY_CREATED,
|
|
83
|
+
{
|
|
84
|
+
hardhatProjectRootPath: configFilePath,
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
if (
|
|
89
|
+
!HardhatError.isHardhatError(
|
|
90
|
+
err,
|
|
91
|
+
HardhatError.ERRORS.CORE.GENERAL.NO_CONFIG_FILE_FOUND,
|
|
92
|
+
)
|
|
93
|
+
) {
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
await assertNoNonInteractiveClashes(workspace, template);
|
|
99
|
+
|
|
100
|
+
console.log("Initializing project...");
|
|
101
|
+
|
|
102
|
+
await validatePackageJson(workspace, template.packageJson, true);
|
|
103
|
+
|
|
104
|
+
await copyProjectFilesNonInteractive(workspace, template);
|
|
105
|
+
|
|
106
|
+
console.log("Installing dependencies...");
|
|
107
|
+
|
|
108
|
+
await Promise.all([
|
|
109
|
+
installProjectDependencies({
|
|
110
|
+
workspace,
|
|
111
|
+
template,
|
|
112
|
+
install: true,
|
|
113
|
+
update: true,
|
|
114
|
+
formatSuccessMessage: false,
|
|
115
|
+
}),
|
|
116
|
+
projectTypeAnalyticsPromise,
|
|
117
|
+
]);
|
|
118
|
+
|
|
119
|
+
console.log("Project initialized");
|
|
120
|
+
}
|
|
121
|
+
|
|
63
122
|
/**
|
|
64
123
|
* initHardhat implements the project initialization wizard flow.
|
|
65
124
|
*
|
|
@@ -126,7 +185,11 @@ export async function initHardhat(options?: InitHardhatOptions): Promise<void> {
|
|
|
126
185
|
// Run them only if the user opts-in to it
|
|
127
186
|
// Concurrently, await the analytics hit
|
|
128
187
|
await Promise.all([
|
|
129
|
-
installProjectDependencies(
|
|
188
|
+
installProjectDependencies({
|
|
189
|
+
workspace,
|
|
190
|
+
template,
|
|
191
|
+
install: options?.install,
|
|
192
|
+
}),
|
|
130
193
|
projectTypeAnalyticsPromise,
|
|
131
194
|
]);
|
|
132
195
|
|
|
@@ -270,12 +333,17 @@ export async function getWorkspace(workspace?: string): Promise<string> {
|
|
|
270
333
|
*
|
|
271
334
|
* NOTE: This function is exported for testing purposes
|
|
272
335
|
*
|
|
336
|
+
* @param hardhatVersion The version of Hardhat whose templates should be considered.
|
|
273
337
|
* @param template The name of the template to use for the project initialization.
|
|
338
|
+
* @param includeAvailableTemplatesInErrors When true, a missing template throws
|
|
339
|
+
* `TEMPLATE_NOT_FOUND_WITH_LIST_OF_OPTIONS` (which lists the available
|
|
340
|
+
* templates) instead of the bare `TEMPLATE_NOT_FOUND`.
|
|
274
341
|
* @returns A tuple with two elements: the template and a promise with the analytics hit.
|
|
275
342
|
*/
|
|
276
343
|
export async function getTemplate(
|
|
277
344
|
hardhatVersion: "hardhat-2" | "hardhat-3",
|
|
278
345
|
template?: string,
|
|
346
|
+
includeAvailableTemplatesInErrors = false,
|
|
279
347
|
): Promise<[Template, Promise<boolean>]> {
|
|
280
348
|
const templates = await getTemplates(hardhatVersion);
|
|
281
349
|
|
|
@@ -299,9 +367,38 @@ export async function getTemplate(
|
|
|
299
367
|
// we wait for the GA hit before throwing
|
|
300
368
|
await projectTypeAnalyticsPromise;
|
|
301
369
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
370
|
+
if (!includeAvailableTemplatesInErrors) {
|
|
371
|
+
throw new HardhatError(
|
|
372
|
+
HardhatError.ERRORS.CORE.GENERAL.TEMPLATE_NOT_FOUND,
|
|
373
|
+
{
|
|
374
|
+
template,
|
|
375
|
+
},
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const availableTemplates = templates.map((t) => ` - ${t.name}`).join("\n");
|
|
380
|
+
throw new HardhatError(
|
|
381
|
+
HardhatError.ERRORS.CORE.GENERAL.TEMPLATE_NOT_FOUND_WITH_LIST_OF_OPTIONS,
|
|
382
|
+
{
|
|
383
|
+
template,
|
|
384
|
+
availableTemplates,
|
|
385
|
+
},
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Prints the list of available templates for the specified Hardhat version.
|
|
391
|
+
*
|
|
392
|
+
* @param hardhatVersion The version of Hardhat whose templates should be
|
|
393
|
+
* printed.
|
|
394
|
+
*/
|
|
395
|
+
export async function printTemplatesList(
|
|
396
|
+
hardhatVersion: "hardhat-2" | "hardhat-3",
|
|
397
|
+
print: (message: string) => void = console.log,
|
|
398
|
+
): Promise<void> {
|
|
399
|
+
const templates = await getTemplates(hardhatVersion);
|
|
400
|
+
const lines = templates.map((t) => ` - ${t.name}`).join("\n");
|
|
401
|
+
print(`Available templates:\n${lines}`);
|
|
305
402
|
}
|
|
306
403
|
|
|
307
404
|
/**
|
|
@@ -496,23 +593,100 @@ export async function copyProjectFiles(
|
|
|
496
593
|
console.log(`✨ ${styleText("cyan", `Template files copied`)} ✨`);
|
|
497
594
|
}
|
|
498
595
|
|
|
596
|
+
// NOTE: This function is exported for testing purposes
|
|
597
|
+
export async function assertNoNonInteractiveClashes(
|
|
598
|
+
workspace: string,
|
|
599
|
+
template: Template,
|
|
600
|
+
): Promise<void> {
|
|
601
|
+
const clashes: string[] = [];
|
|
602
|
+
|
|
603
|
+
for (const relativeTemplatePath of template.files) {
|
|
604
|
+
const relativeWorkspacePath =
|
|
605
|
+
relativeTemplateToWorkspacePath(relativeTemplatePath);
|
|
606
|
+
|
|
607
|
+
if (
|
|
608
|
+
relativeWorkspacePath === "package.json" ||
|
|
609
|
+
relativeWorkspacePath === "README.md" ||
|
|
610
|
+
path.basename(relativeWorkspacePath) === ".gitignore"
|
|
611
|
+
) {
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (await exists(path.join(workspace, relativeWorkspacePath))) {
|
|
616
|
+
clashes.push(relativeWorkspacePath);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
if (clashes.length === 0) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
throw new HardhatError(
|
|
625
|
+
HardhatError.ERRORS.CORE.GENERAL.NON_INTERACTIVE_INIT_WOULD_OVERWRITE_FILES,
|
|
626
|
+
{
|
|
627
|
+
files: clashes.map((f) => ` - ${f}`).join("\n"),
|
|
628
|
+
},
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
// NOTE: This function is exported for testing purposes
|
|
633
|
+
export async function copyProjectFilesNonInteractive(
|
|
634
|
+
workspace: string,
|
|
635
|
+
template: Template,
|
|
636
|
+
): Promise<void> {
|
|
637
|
+
for (const relativeTemplatePath of template.files) {
|
|
638
|
+
const relativeWorkspacePath =
|
|
639
|
+
relativeTemplateToWorkspacePath(relativeTemplatePath);
|
|
640
|
+
let absoluteWorkspacePath = path.join(workspace, relativeWorkspacePath);
|
|
641
|
+
|
|
642
|
+
if (path.basename(relativeWorkspacePath) === ".gitignore") {
|
|
643
|
+
if (await exists(absoluteWorkspacePath)) {
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
} else if (
|
|
647
|
+
relativeWorkspacePath === "README.md" &&
|
|
648
|
+
(await exists(absoluteWorkspacePath))
|
|
649
|
+
) {
|
|
650
|
+
absoluteWorkspacePath = path.join(workspace, "HARDHAT.md");
|
|
651
|
+
if (await exists(absoluteWorkspacePath)) {
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
await ensureDir(path.dirname(absoluteWorkspacePath));
|
|
657
|
+
await copy(
|
|
658
|
+
path.join(template.path, relativeTemplatePath),
|
|
659
|
+
absoluteWorkspacePath,
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
499
664
|
/**
|
|
500
665
|
* installProjectDependencies prints the commands to install the project dependencies
|
|
501
666
|
* and runs them if the install option is true or if the user opts-in to it.
|
|
502
667
|
*
|
|
503
668
|
* NOTE: This function is exported for testing purposes
|
|
504
669
|
*
|
|
505
|
-
* @param
|
|
506
|
-
* @param
|
|
507
|
-
* @param
|
|
508
|
-
* @param
|
|
670
|
+
* @param options The installation options.
|
|
671
|
+
* @param options.workspace The path to the workspace to initialize the project in.
|
|
672
|
+
* @param options.template The template to use for the project initialization.
|
|
673
|
+
* @param options.install Whether to install the project dependencies.
|
|
674
|
+
* @param options.update Whether to update the project dependencies.
|
|
675
|
+
* @param options.formatSuccessMessage Whether to format the success message or not.
|
|
509
676
|
*/
|
|
510
|
-
export async function installProjectDependencies(
|
|
511
|
-
workspace
|
|
512
|
-
template
|
|
513
|
-
install
|
|
514
|
-
update
|
|
515
|
-
|
|
677
|
+
export async function installProjectDependencies({
|
|
678
|
+
workspace,
|
|
679
|
+
template,
|
|
680
|
+
install,
|
|
681
|
+
update,
|
|
682
|
+
formatSuccessMessage = true,
|
|
683
|
+
}: {
|
|
684
|
+
workspace: string;
|
|
685
|
+
template: Template;
|
|
686
|
+
install?: boolean;
|
|
687
|
+
update?: boolean;
|
|
688
|
+
formatSuccessMessage?: boolean;
|
|
689
|
+
}): Promise<void> {
|
|
516
690
|
const pathToWorkspacePackageJson = path.join(workspace, "package.json");
|
|
517
691
|
|
|
518
692
|
const workspacePkg: PackageJson = await readJsonFile(
|
|
@@ -587,7 +761,11 @@ export async function installProjectDependencies(
|
|
|
587
761
|
);
|
|
588
762
|
}
|
|
589
763
|
|
|
590
|
-
|
|
764
|
+
if (formatSuccessMessage) {
|
|
765
|
+
console.log(`✨ ${styleText("cyan", `Dependencies installed`)} ✨`);
|
|
766
|
+
} else {
|
|
767
|
+
console.log(`Dependencies installed`);
|
|
768
|
+
}
|
|
591
769
|
}
|
|
592
770
|
}
|
|
593
771
|
|
|
@@ -640,7 +818,11 @@ export async function installProjectDependencies(
|
|
|
640
818
|
);
|
|
641
819
|
}
|
|
642
820
|
|
|
643
|
-
|
|
821
|
+
if (formatSuccessMessage) {
|
|
822
|
+
console.log(`✨ ${styleText("cyan", `Dependencies updated`)} ✨`);
|
|
823
|
+
} else {
|
|
824
|
+
console.log("Dependencies updated");
|
|
825
|
+
}
|
|
644
826
|
}
|
|
645
827
|
}
|
|
646
828
|
}
|
package/src/internal/cli/main.ts
CHANGED
|
@@ -96,7 +96,70 @@ export async function main(
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
if (builtinGlobalOptions.init) {
|
|
99
|
-
const { initHardhat } =
|
|
99
|
+
const { initHardhat, initHardhat3NonInteractive, printTemplatesList } =
|
|
100
|
+
await import("./init/init.js");
|
|
101
|
+
|
|
102
|
+
let templateName: string | undefined;
|
|
103
|
+
let listTemplates = false;
|
|
104
|
+
|
|
105
|
+
for (let i = 0; i < cliArguments.length; i++) {
|
|
106
|
+
if (usedCliArguments[i]) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (cliArguments[i] === "--templates") {
|
|
111
|
+
usedCliArguments[i] = true;
|
|
112
|
+
listTemplates = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
for (let i = 0; i < cliArguments.length; i++) {
|
|
117
|
+
if (usedCliArguments[i]) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (cliArguments[i] === "--template") {
|
|
122
|
+
usedCliArguments[i] = true;
|
|
123
|
+
|
|
124
|
+
if (templateName !== undefined) {
|
|
125
|
+
throw new HardhatError(
|
|
126
|
+
HardhatError.ERRORS.CORE.ARGUMENTS.DUPLICATED_NAME,
|
|
127
|
+
{ name: "--template" },
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (listTemplates) {
|
|
132
|
+
throw new HardhatError(
|
|
133
|
+
HardhatError.ERRORS.CORE.ARGUMENTS.CANNOT_COMBINE_TEMPLATE_AND_TEMPLATES,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (
|
|
138
|
+
usedCliArguments[i + 1] === undefined ||
|
|
139
|
+
usedCliArguments[i + 1] === true ||
|
|
140
|
+
cliArguments[i + 1] === undefined ||
|
|
141
|
+
cliArguments[i + 1].startsWith("-")
|
|
142
|
+
) {
|
|
143
|
+
throw new HardhatError(
|
|
144
|
+
HardhatError.ERRORS.CORE.ARGUMENTS.MISSING_VALUE_FOR_ARGUMENT,
|
|
145
|
+
{ argument: "--template" },
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
templateName = cliArguments[i + 1];
|
|
150
|
+
i++;
|
|
151
|
+
usedCliArguments[i] = true;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (listTemplates) {
|
|
156
|
+
return await printTemplatesList("hardhat-3", print);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (templateName !== undefined) {
|
|
160
|
+
return await initHardhat3NonInteractive({ template: templateName });
|
|
161
|
+
}
|
|
162
|
+
|
|
100
163
|
return await initHardhat();
|
|
101
164
|
}
|
|
102
165
|
|
package/src/types/arguments.ts
CHANGED
package/src/types/artifacts.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { SolidityBuildInfo } from "./solidity/solidity-artifacts.js";
|
|
2
2
|
import type { NonNeverKeys } from "./utils.js";
|
|
3
3
|
|
|
4
|
+
import "./builtin-plugin-type-extensions.js";
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* A map of bare contract names and fully qualified contract names to their
|
|
6
8
|
* artifacts that will be completed by Hardhat's build system using module
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// This is an internal file that needs to be imported by every top-level type
|
|
2
|
+
// file, so that they load the builtin plugin type extensions.
|
|
3
|
+
//
|
|
4
|
+
// The trade-off here is that we end up with one unnecessary runtime import of
|
|
5
|
+
// an empty file (this one) if a `src/types/*` file is imported without the
|
|
6
|
+
// `type` annotation (e.g. the CLI's indirectly importing task-related enums),
|
|
7
|
+
// in exchange for better DX.
|
|
8
|
+
//
|
|
9
|
+
// The reason we can't just use the `export type *` from the other files instead
|
|
10
|
+
// is that in some cases that leads to a circular export of types that TS can't
|
|
11
|
+
// handle.
|
|
12
|
+
//
|
|
13
|
+
// The reason we can't use `import type` is that those get erased during
|
|
14
|
+
// compilation.
|
|
15
|
+
export type * from "../internal/builtin-plugins/index.js";
|
package/src/types/config.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// type-extensions are loaded when the user imports `hardhat/types/config`.
|
|
3
|
-
import "../internal/builtin-plugins/index.js";
|
|
1
|
+
import "./builtin-plugin-type-extensions.js";
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* A configuration variable to be fetched at runtime from
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { GlobalOptionDefinition } from "./arguments.js";
|
|
2
2
|
|
|
3
|
+
import "./builtin-plugin-type-extensions.js";
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* The values of each global option for a certain instance of the Hardhat
|
|
5
7
|
* Runtime Environment are defined here. This interface can be extended through
|
package/src/types/hooks.ts
CHANGED
|
@@ -14,6 +14,8 @@ import type {
|
|
|
14
14
|
Return,
|
|
15
15
|
} from "./utils.js";
|
|
16
16
|
|
|
17
|
+
import "./builtin-plugin-type-extensions.js";
|
|
18
|
+
|
|
17
19
|
// We add the HookManager to the HRE with a module augmentation to avoid
|
|
18
20
|
// introducing a circular dependency that would look like this:
|
|
19
21
|
// hre.ts -> hooks.ts -> hre.ts
|
package/src/types/hre.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { GlobalOptions } from "./global-options.js";
|
|
|
2
2
|
import type { UserInterruptionManager } from "./user-interruptions.js";
|
|
3
3
|
import type { HardhatConfig, HardhatUserConfig } from "../types/config.js";
|
|
4
4
|
|
|
5
|
+
import "./builtin-plugin-type-extensions.js";
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* The Hardhat Runtime Environment (HRE) is an object that exposes
|
|
7
9
|
* all the functionality available through Hardhat.
|
package/src/types/index.ts
CHANGED
package/src/types/network.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { NetworkConfig, NetworkConfigOverride } from "./config.js";
|
|
2
2
|
import type { EthereumProvider } from "./providers.js";
|
|
3
3
|
|
|
4
|
+
import "./builtin-plugin-type-extensions.js";
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Represents the possible chain types for the network. The options are:
|
|
6
8
|
* - `GenericNetworkType`: Represents the most generic type of network.
|
package/src/types/plugins.ts
CHANGED
|
@@ -2,9 +2,7 @@ import type { GlobalOptionDefinition } from "./arguments.js";
|
|
|
2
2
|
import type { HardhatHooks } from "./hooks.js";
|
|
3
3
|
import type { TaskDefinition } from "./tasks.js";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
// type-extensions are loaded when the user imports `hardhat/types/plugins`.
|
|
7
|
-
import "../internal/builtin-plugins/index.js";
|
|
5
|
+
import "./builtin-plugin-type-extensions.js";
|
|
8
6
|
|
|
9
7
|
// We add the plugins to the config types with a module augmentation to avoid
|
|
10
8
|
// introducing a circular dependency that would look like this:
|
package/src/types/providers.ts
CHANGED
package/src/types/solidity.ts
CHANGED
package/src/types/tasks.ts
CHANGED
|
@@ -8,6 +8,8 @@ import type { HardhatRuntimeEnvironment } from "./hre.js";
|
|
|
8
8
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars -- used in JSDoc {@link} */
|
|
9
9
|
import type { Result } from "./utils.js";
|
|
10
10
|
|
|
11
|
+
import "./builtin-plugin-type-extensions.js";
|
|
12
|
+
|
|
11
13
|
// We add the TaskManager to the HRE with a module augmentation to avoid
|
|
12
14
|
// introducing a circular dependency that would look like this:
|
|
13
15
|
// hre.ts -> tasks.ts -> hre.ts
|
package/src/types/test.ts
CHANGED