From b1a33d40aa09c4e8a1f5ecc7d5fc097ab7af44d0 Mon Sep 17 00:00:00 2001 From: daywalker90 <8257956+daywalker90@users.noreply.github.com> Date: Mon, 4 Aug 2025 12:48:58 +0200 Subject: [PATCH] don't ignore offset in list_transactions --- CHANGELOG.md | 3 +++ src/nwc_lookups.rs | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8550ead..eddd280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ - missing fields for ``make_invoice`` response - new `fees_paid` field in ``pay_keysend``/``multi_pay_keysend`` +### Fixed +- Don't ignore `offset` parameter in ``list_transactions`` + ## [0.1.5] 2025-07-24 ### Changed diff --git a/src/nwc_lookups.rs b/src/nwc_lookups.rs index 3342d67..1527978 100644 --- a/src/nwc_lookups.rs +++ b/src/nwc_lookups.rs @@ -674,6 +674,14 @@ pub async fn list_transactions( transactions.sort_by_key(|t| Reverse(t.created_at)); + if let Some(off) = params.offset.map(|o| o as usize) { + if off < transactions.len() { + transactions.drain(0..off); + } else { + transactions.clear(); + } + } + if let Some(l) = params.limit { if transactions.len() > (l as usize) { transactions = transactions.drain(0..(l as usize)).collect()