> For the complete documentation index, see [llms.txt](https://docs.orda.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orda.network/developers/sdk/monitoring-transactions.md).

# Monitoring Transactions

Track transaction status using multiple methods.

## Get Transaction Status

Query by transaction ID, source hash, or destination hash:

{% code title="example.ts" %}

```typescript
// By transaction ID
const status = await orda.transactions.getStatus({
  transactionId: 'tx-id'
});

// By source hash
const status = await orda.transactions.getStatus({
  sourceHash: '0xabcd...'
});

// By destination hash
const status = await orda.transactions.getStatus({
  destinationHash: '0x1234...'
});
```

{% endcode %}

## Status Response

{% code title="response.ts" %}

```typescript
{
  transaction: {
    transactionId: 'tx-id',
    status: 'COMPLETED',
    fromChain: '1',
    toChain: '8453',
    sourceHash: '0xabcd...',
    destinationHash: '0x1234...',
    ...
  }
}
```

{% endcode %}

## Wait for Completion

Poll automatically until a terminal status:

{% code title="example.ts" %}

```typescript
await orda.transactions.waitForCompletion('tx-id', {
  intervalMs: 5000,      // Poll every 5 seconds
  timeoutMs: 600000,     // Timeout after 10 minutes
  onStatusUpdate: (status) => {
    console.log('Current status:', status);
  }
});
```

{% endcode %}

{% hint style="info" %}
The waitForCompletion helper will poll the transaction status at the supplied interval and call onStatusUpdate with intermediate updates. If a terminal status is reached or the timeout expires, the promise resolves/rejects accordingly.
{% endhint %}

## Get Successful Transactions

Retrieve all successful transactions:

{% code title="example.ts" %}

```typescript
const transactions = await orda.transactions.getSuccessfulTransactions();
```

{% endcode %}

## Transaction Statuses

{% columns %}
{% column %}

#### Active

* PENDING — Initiated
* PROCESSING — In progress
* WAITING\_FOR\_DEPOSIT — Awaiting funds
  {% endcolumn %}

{% column %}

#### Terminal

* COMPLETED — Success
* FAILED — Failed
* CANCELLED — Cancelled
* REFUNDED — Refunded
  {% endcolumn %}
  {% endcolumns %}

## Error Handling

{% code title="example.ts" %}

```typescript
try {
  const status = await orda.transactions.getStatus({ transactionId: 'tx-id' });
} catch (error) {
  if (error instanceof OrdaError) {
    console.error('Status:', error.statusCode);
    console.error('Code:', error.code);
    console.error('Details:', error.details);
  }
}
```

{% endcode %}

{% hint style="warning" %}
Inspect error.statusCode, error.code, and error.details when catching OrdaError to determine the cause and handle it appropriately.
{% endhint %}
