Discussions

Ask a Question
Back to All

Does getTransaction return null if the transaction was dropped?

In order to correctly show pending transactions on the correct screen of my app I manually save them in an array and then when they are mined they are removed thanks to a webhook. However, sometimes the array is not automatically cleared if the transaction is dropped. I am currently using (https://docs.alchemy.com/reference/sdk-gettransaction) getTransaction and it seems that transactions that have been dropped return null while still pending transactions return an actual object.

Is it correct to assume that I can manually clear dropped transactions by checking if they return null or will this not always be correct?