Check Approve Transaction Status
Check status of approve transaction
Last updated
Check status of approve transaction
Last updated
When createTransaction
returns an approval
transaction (i.e. isApproval
field is true
in transaction), and the user signs that transaction, you could periodically call check-approval to see if the approval transaction is completed. After a successful check, you should call createTransaction
again to receive the main transaction.
For checking approval transaction status, you could check it directly from the RPC endpoint if you prefer and skip calling Rango API for this purpose.
Caution
It is important to use approve transaction data generated by Rango API and not hard-coding something on your client side for creating approve transaction, because for some protocols (some bridges), the contract that should be approved is dynamically generated via their API based on route.
You could stop checking approval method if:
Approval transaction succeeded. => isApproved === true
Approval transaction failed. => !isApproved && txStatus === 'failed'
Approval transaction succeeded but currentApprovedAmount
is still less than requiredApprovedAmount
(e.g. user changed transaction data in wallet and enter another approve amount in MetaMask instead of default approve amount proposed by Rango API) => !isApproved && txStatus === 'success'
requestId
*
Description: The unique ID which is generated in the best route endpoint.
Example: b3a12c6d-86b8-4c21-97e4-809151dd4036
txId
Description: Transaction hash returned by wallet
Example: 0x7f17aaba51d1f24204cd8b02251001d3704add46d84840a5826b95ef49b8b74f
isApproved
Description: A flag which indicates that the approve tx is done or not.
txStatus
Description: Status of approve transaction in blockchain (possible values are success
, running
and failed
)
if isArppoved
is false and txStatus
is failed
, it means that approve transaction is failed in the blockchain.
currentApprovedAmount
Description: Required amount to be approved by the user.
requiredApprovedAmount
Description: Current approved amount by the user.