Skip to content

Difference between TransactionResponse.wait() and simpleStorage.deployTransaction.wait() #5210

Answered by pratokko
sikehish asked this question in Q&A
Discussion options

You must be logged in to vote

The first line, await simpleStorage.deployTransaction.wait(6), is used to wait for the deployment transaction of a smart contract to be confirmed. When you deploy a smart contract, a transaction is sent to the blockchain to create the contract on the network. The deployTransaction property of the contract object represents this transaction. By calling the wait method on this property and passing in a timeout value in seconds (in this case, 6 seconds), you are telling the Ethereum client to wait for the transaction to be confirmed for up to 6 seconds before timing out.

The second line, const txRes = await simpleStorage.store("7"); await txRes.wait(6), is used to wait for a transaction that…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sikehish
Comment options

@pratokko
Comment options

Answer selected by sikehish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants