Merge pull request #401 from poanetwork/develop

NW release 5.1.2
This commit is contained in:
Victor Baranov 2020-07-10 16:36:55 +03:00 committed by GitHub
commit 04d9a9515b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 19 deletions

View File

@ -2,6 +2,13 @@
## Current Master ## Current Master
- [#400](https://github.com/poanetwork/nifty-wallet/pull/400) - (Fix) Fix RNS resolving
- [#399](https://github.com/poanetwork/nifty-wallet/pull/399) - (Chore) Set 10 Gwei gas price for POA and Sokol chains
- [#399](https://github.com/poanetwork/nifty-wallet/pull/399) - (Fix) Fix 0 gas price when on POA, Sokol, xDai chains when confirmation popup is called from dApp
- [#398](https://github.com/poanetwork/nifty-wallet/pull/398) - (Chore) New RSK testnet default tokens
- [#398](https://github.com/poanetwork/nifty-wallet/pull/398) - (Fix) Etherscan link for Ethereum Mainnet
- [#398](https://github.com/poanetwork/nifty-wallet/pull/398) - (Chrore) Update NPM deps to fix known vulnerabilities
## 5.1.1 Mon Jun 15 2020 ## 5.1.1 Mon Jun 15 2020
- [#393](https://github.com/poanetwork/nifty-wallet/pull/393) - (Feature) "Send all" option for tokens transfer - [#393](https://github.com/poanetwork/nifty-wallet/pull/393) - (Feature) "Send all" option for tokens transfer

View File

@ -212,7 +212,7 @@ class TransactionController extends EventEmitter {
txParams.value = txParams.value ? ethUtil.addHexPrefix(txParams.value) : '0x0' txParams.value = txParams.value ? ethUtil.addHexPrefix(txParams.value) : '0x0'
txMeta.gasPriceSpecified = Boolean(txParams.gasPrice) txMeta.gasPriceSpecified = Boolean(txParams.gasPrice)
let gasPrice = txParams.gasPrice let gasPrice = txParams.gasPrice
if (!gasPrice) { if (!gasPrice || gasPrice === '0x0') {
gasPrice = this.getGasPrice ? await this.getGasPrice() : await this.query.gasPrice() gasPrice = this.getGasPrice ? await this.getGasPrice() : await this.query.gasPrice()
} }
txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16)) txParams.gasPrice = ethUtil.addHexPrefix(gasPrice.toString(16))

View File

@ -51,6 +51,7 @@ import selectChainId from './lib/select-chain-id'
const version = require('../manifest.json').version const version = require('../manifest.json').version
import ethUtil, { BN } from 'ethereumjs-util' import ethUtil, { BN } from 'ethereumjs-util'
const GWEI_BN = new BN('1000000000') const GWEI_BN = new BN('1000000000')
const GWEI_10_BN = new BN('10000000000')
import percentile from 'percentile' import percentile from 'percentile'
import seedPhraseVerifier from './lib/seed-phrase-verifier' import seedPhraseVerifier from './lib/seed-phrase-verifier'
import log from 'loglevel' import log from 'loglevel'
@ -60,7 +61,7 @@ import EthQuery from 'eth-query'
import nanoid from 'nanoid' import nanoid from 'nanoid'
const { importTypes } = require('../../old-ui/app/accounts/import/enums') const { importTypes } = require('../../old-ui/app/accounts/import/enums')
const { LEDGER, TREZOR } = require('../../old-ui/app/components/connect-hardware/enum') const { LEDGER, TREZOR } = require('../../old-ui/app/components/connect-hardware/enum')
const { ifPOA, ifRSK, getNetworkID, getDPath, setDPath } = require('../../old-ui/app/util') const { ifPOA, ifXDai, ifRSK, getNetworkID, getDPath, setDPath } = require('../../old-ui/app/util')
const { GasPriceOracle } = require('gas-price-oracle') const { GasPriceOracle } = require('gas-price-oracle')
import { import {
@ -1914,9 +1915,15 @@ module.exports = class MetamaskController extends EventEmitter {
const { recentBlocksController } = this const { recentBlocksController } = this
const { recentBlocks } = recentBlocksController.store.getState() const { recentBlocks } = recentBlocksController.store.getState()
const isPOA = ifPOA(networkId) const isPOA = ifPOA(networkId)
const isXDai = ifXDai(networkId)
// Return 1 gwei if using a POA network or if there are no blocks have been observed: // Return 10 gwei if using a POA, Sokol
if (isPOA || recentBlocks.length === 0) { if (isPOA) {
return '0x' + GWEI_10_BN.toString(16)
}
// Return 1 gwei if xDai or there are no blocks have been observed:
if (isXDai || recentBlocks.length === 0) {
return '0x' + GWEI_BN.toString(16) return '0x' + GWEI_BN.toString(16)
} }

View File

@ -222,10 +222,12 @@ function getNetworkEnsSupport (network) {
} }
function getNetworkRnsSupport (network) { function getNetworkRnsSupport (network) {
network = parseInt(network, 10)
return (network === RSK_CODE || network === RSK_TESTNET_CODE) return (network === RSK_CODE || network === RSK_TESTNET_CODE)
} }
function getRnsRegistryAddress (network) { function getRnsRegistryAddress (network) {
network = parseInt(network, 10)
if (network === RSK_CODE) { if (network === RSK_CODE) {
return RNSRegistryData.address.rskMainnet return RNSRegistryData.address.rskMainnet
} }

View File

@ -92,6 +92,7 @@ module.exports = {
ifETC, ifETC,
ifRSKByProviderType, ifRSKByProviderType,
ifPOA, ifPOA,
ifXDai,
toChecksumAddress, toChecksumAddress,
isValidChecksumAddress, isValidChecksumAddress,
isInfuraProvider, isInfuraProvider,
@ -452,7 +453,13 @@ function ifRSKByProviderType (type) {
function ifPOA (network) { function ifPOA (network) {
if (!network) return false if (!network) return false
const numericNet = isNaN(network) ? network : parseInt(network) const numericNet = isNaN(network) ? network : parseInt(network)
return numericNet === POA_SOKOL_CODE || numericNet === POA_CODE || numericNet === DAI_CODE return numericNet === POA_SOKOL_CODE || numericNet === POA_CODE
}
function ifXDai (network) {
if (!network) return false
const numericNet = isNaN(network) ? network : parseInt(network)
return numericNet === DAI_CODE
} }
function toChecksumAddressRSK (address, chainId = null) { function toChecksumAddressRSK (address, chainId = null) {

22
package-lock.json generated
View File

@ -1975,12 +1975,14 @@
} }
}, },
"@rsksmart/rsk-contract-metadata": { "@rsksmart/rsk-contract-metadata": {
"version": "github:rsksmart/rsk-contract-metadata#d7913739e5ee93dac8667043e2c17b0ef339c206", "version": "1.0.0",
"from": "github:rsksmart/rsk-contract-metadata#master" "resolved": "https://registry.npmjs.org/@rsksmart/rsk-contract-metadata/-/rsk-contract-metadata-1.0.0.tgz",
"integrity": "sha512-3bb4+h5u7l61/eGgn7wndOnVCy0oUnhV6+x2bUFa62hT8Vm/JJ/A+YdfkudUhXe3hJFmqrp9CLWi/DfQR6tLfw=="
}, },
"@rsksmart/rsk-testnet-contract-metadata": { "@rsksmart/rsk-testnet-contract-metadata": {
"version": "github:rsksmart/rsk-testnet-contract-metadata#2b89e70d36d2aa58cae68ac817debbf3c451690a", "version": "1.0.0",
"from": "github:rsksmart/rsk-testnet-contract-metadata#master" "resolved": "https://registry.npmjs.org/@rsksmart/rsk-testnet-contract-metadata/-/rsk-testnet-contract-metadata-1.0.0.tgz",
"integrity": "sha512-XWU824DvAMlxGNuBaVaCHxcc8eDHnbwrnYVG0hUNWgIZIYJOT9zwB0f1sSVEVgbryjvFy82H1Ay92k3XXUqZVQ=="
}, },
"@sentry/cli": { "@sentry/cli": {
"version": "1.52.0", "version": "1.52.0",
@ -11633,9 +11635,9 @@
} }
}, },
"eth-net-props": { "eth-net-props": {
"version": "1.0.33", "version": "1.0.35",
"resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.33.tgz", "resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.35.tgz",
"integrity": "sha512-RoqoXkY3+ztjdD9EfbjnMapWqfRjUscPon4Vjt48RLHDDYyNmz7LiQ4Qgb4E41PNS7xRoGkQCWJvJRAI9vDsFQ==", "integrity": "sha512-dvXMYtiaM7EKCVWMGvwNind4iojMum99SZBYIRVfE5zsceP/c4CxCbuS0If7o4tK/IxWAaa9tGt3hUzTsgArJQ==",
"requires": { "requires": {
"chai": "^4.2.0" "chai": "^4.2.0"
} }
@ -43002,9 +43004,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.15", "version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ=="
}, },
"lodash._baseassign": { "lodash._baseassign": {
"version": "3.2.0", "version": "3.2.0",

View File

@ -86,8 +86,8 @@
"@babel/runtime": "^7.5.5", "@babel/runtime": "^7.5.5",
"@material-ui/core": "^4.1.1", "@material-ui/core": "^4.1.1",
"@rsksmart/rns-registry": "^1.0.4", "@rsksmart/rns-registry": "^1.0.4",
"@rsksmart/rsk-contract-metadata": "github:rsksmart/rsk-contract-metadata#master", "@rsksmart/rsk-contract-metadata": "^1.0.0",
"@rsksmart/rsk-testnet-contract-metadata": "github:rsksmart/rsk-testnet-contract-metadata#master", "@rsksmart/rsk-testnet-contract-metadata": "^1.0.0",
"@zxing/library": "^0.8.0", "@zxing/library": "^0.8.0",
"abi-decoder": "^1.2.0", "abi-decoder": "^1.2.0",
"asmcrypto.js": "0.22.0", "asmcrypto.js": "0.22.0",
@ -121,7 +121,7 @@
"eth-keychain-controller": "github:vbaranov/KeyringController#5.3.1", "eth-keychain-controller": "github:vbaranov/KeyringController#5.3.1",
"eth-ledger-bridge-keyring": "github:vbaranov/eth-ledger-bridge-keyring#0.1.0-clear-accounts-flag", "eth-ledger-bridge-keyring": "github:vbaranov/eth-ledger-bridge-keyring#0.1.0-clear-accounts-flag",
"eth-method-registry": "^1.0.0", "eth-method-registry": "^1.0.0",
"eth-net-props": "^1.0.33", "eth-net-props": "^1.0.35",
"eth-phishing-detect": "^1.1.4", "eth-phishing-detect": "^1.1.4",
"eth-query": "^2.1.2", "eth-query": "^2.1.2",
"eth-sig-util": "^2.5.1", "eth-sig-util": "^2.5.1",

View File

@ -16,6 +16,7 @@ const {
ifRSK, ifRSK,
ifRSKByProviderType, ifRSKByProviderType,
ifPOA, ifPOA,
ifXDai,
toChecksumAddress, toChecksumAddress,
isValidChecksumAddress, isValidChecksumAddress,
isInfuraProvider, isInfuraProvider,
@ -359,12 +360,19 @@ describe('normalizing values', function () {
it('checks if this is POA chain', function () { it('checks if this is POA chain', function () {
assert(ifPOA(77)) assert(ifPOA(77))
assert(ifPOA(99)) assert(ifPOA(99))
assert(ifPOA(100))
assert(!ifPOA(1)) assert(!ifPOA(1))
assert(!ifPOA()) assert(!ifPOA())
}) })
}) })
describe('#ifXDai', function () {
it('checks if this is xDai chain', function () {
assert(ifXDai(100))
assert(!ifXDai(1))
assert(!ifXDai())
})
})
const addr = '0xB707b030A7887a21cc595Cd139746A8c2Ed91615' const addr = '0xB707b030A7887a21cc595Cd139746A8c2Ed91615'
const addrRSKMainnet = '0xB707b030A7887a21Cc595cD139746A8c2ED91615' const addrRSKMainnet = '0xB707b030A7887a21Cc595cD139746A8c2ED91615'
const addrRSKTestnet = '0xB707b030a7887a21Cc595CD139746a8C2ED91615' const addrRSKTestnet = '0xB707b030a7887a21Cc595CD139746a8C2ED91615'