From 7215a166b9a9eaae5b5b40b31b60e1e58ed358e5 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Wed, 14 Aug 2019 13:11:01 -0400 Subject: [PATCH] fix: return promise --- src/common/blockchain/services/helpers.js | 28 ++++++++++++----------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/common/blockchain/services/helpers.js b/src/common/blockchain/services/helpers.js index 60942ef..e14fc58 100644 --- a/src/common/blockchain/services/helpers.js +++ b/src/common/blockchain/services/helpers.js @@ -1,15 +1,17 @@ export const broadcastContractFn = (contractMethod, account) => { - return contractMethod - .estimateGas({ from: account }) - .then(estimatedGas => { - contractMethod - .send({ from: account, gas: estimatedGas + 1000 }) - .on('transactionHash', hash => { - resolve(hash) - }) - .on('error', error => { - reject(error) - }) - }) - .catch(error => reject) + return new Promise((resolve, reject) => { + contractMethod + .estimateGas({ from: account }) + .then(estimatedGas => { + contractMethod + .send({ from: account, gas: estimatedGas + 1000 }) + .on('transactionHash', hash => { + resolve(hash) + }) + .on('error', error => { + reject(error) + }) + }) + .catch(error => reject) + }) }