AnySwap Rust SDK
anyswap-sdk is the Rust client for AnySwap: swaps between Lightning and
on-chain Bitcoin or Liquid. Its centrepiece is a driver that runs any number
of swaps to completion and verifies everything against the chain, so an
integration creates swaps and watches statuses rather than implementing the
protocol.
Install
[]
= { = "1.*", = ["esplora"] }
| Feature | Default | Adds |
|---|---|---|
client |
yes | HttpClient, the server API over HTTP |
ws |
yes | The WebSocket subscription that paces the driver; native only |
driver |
yes | The swap driver |
esplora |
no | BitcoinEsplora and LiquidEsplora as ready chain backends |
Where to go next
- Quickstart for one swap, from setup to
Completed. - Swaps for the two flows, the statuses they move through, and cancels.
- Persistence and recovery for the store, restarts, and rebuilding swaps from the mnemonic alone.
- Liquid for the two extra values a Liquid integration needs.
- Compared with Boltz if you come from
boltz-clientorlwk_boltz. - docs.rs for the API reference.
A runnable end-to-end program lives at examples/swaps.rs: it
drives any mix of SwapIns and SwapOuts on both chains against a server.
examples/advance.rs is the other shape: one swap
driven by hand to its outcome over a store on disk, resumable after a
restart.