Closed Aman9723 closed 1 month ago
send()
method has an option called shouldPollResponse
to get the result of the method which will wait for the transaction to be solidity. So here's what you can do:
await tokenContract.methods.approve(this.V2_ROUTER_ADDRESS, amountIn).send({shouldPollResponse: true})
This takes 20-30 sec time. I don't want any time delays. Why does this situation occur on the first place? Is this the way tron protocol works or this issue is on the trongrid api level. Can you give me a brief explanation please.
@Satan-web3?
After you approve, you have to wait it to be solidity so that your consequent function call could get the on chain data.
When sending two function calls one after another. They are not getting executed in order. In the below code approve function reaches the network later resulting in failure of swap call. Why is this occuring and how can I fix it without adding a time delay?