Skip to content

Commit

Permalink
fix: add ListPaymentsRequest to method
Browse files Browse the repository at this point in the history
  • Loading branch information
yse committed Mar 22, 2024
1 parent a88a3ca commit e5100fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions lib/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
12 changes: 6 additions & 6 deletions lib/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -387,8 +387,8 @@ impl Wallet {
})
}

pub fn list_payments(&self, with_scan: bool, include_pending: bool) -> Result<Vec<Payment>> {
if with_scan {
pub fn list_payments(&self, req: ListPaymentsRequest) -> Result<Vec<Payment>> {
if req.with_scan {
self.scan()?;
}

Expand All @@ -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 {
Expand Down

0 comments on commit e5100fb

Please sign in to comment.