useTransactionStatus
TheuseTransactionStatus hook tracks bridge transaction progress with automatic polling until the transaction reaches a terminal state (completed or failed).
Import
Signature
Parameters
The default polling interval is 3 seconds. Polling automatically stops when the transaction reaches a terminal status.
Returns
UseTransactionStatusReturn
TransactionStatus
Features
- Automatic polling - Polls every 3 seconds while transaction is pending
- Smart stop - Automatically stops polling on terminal status (completed, failed, cancelled)
- State preservation - Keeps last known status on error
- Manual refresh - Call
refetch()for immediate status update
Basic Usage
Full Bridge Flow Example
Track a transaction from execution through completion:Status States
The transaction can be in one of these states:Step-by-Step Progress
Display detailed progress for each step:Handling Completion
React to transaction completion:Manual Refresh
Userefetch for immediate status updates:
Error Handling
Best Practices
Usage Tips:
-
Pass
nullto disable - SettransactionIdtonullwhen there is no active transaction to prevent unnecessary polling. -
Handle terminal states - Check for
completedorfailedstatus to show appropriate UI and stop any manual polling logic. - Preserve last status - The hook keeps the last known status even if an error occurs during refresh.
- Clean up on unmount - The hook automatically cleans up polling intervals when the component unmounts.
-
Use with execution result - After calling
mina.execute(), use the returnedtxHashto start tracking.
Next Steps
useMina
Access SDK instance for execution
useQuote
Fetch bridge quotes
