Merge pull request #1212 from josepfo/fix/eth-display-amount
fix: eth bn to bn convertion
This commit is contained in:
commit
e94f1ff223
1 changed files with 4 additions and 5 deletions
|
|
@ -40,7 +40,6 @@ function connect (url) {
|
|||
}
|
||||
|
||||
const hex = bigNum => '0x' + bigNum.integerValue(BN.ROUND_DOWN).toString(16)
|
||||
const bn2bn = bn => new BN(bn.toString(16), 16)
|
||||
|
||||
function privateKey (account) {
|
||||
return defaultWallet(account).getPrivateKey()
|
||||
|
|
@ -92,7 +91,7 @@ function _balance (includePending, address, cryptoCode) {
|
|||
const block = includePending ? 'pending' : undefined
|
||||
return pify(web3.eth.getBalance)(address.toLowerCase(), block)
|
||||
/* NOTE: Convert bn.js bignum to bignumber.js bignum */
|
||||
.then(balance => balance ? BN(balance.toString(16), 16) : BN(0))
|
||||
.then(balance => balance ? BN(balance) : BN(0))
|
||||
}
|
||||
|
||||
function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
||||
|
|
@ -126,10 +125,10 @@ function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
|
|||
|
||||
return Promise.all(promises)
|
||||
.then(([gas, gasPrice, txCount, { baseFeePerGas }]) => [
|
||||
bn2bn(gas),
|
||||
bn2bn(gasPrice),
|
||||
BN(gas),
|
||||
BN(gasPrice),
|
||||
_.max([1, txCount, lastUsedNonces[fromAddress] + 1]),
|
||||
bn2bn(baseFeePerGas)
|
||||
BN(baseFeePerGas)
|
||||
])
|
||||
.then(([gas, gasPrice, txCount, baseFeePerGas]) => {
|
||||
lastUsedNonces[fromAddress] = txCount
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue