1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/app
Elliot Winkler ed3cc404f2
NetworkController: Split network into networkId and networkStatus (#17556)
The `network` store of the network controller crams two types of data
into one place. It roughly tracks whether we have enough information to
make requests to the network and whether the network is capable of
receiving requests, but it also stores the ID of the network (as
obtained via `net_version`).

Generally we shouldn't be using the network ID for anything, as it has
been completely replaced by chain ID, which all custom RPC endpoints
have been required to support for over a year now. However, as the
network ID is used in various places within the extension codebase,
removing it entirely would be a non-trivial effort. So, minimally, this
commit splits `network` into two stores: `networkId` and
`networkStatus`. But it also expands the concept of network status.

Previously, the network was in one of two states: "loading" and
"not-loading". But now it can be in one of four states:

- `available`: The network is able to receive and respond to requests.
- `unavailable`: The network is not able to receive and respond to
  requests for unknown reasons.
- `blocked`: The network is actively blocking requests based on the
  user's geolocation. (This is specific to Infura.)
- `unknown`: We don't know whether the network can receive and respond
  to requests, either because we haven't checked or we tried to check
  and were unsuccessful.

This commit also changes how the network status is determined —
specifically, how many requests are used to determine that status, when
they occur, and whether they are awaited. Previously, the network
controller would make 2 to 3 requests during the course of running
`lookupNetwork`.

* First, if it was an Infura network, it would make a request for
  `eth_blockNumber` to determine whether Infura was blocking requests or
  not, then emit an appropriate event. This operation was not awaited.
* Then, regardless of the network, it would fetch the network ID via
  `net_version`. This operation was awaited.
* Finally, regardless of the network, it would fetch the latest block
  via `eth_getBlockByNumber`, then use the result to determine whether
  the network supported EIP-1559. This operation was awaited.

Now:

* One fewer request is made, specifically `eth_blockNumber`, as we don't
  need to make an extra request to determine whether Infura is blocking
  requests; we can reuse `eth_getBlockByNumber`;
* All requests are awaited, which makes `lookupNetwork` run fully
  in-band instead of partially out-of-band; and
* Both requests for `net_version` and `eth_getBlockByNumber` are
  performed in parallel to make `lookupNetwork` run slightly faster.
2023-03-30 16:49:12 -06:00
..
account-list-item Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
account-menu Fix aria label error on the console (#18370) 2023-03-30 18:33:42 +01:00
add-network Updating Typography to Text (#17681) 2023-03-28 15:04:22 -07:00
advanced-gas-controls Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
advanced-gas-fee-popover feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
advanced-gas-inputs Relocate conversion utils to shared/modules/conversion.utils.js (#17319) 2023-01-20 11:04:37 -06:00
alerts Refactor KeyringTypes constant (#17490) 2023-03-21 12:13:22 -02:30
app-header Move desktop code to flask build type (#17960) 2023-03-06 19:35:00 +00:00
app-loading-spinner swap hex colors in ui/components/app folder (#14189) 2022-03-25 08:32:36 -07:00
approve-content-card Part of 17670: Replace Typography with Text approve-content-card (#17753) 2023-02-16 18:33:35 -08:00
asset-list UX: Multichain: Added TokenList Component (#17859) 2023-03-23 15:38:33 +05:30
asset-list-item Upgrading the Import Account modal (#17763) 2023-03-06 09:48:28 -08:00
beta-header UX: Icon: Stop using fa-times (#17811) 2023-02-27 10:42:02 -06:00
cancel-button Final conversion of tests from enzyme to @testing-library/react (#16862) 2023-01-17 07:51:35 -08:00
cancel-speedup-popover feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
confirm-data Extract out confirm-data and confirm-hex-data components from confirm-transaction-base.component.js (#17822) 2023-03-09 10:38:37 +05:30
confirm-hexdata Extract out confirm-data and confirm-hex-data components from confirm-transaction-base.component.js (#17822) 2023-03-09 10:38:37 +05:30
confirm-page-container NetworkController: Split network into networkId and networkStatus (#17556) 2023-03-30 16:49:12 -06:00
confirm-subtitle Fix #18199 : Add fallbacks for confirmation title on NFT transfers (#18269) 2023-03-30 14:07:29 -02:30
confirm-title Extracting out title component from confirm-transaction-base (#17991) 2023-03-23 22:21:33 +04:00
confirmation-warning-modal Part of #17670: Replace Typography with Text component (#17959) 2023-03-15 17:00:54 -07:00
connected-accounts-list UX: Update three-dot icon for settings (#17558) 2023-02-15 08:39:46 -06:00
connected-accounts-permissions [FLASK] Redesign key management modal (#18263) 2023-03-29 15:17:57 -04:00
connected-sites-list Fix connected site styling (#15409) 2022-08-09 12:29:38 -05:00
connected-status-indicator feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
contact-list Token detection V2 Flag Removal and Re-introducing the use of legacy token list when token detection is OFF (#15138) 2022-08-09 22:56:25 -02:30
create-new-vault Part of #17670: Replace Typography with Text component (#17959) 2023-03-15 17:00:54 -07:00
currency-input Convert ui/helpers/constants/common to typescript (#17348) 2023-01-25 09:47:02 -06:00
custom-spending-cap UX Icon: updated fa-exclamation-circle (#17879) 2023-02-24 12:52:11 -06:00
desktop-enable-button identify desktop is paired in the metrics event (#17892) 2023-03-02 14:55:27 -06:00
detected-token feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
dropdowns NetworkController: Split network into networkId and networkStatus (#17556) 2023-03-30 16:49:12 -06:00
edit-gas-display Changed all Typography to Text component in welcome.js and edit-gas-display.component.js (#18116) 2023-03-21 23:47:59 +05:30
edit-gas-fee-button UX: Icons: Remove usage of chevron fa- icons (#17668) 2023-02-16 07:26:14 -06:00
edit-gas-fee-popover feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
edit-gas-popover feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00
flask [FLASK] Redesign key management modal (#18263) 2023-03-29 15:17:57 -04:00
gas-details-item feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
gas-timing Convert actions.js to typescript (#17446) 2023-02-03 11:56:44 -06:00
hold-to-reveal-button SRP hold to reveal (#17232) 2023-02-15 10:07:33 -08:00
home-notification Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
import-token-link Convert actions.js to typescript (#17446) 2023-02-03 11:56:44 -06:00
info-box Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
ledger-instruction-field feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
loading-network-screen feat: add the ConsenSys zkEVM (Linea) as a default network (#17875) 2023-03-21 13:58:38 -02:30
menu-bar UX: Multichain: Global Action Menu (#18158) 2023-03-28 14:59:18 -05:00
metamask-template-renderer feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
metamask-translation Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
modal Continue converting tests from enzyme to @testing-library/react. (#15941) 2022-09-23 09:41:35 -05:00
modals Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
multilayer-fee-message Remove usages of Conversion util in components folder in favor of Numeric (#17333) 2023-01-23 13:30:43 -06:00
multiple-notifications Update media query instances (#15068) 2022-08-04 09:03:02 -05:00
network-account-balance-header feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
network-display Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
nft-default-image NFT: Replaced all the instances of collectibles with NFTs (#17741) 2023-02-17 00:53:29 +05:30
nft-details Fix #17932 - Ensure NFT last sold price is formatted correctly (#17983) 2023-03-08 14:39:12 -06:00
nft-options NFT: Replaced all the instances of collectibles with NFTs (#17741) 2023-02-17 00:53:29 +05:30
nfts-detection-notice NFT: Replaced all the instances of collectibles with NFTs (#17741) 2023-02-17 00:53:29 +05:30
nfts-items Fix #17848 - Ensure NFT collections toggle appropriately (#17972) 2023-03-09 12:10:37 -06:00
nfts-tab NFT: Replaced all the instances of collectibles with NFTs (#17741) 2023-02-17 00:53:29 +05:30
permission-page-container [FLASK] BREAKING - snaps-monorepo@0.30.0 (#17718) 2023-03-08 13:29:23 -05:00
permissions-connect-footer Consolidating Zendesk URLs in to constants file (#15669) 2022-08-23 09:19:31 -05:00
permissions-connect-header [FLASK] Update snap authorship component (#18262) 2023-03-24 17:16:46 +01:00
permissions-connect-permission-list [FLASK] Add tooltips to show info about a permission (#17685) 2023-03-20 12:32:03 +01:00
qr-hardware-popover feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
recovery-phrase-reminder feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
security-provider-banner-message Open sea security provider warning message (#17662) 2023-02-23 08:38:09 -03:00
selected-account Updating Icon html element to span (#17790) 2023-02-22 14:42:50 -08:00
set-approval-for-all-warning UX: Icon: Remove fa-exclamation-triangle usages (#17691) 2023-02-23 15:20:07 -06:00
signature-request Fix for hovering any Address parsed on Signed Type Data screen does not display the pointer anymore (#18046) 2023-03-23 08:05:25 -02:30
signature-request-original Fix Signature Request scroll (#18305) 2023-03-23 16:04:24 -03:00
signature-request-siwe PermissionsConnectHeader: unlock SiteOrigin title (#18270) 2023-03-23 13:32:54 -03:00
srp-input feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
step-progress-bar Overall CSS #13441 (#13902) 2022-05-16 13:38:04 -05:00
tab-bar UX: Update Settings Icon (#17561) 2023-02-26 20:42:03 -06:00
token-cell UX: Multichain: Added TokenList Component (#17859) 2023-03-23 15:38:33 +05:30
token-list Integrate TokensController (#11552) 2021-09-10 12:37:19 -05:00
token-list-display Feat/hide 0 balances (#13306) 2022-02-02 12:32:16 +01:00
transaction-activity-log Migrate network configurations (previously frequentRpcListDetail) from PreferencesController to NetworkController (#17421) 2023-03-09 15:00:28 -06:00
transaction-alerts NetworkController: Split network into networkId and networkStatus (#17556) 2023-03-30 16:49:12 -06:00
transaction-breakdown Convert ui/helpers/constants/common to typescript (#17348) 2023-01-25 09:47:02 -06:00
transaction-decoding Fix for hovering any Address parsed on Signed Type Data screen does not display the pointer anymore (#18046) 2023-03-23 08:05:25 -02:30
transaction-detail feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00
transaction-detail-item feature: migrate design-system.ts (#17518) 2023-02-02 20:15:26 +00:00
transaction-icon Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
transaction-list Added storybook check to CI (#17092) 2023-01-21 00:57:46 +05:30
transaction-list-item Transaction-list-item-details pop up to display the correct token information on token approve item (#17422) 2023-02-24 14:21:55 -05:00
transaction-list-item-details Convert actions.js to typescript (#17446) 2023-02-03 11:56:44 -06:00
transaction-status-label Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
user-preferenced-currency-display Convert ui/helpers/constants/common to typescript (#17348) 2023-01-25 09:47:02 -06:00
user-preferenced-currency-input Continue converting tests from enzyme to @testing-library/react (#16175) 2022-10-20 11:20:49 -07:00
user-preferenced-token-input Continue converting tests from enzyme to @testing-library/react (#16175) 2022-10-20 11:20:49 -07:00
wallet-overview Disable Bridge button on unsupported networks (#18268) 2023-03-23 14:54:10 -02:30
whats-new-popup Adding NFT autodetection to "What's New" Announcements (#17653) 2023-03-14 11:07:58 -04:00
app-components.scss [FLASK] Update snap authorship component (#18262) 2023-03-24 17:16:46 +01:00
menu-droppo.js Convert unit test render from enzyme to @testing-library/react. (#15091) 2022-08-03 13:30:43 -07:00