EtherscanProvider has no base URL for Optimism #2968
Labels
enhancement
New feature or improvement.
fixed/complete
This Bug is fixed or Enhancement is complete and published.
Ethers Version
5.6.5
Search Terms
optimism etherscan
Describe the Problem
Versions of the Etherscan API that enable historical queries (using
EtherscanProvider.getHistory(address)
) now exist for some L2 chains, including Optimistic Ethereum: https://optimistic.etherscan.io/apis. However, it's not yet possible to use this in Ethers.js AFAICT.This code...
... will throw:
... because
getBaseUrl()
here doesn't know about Optimism.I've also tried using the
JsonRpcProvider
and providing a URL:But of course there's no
getHistory()
method onJsonRpcProvider
.Code Snippet
const network: Network = {name: 'optimism', chainId: 10} const provider = new EtherscanProvider(network, etherscanApiKey)
Contract ABI
No response
Errors
Environment
Altcoin - Please specify (e.g. Polygon), node.js (v12 or newer)
Environment (Other)
Optimism
The text was updated successfully, but these errors were encountered: