smartcontractkit/full-blockchain-solidity-course-js

TypeError: Cannot read properties of undefined (reading 'wait')

herculeskan opened this issue · 1 comments

Lesson

Lesson 6

Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")

https://youtu.be/gyMwXuJrbJQ?si=Wbuv7TWeQmUF4ICh&t=32522

Operating System

Windows

Describe the bug

I posted in Q&A without knowing that issues tab on github could work
hello, I unable to deploy my contract for some issues like for example, deployed() keyword changed to waitForDeployment(), now I have the same issue in my terminal but with another function:

 // update transaction
    const transactionResponse = await simpleStorage.store(7)
    await transactionResponse.wait(1)
    const updatedValue = await simpleStorage.retrieve()
    console.log(`updated value is: ${updatedValue}`)
}

I checked in the simpleStorage part, however I realized that deployTransaction.wait(6) could has an error

console.log(`Deployed contract to: ${simpleStorage.target}`)
    if (network.config.chainId == 11155111 && process.env.ETHERSCAN_API_KEY) {
        console.log("waiting for the block taxes   ")
        await simpleStorage.deployTransaction.wait(6)
        await verify(simpleStorage.address, [])
    }

I know because the error jumps after console.log("waiting for the block taxes ") in the terminal

I suspect that probably ethers.getContractFactoryHas a different function, however is not the same as deployTransaction.wait
and if is it correct. How can I fix this issue?

v4ss commented

Hi @herculeskan,
You have to change await simpleStorage.deployTransaction.wait(6)
by
await simpleStorage.deploymentTransaction().wait(6)

And it could work :)