-
Whats the difference between ->
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
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 is generated when you call a function on the smart contract. In this case, the store function is called on the simpleStorage contract object, which sets the value of the contract's state variable to 7. The store function returns a transaction object that represents the transaction that was sent to the blockchain. By assigning this object to the txRes variable and calling the wait method on it, you are telling the Ethereum client to wait for the transaction to be confirmed for up to 6 seconds before timing out. |
Beta Was this translation helpful? Give feedback.
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…