Lesson 10 : TypeError: Cannot read properties of undefined (reading 'toString') #6136
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
That issue is chainId related (if wrong it makes your entranceFee undefined), make sure your metamask is using correct chainId or if you using something else than metamask just make sure you are using correct chainId and thats all. Metamask like to change id into 1337 instead of using correct one 31337 |
Beta Was this translation helpful? Give feedback.
-
Hi @Neftyr my contractAddresses.json is also 31337 But, the error is still occured. |
Beta Was this translation helpful? Give feedback.
Hii @wwwbaraccuda, don't worry
You just need to replace your updateAbi function in 99-update-front-end.js file with below function
async function updateAbi(){
const lottery = await ethers.getContract("Lottery");
fs.writeFileSync(FRONT_END_ABI, JSON.stringify(lottery.interface.fragments))
}
and rerun harhdat node which will update your abi.json file
Following above steps will fix your issue.