mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +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)
|
||||
}
|
||||
|
||||
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) {
|
||||
this._baseProviderParams = _providerParams
|
||||
const { type, rpcTarget } = this.providerStore.getState()
|
||||
|
@ -355,7 +355,6 @@ module.exports = class MetamaskController extends EventEmitter {
|
||||
submitPassword: nodeify(keyringController.submitPassword, keyringController),
|
||||
|
||||
// network management
|
||||
setNetworkEndpoints: nodeify(networkController.setNetworkEndpoints, networkController),
|
||||
setProviderType: nodeify(networkController.setProviderType, networkController),
|
||||
setCustomRpc: nodeify(this.setCustomRpc, this),
|
||||
|
||||
|
@ -409,7 +409,6 @@ App.prototype.renderDropdown = function () {
|
||||
closeMenu: () => this.setState({ isMainMenuOpen: !isOpen }),
|
||||
onClick: () => {
|
||||
this.props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
||||
.then(() => this.props.dispatch(actions.setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
||||
},
|
||||
}, 'Try Beta!'),
|
||||
])
|
||||
@ -472,7 +471,6 @@ App.prototype.renderPrimary = function () {
|
||||
onClick: () => {
|
||||
global.platform.openExtensionInBrowser()
|
||||
props.dispatch(actions.setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
||||
.then(() => props.dispatch(actions.setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
||||
},
|
||||
style: {
|
||||
fontSize: '0.8em',
|
||||
|
@ -271,7 +271,6 @@ var actions = {
|
||||
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE',
|
||||
|
||||
// Network
|
||||
setNetworkEndpoints,
|
||||
updateNetworkEndpointType,
|
||||
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) {
|
||||
return {
|
||||
type: actions.UPDATE_NETWORK_ENDPOINT_TYPE,
|
||||
|
@ -349,7 +349,6 @@ const mapDispatchToProps = dispatch => {
|
||||
updateCurrentLocale: key => dispatch(actions.updateCurrentLocale(key)),
|
||||
setFeatureFlagToBeta: () => {
|
||||
return dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
||||
.then(() => dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))
|
||||
},
|
||||
showResetAccountConfirmationModal: () => {
|
||||
return dispatch(actions.showModal({ name: 'CONFIRM_RESET_ACCOUNT' }))
|
||||
|
@ -8,7 +8,6 @@ const {
|
||||
tryUnlockMetamask,
|
||||
forgotPassword,
|
||||
markPasswordForgotten,
|
||||
setNetworkEndpoints,
|
||||
setFeatureFlag,
|
||||
} = require('../../actions')
|
||||
const { ENVIRONMENT_TYPE_POPUP } = require('../../../../app/scripts/lib/enums')
|
||||
@ -146,7 +145,6 @@ class UnlockScreen extends Component {
|
||||
h('p.pointer', {
|
||||
onClick: () => {
|
||||
this.props.useOldInterface()
|
||||
.then(() => this.props.setNetworkEndpoints(OLD_UI_NETWORK_TYPE))
|
||||
},
|
||||
style: {
|
||||
fontSize: '0.8em',
|
||||
@ -168,7 +166,6 @@ UnlockScreen.propTypes = {
|
||||
isUnlocked: PropTypes.bool,
|
||||
t: PropTypes.func,
|
||||
useOldInterface: PropTypes.func,
|
||||
setNetworkEndpoints: PropTypes.func,
|
||||
}
|
||||
|
||||
const mapStateToProps = state => {
|
||||
@ -184,7 +181,6 @@ const mapDispatchToProps = dispatch => {
|
||||
tryUnlockMetamask: password => dispatch(tryUnlockMetamask(password)),
|
||||
markPasswordForgotten: () => dispatch(markPasswordForgotten()),
|
||||
useOldInterface: () => dispatch(setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL')),
|
||||
setNetworkEndpoints: type => dispatch(setNetworkEndpoints(type)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,6 @@ class InitializeMenuScreen extends Component {
|
||||
|
||||
showOldUI () {
|
||||
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 OldApp = require('../../old-ui/app/app')
|
||||
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 I18nProvider = require('./i18n-provider')
|
||||
|
||||
@ -24,11 +24,9 @@ function mapDispatchToProps (dispatch) {
|
||||
return {
|
||||
setFeatureFlagWithModal: () => {
|
||||
return dispatch(setFeatureFlag('betaUI', true, 'BETA_UI_NOTIFICATION_MODAL'))
|
||||
.then(() => dispatch(setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
||||
},
|
||||
setFeatureFlagWithoutModal: () => {
|
||||
return dispatch(setFeatureFlag('betaUI', true))
|
||||
.then(() => dispatch(setNetworkEndpoints(BETA_UI_NETWORK_TYPE)))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,6 @@ UnlockScreen.prototype.render = function () {
|
||||
h('p.pointer', {
|
||||
onClick: () => {
|
||||
this.props.dispatch(actions.setFeatureFlag('betaUI', false, 'OLD_UI_NOTIFICATION_MODAL'))
|
||||
.then(() => this.props.dispatch(actions.setNetworkEndpoints(OLD_UI_NETWORK_TYPE)))
|
||||
},
|
||||
style: {
|
||||
fontSize: '0.8em',
|
||||
|
@ -57,7 +57,6 @@ async function startApp (metamaskState, accountManager, opts) {
|
||||
|
||||
const useBetaUi = metamaskState.featureFlags.betaUI
|
||||
const networkEndpointType = useBetaUi ? BETA_UI_NETWORK_TYPE : OLD_UI_NETWORK_TYPE
|
||||
store.dispatch(actions.setNetworkEndpoints(networkEndpointType))
|
||||
|
||||
// if unconfirmed txs, start on txConf page
|
||||
const unapprovedTxsAll = txHelper(metamaskState.unapprovedTxs, metamaskState.unapprovedMsgs, metamaskState.unapprovedPersonalMsgs, metamaskState.unapprovedTypedMessages, metamaskState.network)
|
||||
|
Loading…
Reference in New Issue
Block a user