Hardhat Project Setup
Install and use the Hardhat plugin
The Hardhat plugin extends Hardhat network by listening to incoming blocks and synchronizing them directly with the dashboard. Once installed and included, you won't need to run the CLI as it will be able to listen and synchronize blocks directly.
Installation
Add hardhat-ethernal
to your package.json
, and run npm install
or yarn
Synchronize blocks & transactions
In your hardhat-config.js
file, require the plugin:
That's it! Blocks and transactions will now be synchronized.
Options
It's possible to disable the synchronization by setting ethernalSync
to false
on the hre
object.
You can also specify which workspace you want to synchronize blocks & transactions to (default to the last one used in the dashboard).
By default, transactions will be traced using experimentalAddHardhatNetworkMessageTraceHook
, showing CALLx and CREATEx operations in the dashboard. You can disable this feature with the ethernalTrace
flag.
You can automatically reset your workspace by setting the ethernalResetOnStart
property to the name of the workspace. Everytime the node starts, all accounts/blocks/transactions/contracts will be deleted.
Logging In
You can log in either by using
Or by calling Hardhat commands with extra env variables:
Synchronize artifacts
Require the package in your deploy script:
The plugin will add an ethernal
object with a push
function on the hre
object.
This function takes two parameters:
name
: name of the contract (case sensitive). It needs to match exactly the name of the deployed contractaddress
: address of the contract
You should call this function anytime after the contract has been successfully deployed.
This function returns an empty promise.
By default, the push function is not going to upload AST to Ethernal. If you want to use "Storage" tab on contracts pages, you'll need to activate it. To do so, set the hre.ethernalUploadAst = true
flag in your Hardhat config file (this will upload the ast field, as well as the source field).
Example
Reset a workspace
You can manually reset a workspace by calling: hre.ethernal.resetWorkspace(workspaceName)
(async function). All accounts/blocks/transactions/contracts will be deleted;
Last updated