1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

network - use providerType for localhost

This commit is contained in:
kumavis 2018-03-30 10:59:39 -07:00
parent b2f02300a3
commit 5f1f345a5d
2 changed files with 7 additions and 6 deletions

View File

@ -1300,7 +1300,7 @@ function retryTransaction (txId) {
function setProviderType (type) { function setProviderType (type) {
return (dispatch) => { return (dispatch) => {
log.debug(`background.setProviderType`) log.debug(`background.setProviderType`, type)
background.setProviderType(type, (err, result) => { background.setProviderType(type, (err, result) => {
if (err) { if (err) {
log.error(err) log.error(err)
@ -1321,13 +1321,14 @@ function updateProviderType (type) {
} }
function setRpcTarget (newRpc) { function setRpcTarget (newRpc) {
log.debug(`background.setRpcTarget: ${newRpc}`)
return (dispatch) => { return (dispatch) => {
log.debug(`background.setRpcTarget: ${newRpc}`)
background.setCustomRpc(newRpc, (err, result) => { background.setCustomRpc(newRpc, (err, result) => {
if (err) { if (err) {
log.error(err) log.error(err)
return dispatch(self.displayWarning('Had a problem changing networks!')) return dispatch(self.displayWarning('Had a problem changing networks!'))
} }
dispatch(actions.setSelectedToken())
}) })
} }
} }

View File

@ -203,18 +203,18 @@ NetworkDropdown.prototype.render = function () {
{ {
key: 'default', key: 'default',
closeMenu: () => this.props.hideNetworkDropdown(), closeMenu: () => this.props.hideNetworkDropdown(),
onClick: () => props.setRpcTarget('http://localhost:8545'), onClick: () => props.setProviderType('localhost'),
style: dropdownMenuItemStyle, style: dropdownMenuItemStyle,
}, },
[ [
activeNetwork === 'http://localhost:8545' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'), providerType === 'localhost' ? h('i.fa.fa-check') : h('.network-check__transparent', '✓'),
h(NetworkDropdownIcon, { h(NetworkDropdownIcon, {
isSelected: activeNetwork === 'http://localhost:8545', isSelected: providerType === 'localhost',
innerBorder: '1px solid #9b9b9b', innerBorder: '1px solid #9b9b9b',
}), }),
h('span.network-name-item', { h('span.network-name-item', {
style: { style: {
color: activeNetwork === 'http://localhost:8545' ? '#ffffff' : '#9b9b9b', color: providerType === 'localhost' ? '#ffffff' : '#9b9b9b',
}, },
}, this.context.t('localhost')), }, this.context.t('localhost')),
] ]