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