Expand description
AnySwap client SDK.
Client-side layer over anyswap_core: typed swap views
(swap_in::SwapIn, swap_out::SwapOut), string codecs shared with the
WASM bindings (codec), per-swap key derivation (wallet::Wallet),
and an HTTP client for the server API (client::HttpClient, behind the
client feature; its WebSocket subscription, ws, behind the native-only
ws feature).
On-chain primitives (swap script, transaction builders, swap_fee and invoice
parsing) are re-exported from anyswap_core so consumers depend on this
crate alone.
Re-exports§
Modules§
- api
- HTTP API request and response types shared between the server and the SDK.
- auth
- Shared auth helpers for signing and verifying protected API requests.
- client
- HTTP client for the AnySwap server API.
- codec
- String and hex codecs shared by the SDK, the bindings and the server.
- context
- Client-wide setup: the wallet and the chain parameters the SDK needs.
- driver
- A driver that runs a swap to completion against the chain, taking from the
server only what the chain can verify: its cancel report, its preimage and
its key. The loop is in
tick.rs, what a pass reads inobserve.rs, what it decides indecide/, what fixes a swap’s terms inaccept.rs, what survives a crash inrecord.rs, the knobs inconfig.rs, and what an integrator implements for the chain inchain.rsand for the server inserver.rs. - fee
- Swap pricing. The amount arithmetic is chain-neutral; on-chain fees
dispatch by
Chain, since the transactions a swap broadcasts differ per chain. - invoice
- BOLT11 invoice parsing utilities.
- script
- Locks the on-chain side of the swap, with taproot implementations in
bitcoinandliquid. - swap_in
- Typed client-side view of a swap-in.
- swap_
out - Typed client-side view of a swap-out.
- swap_
script - The swap script of one on-chain side with everything spending it needs:
the chain, the network, and on Liquid the shared blinding key and chain
parameters.
SwapIn,SwapOutand the driver all build their transactions through here. - transaction
- Transaction builders for the swap-script spending paths.
- types
- Shared core types.
- utxo
- Outputs locked by a swap script.
- wallet
- BIP39/BIP32 HD wallet for swap key management.
- ws
- WebSocket client for
/v1/subscribe/{user_id}: one signal per FSM transition of any swap of this wallet. A signal only says which swap moved; read the state withHttpClient::get_swap.HttpClient::signalshands it to the driver as its push channel.
Constants§
- PROTOCOL_
VERSION - The wire protocol this build speaks: the crate’s major and minor version, since a patch release never changes the wire.