From e5100fb27d19988e9b5938c4bc88bf70b09702c5 Mon Sep 17 00:00:00 2001 From: yse Date: Fri, 22 Mar 2024 01:23:27 +0100 Subject: [PATCH] fix: add `ListPaymentsRequest` to method --- lib/src/model.rs | 6 ++++++ lib/src/wallet.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/src/model.rs b/lib/src/model.rs index 70d1af3c7..4c453538b 100644 --- a/lib/src/model.rs +++ b/lib/src/model.rs @@ -182,3 +182,9 @@ pub struct Payment { pub amount_sat: u64, pub payment_type: PaymentType, } + +#[derive(Debug)] +pub struct ListPaymentsRequest { + pub with_scan: bool, + pub include_pending: bool, +} diff --git a/lib/src/wallet.rs b/lib/src/wallet.rs index a800ff84f..6a54edf41 100644 --- a/lib/src/wallet.rs +++ b/lib/src/wallet.rs @@ -24,9 +24,9 @@ use lwk_wollet::{ }; use crate::{ - persist::Persister, Network, OngoingSwap, Payment, PaymentError, PaymentType, - PreparePaymentResponse, ReceivePaymentRequest, ReceivePaymentResponse, SendPaymentResponse, - SwapType, SwapTypeFilter, WalletInfo, WalletOptions, + persist::Persister, ListPaymentsRequest, Network, OngoingSwap, Payment, PaymentError, + PaymentType, PreparePaymentResponse, ReceivePaymentRequest, ReceivePaymentResponse, + SendPaymentResponse, SwapType, SwapTypeFilter, WalletInfo, WalletOptions, }; // To avoid sendrawtransaction error "min relay fee not met" @@ -387,8 +387,8 @@ impl Wallet { }) } - pub fn list_payments(&self, with_scan: bool, include_pending: bool) -> Result> { - if with_scan { + pub fn list_payments(&self, req: ListPaymentsRequest) -> Result> { + if req.with_scan { self.scan()?; } @@ -411,7 +411,7 @@ impl Wallet { }) .collect(); - if include_pending { + if req.include_pending { let pending_swaps = self.swap_persister.list_ongoing_swaps(None)?; for swap in pending_swaps {