Monitoring Transactions

Track transaction status using multiple methods.

Get Transaction Status

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

example.ts
// 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...'
});

Status Response

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

Wait for Completion

Poll automatically until a terminal status:

example.ts
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);
  }
});

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.

Get Successful Transactions

Retrieve all successful transactions:

example.ts
const transactions = await orda.transactions.getSuccessfulTransactions();

Transaction Statuses

Active

  • PENDING — Initiated

  • PROCESSING — In progress

  • WAITING_FOR_DEPOSIT — Awaiting funds

Terminal

  • COMPLETED — Success

  • FAILED — Failed

  • CANCELLED — Cancelled

  • REFUNDED — Refunded

Error Handling

example.ts
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);
  }
}