Skip to content

Commit

Permalink
add funding and closing transaction to paymentMinutiae
Browse files Browse the repository at this point in the history
  • Loading branch information
ubbabeck committed Oct 16, 2023
1 parent 9ff40e4 commit d4bac45
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/models/payment_minutiae.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class PaymentMinutiae {
final bool hasMetadata;
final bool isKeySend;
final PaymentStatus status;
final String? fundingTxid;
final String? closingTxid;

const PaymentMinutiae({
required this.id,
Expand All @@ -50,6 +52,8 @@ class PaymentMinutiae {
required this.hasMetadata,
required this.isKeySend,
required this.status,
required this.fundingTxid,
required this.closingTxid,
});

factory PaymentMinutiae.fromPayment(Payment payment, BreezTranslations texts) {
Expand All @@ -73,6 +77,8 @@ class PaymentMinutiae {
hasMetadata: factory._hasMetadata(),
isKeySend: factory._isKeySend(),
status: payment.status,
fundingTxid: factory._fundingTx(),
closingTxid: factory._closedTx(),
);
}
}
Expand Down Expand Up @@ -286,4 +292,20 @@ class _PaymentMinutiaeFactory {
final details = _payment.details.data;
return (details is LnPaymentDetails) ? details.keysend : false;
}

String? _fundingTx() {
final details = _payment.details.data;
if (details is ClosedChannelPaymentDetails) {
return details.fundingTxid;
}
return null;
}

String? _closedTx() {
final details = _payment.details.data;
if (details is ClosedChannelPaymentDetails) {
return details.closingTxid;
}
return null;
}
}

0 comments on commit d4bac45

Please sign in to comment.