1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00
metamask-extension/app/scripts/controllers
Elliot Winkler 89cec5335f
Replace NetworkController w/ core version (#19486)
This commit fulfills a long-standing desire to get the extension using
the same network controller as mobile by removing NetworkController from
this repo and replacing it with NetworkController from the
`@metamask/network-controller` package.

The new version of NetworkController is different the old one in a few
ways:

- The new controller inherits from BaseControllerV2, so the `state`
  property is used to access the state instead of `store.getState()`.
  All references of the latter have been replaced with the former.
- As the new controller no longer has a `store` property, it cannot be
  subscribed to; the controller takes a messenger which can be
  subscribed to instead. There were various places within
  MetamaskController where the old way of subscribing has been replaced
  with the new way. In addition, DetectTokensController has been updated
  to take a messenger object so that it can listen for NetworkController
  state changes.
- The state of the new controller is not updatable from the outside.
  This affected BackupController, which dumps state from
  NetworkController (among other controllers), but also loads the same
  state into NetworkController on import. A method `loadBackup` has been
  added to NetworkController to facilitate this use case, and
  BackupController is now using this method instead of attempting to
  call `update` on NetworkController.
- The new controller does not have a `getCurrentChainId` method;
  instead, the chain ID can be read from the provider config in state.
  This affected MmiController. (MmiController was also updated to read
  custom networks from the new network controller instead of the
  preferences controller).
- The default network that the new controller is set to is always
  Mainnet (previously it could be either localhost or Goerli in test
  mode, depending on environment variables). This has been addressed
  by feeding the NetworkController initial state using the old logic, so
  this should not apply.
2023-06-22 12:46:09 -06:00
..
ens Fix/use etherjs specific imports (#15461) 2023-01-24 08:10:36 -06:00
permissions Make eth_accounts return all permitted accounts (#18516) 2023-06-08 13:01:43 -07:00
transactions feat: add new linea mainnet network (#19326) 2023-06-16 14:05:33 -02:30
alert.js feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00
app-state.js Fix autolock field to accept decimals in Firefox (#19653) 2023-06-22 10:29:24 -06:00
app-state.test.js [FLASK] Add Snaps privacy warning on snap install (#18835) 2023-05-31 14:43:39 +02:00
backup.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00
backup.test.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00
cached-balances.js remove exclusions for mismatched object jsdoc type casing (#15351) 2022-07-27 08:28:05 -05:00
cached-balances.test.js Deprecating the Rinkeby, Ropsten, and Kovan test networks (#15989) 2022-09-28 20:26:01 -07:00
decrypt-message.test.ts Consume Decrypt Message Manager from @metamask/message-manager (#18379) 2023-04-26 17:02:33 +02:00
decrypt-message.ts Accept SignController approval request from frontend (#19184) 2023-06-20 15:37:09 +02:00
detect-tokens.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00
detect-tokens.test.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00
encryption-public-key.test.ts Return state when calling EncryptionPublicKeyController.cancelEncryptionPublicKey (#18845) 2023-04-27 11:39:37 +01:00
encryption-public-key.ts Accept SignController approval request from frontend (#19184) 2023-06-20 15:37:09 +02:00
incoming-transactions.js Additional incoming transactions support (#14219) 2023-02-14 12:35:42 -06:00
incoming-transactions.test.js Additional incoming transactions support (#14219) 2023-02-14 12:35:42 -06:00
metametrics.js [MMI] Added code fences to the following controllers: app-state, metametrics, preferences (#17894) 2023-05-23 16:16:23 +02:00
metametrics.test.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00
mmi-controller.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00
mmi-controller.test.js [MMI] adds mmi code fences to mm controller (#18279) 2023-05-29 16:38:28 +01:00
onboarding.js Use async/await instead of Promise.resolve (#16221) 2023-01-20 14:20:18 -06:00
preferences.js feat: add new linea mainnet network (#19326) 2023-06-16 14:05:33 -02:30
preferences.test.js Make network controller internal fields private (#18607) 2023-04-17 12:45:33 -02:30
swaps.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00
swaps.test.js Replace NetworkController w/ core version (#19486) 2023-06-22 12:46:09 -06:00