Fix ETH fee fetching

This commit is contained in:
Taranto 2019-08-06 18:01:41 +01:00 committed by Josh Harvey
parent bb9adafeec
commit 91fc4e7cc2

View file

@ -49,14 +49,14 @@ function isStrictAddress (cryptoCode, toAddress) {
function sendCoins (account, toAddress, cryptoAtoms, cryptoCode) {
return generateTx(toAddress, defaultWallet(account), cryptoAtoms, false)
.then(pify(web3.eth.sendRawTransaction))
.then(r => {
return pify(web3.eth.getTransactionByHash)(r.result)
.then(txid => {
return pify(web3.eth.getTransaction)(txid)
.then(tx => {
if (!tx) return { txid: r.result }
if (!tx) return { txid }
const fee = BN(tx.gas).multipliedBy(BN(tx.gasPrice)).round()
return { txid: r.result, fee }
return { txid, fee }
})
})
}