Merge remote-tracking branch 'upstream/release-8.0' into merge-release-8.0-into-dev-220906

This commit is contained in:
Taranto 2022-06-09 23:56:40 +01:00
commit 4023470fec
47 changed files with 410 additions and 149 deletions

View file

@ -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) {
@ -125,11 +124,10 @@ function generateTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
]
return Promise.all(promises)
.then(([gas, gasPrice, txCount, { baseFeePerGas }]) => [
bn2bn(gas),
bn2bn(gasPrice),
_.max([1, txCount, lastUsedNonces[fromAddress] + 1]),
bn2bn(baseFeePerGas)
.then(([gas, gasPrice, txCount]) => [
BN(gas),
BN(gasPrice),
_.max([0, txCount, lastUsedNonces[fromAddress] + 1])
])
.then(([gas, gasPrice, txCount, baseFeePerGas]) => {
lastUsedNonces[fromAddress] = txCount