1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Update NC setProviderType to clear rpcUrl/nickname (#18675)

In the core version of NetworkController, `setProviderType` sets
`rpcTarget` (its name for `rpcUrl`) and `nickname` to `undefined`.
While it would be better to completely remove these properties, it would
be better to follow suit so that we can make the tests between the two
versions of the controllers more alike.
This commit is contained in:
Elliot Winkler 2023-04-20 12:20:59 -06:00 committed by GitHub
parent f9f628690c
commit 73b9c1095a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -5006,10 +5006,10 @@ describe('NetworkController', () => {
expect(controller.store.getState().provider).toStrictEqual({
type: networkType,
rpcUrl: '',
rpcUrl: undefined,
chainId,
ticker,
nickname: '',
nickname: undefined,
rpcPrefs: { blockExplorerUrl },
});
},
@ -6975,10 +6975,10 @@ describe('NetworkController', () => {
await controller.setProviderType('goerli');
expect(controller.store.getState().provider).toStrictEqual({
type: 'goerli',
rpcUrl: '',
rpcUrl: undefined,
chainId: '0x5',
ticker: 'GoerliETH',
nickname: '',
nickname: undefined,
rpcPrefs: {
blockExplorerUrl: 'https://goerli.etherscan.io',
},

View File

@ -742,10 +742,10 @@ export class NetworkController extends EventEmitter {
const network = BUILT_IN_INFURA_NETWORKS[type];
await this.#setProviderConfig({
type,
rpcUrl: '',
rpcUrl: undefined,
chainId: network.chainId,
ticker: 'ticker' in network ? network.ticker : 'ETH',
nickname: '',
nickname: undefined,
rpcPrefs: { blockExplorerUrl: network.blockExplorerUrl },
});
}