0

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 1

1

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

4
  • Is it same as ethers.js documentation?
    – Hacek
    Commented Feb 19, 2023 at 8:08
  • 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
    – donoso.eth
    Commented Feb 19, 2023 at 8:15
  • what is difference between ethers.getSinger and ethers.provider.getSigner?
    – Hacek
    Commented 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
    – donoso.eth
    Commented Feb 19, 2023 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.