尝试在测试函数中使用
ethers.utils.parseUnits("1", "ether")
时,会抛出错误 TypeError: Cannot read properties of undefined (reading 'parseUnits')
。
const { deployments, ethers, getNamedAccounts } = require("hardhat")
const { assert, expect } = require("chai")
describe("FundMe", async function () {
let fundMe
let deployer
const sendValue = ethers.utils.parseUnits("1", "ether")
})
我也尝试过使用 parseEther 得到相同的结果。在 ethers.utils.parseUnits 的文档规范中,它说只使用它。我还缺少其他功能吗?我的以太配置可能不正确吗?