Lesson 8: How does the listenForTransactionMine function have access to the transactionReceipt, which is not declared? #6522
Replies: 1 comment
-
In the provided code, the Here's how it works:
So, the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In the above code, I understand that within the fund function, transactionResponse is defined as
await contract.fund({value: ethers.utils.parseEther(ethAmount),})
and we call the listenForTransactionMine function within the fund function with the response and provider as parameters. What I don't understand is that without defining transactionReceipt, how are we able to pass it into the anonymous function as a parameter inside the listenForTransactionMine function?I would have expected this code to output something along the lines of "transactionReceipt is not defined." Is there something under the hood of the once function that is producing the transactionReceipt that I don't understand?
Any help is appreciated!
Beta Was this translation helpful? Give feedback.
All reactions