小编Max*_*ina的帖子

如何在打字稿任务中使用hardhat.ethers?

以下代码找不到“ethers”

import { HardhatUserConfig, task } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

task('read',async () => {
    const contract = ethers.getContractFactory('AwesomeContract');
    // ...
})

const config: HardhatUserConfig = {
  solidity: "0.8.15",
};

export default config;
Run Code Online (Sandbox Code Playgroud)

开发者当然不能这样做:

import { ethers } from 'hardhat';
Run Code Online (Sandbox Code Playgroud)

因为它抛出HH9

是否可以在打字稿任务中使用hardhat.ethers?

typescript ethers.js hardhat

1
推荐指数
1
解决办法
1692
查看次数

标签 统计

ethers.js ×1

hardhat ×1

typescript ×1