List payments filtering and paging (#369)

* List payments in reverse chonological order

* Add payment filtering and paging

* Fix examples

* Apply suggestions from code review

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>

* Set timestamp for pseudo payments

* Filter by the first non-null timestamp from the join query

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
This commit is contained in:
Ross Savage
2024-07-10 17:50:53 +02:00
committed by GitHub
parent 651428b298
commit 143993fd3a
29 changed files with 1075 additions and 64 deletions

View File

@@ -197,6 +197,42 @@ enum LiquidNetwork {
;
}
/// Represents a list payments request.
class ListPaymentsRequest {
final List<PaymentType>? filters;
/// Epoch time, in seconds
final PlatformInt64? fromTimestamp;
/// Epoch time, in seconds
final PlatformInt64? toTimestamp;
final int? offset;
final int? limit;
const ListPaymentsRequest({
this.filters,
this.fromTimestamp,
this.toTimestamp,
this.offset,
this.limit,
});
@override
int get hashCode =>
filters.hashCode ^ fromTimestamp.hashCode ^ toTimestamp.hashCode ^ offset.hashCode ^ limit.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ListPaymentsRequest &&
runtimeType == other.runtimeType &&
filters == other.filters &&
fromTimestamp == other.fromTimestamp &&
toTimestamp == other.toTimestamp &&
offset == other.offset &&
limit == other.limit;
}
@freezed
sealed class LnUrlPayResult with _$LnUrlPayResult {
const LnUrlPayResult._();