Skip to content

Hardhat v2.16.0 - Extendable providers

Compare
Choose a tag to compare
@fvictorio fvictorio released this 22 Jun 05:55
· 2077 commits to main since this release

This version of Hardhat adds a new extensibility point: you can now wrap Hardhat's network provider with your own logic.

This is done by using the new extendProvider configuration function:

extendProvider(async (provider, config, network) => {
  const newProvider = new MyProviderWrapper(provider);
  return newProvider;
});

Doing this means that all the JSON-RPC calls will go through your custom provider wrapper. You can use this to intercept and handle some requests while forwarding the rest to the original provider.

To learn more about this, read the "Extending the Hardhat provider" section in our docs. If you have questions about how to use this, please open a new discussion.

Other changes

Besides this new feature, this version includes the following changes:

  • console.sol is now memory-safe (thanks @ZumZoom!)
  • Added optional params to some compilation subtasks to make them more flexible (thanks @adjisb!)
  • Added a HARDHAT_DISABLE_TELEMETRY_PROMPT environment variable that can be set to true to prevent Hardhat from showing the telemetry consent prompt
  • The opt-in telemetry is now done using Google Analytics 4