Lesson 5 : TypeError: Cannot read properties of undefined (reading 'wait') #5962
-
When I deploy the deploy.js using node deploy, This error occured : I follow the exact code, which is this :
But, still got an error. Anyone know how to solve this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hello @wwwbaraccuda What version of ethers are you using? Try this version and let me know if issue has been fixed |
Beta Was this translation helpful? Give feedback.
-
I ended up running it like this: const contractFactory = new ethers.ContractFactory(abi, binary, wallet)
console.log("Deploying, please wait...")
const contract = await contractFactory.deploy() // STOP here!! wait for contract to deploy
await contract.deploymentTransaction().wait(1) // wait 1 block
console.log(`Contract deployed to ${contract.target}`) hope this helps 🤙 The problem was the older command: contract.deployTransaction.wait(1); |
Beta Was this translation helpful? Give feedback.
-
I experienced same issue. I realized that it was because I am using Instead of const deploymentReceipt = await contract.deployTransaction.wait(1); do this const deploymentReceipt = await contract.deploymentTransaction().wait(1); It seems |
Beta Was this translation helpful? Give feedback.
I experienced same issue. I realized that it was because I am using
"ethers": "^6.7.0"
and not the"ethers": "^5.5.3"
which was used in the course. There are some slight syntax changes here and there in version ^6.Here's what you can do in this case:
Instead of
do this
It seems
deployTransaction
was changed todeploymentTransaction
in version 6.