mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Make _switchNetwork
async (#18597)
The network controller internal method `_switchNetwork` has been made async, and the `lookupNetwork` call is now awaited. Because this method is only used internally, and because the `await`-ed async operation was the last operation in this function, this change has no functional impact whatsoever. Relates to https://github.com/MetaMask/metamask-extension/issues/18587
This commit is contained in:
parent
40e4a3653f
commit
d85d2318a3
@ -904,14 +904,14 @@ export class NetworkController extends EventEmitter {
|
|||||||
* @param providerConfig - The provider configuration object that specifies
|
* @param providerConfig - The provider configuration object that specifies
|
||||||
* the new network.
|
* the new network.
|
||||||
*/
|
*/
|
||||||
_switchNetwork(providerConfig: ProviderConfiguration): void {
|
async _switchNetwork(providerConfig: ProviderConfiguration) {
|
||||||
this.messenger.publish(NetworkControllerEventType.NetworkWillChange);
|
this.messenger.publish(NetworkControllerEventType.NetworkWillChange);
|
||||||
this._resetNetworkId();
|
this._resetNetworkId();
|
||||||
this._resetNetworkStatus();
|
this._resetNetworkStatus();
|
||||||
this._resetNetworkDetails();
|
this._resetNetworkDetails();
|
||||||
this._configureProvider(providerConfig);
|
this._configureProvider(providerConfig);
|
||||||
this.messenger.publish(NetworkControllerEventType.NetworkDidChange);
|
this.messenger.publish(NetworkControllerEventType.NetworkDidChange);
|
||||||
this.lookupNetwork();
|
await this.lookupNetwork();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user