mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 12:29:06 +01:00
network - remove setNetworkEndpoints
This commit is contained in:
parent
bfedd2776d
commit
6f316ca450
@ -38,19 +38,6 @@ module.exports = class NetworkController extends EventEmitter {
|
|||||||
this.on('networkDidChange', this.lookupNetwork)
|
this.on('networkDidChange', this.lookupNetwork)
|
||||||
}
|
}
|
||||||
|
|
||||||
async setNetworkEndpoints (version) {
|
|
||||||
if (version === this._networkEndpointVersion) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this._networkEndpointVersion = version
|
|
||||||
this._networkEndpoints = getNetworkEndpoints(version)
|
|
||||||
this._defaultRpc = this._networkEndpoints[DEFAULT_NETWORK]
|
|
||||||
const { type } = this.getProviderConfig()
|
|
||||||
|
|
||||||
return this.setProviderType(type, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
initializeProvider (_providerParams) {
|
initializeProvider (_providerParams) {
|
||||||
this._baseProviderParams = _providerParams
|
this._baseProviderParams = _providerParams
|
||||||
const { type, rpcTarget } = this.providerStore.getState()
|
const { type, rpcTarget } = this.providerStore.getState()
|
||||||
|
@ -355,7 +355,6 @@ module.exports = class MetamaskController extends EventEmitter {
|
|||||||
submitPassword: nodeify(keyringController.submitPassword, keyringController),
|
submitPassword: nodeify(keyringController.submitPassword, keyringController),
|
||||||
|
|
||||||
// network management
|
// network management
|
||||||
setNetworkEndpoints: nodeify(networkController.setNetworkEndpoints, networkController),
|
|
||||||
setProviderType: nodeify(networkController.setProviderType, networkController),
|
setProviderType: nodeify(networkController.setProviderType, networkController),
|
||||||
setCustomRpc: nodeify(this.setCustomRpc, this),
|
setCustomRpc: nodeify(this.setCustomRpc, this),
|
||||||
|
|
||||||
|
@ -409,7 +409,6 @@ App.prototype.renderDropdown = function () {
|
|||||||
closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
|
closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
this.props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
||||||
.then(() => this.props.dispatch(actions.setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
|
||||||
},
|
},
|
||||||
}, 'Try Beta!'),
|
}, 'Try Beta!'),
|
||||||
])
|
])
|
||||||
@ -472,7 +471,6 @@ App.prototype.renderPrimary = function () {
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
global.platform.openExtensionInBrowser()
|
global.platform.openExtensionInBrowser()
|
||||||
props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
||||||
.then(() => props.dispatch(actions.setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
fontSize: '0.8em',
|
fontSize: '0.8em',
|
||||||
|
@ -271,7 +271,6 @@ var actions = {
|
|||||||
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE',
|
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE',
|
||||||
|
|
||||||
// Network
|
// Network
|
||||||
setNetworkEndpoints,
|
|
||||||
updateNetworkEndpointType,
|
updateNetworkEndpointType,
|
||||||
UPDATE_NETWORK_ENDPOINT_TYPE: 'UPDATE_NETWORK_ENDPOINT_TYPE',
|
UPDATE_NETWORK_ENDPOINT_TYPE: 'UPDATE_NETWORK_ENDPOINT_TYPE',
|
||||||
|
|
||||||
@ -1922,23 +1921,6 @@ function setLocaleMessages (localeMessages) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setNetworkEndpoints (networkEndpointType) {
|
|
||||||
return dispatch => {
|
|
||||||
log.debug('background.setNetworkEndpoints')
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
background.setNetworkEndpoints(networkEndpointType, err => {
|
|
||||||
if (err) {
|
|
||||||
dispatch(actions.displayWarning(err.message))
|
|
||||||
return reject(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch(actions.updateNetworkEndpointType(networkEndpointType))
|
|
||||||
resolve(networkEndpointType)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateNetworkEndpointType (networkEndpointType) {
|
function updateNetworkEndpointType (networkEndpointType) {
|
||||||
return {
|
return {
|
||||||
type: actions.UPDATE_NETWORK_ENDPOINT_TYPE,
|
type: actions.UPDATE_NETWORK_ENDPOINT_TYPE,
|
||||||
|
@ -349,7 +349,6 @@ const mapDispatchToProps = dispatch => {
|
|||||||
updateCurrentLocale: key => dispatch(actions.updateCurrentLocale(key)),
|
updateCurrentLocale: key => dispatch(actions.updateCurrentLocale(key)),
|
||||||
setFeatureFlagToBeta: () => {
|
setFeatureFlagToBeta: () => {
|
||||||
return dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
return dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
||||||
.then(() => dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))
|
|
||||||
},
|
},
|
||||||
showResetAccountConfirmationModal: () => {
|
showResetAccountConfirmationModal: () => {
|
||||||
return dispatch(actions.showModal({ name: 'CONFIRM_RESET_ACCOUNT' }))
|
return dispatch(actions.showModal({ name: 'CONFIRM_RESET_ACCOUNT' }))
|
||||||
|
@ -8,7 +8,6 @@ const {
|
|||||||
tryUnlockMetamask,
|
tryUnlockMetamask,
|
||||||
forgotPassword,
|
forgotPassword,
|
||||||
markPasswordForgotten,
|
markPasswordForgotten,
|
||||||
setNetworkEndpoints,
|
|
||||||
setFeatureFlag,
|
setFeatureFlag,
|
||||||
} = require('../../actions')
|
} = require('../../actions')
|
||||||
const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
|
const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
|
||||||
@ -146,7 +145,6 @@ class UnlockScreen extends Component {
|
|||||||
h('p.pointer', {
|
h('p.pointer', {
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.props.useOldInterface()
|
this.props.useOldInterface()
|
||||||
.then(() => this.props.setNetworkEndpoints(OLD_UI_NETWORK_TYPE))
|
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
fontSize: '0.8em',
|
fontSize: '0.8em',
|
||||||
@ -168,7 +166,6 @@ UnlockScreen.propTypes = {
|
|||||||
isUnlocked: PropTypes.bool,
|
isUnlocked: PropTypes.bool,
|
||||||
t: PropTypes.func,
|
t: PropTypes.func,
|
||||||
useOldInterface: PropTypes.func,
|
useOldInterface: PropTypes.func,
|
||||||
setNetworkEndpoints: PropTypes.func,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
@ -184,7 +181,6 @@ const mapDispatchToProps = dispatch => {
|
|||||||
tryUnlockMetamask: password => dispatch(tryUnlockMetamask(password)),
|
tryUnlockMetamask: password => dispatch(tryUnlockMetamask(password)),
|
||||||
markPasswordForgotten: () => dispatch(markPasswordForgotten()),
|
markPasswordForgotten: () => dispatch(markPasswordForgotten()),
|
||||||
useOldInterface: () => dispatch(setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL')),
|
useOldInterface: () => dispatch(setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL')),
|
||||||
setNetworkEndpoints: type => dispatch(setNetworkEndpoints(type)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,6 @@ class InitializeMenuScreen extends Component {
|
|||||||
|
|
||||||
showOldUI () {
|
showOldUI () {
|
||||||
this.props.dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
this.props.dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
||||||
.then(() => this.props.dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ const { HashRouter } = require('react-router-dom')
|
|||||||
const App = require('./app')
|
const App = require('./app')
|
||||||
const OldApp = require('../../old-ui/app/app')
|
const OldApp = require('../../old-ui/app/app')
|
||||||
const { autoAddToBetaUI } = require('./selectors')
|
const { autoAddToBetaUI } = require('./selectors')
|
||||||
const { setFeatureFlag, setNetworkEndpoints } = require('./actions')
|
const { setFeatureFlag } = require('./actions')
|
||||||
const { BETA_UI_NETWORK_TYPE } = require('../../app/scripts/controllers/network/enums')
|
const { BETA_UI_NETWORK_TYPE } = require('../../app/scripts/controllers/network/enums')
|
||||||
const I18nProvider = require('./i18n-provider')
|
const I18nProvider = require('./i18n-provider')
|
||||||
|
|
||||||
@ -24,11 +24,9 @@ function mapDispatchToProps (dispatch) {
|
|||||||
return {
|
return {
|
||||||
setFeatureFlagWithModal: () => {
|
setFeatureFlagWithModal: () => {
|
||||||
return dispatch(setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
return dispatch(setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
||||||
.then(() => dispatch(setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
|
||||||
},
|
},
|
||||||
setFeatureFlagWithoutModal: () => {
|
setFeatureFlagWithoutModal: () => {
|
||||||
return dispatch(setFeatureFlag('betaUI', true))
|
return dispatch(setFeatureFlag('betaUI', true))
|
||||||
.then(() => dispatch(setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,6 @@ UnlockScreen.prototype.render = function () {
|
|||||||
h('p.pointer', {
|
h('p.pointer', {
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
this.props.dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
this.props.dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
||||||
.then(() => this.props.dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))
|
|
||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
fontSize: '0.8em',
|
fontSize: '0.8em',
|
||||||
|
@ -57,7 +57,6 @@ async function startApp (metamaskState, accountManager, opts) {
|
|||||||
|
|
||||||
const useBetaUi = metamaskState.featureFlags.betaUI
|
const useBetaUi = metamaskState.featureFlags.betaUI
|
||||||
const networkEndpointType = useBetaUi ? BETA_UI_NETWORK_TYPE : OLD_UI_NETWORK_TYPE
|
const networkEndpointType = useBetaUi ? BETA_UI_NETWORK_TYPE : OLD_UI_NETWORK_TYPE
|
||||||
store.dispatch(actions.setNetworkEndpoints(networkEndpointType))
|
|
||||||
|
|
||||||
// if unconfirmed txs, start on txConf page
|
// if unconfirmed txs, start on txConf page
|
||||||
const unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.unapprovedPersonalMsgs, metamaskState.unapprovedTypedMessages, metamaskState.network)
|
const unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.unapprovedPersonalMsgs, metamaskState.unapprovedTypedMessages, metamaskState.network)
|
||||||
|
Loading…
Reference in New Issue
Block a user