aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-07-26 16:20:47 -0700
committerAdam Soltys <[email protected]>2025-07-26 16:20:47 -0700
commit25cf51c8dbb6f3cea93c10832a05b9a65743bfee (patch)
treecb5afe76c53809d9d0c9df6dc8d56b82225fc484 /lib
parent4b59d73b96987b3335f9b87a1723f6f439288493 (diff)
downloadcoinos-server-25cf51c8dbb6f3cea93c10832a05b9a65743bfee.tar.gz
coinos-server-25cf51c8dbb6f3cea93c10832a05b9a65743bfee.zip
add missing make_invoice fields (fixes #78)
Diffstat (limited to 'lib')
-rw-r--r--lib/invoices.ts3
-rw-r--r--lib/nwc.ts10
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts
index 1e08140a..b8eedbf6 100644
--- a/lib/invoices.ts
+++ b/lib/invoices.ts
@@ -60,6 +60,7 @@ export const generate = async ({ invoice, user }) => {
let hash;
let text;
let path;
+ let paymentHash;
if (account.seed) {
type = "bitcoin";
@@ -90,6 +91,7 @@ export const generate = async ({ invoice, user }) => {
hash = r.bolt11;
text = r.bolt11;
+ paymentHash = r.payment_hash;
} else if (type === PaymentType.bolt12) {
const r = await ln.offer({
amount: amount ? `${amount + tip}sat` : "any",
@@ -132,6 +134,7 @@ export const generate = async ({ invoice, user }) => {
items,
memo,
rate,
+ paymentHash,
pending: 0,
received: 0,
request_id,
diff --git a/lib/nwc.ts b/lib/nwc.ts
index c659141a..d82d35e2 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -198,7 +198,7 @@ const handle = (method, params, ev, app, user) =>
fee: max_fee || Math.round(amount * 0.01),
user,
pr,
- memo: JSON.stringify(metadata)
+ memo: JSON.stringify(metadata),
});
await db.lPush(`${pubkey}:payments`, pid);
@@ -277,7 +277,11 @@ const handle = (method, params, ev, app, user) =>
expiry,
};
- const { hash, created: created_at } = await generate({ invoice, user });
+ const {
+ hash,
+ created: created_at,
+ paymentHash,
+ } = await generate({ invoice, user });
return result({
type: "incoming",
@@ -287,6 +291,8 @@ const handle = (method, params, ev, app, user) =>
amount,
created_at,
expires_at: created_at + expiry,
+ fees_paid: 0,
+ payment_hash: paymentHash,
metadata: {},
});
},