Files
breez-sdk-liquid/lib/core
ok300 5f74b9df4b Restore: Associate swap tx IDs from onchain data (#399)
* Add extend_incomplete_failed_send_swaps() on first sync

* Find lockup txs

* Send Swaps: find refund txs

* Simplify recover_send_swap_tx_ids, add recover_receive_swap_tx_ids

* recover_receive_swap_tx_ids: batch tx lookups

* Move onchain-restore methods to own module

* Store restored data in own struct

* Fix CI: bump pubspec.lock dependencies

* LiquidChainService: add get_scripts_history_electrum()

* restore_onchain: rely on batch call to fetch histories of all known swaps

* Rename get_scripts_history_electrum

* Rename restore_onchain.rs, flatten onchain inner module

* Rename ImmutableDb to SwapsList

* Simplify logic in restore.rs

* restore.rs: Add chain swap support, simplify logic

* restore.rs: add logging when script retrieval fails

* restore.rs: remove unused field create_resp

* restore.rs: rename SwapCompositeData to SwapHistory

* restore.rs: allow unused fields in simulated immutable data

* restore.rs: cargo fmt

* Cargo fmt

* Fix failing test

* When fetching script history, also fetch if tx is confirmed or not

* Recover send swaps: fetch claim tx IDs

* Recover onchain data: persist reconstructed swaps

* Simplify recover_from_onchain: store swap txs per swap ID

* Receive swaps: do not treat lockup/claim txs as pair

* Clarify meaning of partial swap state

* Cargo clippy

* Receive Chain Swap: distinguish BTC lockup from claim/refund tx

* Send Chain Swap: distinguish BTC lockup/claim by vout, not by history order

* get_partial_state: default to Created when state is unclear

* Receive Chain Swaps: differentiate BTC refund from BTC claim txs

* Send Swaps: clarify reason for defaulting to TimedOut on no lockup

* Chain swaps: add docs for meaning of server, user txs

* Recover Receive swaps: cover the case when only the lockup is available

* HistoryTxId: store confirmation block height

* Receive swaps: differentiate claim tx from swapper refund tx

* recover_from_onchain: extract immutable DB (swaps list) as arg

* Rename get_partial_state to derive_partial_state

* Restore: remove validation steps

* Restore chain swaps: treat as Complete only when claim is confirmed

* Fix clippy warnings

* Remove restore call from sync call
2024-08-30 17:18:25 +00:00
..
2024-05-21 12:31:59 +02:00
2024-07-08 15:40:33 +02:00

Breez Liquid SDK

To get started with the Breez Liquid SDK, follow these examples.

Getting Started

let mnemonic = Mnemonic::generate_in(Language::English, 12)?;

// Create the default config
let mut config = LiquidSdk::default_config(LiquidNetwork::Mainnet);

// Customize the config object according to your needs
config.working_dir = "path to an existing directory".into();

let connect_request = ConnectRequest {
    mnemonic: mnemonic.to_string(),
    config,
};
let sdk = LiquidSdk::connect(connect_request).await?;

Tests

In order to run tests, you can execute cargo test -- --nocapture --test-threads 1. This is due to the fact that currently tests require some degree of interaction (e.g. adding the funding invoice) in order to work, and thus should be run with a single thread (sequentially).