Skip to main content
This page takes you from nothing to a finished swap on signet, in TypeScript.

Before you start

1. Install

2. List what the maker trades

No keys, no funds. If this prints routes, the SDK and the maker are both reachable.
routes.ts
Each route has a card with its limits (in sats for BTC and L-BTC) and its fees.

3. Receive L-BTC from a Lightning payment

You pay a Lightning invoice and receive L-BTC on Liquid. The KaleidoSwap API does it in three calls: quote prices the route, start creates the swap, and following the swap claims the L-BTC for you.
swap.ts
Run it with SWAP_MNEMONIC and LIQUID_ADDRESS set, and pay the printed invoice (for example through the Mutinynet faucet). The script prints each phase and ends on settled. If you stop the script after paying, run it again: resume() picks the swap up from ./swaps and claims it.
./swaps holds what the SDK needs to claim or refund your swaps. Use a mnemonic that is only for swaps, keep the folder out of version control, and never delete it or restore an older copy while swaps are open. See Keys and recovery.

Next steps

The KaleidoSwap API

Quotes, refusals, your own store and signer, and errors.

Pay Lightning from on-chain

The opposite direction, with a refund path.

Swap states

Every status, and what your app does at each one.

Examples

Runnable programs in the SDK repository.