ethers-io / ethers.js

Complete Ethereum library and wallet implementation in JavaScript.
https://ethers.org/
MIT License
7.9k stars 1.83k forks source link

EtherscanProvider.getHistory(), got an error; #2181

Open jeffreyzzzs opened 2 years ago

jeffreyzzzs commented 2 years ago

I got this error on EtherscanProvider.getHistory(address);

nodejs.SERVER_ERRORError: missing response (requestBody=null, requestMethod="GET", serverError={"code":"ECONNRESET","path":null,"host":"api.etherscan.io","port":443}, url="https://api.etherscan.io/api?module=account&action=txlist&address=0x99b02491Fd1A9a7A97a31d046767c08D5cCc9A1d&startblock=0&endblock=99999999&sort=asc&apikey=9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB", code=SERVER_ERROR, version=web/5.4.0)
    at Logger.makeError (D:\workspace\defi\pms-defi\node_modules\@ethersproject\logger\lib\index.js:199:21)
    at Logger.throwError (D:\workspace\defi\pms-defi\node_modules\@ethersproject\logger\lib\index.js:208:20)
    at D:\workspace\defi\pms-defi\node_modules\@ethersproject\web\lib\index.js:213:36
    at step (D:\workspace\defi\pms-defi\node_modules\@ethersproject\web\lib\index.js:33:23)
    at Object.throw (D:\workspace\defi\pms-defi\node_modules\@ethersproject\web\lib\index.js:14:53)
    at rejected (D:\workspace\defi\pms-defi\node_modules\@ethersproject\web\lib\index.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
reason: "missing response"
code: "SERVER_ERROR"
requestBody: null
requestMethod: "GET"
serverError: {"code":"ECONNRESET","path":null,"host":"api.etherscan.io","port":443}
url: "https://api.etherscan.io/api?module=account&action=txlist&address=0x99b02491Fd1A9a7A97a31d046767c08D5cCc9A1d&startblock=0&endblock=99999999&sort=asc&apikey=9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB"
name: "SERVER_ERRORError"
pid: 27988
hostname: ...

Here's my code: const ethers = require('ethers'); const provider = new ethers.providers.EtherscanProvider(); const address = "0x99b02491Fd1A9a7A97a31d046767c08D5cCc9A1d"; const history = await provider.getHistory(address);

jeffreyzzzs commented 2 years ago

Where do I have problems writing this way, can you help me see it?

ethers version : "ethers": "^5.4.7"