pollTransactionStatus
interface PollTransactionStatusParams {
// Route ID of the transaction
routeId: string;
// Step ID being monitored
stepId: string;
// Transaction hash from the blockchain
txnHash: string;
// Optional: Interval between status checks in milliseconds (default: 2000ms)
pollingIntervalMs?: number;
// Optional: Maximum time to poll before timing out in milliseconds (default: 600000ms / 10 minutes)
timeoutMs?: number;
// Optional: Callback function for real-time status updates
onStatusUpdate?: (status: TransactionStatus, data?: ExecuteTransactionResult) => void;
}
// Example usage:
const result = await pollTransactionStatus({
routeId: "your-route-id",
stepId: "your-step-id",
txnHash: "your-transaction-hash",
pollingIntervalMs: 3000, // Poll every 3 seconds, by default it's 2 seconds
timeoutMs: 300000, // Timeout after 5 minutes, by default it's 10 minutes
onStatusUpdate: (status, data) => {
console.log(`Transaction status updated: ${status}`);
if (data) {
console.log("Transaction data:", data);
}
},
});
// Example Response
{
"status": "success",
"data": {
"status": "success",
"outputAmount": "1459244847",
"outputAmountDisplay": "1459.244847",
"srcTxnHash": "0x...",
"dstTxnHash": "0x...",
"srcTxnUrl": "https://etherscan.io/tx/0x...",
"dstTxnUrl": "https://etherscan.io/tx/0x...",
"points": 100,
"warnings": [],
}
}Last updated