Skip to main content

useTransactionStatus

The useTransactionStatus 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

Use refetch for immediate status updates:

Error Handling

Best Practices

Usage Tips:
  1. Pass null to disable - Set transactionId to null when there is no active transaction to prevent unnecessary polling.
  2. Handle terminal states - Check for completed or failed status to show appropriate UI and stop any manual polling logic.
  3. Preserve last status - The hook keeps the last known status even if an error occurs during refresh.
  4. Clean up on unmount - The hook automatically cleans up polling intervals when the component unmounts.
  5. Use with execution result - After calling mina.execute(), use the returned txHash to start tracking.

Next Steps

useMina

Access SDK instance for execution

useQuote

Fetch bridge quotes