aboutsummaryrefslogtreecommitdiffstats
path: root/lib/invoices.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-21 10:47:25 -0800
committerAdam Soltys <[email protected]>2024-11-21 10:47:25 -0800
commit3b15d16339c9209f307f8453af91fba15f3d340c (patch)
treed9f4ca8879c6a0b29ca8f6ad795c2154387626fd /lib/invoices.ts
parent5642b90b54084061cdbbf6f1dc70c38245b05d5f (diff)
downloadcoinos-server-3b15d16339c9209f307f8453af91fba15f3d340c.tar.gz
coinos-server-3b15d16339c9209f307f8453af91fba15f3d340c.zip
wip
Diffstat (limited to 'lib/invoices.ts')
-rw-r--r--lib/invoices.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts
index 0a94334c..30ae8402 100644
--- a/lib/invoices.ts
+++ b/lib/invoices.ts
@@ -13,6 +13,7 @@ const lq = rpc(config.liquid);
export const generate = async ({ invoice, user }) => {
let {
bolt11,
+ bolt12,
aid,
currency,
expiry,
@@ -71,6 +72,13 @@ 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({