This test for the `destroy` method in NetworkController uses `toBe` on
the core side because the use of `toBeTruthy` produces a lint warning
there. It doesn't here, but it's good to be consistent anyway so that
comparing the differences in NetworkController tests between this
extension and core is easier.
This controller action exists within the core version of
NetworkController. Although there are no plans to make use of this
action within the extension, it has accompanying tests. So ultimately,
the goal of this commit (like others) is to make it easier to compare
differences in the NetworkController tests between this repo and core
by adding a test for the `getProviderConfig` action.
* Add Snaps privacy warning on snap install
Add snap install warning status to storage
Add storybook
Add test for snap-privacy-warning
Resolve button type issue
Fix popup display logic
Update fixture
Update popup information and read more handling
Replace deprecated button
Update unit test
* Update buttons and add cancel flow
* Refactoring (review 1)
* Add more unit tests
In the `core` version of this controller, event types are not held in an
enum but are specified directly as strings instead.
Simplifying the event types will make it easier to compare the
NetworkController unit tests between extension and core.
This makes it possible to test that mock functions are called the
correct amount of times (otherwise Jest will think that a mock function
has been called for as many tests as exist in the NetworkController unit
test suite).
On the `core` side, the tests for `NetworkController.initializeProvider`
use the `lookupNetworkTests` to automatically test the `lookupNetwork`
behavior that `initializeProvider` initiates. This commit makes use of
the helper to bring the tests closer to the `core` version.
The NetworkController tests in the `core` repo use a `refreshNetwork`
test helper to exercise the behavior performed by various methods
when switching the network. This commit brings over this test helper and
refactors tests for those methods to use it.
import account without password
---------
Co-authored-by: Mike B <32695229+plasmacorral@users.noreply.github.com>
Co-authored-by: Gustavo Antunes <17601467+gantunesr@users.noreply.github.com>
Co-authored-by: Howard Braham <howrad@gmail.com>
* Added code fences to the following controllers: app-state, metametrics, preferences
* Fixed prettier
* Updated code to be align with new changes in MMI
* Changing code fences
* Remove uneeded files
* Fixed tests
* Fixed code fence
* Changing logic to use async/await
* Removed accountAddress
* Reverted code from develop
* Added code fences for account menu
* updates test and messages json
* clean up
* icons
* icons color correct
* icon size fix
* icon size fix
* adds mmi entries and updates to the new IconName
* clean up
* lint
* clean up
* prettier
* prettier
* camel case
---------
Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net>
Co-authored-by: António Regadas <apregadas@gmail.com>
Hex and number responses from the `net_version` request are now
accepted. While most chains return decimal strings for this request,
some chains were returning hex responses instead and failing our
validation for this request (which was added in v10.30.0). This
resolves that problem.
Support for number responses was added because it likely worked in
older versions as well, so support is maintained to avoid similar
problems.
Fixes#19151
The `lookupNetwork` unit tests have been updated to expand test
coverage and match the unit tests for the core network controller. A
helper function `lookupNetworkTests` has been copied from core. It
covers most of the behavior of the function. Vidation tests and
functional tests not covered in core have been retained, but any tests
that are now redundant have been deleted.
Relates to #1197
The detection of the Infura "blocked" status has been updated to apply
only to built-in networks. The message we show to users in this state
is meant only for Infura; we don't want to show it for third-party RPC
APIs that happen to use the same error response.
This brings the network controller further in alignment with the core
network controller.
This isn't tested, but it was found in the course of porting unit tests
from core to extension. It will be covered by these tests, which will
be added in the next PR.
NetworkController doesn't handle `eth_subscribe` or `eth_unsubscribe`
specially, but as it's supported by Infura, we want to make sure we
exercise these RPC methods in the network client tests, even if it is
just to ensure that they get passed through to the network.
We had tests for these RPC methods, but they were commented out in
c095b1accd when the network client code
was extracted to a separate file. At the time we were considering adding
subscription- and filter-based middleware to NetworkController, and so
we commented out the tests for `eth_subscribe` and `eth_unsubscribe`
temporarily until we could rewrite them in a way that would exercise the
new middleware. We reverted that change in
bd23a49013, which meant that we could
restore the existing tests, but it appears that this task was not caught
during review. This commit takes care of restoring them.
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
We now set the network status to "unknown" rather than "unavailable"
when the network ID is invalid. This better reflects what we know when
this happens, and it makes the network controller better aligned with
the core network controller.
This was accomplished by using a regular error for the network ID
assertion rather than using `assert` directly. `assert` would throw an
error with a `code` property, which resutled in us treating it like an
RPC error.
This isn't tested, but it was found in the course of porting unit tests
from core to extension. It will be covered by these tests, which will
be added in the next PR.
This change should have no functional impact because we treat these two
network statuses as equivalent. The distinction between unknown and
unavailable is useful only for debugging.
* added eth sign first step
* added modal
* added validation for form
* updated width with block
* added state trigger for toggle
* updated Eth sign modal text changes
* added eth sign toggle tex
* removed unnecessary code
* fixed form validation text
* updated eth toggle text
* added test
* added analytics
* updated design changes
* lint fix
* updated error text
* updated changes
* UX: Multichain: Implement Account Details Popover
* Styling account details popover
* using ButtonSecondary with variant, removing Text
* adding account-details jest test
* Close popover when outside area clicked
* Move all export functionality into the popover
* Improve jest tests
* Implement new design for export key screens
* Hide warning when popover is closed
* Vertically align the copy button
* Move AccountDetailsDisplay to its own file
* Move authentication to its own file
* Move private key to its own component
* Fix misalignment of avatar on display screen
* Move private key to its own component
* Update ui/components/multichain/account-details/account-details-authenticate.js
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Update ui/components/multichain/account-details/account-details.test.js
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Prevent account name overflow, update text size
* Use FormTextField
* Add analytics
* Move location of accountDetailsAddress
* Ensure passsword input is used
---------
Co-authored-by: Victor Thomas <10986371+vthomas13@users.noreply.github.com>
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Rename `provider` to `providerConfig`
The network controller `provider` state has been renamed to
`providerConfig`. This better reflects what this state is, and makes
this controller more closely aligned with the core network controller.
All references to the provider configuration have been updated to
prefer `providerConfig` over `provider`, to make the distinction clear
between a provider and provider config.
Closes#18902
* Add migration
* Simplify network controller unit test setup
The network controller unit tests have been refactored to simplify the
setup steps related to the controller messenger. The messenger is now
constructed by the `withController` helper function, rather than being
manually setup in each test that references it.
Relates to https://github.com/MetaMask/core/issues/1197
* Bring tests closer in alignment to core
The function to build default controller constructor parameters has
been removed, bringing these tests closer in alignment to the core
tests.