From 079c13c9a1784719bb925f58692cfee83bd6c978 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Fri, 21 Aug 2020 14:09:56 -0400 Subject: [PATCH] spontaneous payments HTTP endpoint --- src/routes.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/routes.js b/src/routes.js index bdd7bdc0..9f06225c 100644 --- a/src/routes.js +++ b/src/routes.js @@ -1163,6 +1163,27 @@ module.exports = async ( }) }) + app.post('api/lnd/unifiedTrx', async (req, res) => { + try { + const { type, amt, to, memo, feeLimit } = req.body + + if (type !== 'spont') { + return res.status(415).json({ + field: 'type', + errorMessage: `Only 'spont' payments supported via this endpoint for now.` + }) + } + + return res + .status(200) + .json(await GunActions.sendSpontaneousPayment(to, amt, memo, feeLimit)) + } catch (e) { + return res.status(500).json({ + errorMessage: e.message + }) + } + }) + // get lnd node payments list app.get('/api/lnd/listpayments', (req, res) => { const { lightning } = LightningServices.services