crytic-compile icon indicating copy to clipboard operation
crytic-compile copied to clipboard

Conflict when multiple explorer API keys provided

Open vovikhangcdv opened this issue 7 months ago • 2 comments

When you use the --etherscan-apikey along with other explorer API key parameters, such as --optim-apikey, the etherscan API key will be added as the first apikey parameter, with other explorer's keys following. This will cause the etherscan key to be counted and loaded when requesting explorer API, which is not expected when used with other explorers such as Optim, and it will result in an invalid API key error.

For example:

❯ crytic-compile optim:0x5499178919c79086fd580d6c5f332a4253244d91 --etherscan-apikey $ETHERSCAN_API_KEY --optim-apikey $OPTIM_API_KEY
ERROR:CryticCompile:Invalid etherscan API Key
ERROR:CryticCompile:Invalid etherscan API Key: https://api-optimistic.etherscan.io/api?module=contract&action=getsourcecode&address=0x5499178919c79086fd580d6c5f332a4253244d91&apikey=<$ETHERSCAN_API_KEY>&apikey=<$OPTIM_API_KEY>

Expected Behavior: It should work seamlessly, and the provided priority API key should adhere to the explorer's address prefix.

vovikhangcdv avatar Jul 22 '24 09:07 vovikhangcdv