You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
switch(name) {
case "homestead":
baseUrl = "https://api.etherscan.io";
break;
case "ropsten":
baseUrl = "https://api-ropsten.etherscan.io";
break;
case "rinkeby":
baseUrl = "https://api-rinkeby.etherscan.io";
break;
case "kovan":
baseUrl = "https://api-kovan.etherscan.io";
break;
case "goerli":
baseUrl = "https://api-goerli.etherscan.io";
break;
case "smartchain":
baseUrl = "https://api.bscscan.com";
break;
default:
throw new Error("unsupported network");
}
Also, there should be a handler for getEtherPrice, like this:
delete these two lines:
if (this.network.name !== "homestead") { return 0.0; }
url += "?module=stats&action=ethprice";
add:
if (this.network.name !== "homestead" && this.network.name !== "smartchain") { return 0.0; }
if (this.network.name == "smartchain") {
url += "?module=stats&action=bnbprice";
} else {
url += "?module=stats&action=ethprice";
}
Thank you very much
Marco
The text was updated successfully, but these errors were encountered:
Hello, please add bscscan (Binance Chain Etherscan) for Etherscan providers
the base URL is https://api.bscscan.com/
I use ethers.js and I need to use this endpoint so I can add historical data support for Binance Smart Chain.
the file is this one:
packages/providers/src.ts/etherscan-provider.ts
Right now the options are these:
switch(name) {
case "homestead":
baseUrl = "https://api.etherscan.io";
break;
case "ropsten":
baseUrl = "https://api-ropsten.etherscan.io";
break;
case "rinkeby":
baseUrl = "https://api-rinkeby.etherscan.io";
break;
case "kovan":
baseUrl = "https://api-kovan.etherscan.io";
break;
case "goerli":
baseUrl = "https://api-goerli.etherscan.io";
break;
default:
throw new Error("unsupported network");
}
It should be like this:
Also, there should be a handler for getEtherPrice, like this:
delete these two lines:
if (this.network.name !== "homestead") { return 0.0; }
url += "?module=stats&action=ethprice";
add:
if (this.network.name !== "homestead" && this.network.name !== "smartchain") { return 0.0; }
if (this.network.name == "smartchain") {
url += "?module=stats&action=bnbprice";
} else {
url += "?module=stats&action=ethprice";
}
Thank you very much
Marco
The text was updated successfully, but these errors were encountered: