Merge pull request #201 from shocknet/invoices-bootstrap

Invoices bootstrap
This commit is contained in:
Daniel Lugo 2020-09-28 12:10:48 -04:00 committed by GitHub
commit 3d965fe630

View file

@ -695,7 +695,24 @@ module.exports = async (
alias, alias,
publicKey publicKey
}, },
follows: await GunGetters.Follows.currentFollows() follows: await GunGetters.Follows.currentFollows(),
data: {
invoices: await Common.makePromise((res, rej) => {
lightning.listInvoices(
{
reversed: true,
num_max_invoices: 50
},
(err, lres) => {
if (err) {
rej(new Error(err.details))
} else {
res(lres)
}
}
)
})
}
}) })
return true return true
@ -3069,6 +3086,7 @@ module.exports = async (
}) })
ap.post('/api/lnd/cb/:methodName', (req, res) => { ap.post('/api/lnd/cb/:methodName', (req, res) => {
try {
const { lightning } = LightningServices.services const { lightning } = LightningServices.services
const { methodName } = req.params const { methodName } = req.params
const args = req.body const args = req.body
@ -3086,5 +3104,14 @@ module.exports = async (
}) })
} }
}) })
} catch (err) {
logger.warn(`Error inside api cb:`)
logger.error(err)
logger.error(err.message)
return res.status(500).json({
errorMessage: err.message
})
}
}) })
} }