Commit Graph

240 Commits

Author SHA1 Message Date
Roei Erez
89d1e9c143 Add some doc commenets 2024-06-05 11:45:39 +03:00
Roei Erez
5a02c4eaf0 abstract onchain wallet behind its own module and trait 2024-06-05 11:42:25 +03:00
Roei Erez
04ac2c20e4 Merge pull request #287 from breez/swapper-stream-trait
Abstract swapper stream as part of swapper trait
2024-06-03 17:49:50 +03:00
Roei Erez
cc010c6797 cargo fmt 2024-06-03 16:58:16 +03:00
ok300
b4976573c4 Rename verbose variable 2024-06-03 13:03:07 +02:00
ok300
7f73c9a51d Send: correctly handle TransactionClaimed event 2024-06-03 13:00:02 +02:00
Roei Erez
f7b7149187 Abstract swapper stream as part of swapper trait 2024-06-03 13:57:20 +03:00
ok300
ec51aa99b4 Cargo clippy (#286) 2024-06-03 10:50:37 +00:00
ok300
1a6e177568 Cargo fmt (#281)
* Cargo fmt

* Remove duplicate log statement
2024-06-03 10:18:05 +00:00
Roei Erez
16a46f298d Merge pull request #273 from breez/claim-preimage
Ensure we have preimage persisted before claiming
2024-06-03 13:03:11 +03:00
Roei Erez
6bd710efdf fix comment 2024-06-03 13:02:36 +03:00
Erdem Yerebasmaz
564d75d59d Mark default_config && parse_invoice as sync functions on Dart bindings (#280)
- Generate Dart bindings
2024-06-03 11:53:34 +03:00
Roei Erez
8d5831e419 ensure we have preimage persisted before claiming 2024-06-02 15:32:34 +03:00
Roei Erez
866f91c38e Merge pull request #246 from breez/swapper-trait
Swapper trait
2024-06-01 18:38:20 +03:00
Roei Erez
eafe7feb39 use url from config 2024-06-01 17:40:33 +03:00
ok300
1cc06cef74 Bump lwk-wollet to fix InsufficientFunds error (#268)
* Bump lwk-wollet to fix InsufficientFunds error

* Re-add swap tracking on Send

* Track Send swap even on re-connect
2024-06-01 11:53:35 +00:00
Roei Erez
b7e703d297 simplified getting boltz url from config 2024-06-01 10:35:04 +03:00
Roei Erez
fd749e7e35 fix expired condition 2024-06-01 10:09:29 +03:00
Roei Erez
26524f8697 use config in swapper 2024-06-01 10:08:09 +03:00
Roei Erez
d5f291128c use get_swap_script 2024-06-01 09:45:39 +03:00
Roei Erez
c763902a19 remove unused import 2024-06-01 09:08:06 +03:00
Roei Erez
9e12b58be1 fix handle send swap. 2024-06-01 09:06:29 +03:00
Roei Erez
9db2e6d6da Allow resending to timeouted swaps 2024-06-01 09:06:26 +03:00
Roei Erez
a9168f651d integrate swapper trait 2024-06-01 09:05:11 +03:00
Roei Erez
806806f166 Add some comments 2024-06-01 08:54:57 +03:00
Roei Erez
272c32fc64 Extract out swapper logic to its own module 2024-06-01 08:54:57 +03:00
Ross Savage
5d9a8f18a3 Add Config (#267)
* Add config

* Add rustdocs to Config, send_payment (#271)

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-06-01 06:32:45 +02:00
Ross Savage
ccba0adf30 Trigger manual refunds on expired pending send swaps (#258)
* Check pending send swap expiration and trigger a refund

* Set interval to 60 secs
2024-06-01 06:08:23 +02:00
ok300
f6082f2aa5 Add global SDK logger (#242)
* Add SDK global logger

* Add bindings

* Fix path to internal uniffi log

* Exclude "set_log_stream" from generated RN methods

* Move logger-specific structs to a separate module

* Delegate init_logging to method in logger.rs

* Rename uniffi BindingLogger to UniffiBindingLogger

* Add set_log_stream for dart bindings

* Add SDK logger to Dart bindings

* Rename dart binding logger to DartBindingLogger

* Add rustdocs

* RN bindings: Add manual handling for setLogStream()

* Re-generate dart bindings

* Re-generate RN bindings

* Remove LOG_INIT cell

* Set global maximum log level once on initialization

Return a LiquidSdkError::Generic instead of Anyhow error when initializing log stream on Dart bindings

* Do not panic when initializing binding loggers

* Rename LogStream to Logger

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
2024-05-31 18:01:39 +00:00
yse
c7c4330905 feat: add send re-subscription and state change on swap expiry (#256)
* Cancel slow swap

* Change Cancelled to TimedOut

* Set Created send swaps to TimedOut on start

* feat: add fetch by invoice before creating swap

* feat: add refund check for swap expired

* fix: check for lockup_tx_id rather than swap state

---------

Co-authored-by: Ross Savage <hello@satimoto.com>
2024-05-31 10:43:28 +02:00
Ross Savage
585184a35c Cancel the created swap on timeout (#249)
* Cancel slow swap

* Change Cancelled to TimedOut

* Set Created send swaps to TimedOut on start
2024-05-31 07:37:44 +02:00
Ross Savage
dd00a0b328 Return pending payment (#245)
* Return pending payment

* Simplify select loop

* Revert dart pubspec

* Add error logging for payment events without swap ids

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-05-30 17:59:35 +02:00
yse
9554dcad19 feat: add random keypair generation to receive (#255)
* feat: add random keypair generation to receive
* feat: add `get_claim_keypair` method to swap
2024-05-30 16:21:08 +02:00
Erdem Yerebasmaz
e0322c39d6 Remove tokio runtime (#239)
* Remove obsolete Tokio runtime dependency on bindings

* Apply changes on example app

* Update "Getting Started" on README

* Update pubspec.lock
2024-05-30 17:04:58 +03:00
ok300
e5dba1043e Add ability to parse an invoice (#240)
* Add ability to parse an invoice

* Simplify LNInvoice initialization

* Add missing LNInvoice fields

* Cargo fmt

* Re-generate bindings after merging main branch

* Explicitly check the invoice signature

* Remove redundant signature check

* Strip potential lightning: prefix before parsing bolt11
2024-05-30 13:26:00 +00:00
Ross Savage
35561bacc5 Improve stream handling (#244)
* Improve stream management

* Check swap for existing lockup/refund tx

* Set broadcast capacity to 30
2024-05-30 14:54:15 +02:00
ok300
4cd2673d01 Integrate shutdown signal in tokio::select (#247) 2024-05-30 08:45:19 +00:00
ok300
434fb80d49 Add shutdown signal (#238)
* Add shutdown signal handling

Revert periodic sync interval change

Revert keep-alive interval change

CLI: Add disconnect command

SDK: Add scaffolding for is_started, shutdown()

Simplify instance init

* Rebase on savage-async-ws branch

* Avoid waiting when shutdown signal is received in the sync loop

* Directly use shutdown signal in background threads

* Acquire is_started lock at the very beginning of start()

* Fix cargo clippy warnings

* Update RN generator (kt): set bindingLiquidSdk to null on disconnect()

* Update RN generator (swift): set bindingLiquidSdk to nil on disconnect()

* Startup: only run foreground sync() if this could be the first run

* Start a sync() in background, before regular sync() loop

* Remove ensure_started check from start()

* Add bindings for disconnect()

* Remove foreground sync condition from startup

* Simplify background sync loop
2024-05-30 08:04:30 +00:00
Ross Savage
e986f75605 Convert the ws handling to async (#234) 2024-05-28 14:20:12 +02:00
Erdem Yerebasmaz
608f54ea69 Bump flutter_rust_bridge_codegen to 2.0.0-dev.36 and generate bindings (#237) 2024-05-28 14:41:47 +03:00
yse
9d2f6f0839 Fix cooperative refund and improve keypair generation (#223)
* feat: add random keypair generation

* Encapsulate decode_keypair in SendSwap::get_refund_keypair()

* Add refund_tx_id and refund_tx_amount_sat to Payment

* fix: remove blocking on refund

* fix: change `refund_private_key` order

* fix: rebasing

* fix: set `next_unused_address` as refund output

* Handle refunds in `get_info`, `list_payments` (#226)

* Exclude refund txs from payment list

* Adjust balance calculation to account for refunds

* fix: revert boltz changes and fix locktime

* Replace subquery with LEFT JOIN to get refund data

* Rewrite locktime check for more clarity

* Rewrite locktime check for more clarity

* Fix select_payment_query in case of refunds

* Include boltz-client fixes (handling of unwraps for failed broadcasts)

* Cargo.toml: Use boltz-client branch instead of commit

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-05-28 08:07:29 +00:00
yse
2fcefee45e Add option to specify backup path (#228)
* feat: add backup_path to backup method

* Re-generate bindings with flutter_rust_bridge`@ 2.0.0-dev.35

* Rebased on main

* Update backup path description

---------

Co-authored-by: ok300 <106775972+ok300@users.noreply.github.com>
2024-05-27 19:01:49 +00:00
ok300
6ef5701660 Send: persist pseudo-tx after to broadcast the lockup (#233) 2024-05-27 10:49:26 +00:00
Ross Savage
06b848a8f3 SDK events framework (#193)
* Add events framework

* Adapt RN codegen and add synced event

* Only use get_connection internally
2024-05-25 06:20:14 +02:00
Ross Savage
5143aeb1dd Merge pull request #225 from breez/savage-fix-ios-build
Fix broken rust security-framework dependency
2024-05-24 12:08:34 +02:00
ok300
ec88a9fb6a Pin security-framework dependencies in Cargo.toml 2024-05-24 11:48:25 +02:00
Ross Savage
e421b95bef Lock security-framework version 2024-05-24 11:22:49 +02:00
Erdem Yerebasmaz
7b1b78a2d9 Update example app on Flutter plugin (#220)
* Update example app on Flutter plugin

* Expose `empty_wallet_cache` through Dart bindings (#224)
2024-05-24 12:12:29 +03:00
ok300
c7b46314f4 Send: Retrieve and store preimage for non-cooperative claim (#222)
* Bump LWK dependencies to v0.5.1

* Send: Retrieve and store preimage for non-cooperative claim

* Remove branch that could have not succeeded
2024-05-24 06:16:41 +00:00
Erdem Yerebasmaz
a9cc69743d Expose sync through Dart bindings (#221)
Reformat build_other.dart
2024-05-23 17:59:01 +03:00