curl -X GET "https://api.gasyard.fi/api/sdk/v2/status" \ -H "x-api-key: YOUR_API_KEY" \ -G \ -d "sourceHash=0xabc123..."
{ "success": true, "data": { "orderId": "0x7f8e9d...", "status": "completed", "input": { "chainId": 1, "txHash": "0xabc123...", "token": "0x0000000000000000000000000000000000000000", "amount": "1000000000000000000", "address": "0xUserAddress...", "timestamp": 1735689600 }, "output": { "chainId": 4, "txHash": "0xdef456...", "token": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", "amount": "2493750000", "address": "0xUserAddress...", "timestamp": 1735689612 }, "solver": { "address": "0xSolverAddress...", "assignedAt": 1735689602 }, "timing": { "createdAt": 1735689600, "expiry": 1735693200, "completedAt": 1735689612, "duration": 12 } } }
Track the status of bridge transactions
Show properties
pending
executing
completed
refunded
failed
async function waitForCompletion(sourceHash, maxAttempts = 60) { for (let i = 0; i < maxAttempts; i++) { const response = await fetch( `https://api.gasyard.fi/api/sdk/v2/status?sourceHash=${sourceHash}`, { headers: { 'x-api-key': API_KEY } } ); const { data } = await response.json(); if (data.status === 'completed') { return data; } if (data.status === 'failed' || data.status === 'refunded') { throw new Error(`Transaction ${data.status}`); } // Wait 5 seconds before next poll await new Promise(resolve => setTimeout(resolve, 5000)); } throw new Error('Transaction timeout'); }
const statusMessages = { pending: 'Finding the best solver...', executing: 'Solver is processing...', completed: 'Transaction complete!', refunded: 'Funds refunded to your wallet', failed: 'Transaction failed' }; function updateUI(status) { document.getElementById('status').textContent = statusMessages[status]; }