From 72ca45c853acf38fa297397d253bdb8ec49d9384 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Fri, 3 Apr 2020 16:06:09 -0400 Subject: [PATCH] return preimage from sendPayment() --- services/gunDB/contact-api/actions.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/gunDB/contact-api/actions.js b/services/gunDB/contact-api/actions.js index aef38070..9ddb0502 100644 --- a/services/gunDB/contact-api/actions.js +++ b/services/gunDB/contact-api/actions.js @@ -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} + * @returns {Promise} 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)