From 93d494bc5d149458ea50a8d7017e155b2e1936ab Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 18 Dec 2024 13:44:00 -0800 Subject: printer endpoint --- lib/invoices.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lib/invoices.ts') diff --git a/lib/invoices.ts b/lib/invoices.ts index 5e59fd83..3259c46b 100644 --- a/lib/invoices.ts +++ b/lib/invoices.ts @@ -14,7 +14,6 @@ const lq = rpc(config.liquid); export const generate = async ({ invoice, user }) => { let { bolt11, - bolt12, aid, currency, expiry, @@ -73,13 +72,6 @@ export const generate = async ({ invoice, user }) => { if (r.payee !== nodeid) fail("invalid invoice"); amount = Math.round(r.amount_msat / 1000); r.bolt11 = bolt11; - } else if (bolt12) { - r = await ln.offer({ - amount_msat: amount ? `${amount + tip}sat` : "any", - label: id, - description: memo || "", - absolute_expiry: expiry, - }); } else { expiry ||= 60 * 60 * 24 * 30; r = await ln.invoice({ @@ -94,6 +86,17 @@ export const generate = async ({ invoice, user }) => { hash = r.bolt11; text = r.bolt11; + } else if (type === types.bolt12) { + const r = await ln.offer({ + amount: amount ? `${amount + tip}sat` : "any", + label: id, + description: memo || "", + absolute_expiry: expiry, + }); + + console.log("R", r); + hash = r.bolt12; + text = r.bolt12; } else if (type === types.bitcoin) { hash = await bc.getNewAddress(); text = bip21(hash, invoice); -- cgit v1.2.3