* First e2e mv3 specific dapp testcase
* Fix testpath for snaps
* Update `it` description
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* e2e test paths improvement
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Migrate to new controller packages
`@metamask/controllers` is deprecated, and most of the controllers that
lived here are now located in their own package ([1]). This commit
replaces `@metamask/controllers` in `package.json` with references to
these packages and updates `import` lines to match.
[1]: https://github.com/MetaMask/controllers/pull/831
* Support GitHub registry for draft PRs (#16549)
* Add additional allowed host to lockfile linter
* Update LavaMoat policies
* Add policy exception for nanoid
* Add additional nanoid overrides
* Update LavaMoat policies again
* Bump controller packages
* Update lavamoat
* Bump controller packages
* Update packages to v1.0.0
* Expand gitignore comment
* Unpin controller dependencies, using ^ range instead
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
* Wait until element is not present
* Wait for non empty element on add account test
* Wait for non empty element for all instances of get account text
* Point to account value directly
* Add accounts as const
* Simplify MV3 initialization
The MV3 initialization logic was complicated and introduced race
difficult-to-reproduce race conditions when dapps connect during
initialization.
It seems that problems were encountered after the UI tried to connect
before the background was initialized. To address this, the
initialization step was _delayed_ until after the first connection.
That first connection was then passed into the initialization function,
and setup properly after initialization had begun.
However, this special treatment is only given for the first connection.
Subsequent connections that still occur during initialization would
fail. This also results in the initialization being needlessly delayed,
which is concerning given that our main performance goal is to speed it
up.
* Setup connect listeners before controller initialization
* Add comments
* Add comment explaining isInitialized step
The bundle size diff message is using the wrong point of comparision,
leading to misleading results on feature branches that have been
merged with `develop` since they were created.
When this feature was introduced, we went back and forth a few times on
what we should be comparing the branch with to get an accurate bundle
size comparison.
The first attempt used `develop` as the point of comparison, but that
didn't work because it was a moving target, and because it didn't
reflect the changes made on this branch. As bundle increases or
decreases were added on `develop`, they would alter the diff on each
feature PR.
Then we chose to use the fork-point of the branch, the commit of
`develop` that the branch forked off of. This works for feature
branches that don't merge in `develop`. But the minute `develop` gets
merged in, then unrelated changes on `develop` affect the measurement.
The _most recent_ commit from `develop` on the current branch is a
better comparison. Any difference between this commit and the feature
branch in terms of bundle size would be attributable to the feature
branch changes. This is what `merge-base` gives us.
* Add all controllers in memstore to store
Add methods to controller to reset memstore
Reset memstore when popup or tab is closed.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* When profile is loaded, set isFirstTime to true..
After resetting the controllers, set the flag to false.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Remove console.logs
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* For some reason programmatically computing the store is not working.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Proper check for browser.storage
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* do a list of rest methods instead of reset controllers.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Mock controller resetStates and localstore get/set
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Comments about TLC
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* bind this.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* use globalThis instead of locastore to store first time state.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Test to check that resetStates is not called a second time
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Set init state in GasFeeController and other controllers so that their
state is persisted accross SW restarts
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Revert localstore changes
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* wrap the reset states changes in MV3 flag
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Remove localstore from metamask-controller
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Always reset state on MMController start in MV2.
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Use relative path for import of isManifestV3
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
* Fix unit test
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>