Monitoring Transactions
Track transaction status using multiple methods.
Get Transaction Status
Query by transaction ID, source hash, or destination hash:
// 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
{
transaction: {
transactionId: 'tx-id',
status: 'COMPLETED',
fromChain: '1',
toChain: '8453',
sourceHash: '0xabcd...',
destinationHash: '0x1234...',
...
}
}Wait for Completion
Poll automatically until a terminal status:
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);
}
});Get Successful Transactions
Retrieve all successful transactions:
const transactions = await orda.transactions.getSuccessfulTransactions();Transaction Statuses
Error Handling
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);
}
}Inspect error.statusCode, error.code, and error.details when catching OrdaError to determine the cause and handle it appropriately.