diff --git a/utils/lightningServices/v2.js b/utils/lightningServices/v2.js index 0f6a19e3..45c03e6e 100644 --- a/utils/lightningServices/v2.js +++ b/utils/lightningServices/v2.js @@ -381,8 +381,31 @@ const listPayments = req => { }) } +/** + * @param {string} payReq + * @returns {Promise} + */ +const decodePayReq = payReq => + Common.Utils.makePromise((res, rej) => { + lightningServices.lightning.decodePayReq( + { pay_req: payReq }, + /** + * @param {{ message: any; }} err + * @param {any} paymentRequest + */ + (err, paymentRequest) => { + if (err) { + rej(new Error(err.message)) + } else { + res(paymentRequest) + } + } + ) + }) + module.exports = { sendPaymentV2Keysend, sendPaymentV2Invoice, - listPayments + listPayments, + decodePayReq }