Error Details: Connect Timeout Error

代码方式验证合约
出现如下报错

yarn hardhat run scripts/deploy.js --network speolia
yarn run v1.22.22
$ /Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/.bin/hardhat run scripts/deploy.js --network speolia
deploy contract...
deploy contract to: 合约地址 这里隐藏
waitting for block taxes...
verifying contract...
UnexpectedError: An unexpected error occurred during the verification process.
Please report this issue to the Hardhat team.
Error Details: Connect Timeout Error
    at Etherscan.isVerified (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/@nomicfoundation/hardhat-verify/src/internal/etherscan.ts:126:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at SimpleTaskDefinition.action (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/@nomicfoundation/hardhat-verify/src/internal/tasks/etherscan.ts:101:24)
    at Environment._runTaskDefinition (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14)
    at Environment.run (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14)
    at SimpleTaskDefinition.action (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/@nomicfoundation/hardhat-verify/src/index.ts:284:9)
    at Environment._runTaskDefinition (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14)
    at Environment.run (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14)
    at verify (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/scripts/deploy.js:31:9)
    at main (/Users/macbook/Desktop/wjh/hhfcc/hardhatfcc/scripts/deploy.js:16:9)
current value: 5
update value: 7
✨  Done in 97.07s.

解决方法:
在hardhat.config.js中添加以下代码:

const { ProxyAgent, setGlobalDispatcher } = require("undici");
const proxyAgent = new ProxyAgent("http://127.0.0.1:1087");//查看自己的代理 修改端口
setGlobalDispatcher(proxyAgent);

yarn add --dev undici

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值