Monitor Swap
Get Swap by ID
Fetch the current status and details of a specific swap using its unique identifier.
const swap = await client.getSwap(swapId);
console.log("Status:", swap.status);
console.log("Source:", swap.source_amount, swap.source_token);
console.log("Target:", swap.target_amount, swap.target_token);Polling for Updates
Monitor a swap's progress by polling at regular intervals:
async function pollSwap(swapId: string) {
while (true) {
const swap = await client.getSwap(swapId, { updateStorage: true });
console.log("Status:", swap.status);
if (["clientredeemed", "expired", "clientrefunded", "clientfundedserverrefunded"].includes(swap.status)) {
return swap; // Terminal state
}
await new Promise((r) => setTimeout(r, 3000));
}
}Response Fields
BTC to EVM Swap
| Field | Type | Description |
|---|---|---|
id | string | Unique swap identifier |
status | string | Current swap status |
sourceAmount | number | BTC amount in satoshis |
targetAmount | number | Stablecoin amount |
targetAddress | string | EVM address receiving tokens |
vhtlcAddress | string | Arkade VHTLC address (Arkade swaps) |
lnInvoice | string | Lightning invoice (Lightning swaps) |
createdAt | string | Creation timestamp |
expiresAt | string | Expiration timestamp |
EVM to BTC Swap
| Field | Type | Description |
|---|---|---|
id | string | Unique swap identifier |
status | string | Current swap status |
sourceAmount | number | Stablecoin amount |
targetAmount | number | BTC amount in satoshis |
contractAddress | string | HTLC contract address |
hashLock | string | HTLC hash lock |
timelock | number | HTLC expiration timestamp |