diff options
| author | Adam Soltys <[email protected]> | 2020-05-13 15:45:11 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-05-13 15:45:11 -0700 |
| commit | 5ca6307dda36fc11d43995c4a88f49a1a4b2e90c (patch) | |
| tree | bc3587def1ac881e8abae89864ce351cff8d3f8d | |
| parent | 816bfa54afd50059d781a9da5dc953611b9fdc66 (diff) | |
| download | coinos-server-5ca6307dda36fc11d43995c4a88f49a1a4b2e90c.tar.gz coinos-server-5ca6307dda36fc11d43995c4a88f49a1a4b2e90c.zip | |
get lightning recipient
| -rw-r--r-- | routes/lightning/query.js | 15 | ||||
| -rw-r--r-- | routes/payments.js | 5 |
2 files changed, 18 insertions, 2 deletions
diff --git a/routes/lightning/query.js b/routes/lightning/query.js new file mode 100644 index 00000000..012f20f4 --- /dev/null +++ b/routes/lightning/query.js @@ -0,0 +1,15 @@ +module.exports = async (req, res) => { + const { payreq } = req.body; + + const invoice = await db.Invoice.findOne({ + include: { + model: db.User, + as: "user" + }, + where: { + text: payreq, + } + }); + + if (invoice) emit(req.user.username, "to", invoice.user); +}; diff --git a/routes/payments.js b/routes/payments.js index 04b5dc51..02e0c88f 100644 --- a/routes/payments.js +++ b/routes/payments.js @@ -33,15 +33,16 @@ const { join } = require("path"); app.post("/send", auth, require("./send")); app.post("/lightning/invoice", auth, require("./lightning/invoice")); + app.post("/lightning/query", auth, require("./lightning/query")); app.post("/lightning/send", auth, require("./lightning/send")); require("./lightning/receive"); - app.post("/bitcoin/send", auth, require("./bitcoin/send")); app.post("/bitcoin/fee", auth, require("./bitcoin/fee")); + app.post("/bitcoin/send", auth, require("./bitcoin/send")); require("./bitcoin/receive"); - app.post("/liquid/send", auth, require("./liquid/send")); app.post("/liquid/fee", auth, require("./liquid/fee")); + app.post("/liquid/send", auth, require("./liquid/send")); require("./liquid/receive"); app.get("/payments", auth, async (req, res) => { |
