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