aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-10 11:54:27 -0800
committerAdam Soltys <[email protected]>2025-01-10 11:54:27 -0800
commite2ba4a77a77daa29869533f6e500b6a6ec3e9708 (patch)
treed5e742f0b5198630a5b465f518c5b3083c3ae04e /lib
parent58a15601a1ffea775f80a9e7337b63f461b36b0c (diff)
downloadcoinos-server-e2ba4a77a77daa29869533f6e500b6a6ec3e9708.tar.gz
coinos-server-e2ba4a77a77daa29869533f6e500b6a6ec3e9708.zip
get internal invoice record for lookup_invoice
Diffstat (limited to 'lib')
-rw-r--r--lib/nwc.ts6
-rw-r--r--lib/payments.ts1
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/nwc.ts b/lib/nwc.ts
index 791f18f5..82c9870d 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -223,23 +223,23 @@ const handle = (method, params, user, ev) =>
amount_received_msat: amount,
description,
expires_at,
- payment_preimage,
paid_at: settled_at,
} = invoices[0];
({ bolt11: invoice, payment_hash } = invoices[0]);
+ const { preimage, settled } = await getInvoice(invoice);
return result({
type: "incoming",
invoice,
description,
- preimage: payment_preimage,
+ preimage,
payment_hash,
amount,
fees_paid: 0,
created_at: expires_at - week,
expires_at,
- settled_at,
+ settled_at: settled_at || Math.round(settled / 1000),
});
}
diff --git a/lib/payments.ts b/lib/payments.ts
index 7536d923..d88dc6aa 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -217,6 +217,7 @@ export const credit = async ({
else {
inv.received += amount;
inv.preimage = ref;
+ inv.settled = Date.now();
}
let balanceKey = "balance";