diff options
| author | Adam Soltys <[email protected]> | 2024-12-18 13:44:00 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-12-18 13:44:00 -0800 |
| commit | 93d494bc5d149458ea50a8d7017e155b2e1936ab (patch) | |
| tree | 3b4b8500089228737f1b2c3005b8d69ebd0f068c /lib | |
| parent | ad8605c99dab31e41d23918e3811bb3bbf1b38b5 (diff) | |
| download | coinos-server-93d494bc5d149458ea50a8d7017e155b2e1936ab.tar.gz coinos-server-93d494bc5d149458ea50a8d7017e155b2e1936ab.zip | |
printer endpoint
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/invoices.ts | 19 | ||||
| -rw-r--r-- | lib/payments.ts | 1 |
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 ({ |
