The network controller method `setProviderType` is now async, and the
async operation `_setProviderConfig` called at the end of the method is
now awaited.
Because the only async operation was the last step, this should have no
impact upon the flow of execution. The only functional change is that
now any callers have the option of waiting until the network switch
operation has completed.
One such change was made, in the `switch-ethereum-chain` middleware. As
a result, an error thrown while the network is switching will now
be thrown in this middleware and returned to the dapp as an internal
error.
Relates to https://github.com/MetaMask/metamask-extension/issues/18587
* Consolidate network stores
The network controller used to have multiple different state stores,
which were composed together to form the main controller state store.
They have been consolidated into a single store. This required few
changes because most state access was already being done through the
composed store.
Fixes https://github.com/MetaMask/metamask-extension/issues/18303
* Add JSDoc comment
Internal network controller methods and fields are now private fields,
using the JavaScript `#` syntax rather than the `private` TypeScript
keyword or a leading underscore.
The one reference to a private field was in the preferences controller
unit tests. Fortunately it was being used to create a test fixture that
was unused. The unnecessary test fixtures have been removed from that
test suite.
Fixes https://github.com/MetaMask/metamask-extension/issues/18588
The network controller internal method `_setProviderConfig` has been
made async, the async `_switchNetwork` operation is now `await`-ed.
Since the `_switchNetwork` call was the last operation, this has zero
functional impact.
Relates to https://github.com/MetaMask/metamask-extension/issues/18587
* Remove the network controller `previousProviderStore`
The `previousProvider` network controller state has been replaced with
a private internal property. This was only used internally, it did not
need to be part of state.
This relates to https://github.com/MetaMask/metamask-extension/issues/18303
* Remove redundant tests
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
* WIP commit
* Moving copy out of messages.json, styling changes
* handling scroll button click and disable logic
* moving scrollButton up to popover component, adding logic for accepting terms of use in popover and onboarding flows
* adding terms of use to e2e wallet creation/import
* adjusting failing unit test
* fixing QR code e2e
* updating welcome test
* setting app state in fixtures
* Update app/scripts/controllers/app-state.js
removing console log
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Update ui/components/app/terms-of-use-popup/terms-of-use-popup.stories.js
adding args to ToU popup storybook
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Update ui/components/app/terms-of-use-popup/terms-of-use-popup.js
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* updating DS components in terms of use
* popover styling changes
* adding metametrics tracking
* editing scrollbutton behavior
* adding unit test
* code fencing
---------
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
In order to be able to better compare differences between the version of
NetworkController in this repo and the version in the `core` repo before
we replace this version with the `core` version, this commit converts
the NetworkController network client tests to TypeScript.
The added types here are copied from the `core` repo. We plan on
making more improvements on the `core` side at some point to polish the
tests and types and reduce some of the duplication, but for now we're
just trying to keep things as similar as possible.
* UX: Multichain: App header
* Export app header, provide required information, put feature flag in place
* Provide available data
* Implement account picker -- centered and opens account popover
* Remove backgrounds, use isUnlocked
* Fix placement of the global menu
* Show logo when unlocked
* Add selector for getting current network, provide props to AvatarNetwork and PickerNetwork
* Wire up the network menu to the header
* fixed ui for all the screens
* updated story for header
* fixed import and header settings
* updated lint error
* fixed tests
* updated header
* removed test
* updated snapshot test
* updated network menu
* updated changes
* removed comment from menu bar
* updated css
* updated test for network list menu
* updated stylesheet
* updated ButtonIcon import
---------
Co-authored-by: NidhiKJha <menidhikjha@gmail.com>
This helps us more easily compare the unit tests for NetworkController
in this repo and the NetworkController in the `core` repo.
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
* update ButtonIcon to TS
lint updates
fix lint issues
add ref
fix as prop
test updates
* box and icon updates for support
* Update ui/components/component-library/text-field/README.mdx
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fix disabled
* update types for as
* update readme
* fix storybook
* george changes to button icon
* revert headerbase
* box prop back to HTMLElementTagNameMap
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
All controllers from the core monorepo have been updated to be equal to
or greater than the versions included in the v42 core release.
This release included a breaking change to all controllers because the
package `isomorphic-fetch` was removed. That package was used to ensure
that a `fetch` polyfill was present, so that the controllers could be
used in a non-browser context. This breaking change does not affect the
extension because we already install a `fetch` polyfill in our unit test
environment, and in a real build the real `fetch` API is present.
The gas fee controller had an additional breaking change: the EIP 1559
API endpoint is now a required argument. This does not affect the
extension because this argument was already being set.
The test `should transfer a single ERC721 NFT from one account to another`
has been failing intermittently. It seems to be failing due to a race
condition; the first render shows "Send Token" but later renders show
"Send TDC". The test only passes if it runs fast enough to read the
first render of the list item component.
The test has been updated to look for the text "Send TDC", which is
what the component shows from the second render onward.