1

Using safe-service-client(https://github.com/safe-global/safe-core-sdk/tree/main/packages/safe-service-client) to figure out if a transaction that is pending has been replaced/rejected or not. I do the following:

  1. Fetch a transaction by safeTxnHash using safe-service-client.getTransaction()
  2. Get safeInfo using safe-service-client.getSafeInfo(safeAddr)
  3. Check if safeInfo.nonce > fetchedTransaction.nonce && !fetchedTransaction.isExecuted, if true, then it means the transaction has been replaced by another since the safeNonce has moved up, but the transaction is still not executed.

This works OK mostly, but there is an intermittent case where the response in the first step says that the transaction has not yet been executed or successful (even though the transaction is successful if I manually check onchain) and the response in the second step gives a nonce that is higher that the transaction nonce. This leads my script to believe that the transaction was rejected, which in reality was successful.

Is there any other way to figure out if a transaction was rejected?

1
  • Multiple transactions can use the same nonce. When one is executed, it does not update the status on other transaction hashes with the same nonce. Is it possible that while you're fetching the specific transaction, the nonce was used by a different txn? Mar 17, 2023 at 20:30

1 Answer 1

0

As getSafeInfo is retrieved directly from Blockchain (using eth_call) but getTransaction requires the transaction to be processed and indexed from the service, getSafeInfo will always be a little faster updating the status, and there's nothing we can do about it as indexing takes a little more time than a simple eth_call. We can only recommend that you wait half a minute before calling getTransaction to give time for the transaction to index

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.