const provider = new ethers.providers.Web3Provider(window.ethereum, "any");
const accounts = await provider.listAccounts()
console.log(await provider.getBalance(accounts[0]));
const signer = provider.getSigner();
这是代码; (这是包含在异步函数中的)
这是当调试器到达“Signer”时我收到的错误
Uncaught (in promise) Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted", method="estimateGas", transaction={"from":"0xE0462A44f97421E0A896cb2A7A31624D592ea52F","to":"0x7810ee6cbe9d0DB24d86110115A88d1200844DFd","data":"0x8632d6ed0000000000000000000000000000000000000000000000000000000000000000","accessList":null}, error={"code":-32603,"message":"execution reverted","data":{"originalError":{"code":3,"data":"0x4e487b710000000000000000000000000000000000000000000000000000000000000011","message":"execution reverted"}}}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
昨晚工作得很好,但发生了一些事情,我不知道为什么。
您的气体估计失败,因为您的调用在执行时恢复了。
错误信息是:
{
"code": -32603,
"message": "execution reverted",
"data": {
"originalError": {
"code": 3,
"data": "0x4e487b710000000000000000000000000000000000000000000000000000000000000011",
"message": "execution reverted"
}
}
}
错误消息
0x4e487b710000000000000000000000000000000000000000000000000000000000000011
解码为 Panic(17)
您所致电的合同需要更多信息
0x7810ee6cbe9d0DB24d86110115A88d1200844DFd
。