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.json
we have this dependency:(it could be a different number other than
^2.0.4
depending on when you read this...This package wraps the
ethers
package inside thehardhat
package to give it extra functionality!So while in hardhat, we want to use the
hardhat
wrapped edition of ethers! This is where those extra functions likegetContractFactory
come from!That's why we use: