我需要从命令行使用 Hardhat 运行特定的 ts 脚本,但我需要指定参数...与此类似:
npx hardhat run --network rinkeby scripts/task-executor.ts param1 param2
Run Code Online (Sandbox Code Playgroud)
其中是hardhat 运行--network rinkeby的参数
, 和是task-executor.ts脚本的参数。
我找不到任何有关此问题的帖子,也无法使其工作。param1param2
我还尝试定义一个安全帽任务并添加这些参数,但如果我尝试执行它,我会得到:
Error HH9: Error while loading Hardhat's configuration.
You probably tried to import the "hardhat" module from your config or a file imported from it.
This is not possible, as Hardhat can't be initialized while its config is being defined.
Run Code Online (Sandbox Code Playgroud)
因为我需要在该特定任务中导入hre或ethers导出。hardhat
如何完成我所需要的?