how to use provider while using ethers from hardhat-ethers?? How can i use all methods from here while using ethers from hardhat-ethers??
1 Answer
Once you have installed @nomiclabs/hardhat-ethers
you can access it either importing it from hardat:
import { ethers} from 'hardhat'
or you can import/receive the hre (hardhat runtime environment):
import * as hre from 'hardhat'
const ethers = hre.ethers,
Hope it helps
-
-
I don't know, yet all of the methods I used on ethers are available and what is really handy, you receive the signer and accounts on local node teting Commented Feb 19, 2023 at 8:15
-
what is difference between ethers.getSinger and ethers.provider.getSigner?– HacekCommented Feb 19, 2023 at 9:23
-
ethers.getSigner() is not available on ethers.js, but available on hardhat.ethers and allows you to query the current signer on your local hardhat node. ethers.provider.getSigner() will return you the signer of your ether connection to the blockchain Commented Feb 19, 2023 at 9:41