How to get real time transaction_hash status

Hi there,

I am trying to fetch live status of transaction from ‘PolygonTransactions’ table using confirmed status true/false.

But i have notice that in this table some time transaction_hash entry direct confirmed status true is inserted.

And Also first time confirmed status false in ‘PolygonTransactions’ when transaction_hash status pending in metamask and when metamask transaction completed then confirmed status is not changing to true in ‘PolygonTransactions’ in real time.

how i am achieved real time transaction status ?

but it is changing after some time later?

you can use an afterSave hook to log when the status is changed

sometimes it can be synced as true directly, for example in the case of a reorg, the delay for confirmed is dependent on a number of block numbers (there is in documentation that exact number per chain specified)

Thanks for reply

yes but i have needed in real time when actually transaction is completed in metamask.

is it possible ?

for other solution i have try Contract?.wait() runcontract wait function and when wait function run successfully then i have updated transaction status in my table.

but problem for this wait() function is that when i have refresh the page its not working.

so please guide if other solution for get real time transaction status.

if you know the transaction hash, you could query a node every x seconds, find out when it was included in a block number, after that wait a specific number of blocks until you consider it as confirmed

there isn’t a specific real time, it depends on what every application considers for a transaction to be confirmed