aboutsummaryrefslogtreecommitdiffstats
path: root/lib/invoices.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/invoices.ts')
-rw-r--r--lib/invoices.ts19
1 files changed, 11 insertions, 8 deletions
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);