require ethers or require hardhat #298
-
|
Hi all, Is there any other syntax for creating a For lesson-5 :- const {ethers} = require("ethers");For lesson-6 :- const {ethers} = require("hardhat");@PatrickAlphaC can you please help me clearing my doubt?? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
Amazing question! So... in lesson 5 we just used the "raw" ethers package. But the "ethers" package by itself doesn't have all the functionality we want for it! However, you'll notice in our (it could be a different number other than This package wraps the So while in hardhat, we want to use the That's why we use: const {ethers} = require("hardhat"); |
Beta Was this translation helpful? Give feedback.
Amazing question!
So... in lesson 5 we just used the "raw" ethers package. But the "ethers" package by itself doesn't have all the functionality we want for it!
However, you'll notice in our
package.jsonwe have this dependency:(it could be a different number other than
^2.0.4depending on when you read this...This package wraps the
etherspackage inside thehardhatpackage to give it extra functionality!So while in hardhat, we want to use the
hardhatwrapped edition of ethers! This is where those extra functions likegetContractFactorycome from!That's why we use: