# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.orda.network/developers/sdks/monitoring-transactions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
