return preimage from sendPayment()

This commit is contained in:
Daniel Lugo 2020-04-03 16:06:09 -04:00
parent 1c3520f785
commit 72ca45c853

View file

@ -876,12 +876,13 @@ const sendHRWithInitialMsg = async (
}
/**
* Returns the preimage corresponding to the payment.
* @param {string} to
* @param {number} amount
* @param {string} memo
* @throws {Error} If no response in less than 20 seconds from the recipient, or
* lightning cannot find a route for the payment.
* @returns {Promise<void>}
* @returns {Promise<string>} The payment's preimage.
*/
const sendPayment = async (to, amount, memo) => {
try {
@ -1078,6 +1079,8 @@ const sendPayment = async (to, amount, memo) => {
require('../Mediator').mySEA
)
}
return preimage
} catch (e) {
logger.error('Error inside sendPayment()')
logger.error(e)