* feat: add desktop enable button component
This component will be added
to the experimental page. Users
will then be able to initialize
a desktop connection
* feat: add desktop pairing page
* feat: add desktop deep-linking shared lib
* test: add initial entries to render helper
Allow specifying initialEntries for
MemoryRouter. This change will allow
testing pages that use the useParam
hook.
* feat: add desktop error page
Error page for any desktop pairing
related issue
* feat: add desktop routes to route component
* feat: add enable desktop button to experimental tab
* feat: add desktop icon when paired in dev mode
* feat: disable ledger live control when desktop enabled
* feat: register desktop error actions on ui init
* fix: add missing code fencing
* chore: remove enable desktop rpc middleware
Now that we are adding the UI
there's no need for this rpc middleware
(as it was used to test desktop background
code)
* fix: display experimental tab for desktop
The network controller has a variety of methods that just retrieve
controller state. These methods are not necessary because controller
state is already part of the public API of the controller and can be
accessed directly.
These methods are:
- getCurrentChainId
- getCurrentRpcUrl
- getNetworkIdentifier
- getNetworkState
- getProviderConfig
- isNetworkLoading
This is part of a larger effort to normalize the API of both network
controllers, to make them easier to merge.
Use DesktopManager in background script to redirect internal and external connections to the desktop app.
Include DesktopController in the MetaMask controller.
Support desktop keyrings in MetaMask controller via the overrides object.
Create middleware handler to connect to the desktop app while UI code is pending.
Add build system support for desktop specific configuration variables.
* refactor class to functional component
* update messages
* fix: use classnames
* feat: add hold to reveal modal
* feat: add new zendesk url for secret recovery phrase and noncustodial wallet
* update: clipboard to clear copied text after delay
* fix: remove save to csv
* feat: update styles for reveal seed page
* fix: update reveal seed snapshot
* add test to check for modal
* fix: lint
* fix: unused messages locale
* fix: use new banner component
* fix: use new button from design system
* fix: update snapshot
* fix: lint
* revert text
* fix: lint
* fix: remove --copy-only
* fix: marginBottom prop value
* fix: iconName and prop error
* --made the QR code slightly smaller so it's less likely to have a scrollbar
--updated the snapshots
* fix: error message not displaying
* SRP hold to reveal using more DS components (#17583)
* Updating to add DS components and remove CSS
* Fixing rendered html and removing some unneeded props
* fix: set block to true
---------
Co-authored-by: Monte <monte.lai@consensys.net>
* fix: add descriptions to messages
* Update ui/components/ui/export-text-container/export-text-container.component.js
fix: lint
Co-authored-by: HowardBraham <HowardBraham@users.noreply.github.com>
* fix: remove using displayWarning in requestRevealSeedWords
* fix: update test to remove displayError
* fix: update design system enums
* fix: messages descriptions
* fix: banner to banneralert
* fix: update preview
* add additional tests
* fix: use jest instead of sinon
* add test if long press isn't completed
* add test if password is wrong
---------
Co-authored-by: Howard Braham <howrad@gmail.com>
Co-authored-by: George Marshall <george.marshall@consensys.net>
The network controller has some tests, but they are incomplete and don't
follow our latest best practices for writing unit tests.
This commit greatly increases the amount of test coverage for the API
that we want to retain in NetworkController, in particular the seemingly
myriad paths that the code takes starting from `initializeProvider`,
`resetConnection`, `setRpcTarget`, `setProviderType`,
`rollbackToPreviousProvider`, and `lookupNetwork`.
There were a couple of pieces of logic I noted which don't seem to have
any effect due to being redundant or unreachable, but they also don't
make our lives more difficult, either, so I opted to leave them in.
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Zachary Belford <belfordz66@gmail.com>
* detect and track ui customizations on personal sign requests
* add feature flag check to metrics
* clean up comments
* get data only if it exists
* updated with PR feedback
* moved constants
* lint
* Apply suggestions from code review
Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
---------
Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
This package has been updated to reduce the bundle size (we already use
the v4 version indirectly). The only breaking change applicable to the
usage of this package in the extension is to the package's exports. The
one import line has been updated accordingly.
This update comes with types (v3 was the TypeScript migration).
* Added translation for eth sign toggle
* Disabled the ability to call eth_sign by default. Added ability within advanced settings to renable support for eth_sign
* Add test case for eth_sign being enabled and disabled
* Modified copy
* Moved rpc method preference to its own object within store
* Complete work on moving rpc method preference into its own object within store
* Fix with prettier
* Fix lint
* Fix a unit test
* Fix test
* Renamed function and object keys to be more intuitive
* Fix e2e test
* Enabled eth_sign through preferences fixture
* Fix lint
* Fix e2e test
Wait for the notification popup to close, leaving 2 window handles the extension and the test dapp
* Fix e2e test
* Fix unit test
Enable eth_sign method
* Lint fix
---------
Co-authored-by: PeterYinusa <peter.yinusa@consensys.net>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
* Add hardcoded list of human-readable snap names
* Make the text properly bold
* Small style fixes to approval screen
* Run yarn lint:fix
* Update snapshots
Any methods in the Ethereum JSON-RPC spec are now included in our
network client tests. These tests were skipped previously because they
are not supported by Infura.
Closes#16938
* Adding browser outdated notification
* updating dependency
* adding unit tests for util function
* adding unit tests for selectors, lintfix
* Added Tests, refactored notification delay logic
* lint:fix
* adding test coverage for method parameter
* Update app/scripts/controllers/app-state.js
adding documentation details
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* moving declaration into test
* Update app/scripts/controllers/app-state.test.js
spacing in test file
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Update jest.config.js
removing duplicate entries
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* using async submitRequestToBackground method
* removing unused import
* removing unnecessary link syntax in notification
* adding opera and edge and associated tests
* handling the undefined case in bowser.satisfies
* setOutdatedBrowserWarningLastShown try/catch
* lint:fix
* Removing try/catch and letting errors bubble up
Removing deprecated displayWarning method
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* taking out forceMetamaskUpdateState call
* excludint app-state test from mocha test suite
* Added note: Jest files should match Mocha excluded
* syntax error, lint:fix
---------
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net>
Co-authored-by: brad-decker <bhdecker84@gmail.com>
* Add tests for `retryOnEmpty` middleware
Tests have been added for the `retryOnEmpty` middleware.
This middleware is only used on the Infura network client, so the tests
that demonstrate this retry behavior are only enabled for the `infura`
provider type.
Most of the tests added were to cover cases where the retry middleware
is skipped, so they were applicable for both provider types.
Closes#17004
* Improve readability of block number tests
The test cases for passing a block number parameter have been made more
readable. Specifically, a comment has been added each time params are
built to call attention to the block parameter and what value it has,
so that it's clear whether it's larger or smaller than the current
block number.
Additionally the blocks for "less than the current block number" and
"equal to the current block number" have been combined using
`describe.each`.
Tests have been added to ensure that our middleware will not return a
cached response to a request with unique parameters. Each parameter
supported by each method is tested independently.
Closes#17003
* Put hardware wallets behind an HARDWARE_WALLETS_MV3 flag
Disable Hardware connect buttons if the flag is set.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
update to metamask/eth-keyring-controller
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
revert to eth-keyring-controller v8
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
LAvamost after rebase
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
lock file.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Added toaster for removed NFTs (#17297)
* added notification for remove nfts
* reverted names for tabs
* updated default key
* updated snapshot
* updated remove nft toast to danger
Setup network controller mocks per-test (#17250)
The network controller unit test network mocks are now setup for each
test. This makes modifying network behavior on a per-test basis easier,
and makes it more clear which test relies upon which mocks.
Security provider check (OpenSea) (#16584)
chore: copy update for metamask fee on swaps (#17133)
* linter fix
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* setLedgerTransportPreference in the metamask-controller should not be called, or should return immediately, if canUseHardwareWallets() is false
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Co-authored-by: Jyoti Puri <jyotipuri@gmail.com>
Support has been restored for Chromium v78. Previously the extension
would crash upon startup.
The main incompatibility was the use of ES2020 operators (the optional
chain and nullish coalesce operators) in the libraries
`@ethereumjs/util` and `superstruct`. This was resolved by transpiling
those libraries.
After fixing that, the extension no longer crashed but the UI refused
to connect. This was because the UI process was not being identified as
an internal process, because the code responsible for checking that was
relying on the `origin` property of `MessageSender` [1] which wasn't
added until Chromium v80. The check has been updated to use the `url`
property instead, which existed in older versions of Chrome.
Lastly, the content security policy was updated to include the default
content security policy alongside the intended modification. Newer
versions of Chrome will merge the configired CSP with the default, but
older versions required it to be explicitly specified. This should not
result in any functional change.
[1]: https://developer.chrome.com/docs/extensions/reference/runtime/#type-MessageSender
The network controller unit test network mocks are now setup for each
test. This makes modifying network behavior on a per-test basis easier,
and makes it more clear which test relies upon which mocks.
* Persist phishing state controller state.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
update phishing controller to latest version
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Rebase, Yarn3, Lavamoat
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
run allow-scrips.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
lavamoat:auto and linter
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* lint fixes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
The network controller is now constructed within each network
controller unit test, rather than in the `beforeEach`. This allows us
to customize the constructor options in each test, which some planned
future tests will require.
The controller is constructed with a helper function that also handles
calling `destroy` after each test, even if the test failed. This helps
to prevent tests from affecting each other.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
This test was testing a function that was only present in the test
module.
The function under test was mistakenly moved here when it was
discovered that it wasn't being used elsewhere, under the assumption
that it was used in these tests. I hadn't realized it was being tested
directly.
The network controller unit tests now use network mocks rather than
mocking controller methods.
This makes the tests less brittle, as they will no longer break when
internal changes to the `_getLatestBlock` method are made.
* Ensure that account tracker does not set balances incorrectly when useMultiAccountBalanceChecker is false
* Lint fix
* Fix account setting in _updateAccount in useMultiAccountBalanceChecker === true case
* Fix _updateAccount
* Add unit tests
The network controller unit tests have been updated to wait until the
network controller is fully initialized before proceeding. This ensures
that the initialization doesn't have any side-effects that affect later
tests.
* fix: Display primaryType in signTyped instead of 'Message' string
* fix: added #17077 to changelog
* fix: remove unused signatureRequest1 message to fix test-lint failure
* Update CHANGELOG.md
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
* test: add assertion for the primaryType to signature-request component test
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
The NetworkController `destroy` method has been updated to ensure that
it no longer throws if called before initialization.
This method was added recently in #17032, but we forgot to handle the
case where the controller was not initialized.
The `initializeProvider` parameters were removed recently in #16863,
but they were still being set in tests. They have now been removed.
An unused property was also being set in the tests, which has now also
been removed.
The "MetaMask middleware" is the set of middleware for handling methods that
we don't send to the network. This includes signing, encryption, `getAccounts`,
and methods that rely on pending transaction state.
Previously this middleware was setup as part of the network client, despite
having nothing to do with the network. They have been moved into the main RPC
pipeline established in `metamask-controller.js` instead.
This is a pure refactor, and should have no functional changes. The middleware
are still run in exactly the same order with the same arguments.
Previously we had written tests for `createInfuraClient`, which creates a middleware stack designed to connect to an Infura provider. These tests exercise various RPC methods that relate to the behavior that the middleware provides (mainly around caching).
Now we need to write the same tests but for `createJsonRpcClient`, which creates a middleware stack designed to connect to a non-Infura RPC endpoint. To do this, we had to:
- Consolidate the tests for both types of RPC client into a single test file.
- Add conditions around tests or assertions in tests to account for differences in behavior between the two sets of middleware stacks.
- Relocate code in `createJsonRpcClient` which slows down `eth_estimateGas` calls just for tests so that this behavior can be disabled in the network client tests.
Eventually, as we unify the network controllers in this repo and in the core repo, we will move these tests into the core repo.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
* dealt with most of the problems in the Create Account dialog
* Fixed "newAccountNumberName" localizations
* In another language, don't allow accounts named, for instance, Cuenta 3
* Editing an account name later now follows the same rules
* Fixing lint errors
* Responding to the review by @adonesky1
* Worked with @montelaidev to alter the RegExp, in order to catch spaces before and after the account name
* Fixed line breaks for eslint