Commit Graph

8 Commits

Author SHA1 Message Date
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
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
ok300
177127d376 Update flutter bindings 2024-05-15 09:41:06 +02:00
ok300
50a654b49c Merge branch 'main' into yse-remove-api-fields
# Conflicts:
#	packages/dart/lib/src/bindings.dart
#	packages/dart/lib/src/frb_generated.dart
#	packages/dart/lib/src/frb_generated.io.dart
#	packages/dart/lib/src/model.dart
#	packages/flutter/example/lib/main.dart
#	packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart
2024-05-15 09:20:53 +02:00
yse
28d4f264eb feat: add refund and improve send flow 2024-05-14 13:05:27 +02: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
4dc16e565a Run dart format -l 110 2024-05-08 01:19:46 +03:00
Erdem Yerebasmaz
5d966fc856 Move dart & flutter packages to packages folder on root 2024-05-03 16:05:39 +03:00