|
|
@ -10,6 +10,7 @@ const TabBar = require('./components/tab-bar') |
|
|
|
const SimpleDropdown = require('./components/dropdowns/simple-dropdown') |
|
|
|
const SimpleDropdown = require('./components/dropdowns/simple-dropdown') |
|
|
|
const ToggleButton = require('react-toggle-button') |
|
|
|
const ToggleButton = require('react-toggle-button') |
|
|
|
const { OLD_UI_NETWORK_TYPE } = require('../../app/scripts/config').enums |
|
|
|
const { OLD_UI_NETWORK_TYPE } = require('../../app/scripts/config').enums |
|
|
|
|
|
|
|
const t = require('../i18n') |
|
|
|
|
|
|
|
|
|
|
|
const getInfuraCurrencyOptions = () => { |
|
|
|
const getInfuraCurrencyOptions = () => { |
|
|
|
const sortedCurrencies = infuraCurrencies.objects.sort((a, b) => { |
|
|
|
const sortedCurrencies = infuraCurrencies.objects.sort((a, b) => { |
|
|
@ -44,8 +45,8 @@ class Settings extends Component { |
|
|
|
return h('div.settings__tabs', [ |
|
|
|
return h('div.settings__tabs', [ |
|
|
|
h(TabBar, { |
|
|
|
h(TabBar, { |
|
|
|
tabs: [ |
|
|
|
tabs: [ |
|
|
|
{ content: 'Settings', key: 'settings' }, |
|
|
|
{ content: t('settings'), key: 'settings' }, |
|
|
|
{ content: 'Info', key: 'info' }, |
|
|
|
{ content: t('info'), key: 'info' }, |
|
|
|
], |
|
|
|
], |
|
|
|
defaultTab: activeTab, |
|
|
|
defaultTab: activeTab, |
|
|
|
tabSelected: key => this.setState({ activeTab: key }), |
|
|
|
tabSelected: key => this.setState({ activeTab: key }), |
|
|
@ -84,7 +85,7 @@ class Settings extends Component { |
|
|
|
h('div.settings__content-item', [ |
|
|
|
h('div.settings__content-item', [ |
|
|
|
h('div.settings__content-item-col', [ |
|
|
|
h('div.settings__content-item-col', [ |
|
|
|
h(SimpleDropdown, { |
|
|
|
h(SimpleDropdown, { |
|
|
|
placeholder: 'Select Currency', |
|
|
|
placeholder: t('selectCurrency'), |
|
|
|
options: getInfuraCurrencyOptions(), |
|
|
|
options: getInfuraCurrencyOptions(), |
|
|
|
selectedOption: currentCurrency, |
|
|
|
selectedOption: currentCurrency, |
|
|
|
onSelect: newCurrency => setCurrentCurrency(newCurrency), |
|
|
|
onSelect: newCurrency => setCurrentCurrency(newCurrency), |
|
|
@ -101,31 +102,31 @@ class Settings extends Component { |
|
|
|
switch (provider.type) { |
|
|
|
switch (provider.type) { |
|
|
|
|
|
|
|
|
|
|
|
case 'mainnet': |
|
|
|
case 'mainnet': |
|
|
|
title = 'Current Network' |
|
|
|
title = t('currentNetwork') |
|
|
|
value = 'Main Ethereum Network' |
|
|
|
value = t('mainnet') |
|
|
|
color = '#038789' |
|
|
|
color = '#038789' |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
case 'ropsten': |
|
|
|
case 'ropsten': |
|
|
|
title = 'Current Network' |
|
|
|
title = t('currentNetwork') |
|
|
|
value = 'Ropsten Test Network' |
|
|
|
value = t('ropsten') |
|
|
|
color = '#e91550' |
|
|
|
color = '#e91550' |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
case 'kovan': |
|
|
|
case 'kovan': |
|
|
|
title = 'Current Network' |
|
|
|
title = t('currentNetwork') |
|
|
|
value = 'Kovan Test Network' |
|
|
|
value = t('kovan') |
|
|
|
color = '#690496' |
|
|
|
color = '#690496' |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
case 'rinkeby': |
|
|
|
case 'rinkeby': |
|
|
|
title = 'Current Network' |
|
|
|
title = t('currentNetwork') |
|
|
|
value = 'Rinkeby Test Network' |
|
|
|
value = t('rinkeby') |
|
|
|
color = '#ebb33f' |
|
|
|
color = '#ebb33f' |
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
default: |
|
|
|
title = 'Current RPC' |
|
|
|
title = t('currentRpc') |
|
|
|
value = provider.rpcTarget |
|
|
|
value = provider.rpcTarget |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -146,12 +147,12 @@ class Settings extends Component { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
h('div.settings__content-row', [ |
|
|
|
h('div.settings__content-row', [ |
|
|
|
h('div.settings__content-item', [ |
|
|
|
h('div.settings__content-item', [ |
|
|
|
h('span', 'New RPC URL'), |
|
|
|
h('span', t('newRPC')), |
|
|
|
]), |
|
|
|
]), |
|
|
|
h('div.settings__content-item', [ |
|
|
|
h('div.settings__content-item', [ |
|
|
|
h('div.settings__content-item-col', [ |
|
|
|
h('div.settings__content-item-col', [ |
|
|
|
h('input.settings__input', { |
|
|
|
h('input.settings__input', { |
|
|
|
placeholder: 'New RPC URL', |
|
|
|
placeholder: t('newRPC'), |
|
|
|
onChange: event => this.setState({ newRpc: event.target.value }), |
|
|
|
onChange: event => this.setState({ newRpc: event.target.value }), |
|
|
|
onKeyPress: event => { |
|
|
|
onKeyPress: event => { |
|
|
|
if (event.key === 'Enter') { |
|
|
|
if (event.key === 'Enter') { |
|
|
@ -164,7 +165,7 @@ class Settings extends Component { |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
this.validateRpc(this.state.newRpc) |
|
|
|
this.validateRpc(this.state.newRpc) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, 'Save'), |
|
|
|
}, t('save')), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]) |
|
|
|
]) |
|
|
@ -180,9 +181,9 @@ class Settings extends Component { |
|
|
|
const appendedRpc = `http://${newRpc}` |
|
|
|
const appendedRpc = `http://${newRpc}` |
|
|
|
|
|
|
|
|
|
|
|
if (validUrl.isWebUri(appendedRpc)) { |
|
|
|
if (validUrl.isWebUri(appendedRpc)) { |
|
|
|
displayWarning('URIs require the appropriate HTTP/HTTPS prefix.') |
|
|
|
displayWarning(t('uriErrorMsg')) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
displayWarning('Invalid RPC URI') |
|
|
|
displayWarning(t('invalidRPC')) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -194,7 +195,7 @@ class Settings extends Component { |
|
|
|
h('div', 'State Logs'), |
|
|
|
h('div', 'State Logs'), |
|
|
|
h( |
|
|
|
h( |
|
|
|
'div.settings__content-description', |
|
|
|
'div.settings__content-description', |
|
|
|
'State logs contain your public account addresses and sent transactions.' |
|
|
|
t('stateLogsDescription') |
|
|
|
), |
|
|
|
), |
|
|
|
]), |
|
|
|
]), |
|
|
|
h('div.settings__content-item', [ |
|
|
|
h('div.settings__content-item', [ |
|
|
@ -203,13 +204,13 @@ class Settings extends Component { |
|
|
|
onClick (event) { |
|
|
|
onClick (event) { |
|
|
|
window.logStateString((err, result) => { |
|
|
|
window.logStateString((err, result) => { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
this.state.dispatch(actions.displayWarning('Error in retrieving state logs.')) |
|
|
|
this.state.dispatch(actions.displayWarning(t('stateLogError'))) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
exportAsFile('MetaMask State Logs.json', result) |
|
|
|
exportAsFile('MetaMask State Logs.json', result) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, 'Download State Logs'), |
|
|
|
}, t('downloadStateLogs')), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]) |
|
|
|
]) |
|
|
@ -229,7 +230,7 @@ class Settings extends Component { |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
revealSeedConfirmation() |
|
|
|
revealSeedConfirmation() |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, 'Reveal Seed Words'), |
|
|
|
}, t('revealSeedWords')), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]) |
|
|
|
]) |
|
|
@ -249,7 +250,7 @@ class Settings extends Component { |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
setFeatureFlagToBeta() |
|
|
|
setFeatureFlagToBeta() |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, 'Use old UI'), |
|
|
|
}, t('useOldUI')), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]) |
|
|
|
]) |
|
|
@ -268,7 +269,7 @@ class Settings extends Component { |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
showResetAccountConfirmationModal() |
|
|
|
showResetAccountConfirmationModal() |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, 'Reset Account'), |
|
|
|
}, t('resetAccount')), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]), |
|
|
|
]) |
|
|
|
]) |
|
|
@ -445,3 +446,4 @@ const mapDispatchToProps = dispatch => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(Settings) |
|
|
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(Settings) |
|
|
|
|
|
|
|
|
|
|
|