cgewecke / hardhat-gas-reporter

Gas Usage Analytics for Hardhat
MIT License
411 stars 57 forks source link

How to use v2 with @nomicfoundation/hardhat-toolbox ? #246

Open kopax opened 2 weeks ago

kopax commented 2 weeks ago

Hi there, I can see you upgraded ethers v5 to v6 in v2, which is highly needed for deduping package.

However, @nomicfoundation use the obselete outdated v1 version.

I have tried to force install the v2 instead of v1, but it seem incompatible.

How do you guy use hardhat-gas-reporter@2 ? Do you have any top so I can use it with the toolbar ?

Thanks

Link https://github.com/NomicFoundation/hardhat/issues/5795

cgewecke commented 2 weeks ago

@kopax Does this fix itself if you completely uninstall the gas-reporter (e.g make sure neither version is in your dependency tree) and then only install the latest?

Another approach is suggested in #229, where you can use npm's overrides, or yarn's resolutions features to specify which version to install by adding the relevant key below to your package.json:

npm

"overrides": {
    "hardhat-gas-reporter": "^2.2.1"
  }

yarn

"resolutions": {
    "hardhat-gas-reporter": "^2.2.1"
  }
kopax commented 2 weeks ago

Hi @cgewecke and thanks for your reply. I just pinned the hardhat-gas-reporter version to latest, and so far I do not see regression (your first suggestion). However, I am not if later i use more feature from hardhat-toolbox if it will become buggy.

Are all the interface the same ? I wish they could upgrade hardhat-toolbox with the latest version, but no one poped yet in the opened issue on their repository.

cgewecke commented 2 weeks ago

@kopax

if later i use more feature from hardhat-toolbox if it will become buggy...are all the interface the same ?

Yes, it should be ok. There were no relevant API changes in the gas reporter between v1 and v2 and the toolbox basically just imports a set of plugins - I think it's meant to make people's hardhat.config.ts look cleaner and be convenient to set up.

You might see peer dependency warnings from npm when installing since the toolbox lists v1 as a peer here, but that's all.