Get Payment (#476)

* Get payment by destination

* CI fixes

* Remove claim_address from query

* Add PaymentDestination enum

* Add payment hash as a payment query option

* Bump Flutter dependencies

* Move destination/address queries to list_payments

* Apply suggestions from code review

Co-authored-by: yse <70684173+hydra-yse@users.noreply.github.com>

---------

Co-authored-by: yse <70684173+hydra-yse@users.noreply.github.com>
This commit is contained in:
Ross Savage
2024-10-10 17:44:32 +02:00
committed by GitHub
parent 42f4ca0129
commit 3867fa91da
32 changed files with 2585 additions and 143 deletions

View File

@@ -234,6 +234,16 @@ class GetInfoResponse {
pubkey == other.pubkey;
}
@freezed
sealed class GetPaymentRequest with _$GetPaymentRequest {
const GetPaymentRequest._();
/// The Lightning payment hash of the payment
const factory GetPaymentRequest.lightning({
required String paymentHash,
}) = GetPaymentRequest_Lightning;
}
/// Returned when calling [crate::sdk::LiquidSdk::fetch_lightning_limits].
class LightningPaymentLimitsResponse {
/// Amount limits for a Send Payment to be valid
@@ -295,6 +305,21 @@ enum LiquidNetwork {
;
}
@freezed
sealed class ListPaymentDetails with _$ListPaymentDetails {
const ListPaymentDetails._();
/// The Liquid BIP21 URI or address of the payment
const factory ListPaymentDetails.liquid({
required String destination,
}) = ListPaymentDetails_Liquid;
/// The Bitcoin address of the payment
const factory ListPaymentDetails.bitcoin({
required String address,
}) = ListPaymentDetails_Bitcoin;
}
/// An argument when calling [crate::sdk::LiquidSdk::list_payments].
class ListPaymentsRequest {
final List<PaymentType>? filters;
@@ -306,6 +331,7 @@ class ListPaymentsRequest {
final PlatformInt64? toTimestamp;
final int? offset;
final int? limit;
final ListPaymentDetails? details;
const ListPaymentsRequest({
this.filters,
@@ -313,11 +339,17 @@ class ListPaymentsRequest {
this.toTimestamp,
this.offset,
this.limit,
this.details,
});
@override
int get hashCode =>
filters.hashCode ^ fromTimestamp.hashCode ^ toTimestamp.hashCode ^ offset.hashCode ^ limit.hashCode;
filters.hashCode ^
fromTimestamp.hashCode ^
toTimestamp.hashCode ^
offset.hashCode ^
limit.hashCode ^
details.hashCode;
@override
bool operator ==(Object other) =>
@@ -328,7 +360,8 @@ class ListPaymentsRequest {
fromTimestamp == other.fromTimestamp &&
toTimestamp == other.toTimestamp &&
offset == other.offset &&
limit == other.limit;
limit == other.limit &&
details == other.details;
}
@freezed
@@ -552,6 +585,9 @@ sealed class PaymentDetails with _$PaymentDetails {
/// In the case of a Receive payment, this is the invoice paid by the user
String? bolt11,
/// The payment hash of the invoice
String? paymentHash,
/// For a Send swap which was refunded, this is the refund tx id
String? refundTxId,