mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2025-12-21 07:54:24 +01:00
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
This commit is contained in:
@@ -511,7 +511,7 @@ abstract class _$$PaymentError_RefundedImplCopyWith<$Res> {
|
||||
_$PaymentError_RefundedImpl value, $Res Function(_$PaymentError_RefundedImpl) then) =
|
||||
__$$PaymentError_RefundedImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String err, String txid});
|
||||
$Res call({String err, String refundTxId});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -526,16 +526,16 @@ class __$$PaymentError_RefundedImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? err = null,
|
||||
Object? txid = null,
|
||||
Object? refundTxId = null,
|
||||
}) {
|
||||
return _then(_$PaymentError_RefundedImpl(
|
||||
err: null == err
|
||||
? _value.err
|
||||
: err // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
txid: null == txid
|
||||
? _value.txid
|
||||
: txid // ignore: cast_nullable_to_non_nullable
|
||||
refundTxId: null == refundTxId
|
||||
? _value.refundTxId
|
||||
: refundTxId // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
@@ -544,16 +544,16 @@ class __$$PaymentError_RefundedImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
|
||||
class _$PaymentError_RefundedImpl extends PaymentError_Refunded {
|
||||
const _$PaymentError_RefundedImpl({required this.err, required this.txid}) : super._();
|
||||
const _$PaymentError_RefundedImpl({required this.err, required this.refundTxId}) : super._();
|
||||
|
||||
@override
|
||||
final String err;
|
||||
@override
|
||||
final String txid;
|
||||
final String refundTxId;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PaymentError.refunded(err: $err, txid: $txid)';
|
||||
return 'PaymentError.refunded(err: $err, refundTxId: $refundTxId)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -562,11 +562,11 @@ class _$PaymentError_RefundedImpl extends PaymentError_Refunded {
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$PaymentError_RefundedImpl &&
|
||||
(identical(other.err, err) || other.err == err) &&
|
||||
(identical(other.txid, txid) || other.txid == txid));
|
||||
(identical(other.refundTxId, refundTxId) || other.refundTxId == refundTxId));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, err, txid);
|
||||
int get hashCode => Object.hash(runtimeType, err, refundTxId);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@@ -576,12 +576,12 @@ class _$PaymentError_RefundedImpl extends PaymentError_Refunded {
|
||||
}
|
||||
|
||||
abstract class PaymentError_Refunded extends PaymentError {
|
||||
const factory PaymentError_Refunded({required final String err, required final String txid}) =
|
||||
const factory PaymentError_Refunded({required final String err, required final String refundTxId}) =
|
||||
_$PaymentError_RefundedImpl;
|
||||
const PaymentError_Refunded._() : super._();
|
||||
|
||||
String get err;
|
||||
String get txid;
|
||||
String get refundTxId;
|
||||
@JsonKey(ignore: true)
|
||||
_$$PaymentError_RefundedImplCopyWith<_$PaymentError_RefundedImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
|
||||
Reference in New Issue
Block a user