Skip to main content

Hardhat plugin usage

=nil; provides an example repository containing a Hardhat project that is already configured to support all essential cluster features.

To install the project generator:

npm i @nilfoundation/create-nil-hardhat-project -g

Create a new project:

create-nil-hardhat-template

When inside the project, create an .env file and add the following information inside it:

NIL_RPC_ENDPOINT=NIL_ENDPOINT
WALLET_ADDR=WALLET_ADDR
PRIVATE_KEY=PRIVATE_KEY
COMETA_ENDPOINT=COMETA_ENDPOINT
tip

Read this tutorial to learn how to create a wallet.

If possible, link the .env file to the config file for the =nil; CLI:

NIL_CONFIG_INI: path/to/config.ini

In this case, the Hardhat plugin will automatically use the wallet and private key specified in the CLI config file. Whenever the CLI creates a new wallet, the Hardhat plugin will start using said wallet.

It is also possible to create a new wallet directly via the Hardhat plugin by running this task:

wallet update

To see the wallet details:

wallet info
Fee credit

The Hardhat plugin has a hardcoded default fee credit that should be enough for most messages. To override this value, specify the feeCredit property in hardhat.config.ts:

feeCredit: 500000