The LavaMoat policies and allow-scripts configuration are now validated
in parallel. They are still only validated for release candidate
branches and the `master` branch.
This commit fulfills a long-standing desire to get the extension using
the same network controller as mobile by removing NetworkController from
this repo and replacing it with NetworkController from the
`@metamask/network-controller` package.
The new version of NetworkController is different the old one in a few
ways:
- The new controller inherits from BaseControllerV2, so the `state`
property is used to access the state instead of `store.getState()`.
All references of the latter have been replaced with the former.
- As the new controller no longer has a `store` property, it cannot be
subscribed to; the controller takes a messenger which can be
subscribed to instead. There were various places within
MetamaskController where the old way of subscribing has been replaced
with the new way. In addition, DetectTokensController has been updated
to take a messenger object so that it can listen for NetworkController
state changes.
- The state of the new controller is not updatable from the outside.
This affected BackupController, which dumps state from
NetworkController (among other controllers), but also loads the same
state into NetworkController on import. A method `loadBackup` has been
added to NetworkController to facilitate this use case, and
BackupController is now using this method instead of attempting to
call `update` on NetworkController.
- The new controller does not have a `getCurrentChainId` method;
instead, the chain ID can be read from the provider config in state.
This affected MmiController. (MmiController was also updated to read
custom networks from the new network controller instead of the
preferences controller).
- The default network that the new controller is set to is always
Mainnet (previously it could be either localhost or Goerli in test
mode, depending on environment variables). This has been addressed
by feeding the NetworkController initial state using the old logic, so
this should not apply.
* feat(srp): add a quiz to the SRP reveal
* fixed the popover header centering
* lint fixes
* converted from `ui/components/ui/popover` to `ui/components/component-library/modal`
* responded to @darkwing review
* added unit tests
* renamed the folder to 'srp-quiz-modal'
* responded to Monte's review
* using i18n-helper in the test suite
* small improvement to JSXDict comments
* wrote a new webdriver.holdMouseDownOnElement() to assist with testing the "Hold to reveal SRP" button
* Updating layout and some storybook naming and migrating to tsx
* Apply suggestions from @georgewrmarshall
Co-authored-by: George Marshall <george.marshall@consensys.net>
* Unit test searches by data-testid instead of by text
* new layout and copy for the Settings->Security page
* now with 100% test coverage for /ui/pages/settings/security-tab
fixes#16871fixes#18140
* e2e tests to reveal SRP after quiz
* e2e- Fix lint, remove unneeded extras
* @coreyjanssen and @georgewrmarshall compromise
Co-authored-by: George Marshall <george.marshall@consensys.net>
Co-authored-by: Corey Janssen <corey.janssen@consensys.net>
* trying isRequired again
* transparent background on PNG
* [e2e] moving functions to helpers and adding testid for SRP reveal quiz (#19481)
* moving functions to helpers and adding testid
* fix lint error
* took out the IPFS gateway fixes
* lint fix
* translations of SRP Reveal Quiz
* new Spanish translation from Guto
* Update describe for e2e tests
* Apply suggestion from @georgewrmarshall
Co-authored-by: George Marshall <george.marshall@consensys.net>
* fixed the Tab key problem
---------
Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
Co-authored-by: Plasma Corral <32695229+plasmacorral@users.noreply.github.com>
Co-authored-by: Corey Janssen <corey.janssen@consensys.net>
The two GitHub action dependencies were mistakenly listed as production
dependencies. They've been moved to `devDependencies` instead.
The `husky` development dependency was mistakenly listed as a
production dependency as well. It has been removed from that set, now
listed as just a `devDependency`.
* feat(action): github action to add release label when PR gets merged
* feat(action): make sure the action only runs for PRs merged in main branch
* fix(action): update labels default color
* fix(action): add check on release label format
* fix(action): type function explicitely
* feat(action): add possibility to extract next release version number from artifact
* fix(action): rename next rc cut number into next semver version
* feat(action): add a github action to create release branch
* fix(action): default branch is develop
* fix(action): specify name of workflow used to create release branch
* fix(action): handle case where artifact doesn't exist
* fix(action): create branch but not the PR
* feat(action): fetch next semver version from release branches name or from package.json
* fix(action): remove unused Create Release Branch action
* fix(action): release branch format was not correct
* feat(action): take tags into account when calculating next version number
* feat(action): add the possibility to force next semver version
* fix(action): update comments
* fix(action): adopt kebak-case instead of snake_case
* fix(action): rename PERSONAL_ACCESS_TOKEN into RELEASE_LABEL_TOKEN
* fix(action): yarn installation not required
* fix(action): yarn install shall be immutable
* fix(action): make the script compatible with ShellCheck
* fix(script): exit script earlier if condition is met
* fix(action): use closingIssuesReferences instead of timeline events
* fix(action): add execute permissions to script
* fix(action): remove duplicate comment
* fix: refactor linea goerli testnet implementation
* fix: rename linea goerli network
* feat: add linea testnet logo
* update linea goerli block explorer url
* update @metamask/eth-json-rpc-infura package to version 8.1.0
* fix: refactor ticker map object in shared/constants/networks.ts files
* Update message manager and signature controller
The packages `@metamask/message-manager` and
`@metamask/signature-controller` have been updated to the latest
versions. These versions were part of part of the [core monorepo v53](MetaMask/core#1385)
release. The remaining packages released as part of v53 will be updated
in later PRs.
These releases included a few breaking changes, but none that affect
the extension. Both packages now expect `getCurrentChainId` to return
`Hex`, but that was already the case here. Additionally the signature
controller now has a peer dependency on the approval controller v3,
which is already present and at the correct version.
Relates to #19271
* Ignore error caused by TS bug
* Update types to omit metadata for encryption requests
* Update lavamoat policy
* Update `@metamask/gas-fee-controller` to v6
The `@metamask/address-book-controller` package has been updated to v3.
This version was part of the [core monorepo v53](MetaMask/core#1385)
release. The remaining packages released as part of v53 will be updated
in later PRs.
This release included a number of breaking changes, but most of them
do not affect the extension:
* Bump to Node 16
* The extension already uses Node.js v16
* The `getChainId` constructor parameter now expects a `Hex` return
type rather than a decimal string
* The extension was already passing in a `getChainId` parameter that
returned `Hex`
* The gas fee controller messenger now requires the
`NetworkController:stateChange` event instead of the
`NetworkController:providerConfigChange` event
* This does not apply if `onNetworkStateChange` and `getChainId` are
provided to the constructor, which is the case here.
* Update `@metamask/network-controller` dependency and peer dependency
* This dependency is only used for types, and none of the type
changes affect how the extension interacts with this controller.
The one change that did have an impact is that the constructor
parameter `onNetworkStateChange` now expects event handlers to be
passed the full network state.
Relates to #19271
* Ensure chainid always matches mainnet in test builds
This is a bit strange, but this is how the tests were setup previously.
* Fix accidental state mutation
* Remove hardcoded mainnet chain ID from test builds
When using older versions of 16.x we may get this error when attempting
to build the extension:
TypeError: Cannot assign to read only property 'Symbol(Symbol.iterator)' of object '[object Set]'
at Object.buildAllowedFlags (node:internal/process/per_thread:375:53)
at process.get [as allowedNodeEnvironmentFlags] (node:internal/bootstrap/node:279:34)
at get (<anonymous>)
at getOwn (node:internal/bootstrap/loaders:182:5)
at NativeModule.syncExports (node:internal/bootstrap/loaders:294:31)
at ModuleWrap.<anonymous> (node:internal/bootstrap/loaders:274:22)
at NativeModule.getESMFacade (node:internal/bootstrap/loaders:279:17)
at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:259:10)
at loadNativeModule (node:internal/modules/cjs/helpers:49:9)
at Function.Module._load (node:internal/modules/cjs/loader:804:15)
This error goes away when upgrading to a later version of 16.x.
To make sure this isn't an issue going forward, this commit bumps the
Node version requirement in `package.json`. 16.20.0 happens to be the
latest version of 16.x (to date).
* snaps@0.34.0-flask.1
* Update LavaMoat policies
* Replace instances of targetKey with targetName
* Replace use of PermissionKeys with PermissionNames
* Use Flask packages in tests for now
* Bump execution env
* Add another mock
* Fix lint
The `@metamask/approval-controller` package has been updated to v3.
This version was part of the [core monorepo v53](MetaMask/core#1385)
release. The remaining packages released as part of v53 will be updated
in later PRs.
The only breaking change in this release was to update the minimum
supported Node.js version to v16.
Note that this will temporarily introduce peer dependency warnings
because of the major version bump. These are safe to avoid for now
because nothing is affected by the Node.js minimum version bump.
A resolution has been added to force v3 to be used throughout the
dependency tree so that this bump doesn't unnecessarily bloat our
dependencies. In practice this is only being used in one place, the
other references are just for types.
The resolution can be removed once the last package using this
controller has been updated, which will happen as part of #19271. The
peer dependency warnings will be resolved once #19271 is completed as
well.
Relates to #19271
The `@metamask/notification-controller` package has been updated to v3.
This version was part of the [core monorepo v53](MetaMask/core#1385)
release. The remaining packages released as part of v53 will be updated
in later PRs.
The only breaking change in this release was to update the minimum
supported Node.js version to v16.
Relates to #19271
The `@metamask/address-book-controller` package has been updated to v3.
This version was part of the [core monorepo v53](https://github.com/MetaMask/core/pull/1385)
release. The remaining packages released as part of v53 will be updated
in later PRs.
This release included a number of breaking changes relating to the
`chainId` format change from `string` to `Hex`. However these changes
don't affect the extension because it was already using `Hex` chain IDs
for all address book interactions.
Relates to #19271
The package `@metamask/controller-utils` has been updated to v4. This
version was part of the core monorepo v53 release. The remaining
packages released as part of v53 will be updated in later PRs.
This release included a variety of breaking changes, but most of them
did not affect the extension's usage of this library. The one that did
have an impact was the removal of the `Json` type, which was identical
to the `Json` type in `@metamask/utils`. We're now using the
`@metamask/utils` version of this type exclusively.
Relates to #19271
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
The `@metamask/announcement-controller` has been updated to v4, which
is the version released in the core monorepo v53 release. The remaining
packages released as part of v53 will be updated in later PRs.
The only breaking change is that the minimum Node.js version was
updated to v16.
Relates to #19271
The `@metamask/base-controller` has been updated to v3, which is the
version released in the core monorepo v53 release. The other packages
released as part of v53 will be updated in later PRs.
Relates to #19271
In preparation for introducing `@metamask/network-controller`, we want
to ensure that any packages that depend on this package are up to date
so that we are using the same version of `@metamask/network-controller`
in the dependency tree.
The extension uses two packages that depend on
`@metamask/network-controller`: `@metamask/assets-controllers` and
`@metamask/gas-fee-controller`. This commit upgrades them to the latest
version. There are no breaking changes in the new release of these
packages so there are no accompanying compatibility changes.
* devDeps: pin @babel/core and @babel/runtime in resulotions
Without this: misses patch, lavamoat error
* storybook 6 to 7 migration
* devDeps: add @storybook/addon-mdx-gfm
* fix lint deps
* devDeps: remove unused require-from-string
* devDeps/resolutions: @types/react@^16.9.53
* devDeps: add @storybook/cli
* storybook: new-frameworks migration
* iyarc: remove resolved dependency advisory
* deps: set globalthis@1.0.1 in resolutions
This is required since a file is copied over from a set path in the dist
package subdirectory as of d13aabde23 (#10014).
A future update should either vendor the shim, or update to
compatibility with a maintained upstream version.
* mdx2 migration fixes
* chore: bump ljharb packages
* devDeps: @storybook/*@^7.0.10->^7.0.11
* storybook: update preview.js to use v7 addon api
* ci/test/storybook: echo between storybook build&test
* ci/circleci: resources tweak
* info-tab: handle undefined global.platform
* update lavamoat build policy
* update lavamoat browserify policies
* Version v10.30.2
* Ensure the GasDetailsItem component can handle a tx with a maxPriorityFee of 0 (#19102)
* Ensure the GasDetailsItem component can handle a tx with a maxPriorityFee of 0
* Clean up code
* Update ui/components/app/gas-details-item/gas-details-item.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
---------
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Backport the `@metamask/message-manager` update to v5 (#19110)
The `@metamask/message-manager` update to v5 has been backported to the
v10.30.x release branch. This update includes three breaking changes,
but two (bump in minimum supported Node.js version, and change in type
from `Map` to `Record`) don't affect this project. The only breaking
change requiring changes was the addition of the `getCurrentChainId`
constructor parameter for the TypedMessageManger.
* Update changelog
---------
Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* adds mmi logic to home container
* adds code fences to home component
* adds code fences to home component
* lint fix
* lint fix
* updates fences and runs prettier
* version bump
* clean up code fence
* Test dapp update to v6.0.0 and tweak initial token amounts to adjust to the new contract
* Update gas estimates for new TST contract
---------
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
* feat: add yaml feature management
Add yaml feature file per build type.
Also add method to parse yaml and set
enabled features env to true. The build
process will then replace any process.env[feature]
that exists on the config by its value
* chore: add example for desktop
* Added initial draft of build features
* [TMP] Sync between computers
* Is able to succesfully build stable extension with snaps feature
* Removing var context from builds.yml
* Add asssets to builds.yml
* Minor bug fixes and removing debug logs
* [WIP] Test changes
* Removed TODOs
* Fix regession bug
Also
* remove debug logs
* merge Variables.set and Variables.setMany with an overload
* Fix build, lint and a bunch of issues
* Update LavaMoat policies
* Re-add desktop build type
* Fix some tests
* Fix desktop build
* Define some env variables used by MV3
* Fix lint
* Fix remove-fenced-code tests
* Fix README typo
* Move new code
* Fix missing asset copy
* Move Jest env setup
* Fix path for test after rebase
* Fix code fences
* Fix fencing and LavaMoat policies
* Fix MMI code-fencing after rebase
* Fix MMI code fencing after merge
* Fix more MMI code fencing
---------
Co-authored-by: cryptotavares <joao.tavares@consensys.net>
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
* Use fake provider for NetworkController unit tests
In the unit tests for NetworkController, it's important to prevent
network requests from occurring. Currently we do that by using Nock.
However, the `core` version of NetworkController uses a fake provider
object. This is arguably a better approach for unit tests because it
prevents us from having to think about the behavior that a specific
middleware may have. For instance, the Infura middleware intercepts
`eth_chainId` to return a static result, and the block cache middleware
replaces the `latest` block tag with the latest block number, making an
extra call to `eth_blockNumber` in doing so. We have to account for
these kinds of behaviors when using Nock, but we do not need to do this
when using a fake provider.
This should make it easier to compare the difference between the unit
tests in this repo vs. in the `core` repo, which should ultimately help
us merge the two controllers together.
* Rename fake-provider-engine to fake-provider
* Rearrange imports
* Move fake-provider and fake-block-tracker into a directory and exclude it from coverage
* Make FakeBlockTracker inert, and fix JSDocs
* Remove generics from FakeProvider
* Call beforeCompleting (and beforeResolving) using async/await
* Fix signature of sendAsync; align other signatures within FakeProvider
* No need to check whether error is not a string
* Don't exclude the provider-api-tests directory from coverage
* Make sure to mock both net_version and eth_getBlockByNumber when testing network status
* Fix FakeProvider so that none of the methods have optional callbacks
The mobile sync feature has been removed. It has been disabled for
years. When we enable sync again, it will be using a different
implementation. This has already been removed on the mobile side.
The mobile sync feature has been removed. It has been disabled for
years. When we enable sync again, it will be using a different
implementation. This has already been removed on the mobile side.
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.
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>
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.
Converting this controller to TypeScript furthers the goal of getting
this whole codebase converted, of course, but it also helps in comparing
the differences between this version of the NetworkController and the
version in the `core` repo more easily, which will ultimately help us in
coalescing the two implementations.
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
The gas fee controller has been updated from v1 to v3. The breaking
changes for v2 and v3 related to the `@metamask/network-controller`
type that was referenced. They don't affect the extension's usage of
this package, so they are non-breaking for the extension.
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
The announcement controller has been updated to v2.0.1. The breaking
change in v2 was the migration to the BaseControllerV2 API. This
affected the constructor, as well as some methods/properties that we do
not use.
* Update `@metamask/swappable-obj-proxy`
The package `@metamask/swappable-obj-proxy` has been updated to the
latest version. The breaking changes include moving the package under
the `@metamask` scope and converting it to TypeScript.
* Update policy
`@metamask/obs-store` has been updated from v5 to v8. The breaking
changes include updating the minimum supported Node.js version to v12,
and removing an unused class `LocalStorageStore`. v8 includes a bugfix
that resolves an accidental breaking change in v6.0.2; it's non-
breaking when updating from older versions.
This update includes type improvements. The main improvement is that
now we can type the observational store using generic parameters. The
previous version used `unknown` for the store contents.
The package `safe-event-emitter` has been updated to v2. This update
includes renaming the package to be scoped under `@metamask`, and it
includes a TypeScript migration.
* fix(18194): Redirect to extension expanded view when click back to safety button
* Bump phishing warning version
---------
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
* fix(18194): Redirect to extension expanded view when click back to safety button
* Bump phishing warning version
---------
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
* NFTs: Remove feature flag for release
* Update security tab jest test
* Fix broken test
* Update snapshot
* Update test
* Fix test
* remove nft build
* move tests to main e2e job
* remove nft scripts
* remove test for nft build
---------
Co-authored-by: David Walsh <davidwalsh83@gmail.com>
* NFTs: Remove feature flag for release
* Update security tab jest test
* Fix broken test
* Update snapshot
* Update test
* Fix test
* Remove last usages of flag
* Update CI jobs
* Fix jest tests
The PhishingController has been updated to v2. This release should
dramatically reduce network traffic and double the update speed of the
phishing list.
This was accomplished by combining both of our phishing configurations
into one list (the "stalelist"), then creating a separate list of the
changes just the past few days (the "hotlist"). Now users will download
a smaller list more frequently (every 30 minutes rather than every
hour), whereas the full list is only updated every 4 days.
The combined configuration means that we no longer know which list was
responsible for each block. The phishing warning page has been updated
to dynamically look this information up, to ensure users are still
directed to the correct place to dispute a block. This update to the
phishing warning page also includes the recent redesign.
* feat: disable deposit popover and replace it with global redirect to onramp on pdapp
* feat: remove legacy code for hardcoded onramp providers
* fix: remove unused visuals and components related to legacy code of deposit popover
* fix: remove unused messages
* feat: use a custom hook for all onramps related methods and variables
* fix: modify the custom hook implementation to include test networks
* fix: remove deprecated file buy-url
* fix: remove references for deleted deposit logos
* fix: network-controller failing unit test
* fix: snapshot loading-swaps-quotes-stories-metadata.test.js.snap
* fix: storybook tests
* fix: remove unused constatns related to buyable onramp chains
* fix: remove unused variables and fix eslint
* adding unit test for useRamps custom hook
* feat: add comment on the proper usage of useRamps within confirm-page-container component
* fix: add unit tests for buy button in token-overview page
* fix: add unit test for open the buy crypto URL for a buyable chain ID in token page
* feat: add unit test coverage for eth-overview page
* fix: update locales
This release only includes one breaking change, which is the renaming
of the package to be under the `@metamask` scope. It includes
improvements to the types that will unblock migrating our network
clients to TypeScript.
The PhishingController has been updated to v2. This release should
dramatically reduce network traffic and double the update speed of the
phishing list.
This was accomplished by combining both of our phishing configurations
into one list (the "stalelist"), then creating a separate list of the
changes just the past few days (the "hotlist"). Now users will download
a smaller list more frequently (every 30 minutes rather than every
hour), whereas the full list is only updated every 4 days.
The combined configuration means that we no longer know which list was
responsible for each block. The phishing warning page has been updated
to dynamically look this information up, to ensure users are still
directed to the correct place to dispute a block. This update to the
phishing warning page also includes the recent redesign.
Current version being resolved is 26
which does not match with the version
being used: 29. This is confusing,
especially because there were apis
that have changed significantly (like
the useFakeTimers one)
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.