Take an example of a voting DApp. A user clicks on a vote button, then behind the scenes the transaction containing the vote gets mined on the blockchain. The DApp then wants to alert('You have voted')
.
Since the transaction takes some time to get mined and get some confirmations, what code should the DApp do before it does the alert
? I have heard of people running loops and calling getTransactionReceipt
. Is this how it should be done, or alternatives? Are there any code snippets or libraries for them?