1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00
Commit Graph

5282 Commits

Author SHA1 Message Date
Elliot Winkler
63c402155d
Sync default value of networkDetails w/ core (#19407)
In the core version of NetworkController, the `networkDetails` property
is initialized to `{ EIPS: {} }`. It is also reset to this
representation when `refreshNetwork` is called.

In this version of NetworkController, however, the default
representation of `networkDetails` is `{ EIPS: { 1559: undefined } }`.
From a consumer's perspective this doesn't make a difference — it's
practically the same. It does make a slight difference in tests,
however.

With that in mind, this commit changes the default representation to `{
EIPS: {} }`. This makes it easier to visually compare differences in the
NetworkController unit tests between core and this repo.
2023-06-02 14:35:08 -06:00
Albert Olivé
9195057136
[MMI] Added code fencing in libs folder (#17929) 2023-06-02 18:40:58 +02:00
David Walsh
b89630fdd2
Release MultiChain 0.5 (#18903)
* Show portfolio icon in ETH overview

* Show new copy button in QR code modal

* Show address copy button in wallet overview

* Update connected status component

* Remove legacy MenuBar

* Remove legacy ImportTokenLink

* Remove AssetListItem

* Remove DetectedTokensLink

* Remove legacy AppHeader

* Remove MULTICHAIN flag from builds.yml

* Remove legacy AccountMenu

* FIX: Token cell snapshot

* Add data-testid for Account Picker

* Remove multichain check in LoadingNetworkScreen

* Remove MULTICHAIN check for AccountDetailsModal

* Remove MULTICHAIN check for AssetList

* Update QR dimensions

* Remove MULTICHAIN declaration from metamaskrc.dist

* Implement PickerNetwork and NetworkListMenu in onboarding

* Remove legacy NetworkDropdown and Dropdown

* Remove documentation about legacy account menu

* FIX: Fixes route tests for missing data-testid=network-display

* Fix account-menu-icon data-testid

* Fix TokenCell test

* FIX Onboarding Flow tests

* Remove unused locales from AccountMenu removal

* E2E: Fix Import Secret Recovery Phrase: logs out of the vault

* E2E: Fix Show account details: should show the QR code for the account

* E2E: Fix add-account.spec.js

* E2E: Fix state-logs.spec.js

* E2E: Fix lock-account.spec.js

* E2E: Fix settings-general.spec.js

* E2E: Fix advanced-settings.spec.js

* E2E: Fix auto-lock.spec.js

* E2E: Fix backup-restore.spec.js

* E2E: Fix clear-activity.spec.js

* E2E: Fix settings-search.spec.js

* E2E: Fix encrypt-decrypt.spec.js

* E2E: Fix dapp-interactions.spec.js

* E2E: Fix test-snap-management.spec.js

* E2E: Fix add-custom-network.spec.js

* E2E: Fix from-import-ui.spec.js

* E2E: Fix provider-api.spec.js

* E2E: Fix chain-interactions.spec.js

* E2E: Fix custom-rpc-history.spec.js

* Remove network icon from overview components

* E2E: Fix user-actions-benchmark.js

* E2E: Fix benchmark.js

* E2E: Fix add-hide-token.spec.js

* E2E: Fix address-book.spec.js

* E2E: Fix custom-token-add-approve.spec.js

* E2E: Fix incremental-security.spec.js

* E2E: Fix metamask-responsive-ui.spec.js

* E2E: Onboarding.spec.js

* E2E: Fix permissions.spec.js

* E2E: Fix send-hex-address.spec.js

* E2E: Fix send-to-contract.spec.js

* Remove dead AccountOptionsMenu test

* E2E: Fix token-details.spec.js

* E2E: Fix switch-custom-network.spec.js

* E2E: Fix metamask-ui.spec.js

* Revert "UX Multichain: updated border top for activity list (#19176)"

This reverts commit 15598f2a23.

* E2Es: Fix test-snap-management.spec.js and test-snap-notification.spec.js

* E2Es: Fix add-account.spec.js after flaky test fixes

* e2e flaky test

* adds back the mmi options

* scss fix

* test fix

* removes unnecessary double quotes

* Prevent double logos on login screen

* Update ui/components/ui/list-item/index.scss

Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>

---------

Co-authored-by: seaona <mariona@gmx.es>
Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net>
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
2023-06-01 16:14:38 -05:00
Dan J Miller
bb605f7e97
Update mv3 minimum version to chrome v88 (#19358) 2023-05-31 17:43:26 -02:30
Elliot Winkler
fbcd2a1113
Ensure custom provider configs have chain ID and RPC URL (#19296)
Update NetworkController so that when it is creating the network client
based on configuration for a custom RPC endpoint, it verifies that the
configuration object contains both a chain ID and RPC URL. This check is
already present on the core side; bringing it over makes the tests more
consistent so we can compare them more easily.
2023-05-31 11:52:04 -06:00
Elliot Winkler
1fc4b39dc7
Update INFURA_NETWORKS in NC tests to ostensibly use dec #'s (#19316)
This is a tiny change in order to make the NetworkController tests
between core and this repo more consistent and easier to compare.
2023-05-31 11:51:46 -06:00
Elliot Winkler
206e4537d1
NetworkController tests: Sync withController helper (#19313)
This reduces the diff in the NetworkController tests between this repo
and core in order to make them easier to merge.
2023-05-31 11:50:32 -06:00
Elliot Winkler
84cb4a7b62
NetworkController tests: Remove commented line (#19315)
This line was accidentally left in a previous PR that swapped Nock in
the NetworkController tests for a fake provider. It does not show up in
the core version of these tests.
2023-05-31 11:16:48 -06:00
Elliot Winkler
3e0d717b97
NetworkController: Improve test for destroy (#19314)
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.
2023-05-31 09:30:17 -06:00
Elliot Winkler
cc2e18b16a
Add getProviderConfig action to NetworkController (#19317)
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.
2023-05-31 09:29:59 -06:00
Elliot Winkler
84d22e122c
Sync NetworkController constructor tests with core (#19311)
This makes it easier to compare the NetworkController unit tests between
extension and core.
2023-05-31 09:29:29 -06:00
David Drazic
f788121c3b
[FLASK] Add Snaps privacy warning on snap install (#18835)
* 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
2023-05-31 14:43:39 +02:00
António Regadas
edf2cc41cb
[MMI] adds mmi code fences to mm controller (#18279)
* adds code fencing

* MMI adds mmi-controller

* MMI prettier

* chore: create keyring builder for CustodyKeyrings

* updates code fence to build-mmi

* adds dependencies

* fix import and prettier

* lint

* clean up

* clean up

* removes old methods and adds new

* comment for now

* adds two missing methods

* runs yarn dedupe

* adds missing import

* bump target values

* lavamoat policy update

* bump values in coverage targets

* prettier import order

* coverage report update

* clean up

* yarn update

* yarn dedupe

* ran lavamoat:auto

* adds zlib entry to storybook/main.js

* adds browserify-zlib

* clean up

* clean up

* prettier

* prettier

* eslint fix

* fix paths

* fix prettier

* fix file name for mocha

* adds to config

* rename

* adds file to configs

* test lavamoat clean up

* run dedupe

* sets value in storybook main.js as false

* runs lavamoat auto

* updates mmi packages to lighter versions

* updates mmi packages

* lavamoat auto

* adds finalized tx status

* lavamoat auto

* yarn dedupe

* clean up

* moving stuff into mmi controller

* clean up

* updates tresholds

* yarn lock review

* updates the mmi controller

---------

Co-authored-by: Shane Terence Odlum <shane.odlum@consensys.net>
2023-05-29 16:38:28 +01:00
Elliot Winkler
c2bbbb1dbc
NetworkController: Simplify event types (#19252)
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.
2023-05-26 10:35:52 -06:00
Elliot Winkler
b387a6e795
Reset all Jest mocks in NetworkController tests (#19295)
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).
2023-05-26 09:55:19 -06:00
Elliot Winkler
b7ef99847a
Refactor NC initializeProvider tests (#19253)
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.
2023-05-25 11:47:36 -06:00
Elliot Winkler
5b85e9b73b
Refactor tests for refreshNetwork behavior (#19238)
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.
2023-05-25 11:36:38 -06:00
Daniel
af018efcb6
Styling fix and content update for Swaps (#19284) 2023-05-25 18:48:11 +02:00
OGPoyraz
9375e3810f
fix cancel reason event for signatures (#19286) 2023-05-25 15:10:45 +02:00
Nicholas Ellul
ba4f56fbf7
Revert "limit connections (#18355)" (#19272)
This reverts commit 8d2803c179.
2023-05-24 11:17:00 -04:00
Albert Olivé
00bad7b8a8
[MMI] Added code fencing in transaction list (#18071)
* Added code fencing in transaction list

* Fixed import

* Fixed tests

* Fixed indentation

* Fixed code fences

* Removed custody icon in favor of svg

* Fix prettier

* lint

* Fixed prettier issue

* adds check before set state with variable _mounted

* lint

* check for address in selectedIdentity

* review fix

* lint

* updates test

* lint

* clean up

* prettier

* adds missing locale

* Added tests and improved code

* Fixed code

---------

Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net>
2023-05-24 13:40:58 +02:00
Monte Lai
832ce634fd
feat(accounts): import account without password (#19132)
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>
2023-05-23 15:54:30 -07:00
Nidhi Kumari
9db971768b
UX Multichain: updated ui for settings page (#19167)
* updated ui for settings page

* lint fix

* resolved errors

* fixed search bar css

* fixed css

* lint fix

* fixed tests

* fixed indentation

* updated settings aria label
2023-05-23 23:59:00 +05:30
Albert Olivé
ae3021c697
[MMI] Added code fences to the following controllers: app-state, metametrics, preferences (#17894)
* 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
2023-05-23 16:16:23 +02:00
legobeat
0e2d641813
test: sanitize url hostname check (#19053) 2023-05-18 00:09:20 +09:00
Albert Olivé
ebc887021e
[MMI] Added code fences for account menu (#17965)
* 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>
2023-05-17 16:58:00 +02:00
Nidhi Kumari
ac6fb3bb09
UX Multichain: updated assets to tokens in home page (#19144)
* updated assets to tokens in home page

* lint fix

* lint fix

* updated tests and spec files

* lint fix
2023-05-17 08:30:47 +05:30
Albert Olivé
a017a1bae0
[MMI] Added note to trader code fencing (#18051)
* Added note to trader code fencing

* Started adding code fences in signature-request

* Finished code fencing

* Improving code

* adds check and runs prettier

* Fixed storybook and code fences bundle

* Added missing dependency

* updates fences

* fewer lines

* undo previously merged PR

* ran lavamoat auto

* adds test

* prettier

---------

Co-authored-by: António Regadas <apregadas@gmail.com>
Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2023-05-16 16:44:08 +01:00
António Regadas
b982bea130
[MMI] adds wrong network notification (#19168)
* adds component and test

* adds correct icon and story file

* lint

* typo fix
2023-05-16 16:59:42 +02:00
Mark Stacey
05715dd981
Support hex and number net_version responses (#19156)
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
2023-05-15 18:56:22 -02:30
Frederik Bolding
125021e425
[FLASK] snaps-monorepo@0.33.1-flask.1 (#18913)
* snaps-monorepo@0.33.0-flask.1

* Add browser-passworder

* Patch babel/core

* Fix PermissionController messenger allowlist

* Update test-snaps

* Use latest patch

* Update LavaMoat policies

* Re-enable RPC E2E

* Make snaps iframe URL be a env variable and bump it

* Add new env variable to test env

* Add iframe URL to desktop build
2023-05-15 19:36:24 +02:00
Mark Stacey
e29faca3a6
Refactor lookupNetwork unit tests (#19070)
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
2023-05-15 13:34:34 -02:30
OGPoyraz
37a2be0fbb
Add getCurrentChainId argument to SignatureController (#19078) 2023-05-11 10:22:42 +02:00
OGPoyraz
d37d5bf0ee
feat: Refactor Transaction Confirmation selector (#18796) 2023-05-11 07:56:17 +02:00
Mark Stacey
cf7c790505
Only recognize "blocked" status for built-in networks (#19069)
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.
2023-05-10 12:11:57 -02:30
Elliot Winkler
05fb01802d
Re-enable tests for subscription-based RPC methods (#18994)
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>
2023-05-10 09:34:10 -02:30
Vinicius Stevam
df3db6e559
Adopt ApprovalType from core (#18567) 2023-05-10 06:36:01 +01:00
Mark Stacey
9847179f54
Set network status to "unknown" when ID is invalid (#19068)
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.
2023-05-09 15:44:14 -02:30
Vinicius Stevam
da8cb0bbc0
Fix fail to reject multiple approval requests (#19050) 2023-05-08 11:09:46 +01:00
Monte Lai
0306422bbf
Add reveal to export private key (#18170)
Co-authored-by: George Marshall <george.marshall@consensys.net>
Co-authored-by: Brad Decker <bhdecker84@gmail.com>
Co-authored-by: David Walsh <davidwalsh83@gmail.com>
Co-authored-by: Howard Braham <howrad@gmail.com>

* change js to tsx

* update to typescript

* add labels to circle animation

* add willHide prop to hold to reveal modal

* add test

* convert to design system

* fix lint

* fix type

* bump coverage

* rename

* remove comments

* remove ts comment and add fix exhuastive dep check

* update coverage

* add hide modal test

* use banneralert

* update label

* remove unused

* fix text

* update aria label messages

* change exportAccountAndGetPrivateKey to be async

* fix lint

* update coverage target

* update coverage

* update input component

* update coverage

* update coverage

* fix blank line

* use &&

* move plainKey to under !privateKeyInput

* update hold modal to display srp and private key message

* fix styling

* fix lint and test

* fix unused locales

* remove redundent check

* update storybook

* fix text alignment

* fix lint

* update snapshot

* fix test

* update coverage

* fix merge conflict

* refactor

* fix variant

* update snapshot

* fix test after merge

* fix test after merge conflict

* fix label text

* update to use label component
2023-05-06 17:04:20 -04:00
Brad Decker
b60b9f441f
Bundle size reduction: Upgrading ethereumjs/tx and ethereumjs/common (#18302)
* upgrade ethereumjs/tx and deps

* Yarn dedupe

---------

Co-authored-by: Dan J Miller <danjm.com@gmail.com>
2023-05-05 10:55:41 -05:00
David Walsh
67dbac6b0d
Fix #18984 - UX: Multichain - Network connection fixes (#19000) 2023-05-05 09:02:28 -05:00
Albert Olivé
33f9d6f480
[MMI] Applied code fencing in transactions and pending tx tracker controllers (#17909)
* Applied code fencing in trabsactions and pending tx tracker controllers

* remove unneeded URL from the comment

* Added test

* Added useful comment

* Fixing code fences

---------

Co-authored-by: António Regadas <apregadas@gmail.com>
2023-05-05 15:58:40 +02:00
Albert Olivé
319696b4ef
[MMI] Added compliance details modal and compliance details component (#18118)
* Added compliance details modal and compliance details component

* Finished component

* Fixed test name
2023-05-05 14:07:51 +02:00
Matthew Walsh
f62d8fce61
Use core signature controller (#18654) 2023-05-05 13:05:52 +01:00
Jyoti Puri
9c63dfca89
Changes in blockaid texts (#19001) 2023-05-04 23:51:46 +05:30
Nidhi Kumari
cfc653ada6
eth_sign toggle Update in advanced settings (#18848)
* 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
2023-05-04 16:44:07 +05:30
Pedro Figueiredo
bfbe10ba28
e2e test for action metrics (#18347)
* e2e test for action metrics

* add tests to implementing sw restart delay tracking

* wip

* wip

* wip

* wip

* remove unneeded code

* remove scuttling changes contemplated in #18989
2023-05-04 10:38:09 +04:00
David Walsh
ab4843f06b
UX: Multichain: Implement Account Details Popover (#18811)
* 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>
2023-05-03 12:09:13 -05:00
witmicko
8d2803c179
limit connections (#18355)
limit background connections
2023-05-03 16:39:56 +01:00
NanamiNakano
6f4969d701
Update messages.json (#18897)
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
Co-authored-by: Danica Shen <zhaodanica@gmail.com>
2023-05-03 08:28:32 -05:00
Frederik Bolding
910b9e713f
Use separate versions for Flask and Stable snaps (#18875)
* Use separate versions for Flask and Stable snaps

* Update LM policy override

* Add deps to depcheck

* Improve import
2023-05-03 15:16:43 +02:00
OGPoyraz
cbcb46f704
fix: prevent cancel and speedup transactions to call accept approval (#18846) 2023-05-03 13:07:03 +02:00
David Walsh
57e90196cc
UX: Multichain: Provide localization for the network menu (#18880) 2023-05-02 12:14:48 -05:00
Mark Stacey
d1cea85f33
Rename provider to providerConfig (#18907)
* 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
2023-05-02 13:23:20 -02:30
Frederik Bolding
4d015de43e
Fence snaps endowments and permissions for stable/flask (#18847)
* Fence snaps endowments and permissions for stable/flask

* Fix lint

* Fix tests

* Actually fix tests

* Fix another test
2023-05-02 14:51:16 +02:00
Mark Stacey
483ffdb5c0
Simplify network controller unit test setup (#18901)
* 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.
2023-05-02 09:02:57 -02:30
George Marshall
1ff437d356
Adding new icons (#18870) 2023-04-28 12:29:58 -07:00
Jyoti Puri
e292d50d9f
Consistent message for third party requests across screens (#18873) 2023-04-28 22:59:36 +05:30
Victorien Gauch
7f585a19b7
fix(18709): fix error when switching to linea testnet using wallet_sw… (#18710)
* fix(18709): fix error when switching to linea testnet using wallet_switchEthereumChain

* fix: update condition to get network config
2023-04-28 10:04:10 -02:30
Albert Olivé
49f01406c4
[MMI] Added confirm-remove-jwt component (#18186)
* Added confirm-remove-jwt component

* changing folder directory

* Fixed lint issues

* Added story

* Fixed confirm remove jwt imports

* Fixed import

* Finished implementing component

* Fixed capitalize eslint problem

* Fixed PR suggestions

* Changed CustodyAccountList import

* updated snapshot

* Fixed typo

* Moved folder to confirm-remove-jwt-modal

* added index

* Adding filter first
2023-04-28 11:01:40 +02:00
Andrew Peters
bbb35dbe8d
update ses@0.18.4 (#17521)
* update ses import directory
* agoric references removed
* domainTaming set to unsafe

---------

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2023-04-27 21:31:52 +09:00
Bernardo Garces Chapero
1253c768c7
Return state when calling EncryptionPublicKeyController.cancelEncryptionPublicKey (#18845)
* returns state

* adds unit test
2023-04-27 11:39:37 +01:00
António Regadas
e6455e92ae
[MMI] custody page component (#18688) 2023-04-27 12:27:31 +02:00
Albert Olivé
4c9bf40688
[MMI] Add interactive-replacement-token-page (#18683)
* Initial commit

* converted the component from class-based to functional.

* Refactored component

* Improved code and tests

* Finished adding tests

* Fixed eslint problems

* Added back custodyLabels component

* Fixed eslint problems

* fixed ts lint problem

* Fixed eslint problems

* Added more tests and improved code

* Added comments

* Fixed eslint problems

* Fixed eslint problems
2023-04-27 10:45:37 +02:00
Jyoti Puri
e0919d529e
Fix for wrong type being assigned to the transaction (#18818)
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2023-04-27 13:46:36 +09:00
TaeRim Lee
17e17e83cc
locales/ko: Fix some mistranslation and typo (#18799)
---------

Co-authored-by: Brad Decker <bhdecker84@gmail.com>
2023-04-27 11:13:07 +09:00
OGPoyraz
6d0f3a0b26
Consume Decrypt Message Manager from @metamask/message-manager (#18379) 2023-04-26 17:02:33 +02:00
Jyoti Puri
82a64195a2
Enable editing L2 gas on optimism (#18217) 2023-04-26 05:43:38 +05:30
Guillaume Roux
6126c156ea
[FLASK] Expanded Snap authorship (#18775) 2023-04-25 19:20:37 +02:00
Olaf Tomalka
95c37e1ba3
feat: add yaml feature management (#18125)
* 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>
2023-04-25 16:32:51 +02:00
Albert Olivé
4df363b251
[MMI] Created custody-confirm-link-modal component (#18632)
* Created custody-confirm-link component

* Removed selector

* Finished component

* Changed button to use design system

* Fixed eslint issue

* updated snapshot

* fixed eslint problems

* Added more tests and added color design systems

* Fixed comments

* Removed unnecessary code

* Removed unneeded code and fixed eslint issues
2023-04-25 08:39:16 -05:00
Monte Lai
cbe438e704
Update keystone links (#18792)
* update keystone links

* update tests

* fix lint
2023-04-25 21:33:43 +08:00
Shane T
16dabdf802
[MMI] Adds a warning if message signing account mismatches selected account (#18659)
* [MMI] Adds a warning if message signing account mismatches selected account

* chore: fix code fencing

* chore: remove render method to simplify

* chore: remove renderMethods
2023-04-25 12:47:12 +02:00
David Drazic
ff96836871
[FLASK] Add updated version of the Snaps settings UI (#18438)
* Add updated version of the Snaps list UI

Add more changes to match the designs of snaps list

Add next design iteration for snaps list

Update icons, sizes and pointer behaviour

Add redesign for snap settings page

Refactor and improve designs

Fix unit tests and refactor code

Fix e2e test

Fix lint

Update margin values

Add CSS override for connected sites list and update margins

Update paddings as requested

Fix vertical alignment of links

Fix tooltip position on the enable button

Add usage of getSnapName function for displaying snap names

Fix e2e tests and update date format for snap install date

Improve unit test for snap-settings-card

Change installation info logic

Update mocked state for snap

Add tests for ViewSnap component, refactor and update mocked state

Add check for version info

Change Snaps icon in Settings

Refactor Snaps list to use selector

Add handling in case of missing version history

* Fix icon ref

* Remove console logs

* Remove onClick from selector

* Add code fencing for imports in selectors.js
2023-04-24 12:21:37 +02:00
Hassan Malik
f833f0e5aa
update ethereum provider endowment weight level and update install warning copy (#18732) 2023-04-21 15:34:11 -04:00
Albert Olivé
4f64e3d6c3
[MMI] Add-compliance-details component (#18575)
Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net>
Co-authored-by: Ariella Vu <20778143+digiwand@users.noreply.github.com>
2023-04-21 13:28:26 -05:00
Nidhi Kumari
0efd00b755
UX Multichain: Added product tour component (#18571)
* adding product tour component

* updated control for prevIcon

* updated app-header and product tour

* updated css

* updated message strings

* updated tests

* removed console statement

* added selector for product tour

* updated test

* updated test

* updated state with steps

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.js

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* Update ui/components/multichain/product-tour-popover/product-tour-popover.scss

Co-authored-by: Garrett Bear <gwhisten@gmail.com>

* fixed lint errors

* updated lint error

* added changes for rtl support

* added changes for rtl support

* fixed lint errors

* Some suggestions (#18676)

* updated messages and indentation

* fixed popup close on my final step

* updated rtl classname condition

---------

Co-authored-by: Garrett Bear <gwhisten@gmail.com>
Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-04-21 20:58:18 +05:30
Albert Olivé
48a61610af
[MMI] Add transaction-failed functional component (#18623)
* Finished component

* Fixed test mock variable

* Using design system colors

* Using design system icons

* removed uneeded css
2023-04-21 15:53:02 +02:00
António Regadas
4f4e9fb29c
[MMI] update eth overview component (#18625)
* wip

* adds mmi stake button and portfolio

* removes unnecessary js icon

* prettier
2023-04-21 12:16:09 +01:00
António Regadas
290353da9b
[MMI] interactive replacement token notification (#18620)
* adds the component and styles

* adds tests

* story file update

* clean up

* lint and prettier

* lint & prettier fix

* adds review changes

* adds necessary dependencies

* runs lint and prettier
2023-04-21 09:58:03 +01:00
Bernardo Garces Chapero
8632acbba3
Update tokens controller (#18459)
* update tokens controller
2023-04-21 09:05:27 +01:00
Jyoti Puri
7f00c2f313
Fixing issue with gasLimit in transaction being 0 (#18682) 2023-04-21 11:17:38 +05:30
flexa-rob
3c01011ffe
17873 ledger instruction banner (#17937)
* switched to use banner alert and added story

* enabled dismiss functionality

* remove close button

* bump global branches coverage target

* replace Typography with Text and (link) Button with ButtonLink

* unit test for component rendering

* left-align button links to match text

* update copy to reflect figma mock ups

* update unit test snapshot

* bump coverage threshold

* update snapshot to reflect button component changes

* update snapshot to reflect box changes
2023-04-21 13:21:31 +10:00
Elliot Winkler
73b9c1095a
Update NC setProviderType to clear rpcUrl/nickname (#18675)
In the core version of NetworkController, `setProviderType` sets
`rpcTarget` (its name for `rpcUrl`) and `nickname` to `undefined`.
While it would be better to completely remove these properties, it would
be better to follow suit so that we can make the tests between the two
versions of the controllers more alike.
2023-04-20 15:50:59 -02:30
Elliot Winkler
24eae1d3c6
Use fake provider for NetworkController unit tests (#18628)
* 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
2023-04-20 15:21:41 -02:30
Mark Stacey
3776f4ad4c
Remove mobile sync feature (#18692)
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.
2023-04-20 14:29:30 -02:30
Mark Stacey
8e52ed3fac
Make upsertNetworkConfiguration async (#18606)
The network controller method `upsertNetworkConfiguration` has been
made async. It makes one async call internally, which is the optional
step of setting the given network as the active network.

If the `setActive` option is set to `true`, this function will not
resolve until after the network switch has completed. If the
`setActive` option is `false`, this change will not have any functional
impact.

Relates to https://github.com/MetaMask/metamask-extension/issues/18587
2023-04-19 20:24:50 -02:30
Monte Lai
fa6e26744d
18566 firefox ledger u2f message (#18570)
* check for user agent

* fix regex

* fix lint

* update link

* add test

* update message

* update coverage

* fix test names

* update text

* add whats new notification for firefox and ledger users

* update action button link

* update notification text

* update viewed notification

* update coverage

* update coverage
2023-04-19 19:23:07 -02:30
Dan J Miller
7ca9383785
Fix swaps controller: update provider after networkIdStore state update (#18670)
* Fix swaps controller: update provider after networkIdStore state update

* Listen for changes on networkController.store, instead of networkController.networkIdStore, in the swaps controller

* Fix unit tests
2023-04-19 18:15:26 -02:30
Elliot Winkler
a876eaba23
removeNetworkConfiguration validates given ID (#18650)
In the `core` version of NetworkController, `removeNetworkConfiguration`
throws an error if the given network configuration ID doesn't match an
existing network configuration. This commits adds the same check for
consistency. It also makes some minor changes to the implementation and
tests for `removeNetworkConfiguration` for consistency as well.
2023-04-19 09:47:33 -06:00
Nidhi Kumari
d362dbfacb
UX Multichain: updated ethereum logo icon (#18528)
* updated ethereum logo icon

* Updating eth logo (#18631)

* Updating eth logo

* Removing border from eth logo identicon

* Removing old eth logo

* updated snapshot and lint errors

* updated eth logo from svg to png

---------

Co-authored-by: George Marshall <george.marshall@consensys.net>
2023-04-19 20:55:19 +05:30
Dan J Miller
7bc13e90f8
Rename migration 83 to 84 and rename migration 84 to 83 (#18655)
Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
2023-04-19 11:38:16 -02:30
Brad Decker
7fa7c05586
use network did change instead of state update for assetsContractController (#18629) 2023-04-18 14:03:12 -02:30
Mark Stacey
1fe28ee15a
Make setActiveNetwork async (#18605)
The network controller method `setActiveNetwork` is now async, and the
asynchronous `_setProviderConfig` step is now awaited. The function
will not resolve until the network has finished switching.

This change affects the `eth_switchEthereumChain` and
`eth_addEthereumChain` middleware, and it affects any network switching
performed in our UI.

Relates to https://github.com/MetaMask/metamask-extension/issues/18587
2023-04-18 13:25:05 -02:30
Dan J Miller
e6f73f5fe9
Pass correct params to fetchEstimatedL1Fee in the swaps controller (#18634) 2023-04-18 12:15:18 -02:30
Vinicius Stevam
ae0af1b283
Adopt security provider request from core (#18520) 2023-04-18 08:33:32 +01:00
Jyoti Puri
00d2d43d45
Fix error in console on rejecting signature request (#18614) 2023-04-18 05:58:28 +05:30
Mark Stacey
e5835ac459
Make resetConnection async (#18601)
The network controller method `resetConnection` is now async. This has
no functional impact.

Relates to https://github.com/MetaMask/metamask-extension/issues/18587
2023-04-17 15:45:22 -02:30
Mark Stacey
b87c1b8526
Make setProviderType async (#18604)
The network controller method `setProviderType` is now async, and the
async operation `_setProviderConfig` called at the end of the method is
now awaited.

Because the only async operation was the last step, this should have no
impact upon the flow of execution. The only functional change is that
now any callers have the option of waiting until the network switch
operation has completed.

One such change was made, in the `switch-ethereum-chain` middleware. As
a result, an error thrown while the network is switching will now
be thrown in this middleware and returned to the dapp as an internal
error.

Relates to https://github.com/MetaMask/metamask-extension/issues/18587
2023-04-17 15:45:01 -02:30