From 765c6a42135b9334b616c26b22c816edd06e382a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 15 Sep 2019 23:05:26 -0700 Subject: refactor --- payments.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 payments.js (limited to 'payments.js') diff --git a/payments.js b/payments.js new file mode 100644 index 00000000..d2e89b44 --- /dev/null +++ b/payments.js @@ -0,0 +1,19 @@ +const createLnrpc = require("./lib/createLnrpc"); +const config = require("./config"); + +module.exports = async (app, auth, addresses, bc, db, emit, seen, payments) => { + const lna = await createLnrpc(config.lna); + const lnb = await createLnrpc(config.lnb); + + require("./bitcoinPayments")(app, bc, db, addresses, payments, emit); + require("./lightningPayments")(app, db, lna, lnb, emit, payments); + + app.post( + "/sendPayment", + auth, + require("./sendPayment")(app, db, emit, seen, lna, lnb) + ); + app.post("/payUser", auth, require("./payUser")(db, lnb)); + app.post("/sendCoins", auth, require("./sendCoins")(app, bc, db, emit)); + app.post("/addInvoice", auth, require("./addInvoice")(app, db, lnb)); +}; -- cgit v1.2.3