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) { function sendCoins (account, toAddress, cryptoAtoms, cryptoCode) {
return generateTx(toAddress, defaultWallet(account), cryptoAtoms, false) return generateTx(toAddress, defaultWallet(account), cryptoAtoms, false)
.then(pify(web3.eth.sendRawTransaction)) .then(pify(web3.eth.sendRawTransaction))
.then(r => { .then(txid => {
return pify(web3.eth.getTransactionByHash)(r.result) return pify(web3.eth.getTransaction)(txid)
.then(tx => { .then(tx => {
if (!tx) return { txid: r.result } if (!tx) return { txid }
const fee = BN(tx.gas).multipliedBy(BN(tx.gasPrice)).round() const fee = BN(tx.gas).multipliedBy(BN(tx.gasPrice)).round()
return { txid: r.result, fee } return { txid, fee }
}) })
}) })
} }