Commit Graph

56 Commits

Author SHA1 Message Date
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
ok300
9d5097a55c Send: store preimage on Complete 2024-05-23 13:58:40 +00:00
ok300
fcee44b1c2 Swap name consolidation (#218)
* Rename swap_in.rs, swap_out.rs

* Rename SwapIn, SwapOut structs SendSwap, ReceiveSwap

* Rename .*swap_in.* variables and methods to .*send_swap.*

* Rename .*swap_out.* variables and methods to .*receive_swap.*

* Rename Submarine Swap to Send Swap, Reverse Swap to Receive Swap

* Rename rev_swap_id to swap_id
2024-05-23 15:46:38 +02:00
ok300
6214d3d3b2 Send: fix tracking swap type (#217) 2024-05-23 08:13:57 +00:00
Erdem Yerebasmaz
a861011952 Generate Bindings
- Fix list_payments API on bindings
2024-05-23 10:12:53 +03:00
Erdem Yerebasmaz
1fe5bb353c Stop using singleton instance on Dart bindings
Apply changes to test cases on Dart plugin
2024-05-23 10:10:42 +03:00
ok300
f18f3cb9a6 Uniffi: Add list-payments to UDL (#204)
* Uniffi: Add list-payments to UDL

* Update Payment on uniffi bindings

* Update RN bindings

* Update flutter bindings

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
2024-05-23 06:19:26 +00:00
ok300
c975da5b3c Payment lifecycle (#184)
* Rename swap tables: remove ongoing_ prefix

* Add swap status enums and filtering

* Swap-in: add claim_txid

* Swap-out: add claim_txid

* resolve_swap: Don't remove swap when complete

* Fixups after rebase

* Remove unused method

* Consider payment as pending based on confirmations

An onchain payment with no confirmations is considered
pending. The previous logic of converting pending swaps
into pending payments is removed, since we may have
pending swaps that should not result in pending
payments (for example on Receive, before the invoice
is paid).

* Fix swap-in query

* GetInfoResponse: fix balance, include pending

* Remove unused method

* Re-generate flutter bridge files

* Re-generate RN bindings

* Fix payment_type detection in list_payments

* Send: persist to DB when claim tx is seen

* Receive: fix occasional error when broadcasting claim

* Remove fixed TODO

* Receive: only rescan on testnet, where Electrum is used to broadcast

* Log more details when broadcasting fails

* Improve AlreadyClaimed error detection and handling

* Rename SubmarineSwapStatus::Initial to Created

* Split pending payment types into separate field status

* Rename swap status enums

* Fix INSERT query

* Bump lwk libraries

* Simplify Receive try_handle_reverse_swap_status loop

* Change resolve_swap to insert_or_update_payment

* Refactor payment data persistence

* Remove unused dependency

* Bump LWK dependencies

* Rename reconcile_payments_with_onchain

* Rename try_claim_v2

* Rename address() to next_unused_address()

* Move all claim persistence writes in try_claim

* Flatten Payment struct

* Re-generate bindings

* Expose sync() in service interface

* Set Send ws stream as nonblocking, use singleton stream

* Send_payment: sync() before handling new state

* Sync() on sdk.connect()

* Remove unused args from list_payments()

* Receive: rename DB field redeem_script to response JSON

* Convert to and from internal structs to persist CreateResponse JSON

* De-duplicate internal CreateResponse structs to prevent storing same field twice

* Schedule a periodic sync() thread on startup

* Persist swap states and add methods to transition between them

* Handle unwrap() when subscribing for WS updates

* Status Stream: handle remaining unwraps() and TODOs

* Consolidate status transitions into two SDK methods

* Status Stream: reconnect and resume tracking on disconnect

* Remove superfluous TODO

* Send swaps: correctly transition to Complete even if app killed during send_payment()

* State transitions: Move SQL queries to persistence layer

* Send: handle edge TransactionClaimed edge-case

* Send: mark as Complete after we check the preimage

* Send: remove marking as Complete on TransactionClaimed
2024-05-22 20:00:38 +00:00
Ross Savage
7787267275 Build android fixes
Signed-off-by: Ross Savage <hello@satimoto.com>
2024-05-21 12:31:59 +02:00
ok300
fab4be45b5 Use hardcoded random P2TR addresses to estimate fees
Use P2TR address as destination when estimating fees
2024-05-16 23:04:33 +02:00
ok300
f6c6b0c625 Remove deprecated v1 code 2024-05-15 10:31:56 +02:00
ok300
41fc748d44 Remove duplicated versions of boltz-client 2024-05-15 10:13:44 +02:00
ok300
177127d376 Update flutter bindings 2024-05-15 09:41:06 +02:00
ok300
6b88461341 Add PaymentError::Refunded to UDL 2024-05-15 09:22:47 +02:00
yse
67aa6a38f8 fix: reword lockup tx error 2024-05-14 15:45:49 +02:00
yse
4496318089 fix: renaming 2024-05-14 15:44:30 +02:00
yse
70e2db708a feat: add better fee estimation 2024-05-14 15:33:26 +02:00
yse
5a9dc1d5ce feat: fix fee calculation issues 2024-05-14 13:05:55 +02:00
yse
55804e88c5 feat: add double lockup checks and resolve on claim details 2024-05-14 13:05:55 +02:00
yse
a92e83a446 feat: improve send and refund 2024-05-14 13:05:54 +02:00
yse
28d4f264eb feat: add refund and improve send flow 2024-05-14 13:05:27 +02:00
ok300
a1e437a04e Fix error handling in receive_payment 2024-05-13 17:05:50 +02:00
ok300
6b58682a91 Receive: broadcast claim tx when lockup tx in mempool 2024-05-12 18:34:44 +02:00
ok300
8f93587129 Extract get_liquid_swap_key() 2024-05-12 18:06:00 +02:00
yse
2e8bbb3e4a fix: change send_payment resolve 2024-05-10 18:20:24 +02:00
ok300
5476ddad54 Add non-blocking socket (fix #173) 2024-05-09 22:58:39 +02:00
ok300
d8cbcce5ae Correctly handle swap status parsing errors 2024-05-09 21:45:04 +02:00
ok300
fb7190032a Bump boltz-rust client to latest patch level 2024-05-09 21:22:57 +02:00
ok300
91b6598cf8 Update claim conditions for pending rev swaps 2024-05-09 20:59:48 +02:00
ok300
135fa9da62 Rev swap claims: broadcast claim tx with lowball fees 2024-05-09 20:58:40 +02:00
ok300
e4353b75be Use correct ElectrumConfig when claiming 2024-05-09 19:35:51 +02:00
ok300
dc569f0721 Simplify swap subscription 2024-05-09 16:11:50 +00:00
ok300
24861cb372 Track swap status updates via websocket event stream 2024-05-09 16:11:50 +00:00
ok300
d67756bf43 Migrate receive-payment to V2 API, use WS to get status 2024-05-09 16:09:12 +00:00
yse
18257dbc91 feat: migrate send_payment to v2 (#171) 2024-05-09 15:47:23 +03:00
yse
be3120c935 feat: remove PrepareSendResponse fields
feat: add `PrepareSendRequest` object

fix: rename to `claim_tx_feerate`

fix: fix reverse submarine test

feat: improve prepare_send and prepare_receive interfaces

fix: use v2 to broadcast lowball tx

feat: finalize prepare_send and prepare_receive

feat: remove manual BTC pair from response

fix: remove `pair_hash` from PrepareReceive

rebasing

updating Cargo.lock

fix: update lbtc pair method names

fixing bindings

fix: re-add uniffi_macros

add comment to elements dependency

fix: switch back to v1 fee calculation

fix: revert to v1 pair hash

fix: simplify migrations

fix: rename `FeesExpired` to `InvalidOrExpiredFees`

Log error when list_ongoing_swaps() fails

Log swap ID when list_ongoing_swaps() succeeds

Migrations: add missing ongoing_receive_swaps field

Clarify swap type (reverse vs submarine) in logs
2024-05-09 11:26:10 +03:00
Erdem Yerebasmaz
05689299f0 Update flutter_rust_bridge to 2.0.0-dev.33
Update dependencies to latest & increase the supported range
2024-05-06 14:58:31 +03:00
Erdem Yerebasmaz
3071c36486 Generate Dart/Flutter bindings 2024-05-06 14:50:20 +03:00
ok300
8a1508ab07 Rename wallet to SDK or LiquidSdk (#157)
* Rename global instance in bindings.rs

* Rename wallet to SDK or LiquidSdk

* Rename BindingWallet to BindingLiquidSdk

* Rename wallet to lwk_wollet, signer to lwk_signer

* Rename LsSdkError to LiquidSdkError

* Cargo fmt

* Rename LsSdkError in RN generator

---------

Co-authored-by: Ross Savage <hello@satimoto.com>
2024-05-03 13:53:37 +00:00
Erdem Yerebasmaz
fc85f4f488 Generate Dart/Flutter bindings 2024-05-03 16:05:39 +03:00
Erdem Yerebasmaz
d5ae712568 Generate Dart bindings & C Headers
- Enable full dependencies
2024-05-03 16:05:39 +03:00
Erdem Yerebasmaz
31d37cc05e Add suitable crate-types are configured for target devices
- lib is required for non-library targets, such as tests and benchmarks
- staticlib is required for iOS
- cdylib for all other platforms
2024-05-03 16:05:39 +03:00