Lendasat LogoLendasat Docs
Monitor Swap

List Swaps

Get a list of all swaps stored locally for your wallet.

const swaps = await client.listAllSwaps();

for (const swap of swaps) {
  console.log(`${swap.swapId}: ${swap.response.status}`);
}

Filter by Status

Filter swaps by their current status:

const swaps = await client.listAllSwaps();

const pending = swaps.filter((s) => s.response.status === "pending");
const funded = swaps.filter((s) => s.response.status === "serverfunded");
const done = swaps.filter((s) => s.response.status === "clientredeemed");

console.log(`Pending: ${pending.length}, Funded: ${funded.length}, Done: ${done.length}`);

Delete Swaps

Remove swaps from local storage:

// Delete a single swap
await client.deleteSwap(swapId);

// Clear all swap data
await client.clearSwapStorage();

Caution: Deleting swap data removes local records. If you have pending swaps, you'll need to recover them using your mnemonic and the xpub-based recovery flow.


Best Practices

  1. Check status regularly - Poll pending swaps to track progress
  2. Clean up completed swaps - Remove old swaps to keep storage tidy
  3. Back up before clearing - Ensure you have your mnemonic before clearing storage
  4. Filter for action items - Focus on swaps that need attention (pending claims, etc.)