How to check if a transaction has been completed?