From bee5e350576baf674594a101795b23318b654c9a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 6 Nov 2022 06:19:17 -0800 Subject: send invoice to recipient --- routes/invoices.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routes/invoices.js b/routes/invoices.js index 6e0fe358..c492b475 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -60,7 +60,7 @@ app.get("/invoice/:text", async (req, res, next) => { app.post("/invoice", optionalAuth, async (req, res, next) => { try { let { type = "bech32", liquidAddress, id, invoice, user, tx } = req.body; - let { blindkey, currency, tip, amount, rate, network } = invoice; + let { blindkey, currency, tip, amount, rate, network, recipient } = invoice; let address, unconfidential, text; if (amount < 0) throw new Error("amount out of range"); @@ -151,6 +151,10 @@ app.post("/invoice", optionalAuth, async (req, res, next) => { if (blindkey) await lq.importBlindingKey(invoice.address, blindkey); } + if (recipient) { + emit(recipient, "invoice", invoice.get({ plain: true {)); + } + res.send(invoice); } catch (e) { err(e.message, e.stack); -- cgit v1.2.3