Skip to main content

Crate anyswap_sdk

Crate anyswap_sdk 

Source
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§

pub use bitcoin;
pub use elements;

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 in observe.rs, what it decides in decide/, what fixes a swap’s terms in accept.rs, what survives a crash in record.rs, the knobs in config.rs, and what an integrator implements for the chain in chain.rs and for the server in server.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 bitcoin and liquid.
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, SwapOut and 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 with HttpClient::get_swap. HttpClient::signals hands 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.