mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 04:20:53 +01:00
set last provider when switching to a customRPC (#10084)
This commit is contained in:
parent
53d50b509f
commit
ce70c86774
@ -40,6 +40,9 @@ function mapDispatchToProps(dispatch) {
|
||||
setProviderType: (type) => {
|
||||
dispatch(actions.setProviderType(type))
|
||||
},
|
||||
setPreviousProvider: (type) => {
|
||||
dispatch(actions.setPreviousProvider(type))
|
||||
},
|
||||
setRpcTarget: (target, chainId, ticker, nickname) => {
|
||||
dispatch(actions.setRpcTarget(target, chainId, ticker, nickname))
|
||||
},
|
||||
@ -82,6 +85,7 @@ class NetworkDropdown extends Component {
|
||||
setRpcTarget: PropTypes.func.isRequired,
|
||||
hideNetworkDropdown: PropTypes.func.isRequired,
|
||||
setNetworksTabAddMode: PropTypes.func.isRequired,
|
||||
setPreviousProvider: PropTypes.func.isRequired,
|
||||
setSelectedSettingsRpcUrl: PropTypes.func.isRequired,
|
||||
frequentRpcListDetail: PropTypes.array.isRequired,
|
||||
networkDropdownOpen: PropTypes.bool.isRequired,
|
||||
@ -112,6 +116,10 @@ class NetworkDropdown extends Component {
|
||||
}
|
||||
|
||||
renderCustomRpcList(rpcListDetail, provider) {
|
||||
const {
|
||||
provider: { type: providerType },
|
||||
setPreviousProvider,
|
||||
} = this.props
|
||||
const reversedRpcListDetail = rpcListDetail.slice().reverse()
|
||||
|
||||
return reversedRpcListDetail.map((entry) => {
|
||||
@ -125,6 +133,7 @@ class NetworkDropdown extends Component {
|
||||
closeMenu={() => this.props.hideNetworkDropdown()}
|
||||
onClick={() => {
|
||||
if (isPrefixedFormattedHexString(chainId)) {
|
||||
setPreviousProvider(providerType)
|
||||
this.props.setRpcTarget(rpcUrl, chainId, ticker, nickname)
|
||||
} else {
|
||||
this.props.displayInvalidCustomNetworkAlert(nickname || rpcUrl)
|
||||
|
Loading…
Reference in New Issue
Block a user