Log miner fee (#237)
* Get miner fee written in some wallet plugins * Return txid and fee for geth. possible problem with txid (zero hash on pending transaction) * bitgo fee return * Wallet apis fees save in cryptoAtoms
This commit is contained in:
parent
fa69956963
commit
163473a7ee
9 changed files with 64 additions and 4 deletions
|
|
@ -1,3 +1,4 @@
|
|||
const _ = require('lodash/fp')
|
||||
const jsonRpc = require('../../common/json-rpc')
|
||||
|
||||
const BN = require('../../../bn')
|
||||
|
|
@ -41,6 +42,14 @@ function sendCoins (account, address, cryptoAtoms, cryptoCode) {
|
|||
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => fetch('sendtoaddress', [address, coins]))
|
||||
.then((txId) => fetch('gettransaction', txId))
|
||||
.then((res) => _.pick(res, ['fee', 'txid']))
|
||||
.then((pickedObj) => {
|
||||
return {
|
||||
fee: BN(pickedObj.fee).abs().shift(unitScale).round(),
|
||||
txid: pickedObj.txid
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
if (err.code === -6) throw new E.InsufficientFundsError()
|
||||
throw err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue