-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Support Etherscan API v2 #6727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Etherscan API v2 #6727
Conversation
🦋 Changeset detectedLatest commit: 6b51247 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
98170fc
to
5af85da
Compare
.changeset/nasty-readers-explode.md
Outdated
"@nomicfoundation/hardhat-verify": patch | ||
--- | ||
|
||
Support Etherscan API v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that when we release a new hardhat version, we also add a link to the original issue issue. See here: https://github.com/NomicFoundation/hardhat/releases.
So maybe it can be added here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I appended the issue number to the changeset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a minor comment but apart from that LGTM
I have a question here: for the custom chains do you also show a warning? The reason I'm asking is my own (completely insane) |
Closes #6716
This PR means to support the api v2 of Etherscan.io. The main difference is that with v2 you can use only one api key (from etherscan.io), to access the explorer services on all supported chains, in contrast with having to register and have multiple api keys and explorers.
There are three main scenarios in which the plugin is used right now, related to this change, and we intend to provide support for all of them.
1- The user specifies a single api key in the config. This is assumed to be an etherscan.io key and it will be used to verify contracts on all the supported chains, using the api v2.
2- The user specifies a map with network -> api key combination. This is now deprecated and we show a warning, but we still attempt to use the v1 api using these keys and endpoints until they discontinue support from Etherscan. We cannot use v2 in this case because api keys of different explorers (e.g. arbiscan) are not valid for etherscan.io v2 api.
3- The user specifies custom chains. In this case we keep the existing behavior, treating the api as an etherscan v1 api.
The actual implementation is simple, when we want to use the v2 api, we use the updated endpoint (which is etherscan.io for all chains) and pass a query parameter with the chain id.