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

174 Commits

Author SHA1 Message Date
Danica Shen
f92e463a0f
fix: Pass correct optimism chain id to gas estimation (#18478) 2023-04-06 12:50:52 +01:00
Frederik Bolding
40628da3b4
[FLASK] Fix crash when requesting unknown snap permission (#18447) 2023-04-05 15:34:33 +02:00
George Marshall
739075662c
Migrating Icon to typescript and deprecating JS component (#18431)
* Migrating Icon to typescript and deprecating JS component

* gw suggestions (#18434)

---------

Co-authored-by: Garrett Bear <gwhisten@gmail.com>
2023-04-04 09:48:04 -07:00
Garrett Bear
01057f9824
convert text component to TS (#18329)
* convert text component to TS

* invisible character fix

* storybook fix

* fix types export

* update ButtonBase

* add typeof to objects in TextProps

* fix linting issues

* fix implicit conversion

* lint fix

* add deprecated Text back

* change box ref to any

* fix classnames issue

* account details to use deprecated text reference

* ref update

* make RefObject

* remove RefObject and go back to Ref

* react.ref change to box
2023-04-03 10:42:37 -07:00
David Drazic
8603a4b067
[FLASK] Add permission cell component (#18372)
* Add permission cell component

Add storybook and handling for revoked permission colors

* Fix things after conflict resolve after rebase

* Add code refactoring and minor UI changes

* Add permission cell component to snap-update flow

* Update storybook

* Add unit tests for permission cell

* Update component padding

* Fix spacing between permission cells

* Fix main icon color for approved permissions

* Update width value with constant
2023-04-03 19:33:54 +02:00
Elliot Winkler
ed3cc404f2
NetworkController: Split network into networkId and networkStatus (#17556)
The `network` store of the network controller crams two types of data
into one place. It roughly tracks whether we have enough information to
make requests to the network and whether the network is capable of
receiving requests, but it also stores the ID of the network (as
obtained via `net_version`).

Generally we shouldn't be using the network ID for anything, as it has
been completely replaced by chain ID, which all custom RPC endpoints
have been required to support for over a year now. However, as the
network ID is used in various places within the extension codebase,
removing it entirely would be a non-trivial effort. So, minimally, this
commit splits `network` into two stores: `networkId` and
`networkStatus`. But it also expands the concept of network status.

Previously, the network was in one of two states: "loading" and
"not-loading". But now it can be in one of four states:

- `available`: The network is able to receive and respond to requests.
- `unavailable`: The network is not able to receive and respond to
  requests for unknown reasons.
- `blocked`: The network is actively blocking requests based on the
  user's geolocation. (This is specific to Infura.)
- `unknown`: We don't know whether the network can receive and respond
  to requests, either because we haven't checked or we tried to check
  and were unsuccessful.

This commit also changes how the network status is determined —
specifically, how many requests are used to determine that status, when
they occur, and whether they are awaited. Previously, the network
controller would make 2 to 3 requests during the course of running
`lookupNetwork`.

* First, if it was an Infura network, it would make a request for
  `eth_blockNumber` to determine whether Infura was blocking requests or
  not, then emit an appropriate event. This operation was not awaited.
* Then, regardless of the network, it would fetch the network ID via
  `net_version`. This operation was awaited.
* Finally, regardless of the network, it would fetch the latest block
  via `eth_getBlockByNumber`, then use the result to determine whether
  the network supported EIP-1559. This operation was awaited.

Now:

* One fewer request is made, specifically `eth_blockNumber`, as we don't
  need to make an extra request to determine whether Infura is blocking
  requests; we can reuse `eth_getBlockByNumber`;
* All requests are awaited, which makes `lookupNetwork` run fully
  in-band instead of partially out-of-band; and
* Both requests for `net_version` and `eth_getBlockByNumber` are
  performed in parallel to make `lookupNetwork` run slightly faster.
2023-03-30 16:49:12 -06:00
Hassan Malik
c2b2f2685e
[FLASK] Redesign key management modal (#18263)
* added the rest of the sev1 warnings to getSnapInstallWarnings

* added and updated translations

* Updated getSnapInstallWarnings to include warnings for all weight-1 permissions

* Updated snap install warning and css according to designs

* fix snaps tests

* fixed alignment/spacing

* updated e2e tests to click through the newly displayed public key access warning

* lint fix

* fixed update snap test

* refactored getSnapInstallWarnings, moved logic to PERMISSION_DESCRIPTIONS

* fix logic to account for objects & arrays

* update function description

* add missing properties to ethereum provider description

* moved id and message to baseDescription to fix error

* add optional chaining to fix undefined error

* more optional chaining

* more optional chaining
2023-03-29 15:17:57 -04:00
aleksandar-mihajlovic
0f1b86a037
Removed advanced gas controls from the settings (#18138) 2023-03-27 08:45:17 +02:00
Frederik Bolding
4179ce634c
[FLASK] Update snap authorship component (#18262)
* Create new snap authorship component

* Add icons and fix overflow issues

* Add empty state + more fixes

* Fix overflow

* Move some code to SnapAvatar

* Fix lint

* Change component name

* Delete forgotten file
2023-03-24 17:16:46 +01:00
Victorien Gauch
a04fa20f96
feat: add the ConsenSys zkEVM (Linea) as a default network (#17875)
* feat: add the consensys zkEVM as a default network

* fix: change infuraNetworkStatus in navigate-txs file

* fix: remove account tracker for zkEVM + remove zkEVM from infura list

* fix: change consensys zkevm name to linea + change rpc url for linea network

* fix: rebase conflicts

* feat: add new colors for linea goerli network

* feat: add new function inside network dropdown to render non infura networks

* feat: add feature toggle for linea network

* fix: add new unit test

---------

Co-authored-by: Dan J Miller <danjm.com@gmail.com>
2023-03-21 13:58:38 -02:30
Maarten Zuidhoorn
c59e2b4d44
[FLASK] Add tooltips to show info about a permission (#17685)
* Add tooltips to show info about a permission

* Make Tooltip component in scope regardless of build type

* Add descriptions

* Add translation variables and fix tooltip

* Use new icons

* Add missing description after rebase

* Fix build issues

* Fix icons

* Fix translation

* Add missing description

* Fix Ethereum icon

* Update coverage
2023-03-20 12:32:03 +01:00
Guillaume Roux
d6f58bceb0
[FLASK] snaps-monorepo@0.31.0 (#18142)
* allow SnapController to call `ApprovalController:updateRequestState` action

* combine popups

* show only autorship pill on result

* lint

* update `snaps-monorepo@0.31.0` and regen policies

* dedupe deps and fix fencing

* fix update button text

* fix fencing

* Update a bunch of e2es

* address requested changes

* update policy

* bump key-tree

* fix lint

* Update RPC E2E

* fix locales

* Remove wrong instance of window handle polling

* design changes and address pr comments

* remove unused imports

* fix lint

* fix fencing

* remove unused locales

* fence things

* re-add redirection

* bump test-snaps version

* Fix update e2e

* fix redirecting logic and address requested changes

* force update metamask state on approved

* move force update

---------

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
2023-03-17 12:00:05 +01:00
David Walsh
5b1b5dc03b
NFTs: Remove feature flag for release (#17401)
* 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
2023-03-13 14:29:37 -05:00
Dan J Miller
3ad6cf15ae
Use replace instead of replace all so that we are compatible with v78 (#18080)
* Use replace instead of replace all so that we are compatible with v78

* Add unit tests
2023-03-10 10:06:07 -03:30
David Drazic
642ce91b70
[FLASK] Add WebAssembly endowment (#17694)
* Add WebAssembly endowment

Update message and fix lint

Update fa icon

* Remove duplicated webassembly permission from a list
2023-03-10 12:38:58 +01:00
Hassan Malik
7086494b72
[FLASK] BREAKING - snaps-monorepo@0.30.0 (#17718)
* updated snap permission to wallet_snap, updated tests and added migration

* updated snap packages

* yarn.lock fix

* fixed errors

* override policy

* update policy

* undo override

* updated localization message descriptions

* updated lavamoat policy

* more policy updates

* update permission controller version

* update policy

* update fixture builder

* updated code to include permission value to satisfy wallet_snap permission description call

* fix import issue

* update test-snaps version

* added missing actions, added snap permission dedupe function

* prettier fix

* fix fencing

* add more fencing

* prettier fix

* fix fencing (again)

* added new action and selector and updated view snap accordingly

* update test snaps website version

* unfence request variable

* add fencing

* add optional chaining to fix type error

* update migration #

* remove old migration

* prettier fix

* fix migration test

* fix fencing

* added missing fencing

* updated code to workaround fencing

* update test-snaps site version and remove snap confirm test

* update snap packages

* update policies

* fix merge marker issue

* update test

* more fixes

* fix permissions

* update test

* fixed test

* Bump test-snaps and iframe-execution-environment

* remove unused snap permission from fixture builder

* update policies

* undo comment removal, update selector implementation

* removed unnecessary function, updated migration, updated caveat action

* remove optional chaining

* fix type issue

* more type fixes

* fix migration test

* remove isFlask check, make migration logic more robust

* update coverage

* Update LavaMoat policies

* Update test/e2e/snaps/enums.js

* add extra bail condition

* Revert "add extra bail condition"

This reverts commit b45c53dcfc6e6e35a5e283d4955d6d6ea9ca5965.

* Revert "Revert "add extra bail condition""

This reverts commit cd2ded677935c9cdab0c02b6af55474c83727f60.

* fix test

* add SnapController entry to state object

* updated permission name and caveat type with hardcoded values

* add extra test for non-flask scenario

* update lavamoat policies

* fix locale messages

* change coverage target

* re-enable rpc snap test

* revert locale message change

* fix el message

* reverted changes

---------

Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
2023-03-08 13:29:23 -05:00
weizman
bfbd65237e
Avoid blob url for files downloads (#17986) 2023-03-07 12:47:45 +02:00
HowardBraham
694773f17a
Upgrading the Import Account modal (#17763)
Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
Co-authored-by: NidhiKJha <nidhi.kumari@consensys.net>
Co-authored-by: montelaidev <monte.lai@consensys.net>
2023-03-06 09:48:28 -08:00
António Regadas
56cba09749
[MMI] Adds mmi build type + manifest files and images (#17842)
* MMI adds all mmi images, build type and manifest files

* build-for-all-custodians

* fix remove-fenced-code test

* no need for axios

* runs prettier

* linter

* MMI moving file out of codebase

* MMI adds locale appNameMmi

* MMI adds locale appNameMmi to verify-locale-strings
2023-03-01 09:38:15 +00:00
Alaa Hadad
5998ae21aa
Buy crypto by redirecting to onramp experience on pdapp instead of deposit popover (#17689)
* 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
2023-03-01 12:45:27 +04:00
Nidhi Kumari
878bb4ab25
Ux: Icon: Update fa-eye with ICON_NAMES.EYE (#17800)
* updated fa-eye

* Fix build error

* resolved lint error

* lint error fix

---------

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
2023-02-28 12:55:58 +05:30
Frederik Bolding
64bfe6f307
Fix a bug where non-address types would be rendered as addresses in EIP-712 (#17846)
* Fix EIP-712 rendering logic

* Fix tests

* Fix tests and story

* Fix lint

* Fix import

* Fix stories
2023-02-27 17:32:51 +01:00
witmicko
d7adbb6f41
window open noopener (#17882)
* window open noopener
2023-02-24 15:27:38 +00:00
Nidhi Kumari
33cc8d587a
NFT: Replaced all the instances of collectibles with NFTs (#17741)
* replaced all the instances of collectibles with nfts

* updated actions

* updated e2e seeder

* updated confirm Approve test

* updated test dapp change

* updated test dapp change

* nit fix

* nit fix

* updated casing and snapshots

* updated casinG

* added migrations

* updated ,igration

* updated 078.test

* updated tests for 078 migration

* updated migration

* updated 078 index.js
2023-02-17 00:53:29 +05:30
Jyoti Puri
9979020252
Confirm transaction test (#17780) 2023-02-16 20:23:15 +05:30
David Walsh
7774ee6e2f
UX: Replace all fa-bell instances with Notification icon (#17524)
* UX: Replace all fa-bell instances with Notification icon

* Fix flask comment fencing

* Fix import error
2023-02-10 19:33:11 -06:00
amerkadicE
1ecf241a9f
Rename reset account settings (#17457)
* Rename reset account settings

Fix snapshot

Update snapshots

Fix e2e tests

Fix e2e tests

* Rename reset-account e2e test to clear-activity e2e test
2023-02-10 22:50:12 +01:00
Jyoti Puri
61a7850afc
Sanitising string on signature request pages (#17571) 2023-02-09 04:35:52 +05:30
Nidhi Kumari
3be1fc6d0c
converted collectibles files to nfts (#17658)
* converted collectibles files to nfts

* updated relative import for scss

* updated scss for pages
2023-02-08 20:04:56 +05:30
Maarten Zuidhoorn
ff85b040cb
Sort permissions based on weight (#17660) 2023-02-08 15:28:48 +01:00
Matthew Walsh
92367dff79
Add desktop build type (#17592)
Implement build type inheritance.
Add CircleCI jobs for desktop build type.
2023-02-08 09:24:01 +00:00
Maarten Zuidhoorn
1d5030af97
Add hardcoded list of human-readable snap derivation paths (#17627)
* Add hardcoded list of human-readable snap derivation paths

* Fix formatting

* Update policies
2023-02-06 21:49:56 +01:00
Harry
b4ecc4c3f5
Disable eth_sign by default, allow users to toggle it back on (#17308)
* 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>
2023-02-06 13:17:50 -03:30
Maarten Zuidhoorn
8cda817f5c
Add hardcoded list of human-readable snap names (#17595)
* 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
2023-02-06 11:05:57 +01:00
Brad Decker
31897b542d
Convert actions.js to typescript (#17446) 2023-02-03 11:56:44 -06:00
vthomas13
532a10f9f5
Adding browser outdated notification (#17027)
* 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>
2023-02-02 13:56:41 -05:00
Brad Decker
aededb1c71
Convert confirm-tx.utils.js to typescript (#17349) 2023-02-02 12:35:05 -06:00
Danica Shen
2958d68af8
feat(mme-17214): migrate L33 files to typescript (#17372) 2023-01-31 12:01:10 +00:00
Danica Shen
c23bd4925b
feature: convert level 32 files to typescript (#17390) 2023-01-27 18:28:03 +00:00
ryanml
47f6d46bb3
Add alt text for NFT images (#17284) 2023-01-25 08:08:35 -06:00
Brad Decker
3ff12d70e9
Replace usages of conversion util in rest of UI folder in favor of Numeric (#17334) 2023-01-24 08:44:49 -06:00
Vladimir Saric
f988dc1c5e
Enable the Token Allowance flow by default for all users (#16740) 2023-01-23 21:49:55 +05:30
Brad Decker
92f6ea6f6b
Relocate conversion utils to shared/modules/conversion.utils.js (#17319) 2023-01-20 11:04:37 -06:00
Brad Decker
5f6d2ba6b0
Convert Transaction constants to typescript (#17149) 2023-01-18 08:47:29 -06:00
ryanml
d8ce8612bd
Update copy and fix duplicate entries for Token Detection Settings search results (#17273) 2023-01-18 11:13:57 -03:30
Thomas Huang
4c3c4eebac
Final conversion of tests from enzyme to @testing-library/react (#16862)
* Add transaction activity log component

* Remove duplicate tx activity log snapshot.

* Convert Advanced Tab to tlr.

* Lint fix

* Change ENS to DNS in mock state data.

* Add test ids for speedup, cancel, rety buttons.

* Convert TransactionListItemDetails component to RTL.

* Convert PageContainerHeader component to RTL.

* Convert TokenInput component to RTL.

* Convert UnitInput component to RTL.

* Convert withModalProps to RTL.

* Convert i18n-helper to RTL.

* Convert ConfirmSeedPhrase component to TLR.

* Convert AddRecipient component to RTL.

* Set process.env metamask build type to 'main' for test

Co-authored-by: Brad Decker <bhdecker84@gmail.com>
Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net>
2023-01-17 07:51:35 -08:00
Niranjana Binoy
a0bb4a6c5a
Toggle option to enable/disable balance and Token rate checking for using third-party API (#16772) 2023-01-17 10:23:04 -05:00
HowardBraham
b9d9112b97
Prevent account name collisions (#16752)
* 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
2022-12-22 11:27:31 -06:00
Daniel
2832f8a97e
Update quote selection for Optimism (#16998) 2022-12-21 20:59:34 +01:00
Alex Donesky
1a842aabb6
Replace eth-optimism/contracts package with local snippet of gas price ABI and address (#16891) 2022-12-20 14:05:07 -06:00