1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Merge pull request #6444 from MetaMask/localhost-network-dropdown

Fixes #6321 & #6421 - Add Localhost 8545 for network dropdown names
This commit is contained in:
Thomas Huang 2019-04-16 14:39:00 -05:00 committed by GitHub
commit 00133d31b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 3 deletions

View File

@ -308,6 +308,9 @@
"connectingToRinkeby": { "connectingToRinkeby": {
"message": "Connecting to Rinkeby Test Network" "message": "Connecting to Rinkeby Test Network"
}, },
"connectingToLocalhost": {
"message": "Connecting to Localhost 8545"
},
"connectingToUnknown": { "connectingToUnknown": {
"message": "Connecting to Unknown Network" "message": "Connecting to Unknown Network"
}, },

View File

@ -140,10 +140,10 @@ module.exports = class NetworkController extends EventEmitter {
this.providerConfig = providerConfig this.providerConfig = providerConfig
} }
async setProviderType (type) { async setProviderType (type, rpcTarget = '', ticker = 'ETH', nickname = '') {
assert.notEqual(type, 'rpc', `NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget"`) assert.notEqual(type, 'rpc', `NetworkController - cannot call "setProviderType" with type 'rpc'. use "setRpcTarget"`)
assert(INFURA_PROVIDER_TYPES.includes(type) || type === LOCALHOST, `NetworkController - Unknown rpc type "${type}"`) assert(INFURA_PROVIDER_TYPES.includes(type) || type === LOCALHOST, `NetworkController - Unknown rpc type "${type}"`)
const providerConfig = { type } const providerConfig = { type, rpcTarget, ticker, nickname }
this.providerConfig = providerConfig this.providerConfig = providerConfig
} }

View File

@ -285,6 +285,8 @@ NetworkDropdown.prototype.getNetworkName = function () {
name = this.context.t('kovan') name = this.context.t('kovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = this.context.t('rinkeby') name = this.context.t('rinkeby')
} else if (providerName === 'localhost') {
name = this.context.t('localhost')
} else { } else {
name = provider.nickname || this.context.t('unknownNetwork') name = provider.nickname || this.context.t('unknownNetwork')
} }

View File

@ -45,6 +45,8 @@ export default class LoadingNetworkScreen extends PureComponent {
name = this.context.t('connectingToKovan') name = this.context.t('connectingToKovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = this.context.t('connectingToRinkeby') name = this.context.t('connectingToRinkeby')
} else if (providerName === 'localhost') {
name = this.context.t('connectingToLocalhost')
} else { } else {
name = this.context.t('connectingTo', [providerId]) name = this.context.t('connectingTo', [providerId])
} }

View File

@ -139,7 +139,7 @@ Network.prototype.render = function () {
}, },
}), }),
h('.network-name', providerNick || context.t('privateNetwork')), h('.network-name', providerName === 'localhost' ? context.t('localhost') : providerNick || context.t('privateNetwork')),
h('i.fa.fa-chevron-down.fa-lg.network-caret'), h('i.fa.fa-chevron-down.fa-lg.network-caret'),
]) ])
} }

View File

@ -267,6 +267,8 @@ class Routes extends Component {
name = this.context.t('connectingToKovan') name = this.context.t('connectingToKovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = this.context.t('connectingToRinkeby') name = this.context.t('connectingToRinkeby')
} else if (providerName === 'localhost') {
name = this.context.t('connectingToLocalhost')
} else { } else {
name = this.context.t('connectingTo', [providerId]) name = this.context.t('connectingTo', [providerId])
} }
@ -288,6 +290,8 @@ class Routes extends Component {
name = this.context.t('kovan') name = this.context.t('kovan')
} else if (providerName === 'rinkeby') { } else if (providerName === 'rinkeby') {
name = this.context.t('rinkeby') name = this.context.t('rinkeby')
} else if (providerName === 'localhost') {
name = this.context.t('localhost')
} else { } else {
name = this.context.t('unknownNetwork') name = this.context.t('unknownNetwork')
} }