-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'getContract' function does not exist when used with hardhat-waffle #12
Comments
For that issue you currently need to install hardhat-deploy-ethers as alias. See https://github.com/wighawag/hardhat-deploy-ethers#installation I'm the future (waiting for some changes in hardhat itself) this will hopefully not be required anymore |
I created #13 because I'm not sure how to follow that installation advice. Seems like that breaks also. |
Sorry, the code that I had posted was not correct. In fact I had installed hardhat-deploy-ethers as alias. I updated the code for the second package.json. Still, the problem persists. @wighawag |
@fabianschu can you try with an alias to a specific version of hardhat-deploy-ethers ? like |
@wighawag I tried that. Here is my dependencies: "devDependencies": {
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.10",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"chai": "^4.3.4",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.4.1",
"hardhat": "^2.4.1",
"hardhat-deploy": "^0.7.0-beta.46",
"hardhat-gas-reporter": "^1.0.4",
"solhint": "^3.3.3"
},
"dependencies": {
"@openzeppelin/contracts": "^4.2.0",
"eslint": "^7.30.0",
"solidity-coverage": "^0.7.16"
} I first installed hardhat-deploy-ethers by adding this line
I force-installed hardhat-waffle
|
Fun fact: with yarn, these dependencies can be installed without an error and both hardhat-deploy-ethers and hardhat-waffle seem to work.
|
Ran into the same problem. Took me quite a while before I found this but @fabianschu's suggestion to use Yarn AND the specific version reference fixed it. |
+1 the suggestion of yarn + specific version (copypasted full line |
do you have an idea/time horizon when that will happen? |
Best to ask hardhat team there : NomicFoundation/hardhat#1040 :) |
@jrfrantz commented on September 8, 2021 10:38 PM:
Does this work for anyone with the latest |
I think I'm possibly seeing the same issue with |
See wighawag/hardhat-deploy-ethers#12 Still doesn't work with `npm install`, but `yarn install` is fine.
i think using npm running this command might help |
Same problem with https://github.com/Tenderly/hardhat-tenderly which hardcodes @nomiclabs/hardhat-ethers . I will open an issue in their repo. How should they go about fixing this? How do they not hardcode a version of hardhat-ethers that gives us freedom to use hardhat-deploy-ethers instead? |
I solved this problem using the solution suggested in this comment Tenderly/hardhat-tenderly#51 (comment) |
first it didn't work for me. But I re-checked to have similar dependencies as in the scaffold-eth repo and now it solved it for me |
hardhat-deploy-ethers@next has been released It is now an extension to hardhat-ethers so you need both But note that that new version do not support external artifact if you were using them |
can you help with this, where is this "hardhat-deploy-ethers@next" version? |
the latest is https://www.npmjs.com/package/hardhat-deploy-ethers/v/0.4.0-next.1 you can use the tag when installing
|
how come on GitHub there are no tags for those next releases? |
I am just not very good at making sure they are tagged :) |
I was searching there 2 months ago, then again today, couldn't find it and was thinking WTF am I missing :D |
I'm having a simple hardhat project. I'm using the instructions from this issue #1 to circumvent the error
'getContract' function does not exist on HardhatRuntimeEnvironment.ethers
. Mypackage.json looks as follows and everything works fine:
So, I want to use the
hardhat-waffle
plugin. I donpm i -D @nomiclabs/hardhat-ethers
. As a result I cannot usegetContract
, because I get the error'getContract' function does not exist on HardhatRuntimeEnvironment.ethers
again. My package.json looks now looks like this:Any ideas how I can fix this?
cheers
The text was updated successfully, but these errors were encountered: