From fc49249984894966c9c680845040c8e538081b03 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 9 Sep 2020 15:58:44 -0400 Subject: [PATCH] rpc-style lnd endpoint --- src/routes.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/routes.js b/src/routes.js index 998f983e..dc81fe89 100644 --- a/src/routes.js +++ b/src/routes.js @@ -2986,4 +2986,24 @@ module.exports = async ( }) }) }) + + ap.get('/api/lnd/cb/:methodName', (req, res) => { + const { lightning } = LightningServices.services + const { methodName } = req.params + const args = req.body + + lightning[methodName](args, (err, lres) => { + if (err) { + res.status(500).json({ + errorMessage: err.details + }) + } else if (lres) { + res.status(200).json(lres) + } else { + res.status(500).json({ + errorMessage: 'Unknown error' + }) + } + }) + }) }