Merge pull request #329 from poanetwork/vb-connect-to-unknown-network

Connect to unknown private network fix
This commit is contained in:
Victor Baranov 2020-03-11 18:34:48 +03:00 committed by GitHub
commit 10d6399dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 44 additions and 40 deletions

View File

@ -2,6 +2,7 @@
## Current Master
- [#329](https://github.com/poanetwork/nifty-wallet/pull/329) - (Fix) Connect to unknown private network fix
- [#326](https://github.com/poanetwork/nifty-wallet/pull/326) - (Chore) HTTP2 RPC endpoints for POA and xDai
- [#324](https://github.com/poanetwork/nifty-wallet/pull/324) - (Chore) Whitelist Geon token
- [#323](https://github.com/poanetwork/nifty-wallet/pull/323) - (Chore) update Mainnet tokens metadata

View File

@ -40,29 +40,29 @@ const CLASSIC_CODE = 61
const RSK_CODE = 30
const RSK_TESTNET_CODE = 31
const POA_DISPLAY_NAME = 'POA Core'
const DAI_DISPLAY_NAME = 'xDai Chain'
const POA_SOKOL_DISPLAY_NAME = 'Sokol'
const MAINNET_DISPLAY_NAME = 'Main Ethereum Network'
const ROPSTEN_DISPLAY_NAME = 'Ropsten'
const RINKEBY_DISPLAY_NAME = 'Rinkeby'
const KOVAN_DISPLAY_NAME = 'Kovan'
const POA_DISPLAY_NAME = 'POA'
const DAI_DISPLAY_NAME = 'xDai'
const POA_SOKOL_DISPLAY_NAME = 'Sokol Testnet'
const MAINNET_DISPLAY_NAME = 'Ethereum'
const ROPSTEN_DISPLAY_NAME = 'Ropsten Testnet'
const RINKEBY_DISPLAY_NAME = 'Rinkeby Testnet'
const KOVAN_DISPLAY_NAME = 'Kovan Testnet'
const GOERLI_TESTNET_DISPLAY_NAME = 'Görli Testnet'
const CLASSIC_DISPLAY_NAME = 'Ethereum Classic'
const RSK_DISPLAY_NAME = 'RSK Mainnet'
const RSK_DISPLAY_NAME = 'RSK'
const RSK_TESTNET_DISPLAY_NAME = 'RSK Testnet'
const DROPDOWN_POA_DISPLAY_NAME = POA_DISPLAY_NAME
const DROPDOWN_DAI_DISPLAY_NAME = DAI_DISPLAY_NAME
const DROPDOWN_POA_SOKOL_DISPLAY_NAME = 'Sokol Network'
const DROPDOWN_MAINNET_DISPLAY_NAME = 'Main Network'
const DROPDOWN_ROPSTEN_DISPLAY_NAME = 'Ropsten Test Net'
const DROPDOWN_RINKEBY_DISPLAY_NAME = 'Rinkeby Test Net'
const DROPDOWN_KOVAN_DISPLAY_NAME = 'Kovan Test Net'
const DROPDOWN_GOERLI_TESTNET_DISPLAY_NAME = 'Görli Test Net'
const DROPDOWN_CLASSIC_DISPLAY_NAME = 'Ethereum Classic'
const DROPDOWN_RSK_DISPLAY_NAME = 'RSK Main Net'
const DROPDOWN_RSK_TESTNET_DISPLAY_NAME = 'RSK Test Net'
const DROPDOWN_POA_SOKOL_DISPLAY_NAME = POA_SOKOL_DISPLAY_NAME
const DROPDOWN_MAINNET_DISPLAY_NAME = MAINNET_DISPLAY_NAME
const DROPDOWN_ROPSTEN_DISPLAY_NAME = ROPSTEN_DISPLAY_NAME
const DROPDOWN_RINKEBY_DISPLAY_NAME = RINKEBY_DISPLAY_NAME
const DROPDOWN_KOVAN_DISPLAY_NAME = KOVAN_DISPLAY_NAME
const DROPDOWN_GOERLI_TESTNET_DISPLAY_NAME = GOERLI_TESTNET_DISPLAY_NAME
const DROPDOWN_CLASSIC_DISPLAY_NAME = CLASSIC_DISPLAY_NAME
const DROPDOWN_RSK_DISPLAY_NAME = RSK_DISPLAY_NAME
const DROPDOWN_RSK_TESTNET_DISPLAY_NAME = RSK_TESTNET_DISPLAY_NAME
const chainTypes = {
TEST: 1,

View File

@ -46,6 +46,7 @@ const DeleteImportedAccount = require('./components/delete-imported-account')
const ConfirmChangePassword = require('./components/confirm-change-password')
const ethNetProps = require('eth-net-props')
const { getMetaMaskAccounts } = require('../../ui/app/selectors')
const { getNetworkID } = require('./util')
module.exports = compose(
withRouter,
@ -360,6 +361,8 @@ App.prototype.renderPrimary = function () {
}
App.prototype.getNetworkName = function () {
const { network } = this.props
return ethNetProps.props.getNetworkDisplayName(network)
const { provider } = this.props
const providerName = provider.type
const network = getNetworkID({network: providerName})
return ethNetProps.props.getNetworkDisplayName(network.netId)
}

View File

@ -243,7 +243,7 @@ textarea.twelve-word-phrase {
}
.network-name {
width: 5.2em;
width: 5.4em;
line-height: 9px;
text-rendering: geometricPrecision;
padding-left: 9px;

6
package-lock.json generated
View File

@ -14684,9 +14684,9 @@
}
},
"eth-net-props": {
"version": "1.0.29",
"resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.29.tgz",
"integrity": "sha512-tCJgAnf8QM1hxeVWPf/h5xe+mfQ01+jLM140mYHxRHWahO6VLRpTdD7Bb//cOfWbcMQMQNMBDR85vulQoCH7Kg==",
"version": "1.0.31",
"resolved": "https://registry.npmjs.org/eth-net-props/-/eth-net-props-1.0.31.tgz",
"integrity": "sha512-ecopbpwYmkkt1X0EwOE+BDN2Okwg+pCu3ZLOVQf8kjPC9pY8UQxbZr8QSp16t2U5H6UoxNTOcdXSFnMjTQrj0A==",
"requires": {
"chai": "^4.2.0"
}

View File

@ -117,7 +117,7 @@
"eth-keychain-controller": "github:vbaranov/KeyringController#simple-address",
"eth-ledger-bridge-keyring": "github:vbaranov/eth-ledger-bridge-keyring#0.1.0-clear-accounts-flag",
"eth-method-registry": "^1.0.0",
"eth-net-props": "^1.0.29",
"eth-net-props": "^1.0.31",
"eth-phishing-detect": "^1.1.4",
"eth-query": "^2.1.2",
"eth-sig-util": "^2.2.0",

View File

@ -2,7 +2,7 @@ const assert = require('assert')
const { screens, elements, NETWORKS } = require('../elements')
const RSKNetworkTests = async (f, account1) => {
it('connects to RSK mainnet', async function () {
it('connects to RSK', async function () {
await f.setProvider(NETWORKS.RSK)
await f.delay(2000)
})

View File

@ -210,9 +210,9 @@ const addCustomToken = async (f, account1, account2) => {
assert(await f.isDisabledAddInexistentToken(tokenAddress), true, 'can add inexistent token in MAINNET')
})
it('can not add inexistent token to RSK mainnet', async () => {
it('can not add inexistent token to RSK', async () => {
await f.setProvider(NETWORKS.RSK)
assert(await f.isDisabledAddInexistentToken(tokenAddress), true, 'can add inexistent token in RSK mainnet')
assert(await f.isDisabledAddInexistentToken(tokenAddress), true, 'can add inexistent token in RSK')
})
it('can not add inexistent token to RSK testnet', async () => {

View File

@ -251,7 +251,7 @@ const addTokeFromSearch = async (f) => {
assert.equal(await f.assertTokensNotDisplayed(), true, 'tokens are displayed')
})
it('token should not be displayed in RSK mainnet', async () => {
it('token should not be displayed in RSK', async () => {
await f.setProvider(NETWORKS.RSK)
assert.equal(await f.assertTokensNotDisplayed(), true, 'tokens are displayed')
})

View File

@ -132,7 +132,7 @@ const customRPC = async (f) => {
it('deleted custom rpc isn\'t displayed in \'Settings\' screen', async function () {
const currentNetwork = await f.waitUntilShowUp(screens.settings.currentNetwork)
assert.equal(await currentNetwork.getText(), 'POA Core', 'custom Rpc is displayed after deletion')
assert.equal(await currentNetwork.getText(), 'POA', 'custom Rpc is displayed after deletion')
})
it('deleted custom rpc isn\'t displayed in network dropdown menu', async function () {

View File

@ -38,7 +38,7 @@ const importAccount = async (f) => {
await menu.click()
})
it('Auto-detect tokens for POA core network ', async () => {
it('Auto-detect tokens for POA ', async () => {
// await setProvider(NETWORKS.POA)
const tab = await f.waitUntilShowUp(tokensEl.menu)
await tab.click()

View File

@ -66,7 +66,7 @@ describe('', function () {
assert.equal(kovanUrl, 'https://gitter.im/kovan-testnet/faucet/')
})
it('returns exchanges for POA core network', function () {
it('returns exchanges for POA', function () {
const exchanges = getExchanges({network: 99})
assert.deepEqual(exchanges, [
{

View File

@ -73,31 +73,31 @@ describe('Network utils', () => {
const tests = [
{
input: 3,
expected: 'Ropsten',
expected: 'Ropsten Testnet',
}, {
input: 4,
expected: 'Rinkeby',
expected: 'Rinkeby Testnet',
}, {
input: 42,
expected: 'Kovan',
expected: 'Kovan Testnet',
}, {
input: 77,
expected: 'Sokol',
expected: 'Sokol Testnet',
}, {
input: 'ropsten',
expected: 'Ropsten',
expected: 'Ropsten Testnet',
}, {
input: 'rinkeby',
expected: 'Rinkeby',
expected: 'Rinkeby Testnet',
}, {
input: 'kovan',
expected: 'Kovan',
expected: 'Kovan Testnet',
}, {
input: 'sokol',
expected: 'Sokol',
expected: 'Sokol Testnet',
}, {
input: 'mainnet',
expected: 'Main Ethereum Network',
expected: 'Ethereum',
},
]