Last updated
Last updated
In this next part of the tutorial, we'll cover all the basics needed to mint an NFT to users wallets
First, define some common helpers that we can reuse in later pieces of code. Create a new helpers.js
file and add following code:
Open up the .env
file you created in the last part of the tutorial and add a new variable NFT_CONTRACT_ADDRESS
and set it to the
Add a new mint.js
file to your scripts
folder and write the task:
We are now ready to go! To mint tokens, call our new mint
task:
This transaction record shows us who called the contract function, what the outcome was (Tokens Transferred) and how much the transaction cost the caller in both gas fees and cost to transact.
Hardhat allows users to in their projects that can execute common user actions using the Hardhat CLI directly. To do that, we will import the new mint.js
file to our hardhat.config.js
configuration so that it is picked up by Hardhat
If you take that transaction hash over to , you should see something like this: