Fix ETH fee fetching
This commit is contained in:
parent
bb9adafeec
commit
91fc4e7cc2
1 changed files with 4 additions and 4 deletions
|
|
@ -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 }
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue