Persist swapper fees for swaps (#586)

* Add new Payment field swapper_fees_sat

* Add swapper fee handling for Receive Swaps

* Add swapper fee handling for Send Swaps

* Add swapper fee handling for Chain Swaps

* Fix tests

* Send Swap: persist pair JSON instead of service fee

* Receive Swap: persist pair JSON instead of service fee

* Chain Swap: persist pair JSON instead of service fee
This commit is contained in:
ok300
2024-12-06 08:32:03 +00:00
committed by GitHub
parent 3a9b6a6dcd
commit 790dfa91be
19 changed files with 295 additions and 114 deletions

View File

@@ -552,6 +552,10 @@ class Payment {
/// - for Receive payments, this is zero
final BigInt feesSat;
/// Service fees paid to the swapper service. This is only set for swaps (i.e. doesn't apply to
/// direct Liquid payments).
final BigInt? swapperFeesSat;
/// If it is a `Send` or `Receive` payment
final PaymentType paymentType;
@@ -572,6 +576,7 @@ class Payment {
required this.timestamp,
required this.amountSat,
required this.feesSat,
this.swapperFeesSat,
required this.paymentType,
required this.status,
required this.details,
@@ -584,6 +589,7 @@ class Payment {
timestamp.hashCode ^
amountSat.hashCode ^
feesSat.hashCode ^
swapperFeesSat.hashCode ^
paymentType.hashCode ^
status.hashCode ^
details.hashCode;
@@ -598,6 +604,7 @@ class Payment {
timestamp == other.timestamp &&
amountSat == other.amountSat &&
feesSat == other.feesSat &&
swapperFeesSat == other.swapperFeesSat &&
paymentType == other.paymentType &&
status == other.status &&
details == other.details;