Skip to content
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

getGasPriceUrlForChain never sets apiKey for L1 #239

Closed
sherpya opened this issue Aug 10, 2024 · 4 comments
Closed

getGasPriceUrlForChain never sets apiKey for L1 #239

sherpya opened this issue Aug 10, 2024 · 4 comments

Comments

@sherpya
Copy link

sherpya commented Aug 10, 2024

export function getGasPriceUrlForChain(options: GasReporterOptions): string {
  let apiKey = "";

  if (options.gasPriceApi) return options.gasPriceApi;

  if (options.L2) {
    if (!L2[options.L2]) throw new Error;

    apiKey = (options.L2Etherscan)
      ? `${DEFAULT_API_KEY_ARGS}${options.L2Etherscan}`
      : "";

    return `${L2[options.L2!].baseUrl}${DEFAULT_GAS_PRICE_API_ARGS}${apiKey}`;
  }

  if (!L1[options.L1!]) throw new Error();

  return `${L1[options.L1!].baseUrl}${DEFAULT_GAS_PRICE_API_ARGS}${apiKey}`;
}

apiKey is always empty string on ethereum mainnet

@cgewecke
Copy link
Owner

@sherpya Thanks for catching... out of curiosity are you currently seeing etherscan rate limit this call on Ethereum mainnet?

@sherpya
Copy link
Author

sherpya commented Aug 11, 2024

@sherpya Thanks for catching... out of curiosity are you currently seeing etherscan rate limit this call on Ethereum mainnet?

yes, I'm getting:

{
    status: "0",
    message: "NOTOK",
    result: "Missing/Invalid API Key"
}

the url is:
https://api.etherscan.io/api?module=proxy&action=eth_gasPrice"

@cgewecke
Copy link
Owner

@sherpya Patched via #240 and published in v2.2.1. Please just lmk if that doesn't fix it and I'll re-open.

Thanks again!

https://github.com/cgewecke/hardhat-gas-reporter/releases/tag/v2.2.1

@sherpya
Copy link
Author

sherpya commented Aug 12, 2024

yes, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants