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:
parent
7fdeb37cb7
commit
7215a166b9
@ -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)
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user