Merge pull request #168 from shocknet/fix/payment-route
send payment try catch
This commit is contained in:
commit
2bc3ae50bc
1 changed files with 28 additions and 23 deletions
|
|
@ -1507,36 +1507,41 @@ module.exports = async (
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keysend) {
|
try {
|
||||||
const { dest, amt, finalCltvDelta = 40 } = req.body
|
if (keysend) {
|
||||||
if (!dest || !amt) {
|
const { dest, amt, finalCltvDelta = 40 } = req.body
|
||||||
return res.status(400).json({
|
if (!dest || !amt) {
|
||||||
errorMessage: 'please provide "dest" and "amt" for keysend payments'
|
return res.status(400).json({
|
||||||
})
|
errorMessage: 'please provide "dest" and "amt" for keysend payments'
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const payment = await sendPaymentV2Keysend({
|
const payment = await sendPaymentV2Keysend({
|
||||||
amt,
|
amt,
|
||||||
dest,
|
dest,
|
||||||
|
feeLimit,
|
||||||
|
finalCltvDelta,
|
||||||
|
maxParts,
|
||||||
|
timeoutSeconds
|
||||||
|
})
|
||||||
|
|
||||||
|
return res.status(200).json(payment)
|
||||||
|
}
|
||||||
|
const { payreq } = req.body
|
||||||
|
|
||||||
|
const payment = await sendPaymentV2Invoice({
|
||||||
feeLimit,
|
feeLimit,
|
||||||
finalCltvDelta,
|
payment_request: payreq,
|
||||||
maxParts,
|
amt: req.body.amt,
|
||||||
|
max_parts: maxParts,
|
||||||
timeoutSeconds
|
timeoutSeconds
|
||||||
})
|
})
|
||||||
|
|
||||||
return res.status(200).json(payment)
|
return res.status(200).json(payment)
|
||||||
|
} catch (e) {
|
||||||
|
logger.error(e)
|
||||||
|
return res.status(500).json({ errorMessage: e })
|
||||||
}
|
}
|
||||||
const { payreq } = req.body
|
|
||||||
|
|
||||||
const payment = await sendPaymentV2Invoice({
|
|
||||||
feeLimit,
|
|
||||||
payment_request: payreq,
|
|
||||||
amt: req.body.amt,
|
|
||||||
max_parts: maxParts,
|
|
||||||
timeoutSeconds
|
|
||||||
})
|
|
||||||
|
|
||||||
return res.status(200).json(payment)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
app.post('/api/lnd/trackpayment', (req, res) => {
|
app.post('/api/lnd/trackpayment', (req, res) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue