-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 multiple api keys #2130
Conversation
🦋 Changeset detectedLatest commit: 6dcf619 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 |
5e42d53
to
01c75b5
Compare
The config has been extended to allow both a string as api key or an object that can contain multiple api keys, keyed by chain. Relates to #1448.
01c75b5
to
e04944c
Compare
Previously the enums where internal, to support passing eslint tests they are being switched to camelcase.
A previous refactoring was able to invalidate the test when the type of chainConfig changed.
I modified some error messages. I think they look a bit better now: There is only one extra thing I'd like to have here related to error handling: to show a proper error when the user configures an API key under an invalid network name. This is only relevant for javascript projects, since in typescript that will simply not compile. I think this is important because it's likely that users won't read the docs, and they'll try to use the network name as the key. |
For js projects there is now an explicit check that the api keys provided are supported.
I have added a check on the etherscan api keys during I have repeated the manual test of a verify against ropsten, but that was using the same linking approach as before @fvictorio. |
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.
Small comments, pre-approving
Co-authored-by: Franco Victorio <victorio.franco@gmail.com>
I pulled master and just use the multi-api-key, amazing feature 👍 Thank you so much 🚀 🚀 |
@Shelvak oh, thank you for testing it! We'll probably release this feature this week. |
Etherscan has expanded to provided block explorers and verifiers for popular sidechains. The config in the
hardhat-etherscan
plugin assumes there is only oneapiKey
for use in verification, even though the project may be targeting multiple network/sidechains.This PR adds support in the
hardhat-etherscan
configuration for setting an api key for etherscan per network (i.e. a project could support project verification on both mainnet and polygon at once without hacks).Approach
Extend the current allowed structure of the
hardhat-etherscan
from:to:
Where
EtherscanApiKeys
is an object with one property for each supported network mapping to the apiKey to used when verifying on that network.The supported networks are derived from the
networkConfig
object that combines the chainId and etherscan urls, and is used to define the typesafety of the etherscan config object (only networks present on the config object are allowed in a valid etherscan config).Relates to #1448
TODO
We'll release a new major version.
EtherscanApiKeys
under etherscan config