* capture exception for sentry when invariant conditions are met in migration 82
* Code cleanup
* Capture exceptions in invariant conditions for migrations 83,84,85,86,89,91,93,94
* Update app/scripts/migrations/082.test.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Code cleanup
* Fix SentryObject type declaration
* Stop throwing error if preferences controller is undefined
* Refactor 084 and 086 to remove double negative
* Capture exceptions for invariant states in in migrations 87,88,90 and 92
* lint fix
* log warning in migration 82 when preferences controller is undefined
---------
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
The unflattened background state is now attached to any Sentry errors
from the background process. This provides a clearer picture of the
state of the wallet, and unblocks further improvements to Sentry state
which will come in later PRs.
The state mask used to anonymize the Sentry state snapshots has been
split into UI and background masks. This was done to simplify later
refactors. There should be no functional changes.
* Add AppMetadataController so current and previous application and migration version can be captured in sentry
* Add currentAppVersion, previousAppVersion, previousMigrationVersion, currentMigrationVersion to SENTRY_OBJECT
* Update app/scripts/controllers/app-metadata.ts
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Update app/scripts/controllers/app-metadata.ts
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Update app/scripts/controllers/app-metadata.ts
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Fix types
* Add tests for app-metadata.test.ts
* Lint fixes
* Modify loadStateFromPersistence to return the whole versionData object, so that the migration version can be passed to the metamask-controller on instantiation
* Remove reference to implementation details in test descriptions in app/scripts/controllers/app-metadata.test.ts
* Reset all mocks afterEach in AppMetadataController
* Refactor AppMetadataController to be passed version instead of calling platform.version directly (for ease of unit testing the MetaMask Controller)
* Make maybeUpdateAppVersion and maybeUpdateMigrationVersion private, and remove unit tests of those specific functions
---------
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Reorganize Sentry error e2e tests
The tests have been reorganized into different describe blocks. Each
describe block is for either before or after initialization, and either
with or without opting into metrics.
This was done to simplify later test additions. The conditions for each
test are now in the describe block, letting us test additional things
in each of these conditions. The conditions were flattened to a single
level to avoid excessive indentation.
* Add error e2e test for background and UI errors
The Sentry e2e tests before initialization only tested background
errors, and the after initialization tests only tested UI errors. Now
both types of errors are tested in both scenarios.
* Add error e2e tests for Sentry error state
E2E tests have been added to test the state object sent along with each
Sentry error.
At the moment this object is empty in some circumstances, but this will
change in later PRs.
* Rename throw test error function
* Only setup debug/test state hooks in dev/test builds
The state hooks used for debugging and testing are now only included in
dev or test builds. The function name was updated and given a JSDoc
description to explain this more clearly as well.
* Add state snapshot assertions
State snapshot assertions have been added to the e2e error tests. These
snapshots will be very useful in reviewing a few PRs that will follow
this one.
We might decide to remove these snapshots after this set of Sentry
refactors, as they might be more work to maintain than they're worth.
But they will be useful at least in the short-term.
The login step has been removed from a few tests because it introduced
indeterminacy (the login process continued asynchronously after the
login, and sometimes was not finished when the error was triggered).
* Ensure login page has rendered during setup
This fixes an intermittent failure on Firefox
* Format snapshots with prettier before writing them
* Use defined set of date fields rather than infering from name
* Remove waits for error screen
The error screen only appears after a long timeout, and it doesn't
affect the next test steps at all.
* refactor: use addNewAccount from core KeyringController
* refactor: replace missed interaction
* refactor: select account only when is new
* refactor: use getAccounts to check if account is new
* Fix#20305 - Show the network name in Delete Network modal
* Update app/_locales/en/messages.json
Co-authored-by: George Marshall <george.marshall@consensys.net>
* Add unit test
---------
Co-authored-by: George Marshall <george.marshall@consensys.net>
* feat(878): add new incomingTxn component and change styles of settings
* feat(878): relocate openSea tab from rebase regression
* feat(878): make UI and test modifications
* feat(878): transfer to ts
* feat(878): rename network-toggle.tsx
The "last fetched" state for the `PhishingController` has been deleted
to force an immediate full update of the phishing configuration state.
We're doing this because the state was cleared in v10.34.2 because the
format of that state had changed.
This has been implemented in migration 92. The previous migration 92
has been renamed to 93 because it won't be included until a future
release. We need the migrations to remain sequential, and this will
save us from having to resolve a complex conflict when releasing this.
An import was introduced in #20125 that was broken. It was importing
from `app/` instead of using a relative import. This was causing the
CI "depcheck" job to fail. The import has been updated to use a
relative path.
* Add link to buy more ETH if insufficient gas
* Fix lint error
* Use native currency per network
* Use localized msg for buy more gas
* Add the word "more"
* Fix smart tx not showing msg
* Pull out not enough balance into own component
* Add story for not enough balance
* Fix btn text not being aligned with rest of text
* Move inline style to class, remove empty classname
* Update ui/pages/swaps/prepare-swap-page/not-enough-balance.stories.tsx
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
* Update ui/pages/swaps/prepare-swap-page/index.scss
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* Remove line
* Move BannerAlert back into review-quote and use BannerAlert props
* Remove unused CSS
---------
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
* allow `SnapController` to call `SnapsRegistry:update`
* call `SnapController:updateBlockedSnaps` on extension startup
* only check if at least one snap is installed
* Fix migration 88 to handle the case where chainId keys can be undefined
* Add migration 91 to delete network configurations that have no chainId
* Lint fix
* Update migration number
* Update migration 91 description
* Update version numbers in 091.test.js
* Fix 088.test.ts typescript problem
* Fix 088.test.ts typescript problem
* Update app/scripts/migrations/091.ts
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Change app/scripts/migrations/091.test.js to typescript
* clone oldstorage for test result comparisons in 091.test.js
* Lint fix
* Add missing test case
---------
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Remove fallback phishing warning configuration
The package `@metamask/phishing-controller` has been updated from v4
v6. The only breaking changes are a minimum Node.js version bump, and
the removal of the fallback phishing configuration.
The fallback phishing configuration was resulting in MetaMask being
incorrectly flagged as malware, and the stale config was causing
problems for sites that had been blocked in the past but have since
been unblocked. This should substantially reduce the bundle size as
well.
* Update LavaMoat policies
* Update test state to include example blocked site
---------
Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
* Handle the case where tokensChainsCache data is undefined in migration 77
* Delete parts of state that should have been removed in migrations 82,84,86 and 88
* Create 077-supplements.md
* Update 077-supplements.md
* Update 077-supplements/*.js code comments
* Fix types and jsdoc
* Type/lint fix
* Cleanup
* Add 'should set data to an empty object if it is null' test case to 077.test.js
* Update app/scripts/migrations/077.test.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Modify deletion criteria so that all decimal chain id proprties are deleted in migration 88 supplement
* Readme.md
* Update app/scripts/migrations/077.test.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Update app/scripts/migrations/077.test.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Update app/scripts/migrations/077.test.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Lint fix
* Only delete decimal chain id keyed-entries in migration 88 supplement if there are hexadecimal keyed entries as well
* Remove redundant test
* Add 'does not delete' cases for nftcontroller related tests in 077.test.js
---------
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Capture Sentry errors prior to initialization
Sentry errors captured before/during the wallet initialization are
currently not captured because we don't have the controller state yet
to determine whether the user has consented.
The Sentry setup has been updated to check the persisted state for
whether the user has consented, as a fallback in case the controller
state hasn't been initialized yet. This ensures that we capture errors
during initialization if the user has opted in.
* Always await async check for whether the user has opted in
* Remove unused import
* Update JSDoc return type
* Remove unused driver method
* Fix metametrics controller unit tests
* Fix e2e tests
* Fix e2e test on Firefox
* Start session upon install rather than toggle
* Update phishing controller to v4.0.0
* Move phishing e2e test utilities into its own helper.js
* Update phishing detection e2e test
* Update MetaMask Controller test mocks
* Update mv3 phishing tests
* Fix test for 500 error on warning page
* Allow for directories in test folder
* Update migration number
* Linting fixes
* Remove fail on console error
* Separate mocks from helpers
* Have migration delete PhishingController state entirely
* Remove phishing detection directory
* Only delete the listState in migration
* Bump migration version
* update transaction status to not be considered anonymous
* fix failing e2e
* revert status changes in txn spec file
* Fix e2e by adding status
---------
Co-authored-by: Olusegun Akintayo <akintayo.segun@gmail.com>
* Allow user to turn off IPFS gateway resolution
* Add end to end test for toggle on and off
* Fix jest tests and snapshots
* Change variable name
* Implement provided content
* Use MetaMask eth instead
* Allow searching for ENS setting
* Fix jest
---------
Co-authored-by: Brad Decker <bhdecker84@gmail.com>