aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/invoices.ts19
-rw-r--r--lib/payments.ts1
2 files changed, 12 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);
diff --git a/lib/payments.ts b/lib/payments.ts
index af838758..3cc5a501 100644
--- a/lib/payments.ts
+++ b/lib/payments.ts
@@ -38,6 +38,7 @@ export const types = {
liquid: "liquid",
ecash: "ecash",
reconcile: "reconcile",
+ bolt12: "bolt12",
};
export const debit = async ({