-Two issues identified with the list_transactions command: (#11)

-Was accessing the arguments from payload instead of from params
 -Was using "to" instead of "until" defined in NIP-47
This commit is contained in:
21M4TW 2025-06-09 12:51:50 +00:00 • committed by Riccardo Balbo
commit b851920eb3

View file

@ -373,16 +373,17 @@ async def _on_list_transactions(
return [(None, error, [])] return [(None, error, [])]
if not nwc: if not nwc:
raise Exception("Pubkey has no associated wallet") raise Exception("Pubkey has no associated wallet")
tfrom = payload.get("from", 0) params = payload.get("params", 0)
tto = payload.get("to", int(time.time())) tfrom = params.get("from", 0)
limit = payload.get("limit", 10) tuntil = params.get("until", int(time.time()))
offset = payload.get("offset", 0) limit = params.get("limit", 10)
unpaid = payload.get("unpaid", False) offset = params.get("offset", 0)
tx_type = payload.get("type", "") unpaid = params.get("unpaid", False)
tx_type = params.get("type", "")
# hardening # # hardening #
assert_valid_positive_int(tfrom) assert_valid_positive_int(tfrom)
assert_valid_positive_int(tto) assert_valid_positive_int(tuntil)
assert_valid_positive_int(limit) assert_valid_positive_int(limit)
assert_valid_positive_int(offset) assert_valid_positive_int(offset)
assert_boolean(unpaid) assert_boolean(unpaid)
@ -392,7 +393,7 @@ async def _on_list_transactions(
values = [] values = []
filters: Filters = Filters() filters: Filters = Filters()
filters.where(["time <= ?"]) filters.where(["time <= ?"])
values.append(tto) values.append(tuntil)
filters.values(values) filters.values(values)
history = await get_payments( history = await get_payments(
wallet_id=nwc.wallet, wallet_id=nwc.wallet,