Await TronWeb send function to finish

1.2k views Asked by At

Hi Im new in tron so I have succefully implemented read functions in smartcontract and also write but the issue im facing is how do I wait for the transaction to finish so I can display its result in tronWeb. I do know how to do it in ethereum 0.x & 1.x but having no luck in tronWeb.

1

There are 1 answers

0
Syed Zain Hasan On BEST ANSWER

After some research I was able to wait for the transaction. I have to put the flag shouldPollResponse = true in the transaction like

 var demo = await tokenContract.claimAirdrop().send({
    feeLimit: 100000000,
    shouldPollResponse:true,
    callValue:  0,
  })

where function should be called async (Rule for using await), tokenContract is my contract instance and claimAirdrop is my contract functions