diff --git a/lib/plugins/wallet/geth/base.js b/lib/plugins/wallet/geth/base.js index 3904b911..8720808d 100644 --- a/lib/plugins/wallet/geth/base.js +++ b/lib/plugins/wallet/geth/base.js @@ -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