1
0
mirror of https://github.com/dap-ps/discover.git synced 2025-02-07 06:54:49 +00:00

fix: return promise

This commit is contained in:
Richard Ramos 2019-08-14 13:11:01 -04:00
parent 7fdeb37cb7
commit 7215a166b9

View File

@ -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)
})
}