Replies: 3 comments 1 reply
-
|
Bruv I used .json in lowercase itself, but I'm not getting an abi.json output. Do you have any ideas why? My contract addresses JSON file is all perfect, but I'm getting errors here. Do you have any idea? |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
instead of this fs.writeFileSync(FRONT_END_ABI_FILE, raffle.interface.format(ethers.utils.FormatTypes.JSON));try this fs.writeFileSync(FRONT_END_ABI_FILE, JSON.stringify(raffle.interface)); |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
In ethers 6, you can use the The line to write the contract ABI : fs.writeFileSync(FRONT_END_ABI_FILE, raffle.interface.formatJson()); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
At this point of the course I was following the typing out of this code.
As the last line is getting typed out, the video quickly cuts to the Ethers docs. At the same time, VScode suggests I replace
jsonwithJSONby hitting Enter. I do so (in VScode we trust).I run
yarn hardhat nodeto produce our.jsonfiles. I get the following error:I try adding
.toString()on the end. It goes through but theabi.jsonlooks all weird and unformatted. Nope, next.After tinkering around and googling for like 15 minutes, while looking at the Ethers docs I try putting it back to lowercase
.json. It goes through and myabi.jsonlooks beauuutiful!!Just a heads-up for anyone potentially searching the Discussions for this error (I didn't find any); might save them some time and frustration, it made my eyes roll how a VScode suggestion made the code break like this lol.
Take note when VScode suggests you something. You could overlook it and it can break your code later.
Cheers
Beta Was this translation helpful? Give feedback.
All reactions