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

4415 Commits

Author SHA1 Message Date
Mark Stacey
8866c39623
Update the Firefox prerelease version format (#13158)
The Firefox extension version format does not support the version
format we use (SemVer), so we have to specially format the extension
version to be compatible. The format we chose was
`[major].[minor].[patch].[buildType][buildVersion]`. But when we tried
to submit a build with a version in that format, it was rejected as
invalid for unknown reasons.

The Firefox extension format has been updated to
`[major].[minor].[patch][buildType][buildVersion]`. This seems to pass
validation.
2022-01-03 12:48:10 -03:30
Mark Stacey
ae97e91443
Fix how version_name manifest field is used (#13155)
The `version_name` manifest field was being used on Chrome to store the
build type. However, Chrome intended this field to be a full
representation of the version, for display purposes. This was evident
when uploading this version to the Chrome Web Store, because it used
`flask` as the entire version.

Instead the `version_name` field now includes the full SemVer version
string. The version parsing code within the build script and in the
wallet itself have been updated accordingly.
2022-01-03 10:30:13 -03:30
Mark Stacey
fe77367837
Update the Sentry setup log with the build type (#13157)
The `environment` field we use for Sentry includes the build type for
all build types except `main`, but the log message indicating that
Sentry did not include this. This log message is useful for ensuring
that Sentry is setup correctly, so it should display the same
environment that Sentry is using. It has been updated to do just that.
2022-01-03 10:29:44 -03:30
Mark Stacey
809aae0ac3
Add Chrome store policy compliant names/descriptions (#13142)
The Chrome Web Store has spam policies that prevent uploading
extensions that are too similar to each other. There are exceptions for
test and development versions of extensions, but these exceptions are
required to be clearly identified in the name and description of the
extension.

The name and description of both the Flask and beta distributions have
been updated to include explicit all-caps declarations that identify
them as development and beta distributions respectively, in-line with
the examples shown in the Chrome Web Store spam FAQ.

For more information, see: https://developer.chrome.com/docs/webstore/spam-faq/#test-version
2021-12-22 16:25:27 -03:30
Mark Stacey
609f85dbc3
Add more missing appName messages (#13140)
Three locales were missing the `appNameBeta` and `appNameFlask`
localized messages. These were missed in the previous PR (#13138).
2021-12-21 21:36:20 -03:30
Mark Stacey
279c7b61b0
Add missing appName localized messages for Flask and Beta (#13138)
The `appNameFlask` and `appNameBeta` are mandatory because they are
used by the Chrome Web Store, but they are missing from some locales.
This will prevent submitting either of these build types.

These two messages have been added to all locales. The English name has
been used everywhere, since this is a brand name and brands are often
not translated. We can update this to something more appropriate for
other locales in the future if necessary.
2021-12-21 16:32:57 -03:30
Niranjana Binoy
8c77e37d2a
EIP-1559 V2: Adding default settings to advanced gas modal (#12911) 2021-12-21 14:45:28 -05:00
Niranjana Binoy
3a11800cb1
EIP-1559 V2: Advanced gas fee modal - base fee and priority fee trends (#13025) 2021-12-21 14:01:43 -05:00
Mark Stacey
dc3efef50c
Switch Flask horizontal logos (#13113)
The Flask horizontal logos for "light" and "dark" mode were
accidentally switched. They have now been switched back. The image
`metamask-logo-horizontal.svg` is for light mode, and the image
`metamask-logo-horizontal-dark.svg` is for dark mode.
2021-12-16 16:33:55 -03:30
filipsekulic
62f41600f2
Fix account name duplicates (#12867)
* Fix account name duplicates

* Change button disabling logic

* Fix function error

* Requested changes

* Move functions from selectors file into components

* Applying requested changes
2021-12-16 07:11:55 -03:30
Hassan Malik
f946c030b5
Choose accounts refactor (#13039)
* added wrapper around account list to prevent storybook from collapsing the list

* updated translation files

* added snap-connect page

* refactored account list out of the choose account component

* fixed width

* removed unnecessary scss from choose-account component, fixed props in choose account story

* removed snaps-connect page, added comments to ChooseAccount

* updated choose account subtitle text, updated styling for title & subtitle, removed redundant account list story

* updated component name, updated paths

* fixed linter errors

* added comments

* removed unused message

* removed selectAccounts key from all locales

* updated class name for account list header, updated allAreSelected function to use length checks

* Revert "removed unused message"

This reverts commit 32771bc83c08f120825ef75f0741f3034e7dbecb.

* Revert "removed selectAccounts key from all locales"

This reverts commit ccfa4a860f9a75693d893d7c404384e719de297e.

* updated locale messages to use selectAccounts key

* removed stray import

* updated scss

* updated translation key

* removed chooseAccounts key from en locale

* removed optional chaining

* changes

* updated subjectMetadata

* updated subject types

* update useOriginMetadata function to include unknown subject type

* updated permission connect header props, removed host and added subjectType to targetSubjectMetadata

* added subjectType to targetSubjectMetadata

* removed console.log

* changed prop name to iconUrl
2021-12-14 18:54:46 -05:00
Alex Donesky
1b6e58c417
Feat/collectibles the return (#12970)
* Wire collectibles frontend UI with controller data
2021-12-13 17:41:10 -06:00
Erik Marks
c03b6dd19b
Subject metadata cleanup (#13090)
This PR fixes some subject metadata-related issues that were missed in #13026.
2021-12-13 12:10:20 -08:00
cheese1
a02f9fe751
Fix typo in German translation (#13040) 2021-12-13 08:54:05 -06:00
Jyoti Puri
19c3d021ea
Using EIP-1559 V2 for swaps (#12966) 2021-12-12 04:56:28 +05:30
Thomas Huang
c9cb2ae1a1
Jestify app/scripts/controller/network/**/*.test.js (#12985) 2021-12-10 11:25:58 -06:00
Jyoti Puri
889e49a4a2
Changes in gas loading animation in EIP-1559 V2 (#13016) 2021-12-10 06:20:38 +05:30
Mark Stacey
ba54a3d83b
Update ESLint config to v8 (#12886)
The ESLint config has been updated to v8. The breaking changes are:

* The Prettier rule `quoteProps` has been changed from `consistent` to
`as-needed`, meaning that if one key requires quoting, only that key is
quoted rather than all keys.
* The ESLint rule `no-shadow` has been made more strict. It now
prevents globals from being shadowed as well.

Most of these changes were applied with `yarn lint:fix`. Only the
shadowing changes required manual fixing (shadowing variable names were
either replaced with destructuring or renamed).

The dependency `globalThis` was added to the list of dynamic
dependencies in the build system, where it should have been already.
This was causing `depcheck` to fail because the new lint rules required
removing the one place where `globalThis` had been erroneously imported
previously.

A rule requiring a newline between multiline blocks and expressions has
been disabled temporarily to make this PR smaller and to avoid
introducing conflicts with other PRs.
2021-12-09 15:36:24 -03:30
Mark Stacey
670bed4c61
Add @metamask/rpc-methods package (#13027)
The `selectHooks` function has been replaced with the equivalent
function from the `@metamask/rpc-methods` package, which is
functionally equivalent.

The function was included in that package so that it could be used
elsewhere in the `snaps-skunkworks` repo. Eventually the goal is to
migrate much of our RPC logic into this package so that it can be
shared across products, and by our libraries as needed.
2021-12-09 11:22:53 -03:30
Dan J Miller
e45560859c
Support EIP-1559 on Trezor Model One (#13023)
* Support EIP-1559 on Trezor Model One

* Update unit tests

* Fix unit test

* Run yarn lavamoat:auto
2021-12-08 23:16:54 -03:30
Erik Marks
fc1ffae406
Add subject types (#13026)
This PR introduces the concept of subject _types_ to be associated with each subject in the `SubjectMetadataController`, and used for control flow in our RPC stack (`setupProviderEngine` and so forth).

We already differentiate between "types" of subjects in various places on an ad hoc basis via boolean flags (e.g. `isInternal` in our RPC stack) or the presence/absence of certain values in the subject's metadata (specifically `metadata.extensionId`). The status quo is manageable if not ideal, but will start to become untenable with the introduction of Snaps in the near future.

Therefore, this PR establishes a `SUBJECT_TYPES` enum and adds the `subjectType` property to the metadata of each subject. A new migration is added to accomplish this. Finally, we specify and `INTERNAL` subject type to distinguish internal from external requests.
2021-12-08 15:37:29 -08:00
Jyoti Puri
8c5fdf779c
Fixing EIP-1559 V2 advance gas fee inputs validations (#13013) 2021-12-09 04:26:10 +05:30
Mark Stacey
5076e5057f
Remove nodeify (#13003)
The `nodeify` utility is no longer needed for the background API.
Instead each method is assumed to be either synchronous or Promise-
returning.

The error handling was updated to at least log the error in the case
where a method fall fails after the connection is broken.
2021-12-08 18:06:53 -03:30
Dan J Miller
c9768df149
Dispose the trezor connect iframe upon lock (#13018)
* Dispose the trezor connect iframe upon lock

* Use KEYRING_TYPES.TREZOR

* Update eth-trezor-keyring version
2021-12-08 13:55:27 -03:30
g. nicholas d'andrea
4ed7c8c559
Fix tx-insight accreditation styling (#13009)
* Fix tx-insight accreditation styling

- Ensure "Etherscan" appears capitalized
- Ensure messages are separated by newline
- Handle case where server returns `fetchedVia` that frontend doesn't
  support

* Revert "Fix tx-insight accreditation styling"

This reverts commit f7121d23cf9e5cf37e18444793933c36b66d9028.

* New Fix tx-insight accreditation styling

Co-authored-by: Dan Miller <danjm.com@gmail.com>
2021-12-08 13:21:49 -03:30
Dan J Miller
5e9ea9d8fa
Add what's new notification for transaction insights (#13000)
* Add what's new notification for transaction insights

* locales file lint fix
2021-12-08 10:47:01 -03:30
Mark Stacey
c17fa40114
Consolidate permission exports (#13012)
The permission-related modules are now all exported together in the
index of the `app/scripts/controllers/permissions` directory.
2021-12-08 07:07:35 -03:30
Alaa Hadad
a858b85899
Tx decoding accreditation (#12918)
* feature: adding support for truffle and etherscan accreditation

* Fix scss linting

* fix styling and classnames

* Switch font size to rem

* Update ui/components/app/transaction-decoding/components/ui/accreditation/accreditation.component.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update ui/components/app/transaction-decoding/components/ui/accreditation/index.scss

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update ui/components/app/transaction-decoding/components/ui/accreditation/accreditation.component.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Update ui/components/app/transaction-decoding/components/ui/accreditation/accreditation.component.js

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>

* Fix linting

Co-authored-by: g. nicholas d'andrea <gnidan@trufflesuite.com>
Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
Co-authored-by: g. nicholas d'andrea <gnidan@users.noreply.github.com>
2021-12-07 16:13:14 -03:30
igorms-cons
981db6e0ea
Fix confirmed transaction time (#12633) 2021-12-07 12:16:40 -06:00
Thomas Huang
028de38e57
Capitalize Activity log (#13002)
* Capitalize Activity log

* Update app/_locales/en/messages.json

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-12-07 10:31:13 -06:00
Dan J Miller
7212dcf098
Tx insights fixes (#12988)
* Ensure that function representation on hex and data tabs are consistent

* Don't show redundant hex tab when deploying contract

* Show standard pointer cursor on error messages in tx-decoder component

* Don't show activity log for incoming transactions

* Update localization

* Fix error message
2021-12-07 11:42:34 -03:30
Daniel
c8b697687f
Swaps UI redesign for the View Quote page (#12950)
* Update EIP-1559 UI on the View Quote page (WIP)

* UI redesign for the View Quote page in Swaps, update tests,  refactoring

* Update styles for the View Quote page

* Improve scrolling and styling for the View Quote page

* Update snapshots

* Fix a scrolling issue

* Use Ethereum mainnet for swaps API calls if it's Rinkeby

* UI / content updates on the View Quote page

* Remove unused content in Swaps

* Fix an ESLint issue

* Update UTs with the latest content

* Renaming

* Remove 2 more unused content strings
2021-12-07 00:21:26 -03:30
Erik Marks
31cf7c10a4
Permission System 2.0 (#12243)
# Permission System 2.0

## Background

This PR migrates the extension permission system to [the new `PermissionController`](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions).
The original permission system, based on [`rpc-cap`](https://github.com/MetaMask/rpc-cap), introduced [`ZCAP-LD`](https://w3c-ccg.github.io/zcap-ld/)-like permissions to our JSON-RPC stack.
We used it to [implement](https://github.com/MetaMask/metamask-extension/pull/7004) what we called "LoginPerSite" in [version 7.7.0](https://github.com/MetaMask/metamask-extension/releases/tag/v7.7.0) of the extension, which enabled the user to choose which accounts, if any, should be exposed to each dapp.
While that was a worthwhile feature in and of itself, we wanted a permission _system_ in order to enable everything we are going to with Snaps.
Unfortunately, the original permission system was difficult to use, and necessitated the creation of the original `PermissionsController` (note the "s"), which was more or less a wrapper for `rpc-cap`.

With this PR, we shake off the yoke of the original permission system, in favor of the modular, self-contained, ergonomic, and more mature permission system 2.0.

Note that [the `PermissionController` readme](https://github.com/MetaMask/snaps-skunkworks/tree/main/packages/controllers/src/permissions/README.md) explains how the new permission system works.

The `PermissionController` and `SubjectMetadataController` are currently shipped via `@metamask/snap-controllers`. This is a temporary state of affairs, and we'll move them to `@metamask/controllers` once they've landed in prod.

## Changes in Detail

First, the changes in this PR are not as big as they seem. Roughly half of the additions in this PR are fixtures in the test for the new migration (number 68), and a significant portion of the remaining ~2500 lines are due to find-and-replace changes in other test fixtures and UI files.

- The extension `PermissionsController` has been deleted, and completely replaced with the new `PermissionController` from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The original `PermissionsController` "domain metadata" functionality is now managed by the new `SubjectMetadataController`, also from [`@metamask/snap-controllers`](https://www.npmjs.com/package/@metamask/snap-controllers).
- The permission activity and history log controller has been renamed `PermissionLogController` and has its own top-level state key, but is otherwise functionally equivalent to the existing implementation.
- Migration number 68 has been added to account for the new state changes.
- The tests in `app/scripts/controllers/permissions` have been migrated from `mocha` to `jest`.

Reviewers should focus their attention on the following files:

- `app/scripts/`
  - `metamask-controller.js`
    - This is where most of the integration work for the new `PermissionController` occurs.
      Some functions that were internal to the original controller were moved here.
  - `controllers/permissions/`
    - `selectors.js`
      - These selectors are for `ControllerMessenger` selector subscriptions. The actual subscriptions occur in `metamask-controller.js`. See the `ControllerMessenger` implementation for details.
    - `specifications.js`
      - The caveat and permission specifications are required by the new `PermissionController`, and are used to specify the `eth_accounts` permission and its JSON-RPC method implementation.
        See the `PermissionController` readme for details.
  - `migrations/068.js`
    - The new state should be cross-referenced with the controllers that manage it.
      The accompanying tests should also be thoroughly reviewed.

Some files may appear new but have just moved and/or been renamed:

- `app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js`
  - This was previously implemented in `controllers/permissions/permissionsMethodMiddleware.js`.
- `test/mocks/permissions.js`
  - A truncated version of `test/mocks/permission-controller.js`.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-12-06 19:16:49 -08:00
Jyoti Puri
2af45a656f
Adding validations for advance gas fee input fields (#12879) 2021-12-07 00:17:26 +05:30
Thomas Huang
d78cfebd43
Jestify app/scripts/lib/**/*.test.js (#12890)
* Jestify app/scripts/lib/*.test.js

* Mocha config on mocha test script

* Add app/scripts/lib to include subdirs
2021-12-06 10:40:39 -06:00
Jyoti Puri
a6bb503e52
Adding tooltips in edit gas fee network status section (#12916) 2021-12-06 21:32:23 +05:30
Jyoti Puri
9dd5af3523
Implementing design feedbacks in EIP-1559 V2 flow (#12943) 2021-12-06 21:10:20 +05:30
Jyoti Puri
cd4ddffd9c
Adding gas limit section on advance gas fee modal (#12865) 2021-12-03 21:29:48 +05:30
Alex Donesky
6542d16349
1559 v2 tooltips (#12750)
* add tooltips
2021-12-03 09:44:23 -06:00
Mark Stacey
7226357422
Fix isMainnet propType error (#12951)
A propType error was showing up during e2e tests with a `testDev`
build. It was caused by `process.env.IN_TEST` being treated as a
boolean, when in fact it is either the string `'true'` or a boolean.

`IN_TEST` has been updated to always be a boolean. `loose-envify` has
no trouble injecting boolean values, so there's no reason to treat this
as a string.
2021-12-02 14:46:46 -03:30
Olaf Tomalka
90b656bd66
Added SiteOrigin and PermissionList components (#12832)
* Changed back button to the one in design

* PermissionConnect now uses Chip component

* Added SiteOrigin widget

* WIP

* Added new permission list

* Fix linting errors

* Removed unused messages

* Removed more unused messages

* Make SiteOrigin bigger

* Fix lint

* Code Review fixes

* Fix SiteOrigin overflowing

* Add stories

* Fix lint

* Added useMemo to constant

* Fix Chip's max-content overflowing SiteOrigin

* Fix code review issues

Co-authored-by: Olaf Tomalka <olaftomalka@Olafs-MacBook-Pro-2.local>
2021-12-02 18:22:18 +01:00
igorms-cons
6dbf6e3ab3
Latest update conversion date - issue #10741 (#12422)
* conversion date fix

* update in settings conversion date - no internet

* update conversionDate fetch - setting container

* no currency date message updated
2021-12-02 08:48:09 -03:30
Alex Donesky
9e2935dd55
Revert "Feat/collectibles display (#12873)" (#12934)
This reverts commit 81ea24f08a.
2021-12-01 17:46:26 -06:00
George Marshall
eb4f051b23
Adding SnapSettingsCard ui component (#12655)
* parent d89e5336a6
author georgewrmarshall <george.marshall@consensys.net> 1636692862 -0800
committer hmalik88 <hassan.malik@consensys.net> 1637342043 -0500

Initial SnapSettingsCard component

Updates to styles but having specificity issues so increased specificity

Updates to styles but having specificity issues so increased specificity

added overflow fix and added tests

lockfile update

prettier fix

added stylelint ignore

yarn.lock fixed

* merge conflict fix

* package/yarn fix

* fixed package.json

* updated lockfile...

* removed comment

* removed unnecessary key/val for chip status indicator color

* bumped lattice to 0.4.0 in package json, fixed yarn lock

* removed dupe entry in yarn lock

* ran yarn setup to update lock file

* updated chip label prop

* parent d89e5336a6
author georgewrmarshall <george.marshall@consensys.net> 1636692862 -0800
committer hmalik88 <hassan.malik@consensys.net> 1637342043 -0500

Initial SnapSettingsCard component

Updates to styles but having specificity issues so increased specificity

Updates to styles but having specificity issues so increased specificity

added overflow fix and added tests

lockfile update

prettier fix

added stylelint ignore

yarn.lock fixed

* merge conflict fix

* package/yarn fix

* fixed package.json

* updated lockfile...

* removed comment

* bumped lattice to 0.4.0 in package json, fixed yarn lock

* removed dupe entry in yarn lock

* ran yarn setup to update lock file

* Using IconWithFallback instead of SiteIcon, fixing icon prop, and adding status story and docs page

* Updating to follow storybook folder convention

* Updates to styles

* Adding localization

* added todo comment

Co-authored-by: hmalik88 <hassan.malik@consensys.net>
2021-12-01 16:10:51 -05:00
Alaa Hadad
e056c88ba7
Feature: Transaction Insights (#12881)
* integration for tx decoding confirmation and history view

* upgrading @truffle/decoder to latest release 5.1.0

* Update acorn and colors patches

* feat: remove redundant styling

* feat: basic integration for nickname components

* feat: wiring functionality of adding new nickname

* feat: wire functionality of showing nickname modal

* feat: link the nickname popover with add/update popover

* feat: moving forward with address nicknames integration

* feat: fixing a bug related to passing chainId in addressBook

* feat: populating memo prop in addressbook entry

* feat: add explorer link

* feat: bug fixing update nickname component

* feat: fix proptypes

* feat: adding tooltip for copying nickname address

* featL fix styling for tx-details page

* feat: optimize code for error handling

* feat: limiting transaction decoding to tx with data

* feat: remove tree UI component

* feat: adding request to check for tx decoding supported networks

* feat: showing data hex component

* feat: fix react warnings

* feat: remove extra margin in tx decoding

* Remove unused package @truffle/source-map-utils

* Ensure messages get translated

* feat: link tx-decoding addresses with nicknames

* Omit value for boolean attributes

* Fix props reading in CopyRawData

* fix: fixing issue with transaltion

* Fix lint errors in TransactionDecoding

- Remove unused import
- Reorder imports
- Address conflict between caught `error` and error state flag by
  renaming state flag to `hasError`
- Fix requestUrl identifier casing and use of template string
- Ensure `useEffect` gets passed the deps it needs
- Add scope braces around case statement where it's needed
- Omit literal `true` for boolean jsx attribute
- Refactor nested ternary as `if` statements

* fix: revert fetchWithCache modifications

* Fix linting for TransactionListItemDetails

- Remove unused import
- Fix import spacing
- Remove unused prop dereference
- Fix string interpolation for translated From/To

* Moving to popover pattern

* fix: sass color variable

* Omit value for boolean attribute

* Remove changes from modal.js

* fix: refactor nickname popovers

* Ensure const gets declared before it's used

* Fix linting for ConfirmTransactionBase

- Remove unused prop chainId
- Stop destructuring an unused field

* fix: refactor usage of nicknames popovers in send-content-container

* fix: remove extra prop updateAccountNicknameModal

* fix: refactor code for address.component

* fix: remove extra tooltip

* Ensure NicknamePopovers always returns component

* Fix linting for NicknamePopover component

- Fix useCallback deps
- Switch ternary to logical-or

* Fix linting for SenderToRecipient

... by fixing import order

* Remove unused addressCopied state

* Delete empty file

* fix: remove sender-to-recipient.container

* fix: refactor usage of nickname popovers in confirm-page-container

* fix: bug related to state variable

* Stylelint fix

* Lint fix

* Change "Total Amount" to "Total"

* Lint fix locales

* Update address-book.spec.js

* e2e test update

* Update e2e tests

* Fix issue where absence of function params in data hex tab would result in rendering a  string

* Fix border radius, and width and height in small notification windows, of the update-nickname-popover

* Remove fake await

* Clean up

* Clean up

Co-authored-by: Alaa Hadad <alaahd@Alaas-MacBook-M1-Pro-14-inch.local>
Co-authored-by: Dan Miller <danjm.com@gmail.com>
Co-authored-by: g. nicholas d'andrea <gnidan@trufflesuite.com>
2021-12-01 13:52:08 -03:30
Olaf Tomalka
70386726f6
Implement Flask onboarding UI (#12745)
* Added Flask Experimental Area warning to OnboardingV2

* Added first time flow Flask Experimental Area warning

* Made both onboarding flows use one Experimental Area component

* Fix comments in React divs

* Fix unreachable code

* Fix build lint problems

* Changes after code review

* Added guards around route constants imports

* Code Review changes

* Update ui/components/app/flask/experimental-area/index.scss

Co-authored-by: George Marshall <george.marshall@consensys.net>

* Code review changes

* Fix lint

* Update ui/components/app/flask/experimental-area/index.scss

Co-authored-by: George Marshall <george.marshall@consensys.net>

* Update ui/components/app/flask/experimental-area/index.scss

Co-authored-by: George Marshall <george.marshall@consensys.net>

* Update ui/components/app/flask/experimental-area/index.scss

Co-authored-by: George Marshall <george.marshall@consensys.net>

* Update ui/components/app/flask/experimental-area/index.scss

Co-authored-by: George Marshall <george.marshall@consensys.net>

* Update ui/components/app/flask/experimental-area/index.scss

Co-authored-by: George Marshall <george.marshall@consensys.net>

* fix lint

Co-authored-by: George Marshall <george.marshall@consensys.net>
2021-12-01 17:53:30 +01:00
Alex Donesky
81ea24f08a
Feat/collectibles display (#12873)
* Wiring up Collectibles lists/items

* wip

* more wip

* more more wip

* yet more wip

* wippp

* more wipppp

* closer

* wroking

* more wip

* cleanup

* cleanup

* add-collectible form validation

* update default ipfs-gateway

* update refresh button

* fix proptypes issue + add more padding to asset background

* css tweaking

* more cleanup

* more cleanup

* more cleanup

* add migration

* address feedback

* fix migration + cleanup

* bumping controllers version + adapting new collectiblesController shape

* fix yarn dedupe
2021-12-01 10:10:17 -06:00
Alex Donesky
3434b9f80a
add openSeaEnabled preference (#12909)
* add openSeaEnabled preference

* cleanup

* add description copy
2021-11-30 22:12:27 -06:00
Matthew Epps
8e6a0ff879
Send all swaps requests to api2, remove useNewSwapsApi boolean (#12792)
* Send all swaps requests to api2, remove useNewSwapsApi boolean

* Switch token bucket priority

* Fix tests

* Trigger Build

* Trigger Build
2021-11-30 19:56:28 +01:00
Dan J Miller
2856ea7606
Add support for eip-1559 on Trezor (#12627)
* Add support for eip-1559 on Trezor

* temp

* Lint fix

* Store trezor model type in background state instead attempting to get it in the frontend

* code simplification

* Temp update to eth-trezor-keyring version

* Tempory update to eth-trezor-keyring version

* Temp update to eth-trezor-keyring version

* Fix display of hdpath selector in connect hardware flow for trezor

* Updating the package version but we still need to run yarn setup and update the lockfile, once the package is updated

* Update yarn.lock

* Fix unit tests
2021-11-30 10:58:28 -03:30
VSaric
35c1eaa2bd
Created a Nickname popover (#12632)
* Created a Nickname popover

* Fixing lines in index.scss

* Handle copy button and fix some paddings

* Added text to be editable in the storybook component

* Simplify nickname scss and html

* Delete harcoded address

* Change color usage with new color system
2021-11-29 16:05:56 -03:30
Jyoti Puri
7ace0497c8
Removing un-necessary comma (#12883)
* Confirm transaction screen style fixes
2021-11-30 00:32:54 +05:30
Niranjana Binoy
4b975adc85
EIP-1559 V2 : Advanced gas fee modal - Max base fee and Priority fee inputs (#12619) 2021-11-29 23:10:48 +05:30
Alex Donesky
5aa191fd2e
Feat/add collectible manually (#12834)
* hook up add collectible manually flow

* address feedback
2021-11-26 14:03:35 -06:00
ryanml
279c8072ed
Adding collectibles items overview (#12506)
* Adding collectibles items overview

* addressing feedback

Co-authored-by: Alex <adonesky@gmail.com>
2021-11-26 12:59:46 -06:00
Alex Donesky
0bed51b936
add and hook up setting to toggle on/off collectible autodetection (#12839) 2021-11-26 12:54:57 -06:00
Jyoti Puri
7609841902
Confirm transaction page - onchain failure handling (#12743) 2021-11-24 22:32:53 +05:30
Jyoti Puri
f65063ac6c
Eip1559 v2 12593 (#12719) 2021-11-23 23:48:44 +05:30
Niranjana Binoy
582882b3ed
Adding the AdvancedGasFeePopover template (#12780) 2021-11-23 23:16:33 +05:30
Aaron Chen
a931316a53
Introduce QR based signer into MetaMask (#12065)
* support qr based signer

* add CSP for fire fox

* get QR Hardware wallet name from device

* fix qrHardware state missing in runtime

* support qr based signer sign transaction

* refine Request Signature modal ui

* remove feature toggle

* refine ui

* fix notification is closing even there is a pending qr hardware transaction

* add chinese translation, refine ui, fix qr process was breaking in some case

* support import accounts by pubkeys

* refine qr-based wallet ui and fix bugs

* update @keystonehq/metamask-airgapped-keyring to fix that the signing hd path was inconsistent in some edge case

* fix: avoid unnecessay navigation, fix ci

* refactor qr-hardware-popover with @zxing/browser

* update lavamoat policy, remove firefox CSP

* refine qr reader ui, ignore unnecessary warning display

* code refactor, use async functions insteads promise

Co-authored-by: Soralit <soralitria@gmail.com>
2021-11-23 13:58:39 -03:30
Jyoti Puri
fbc6f4e603
Adding network status section on edit gas fee modal (#12704) 2021-11-23 22:22:50 +05:30
Daniel
bf06025615
Fix "BigNumber Error: times() number type has more than 15 significant digits:" (#12802) 2021-11-23 17:33:32 +01:00
Dan J Miller
2647be9662
Ensure one and only one localhost option appears in network list (#12786)
* Ensure one and only one localhost option appears in network list

* Fix unit tests
2021-11-22 12:54:42 -03:30
dragana8
367492a0af
Create an "Add a Nickname" popover (also support edit) #12528 (#12644)
* added update nickname popover

* fixed style errors

* styling changes

* fixed prettier error

* added header

* updates
2021-11-22 08:56:09 -03:30
Olusegun Akintayo
143a5c4a53
Increase friction to bypass estimated revert (#12576)
* If a transaction would revert/fail,
    1. hide the gas estimate info.
    2. Disable the confirm button.
    3. All user to enable the confirm button anyways.
    4. Do not show the default Transaction error message

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Always return a value for hasSimulationError

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Use primary button of action message

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove hasSimulationError from getErrorKey

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Move confirm anyways logic to base component.
Change message

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Disable edit if there's simulation error

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* hide confirm anyways button once clicked.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Move Actionable Primary Action to flex-end

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix unit tests

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix nested ternary lint issues

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* add !confirmAnyways to conditions to show GasDetails.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* ConfirmAnyways should be read from state

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Rename tryAnywayOption

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove await tick

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint issue fix

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes after rebase

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* description should show that it's content being tested.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* If a transaction would revert/fail,
    1. hide the gas estimate info.
    2. Disable the confirm button.
    3. All user to enable the confirm button anyways.
    4. Do not show the default Transaction error message

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Always return a value for hasSimulationError

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Use primary button of action message

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove hasSimulationError from getErrorKey

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Move confirm anyways logic to base component.
Change message

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Disable edit if there's simulation error

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* hide confirm anyways button once clicked.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Move Actionable Primary Action to flex-end

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix unit tests

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fix nested ternary lint issues

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* add !confirmAnyways to conditions to show GasDetails.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* ConfirmAnyways should be read from state

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Rename tryAnywayOption

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Remove await tick

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint issue fix

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Lint fixes after rebase

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* description should show that it's content being tested.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Move simulation fails message inline with gas details component (#12705)

* Move simulation fails message inline with gas details component

* Remove old unit tests

Co-authored-by: Dan Miller <danjm.com@gmail.com>

* lint fix

* use an XOR operation.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* The changes in this file are no longer needed because we hide the edit button now

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

Co-authored-by: Dan Miller <danjm.com@gmail.com>
2021-11-22 16:13:30 +04:00
Alex Donesky
6838a3d074
fix issue where contractExchangeRates are not available in swaps controller, make token address matching case insensitive (#12770) 2021-11-22 08:34:31 -03:30
Dan J Miller
c9baf39c4d
Ensure that metametrics error related to anonymousId is not sent to sentry (#12763) 2021-11-19 14:07:50 -03:30
Alex Donesky
b119b7744d
Add CollectiblesController & CollectibleDetectionController (#12443)
* Add CollectiblesController

* bump controllers version

* add CollectibleDetectionController

* adapt to ERC1155 support changes in CollectiblesController

* update @metamask/controllers to v20.0.0

* update lavamoat policy files

* put collectibleDetectionController instantiation behind feature flag
2021-11-19 10:16:41 -06:00
Olaf Tomalka
3f3479bf6e
Fix: eth_sign does not validate input (#12679)
* Fix #5039

* Converted function into async

* Added more explicit explanation of why the number of bits for EcSign

* eth_sign and eth_personalSign now report errors correctly back to the user

* Added leeway to unsigned message byte check

* Fix lint
2021-11-19 17:05:24 +01:00
Jyoti Puri
2c6fb06114
Edit gas fee modal more changes (#12660) 2021-11-19 00:38:29 +05:30
ryanml
d6d35d9acb
Adding new nfts detected notice (#12721) 2021-11-18 11:30:56 -07:00
Jyoti Puri
0daefe9ea0
Adding edit gas fee modal (#12624)
Edit transaction screen changes for EIP-1559 V2
2021-11-18 23:24:58 +05:30
Mark Stacey
cce2dda8e4
Remove unused background API methods (#12731)
These background API methods were not used anywhere in the UI. One of
them was called in `actions.js` by a function that itself was never
called, so it have been removed. Additionally, one unused `actions.js`
function was found and removed as well.

`setAdvancedGasFee` is the only unused background method that remains.
It was recently added and will be used in the near future.
2021-11-17 15:03:36 -03:30
Daniel
ecceb4d6da
Use v2 API for fiat onboarding URL creation, fix wrapping / unwrapping (#12729)
* Use a Swaps v2 API to get a fiat onboarding URL

* Fix an issue with wrapping / unwrapping if an address contained uppercase chars

* Rename a constant

* Use a constant in a test
2021-11-17 18:04:50 +01:00
Dan J Miller
ab8db945cd
Ensure the test network dismissal message in the network dropdown is permanently dismissed (#12723) 2021-11-16 18:52:01 -03:30
ryanml
18969db4f7
Updates to network dropdown test network messaging (#12722)
* Updates to network dropdown test network messaging

* Updating text from Disable/enable -> Show/hide
2021-11-16 17:02:40 -03:30
Erik Marks
0e4005b1e7
Fix manifest i18n substitutions for Beta and Flask (#12717) 2021-11-16 08:43:21 -08:00
Ikko Ashimine
568289f29e
Fix typo in network.js (#12636)
intialize -> initialize
2021-11-16 10:40:49 -03:30
Erik Marks
05fae3fa1e
Add RPC method handler hook selection (#12664)
Adds a property, `hookNames`, to each RPC method handler export in `app/scripts/lib/rpc-method-middleware` and a function, `selectHooks`, to select from them.

`createMethodMiddleware` receives a giant `opts` object that includes a bunch of different methods from `MetaMaskController` and its subcontrollers. Each method implementation only requires a subset of these methods to do its work. Because they need some kind of name, we call these methods "hooks". With this change, whenever an RPC method is called, `selectHooks` will be called to ensure that each method only receives the hooks that it needs in order to do its job.

This implementation is based on [work in `snaps-skunkworks`](https://github.com/MetaMask/snaps-skunkworks/blob/a3e1248/packages/rpc-methods/src/utils.ts#L17-L34) that will be merged in the near future.
2021-11-15 15:11:51 -08:00
Olusegun Akintayo
0cf7455e18
addresses an issue found in 10.6.0 QA (#12710)
* addresses an issue found in 10.6.0 QA

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* update test cases.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>

* Fixes unit test texts to pass

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-11-15 18:34:09 -03:30
Dan J Miller
2ced3a8bfa
Add migration to set showTestNetworks to true if there is evidence of testnet use (#12675)
* Add migration to set showTestNetworks to true if there is evidence the user has used a test network

* Add migration to index file

* Remove console.log

* Clean up conditional structure in migration 67
2021-11-15 15:50:33 -03:30
ryanml
5712539a38
Implement 'Add NFT' screen (#12544)
* Implement 'Add NFT' screen

* Guarding added route with feature flag
2021-11-15 10:28:35 -07:00
Olaf Tomalka
a323a5fe59
Reject popup confirmations on close (#12643)
* Background clears confirmations on popup close

* [WIP] Remove clearing confirmations through UI

* Confirmations are now rejected instead of cleared

* Erased commented out code

* Fix linter errors

* Changes after code review

* Moved metrics events from onWindowUnload to background

* PR review fixes

* Added abillity to add reason to rejection of messages

* Fix prettier

* Added type metrics event to signature cancel

* Fix test

* The uncofirmed transactions are now cleared even if Metamask is locked
2021-11-15 17:13:51 +01:00
Jyoti Puri
39cb29d5b5
Changes in edit link on confirm transaction page (#12567) 2021-11-13 00:39:59 +05:30
白宦成
4ef7162656
fix typo (#12672) 2021-11-12 11:10:50 -03:30
Jyoti Puri
4779bd9fe5
Show warning in confirm transaction screen for low/high gas values. (#12545) 2021-11-12 08:52:54 +05:30
Dan J Miller
9bc07f5e6b
Fix copy issues related to layer 2 fee changes (#12667) 2021-11-11 20:45:43 -03:30
Erik Marks
b3963daaab
eth-json-rpc-middleware@8.0.0 (#10738)
We're bumping from `^6` to `^8`. All imports are now named, and they have been updated. This is a breaking change, in that support for `eth_signTransaction` is added in `^8.0.0`. We do not support this method in our UI, so our middleware stack has been instrumented to reject.

In addition, there are some non-breaking behavioral changes in this version that reviewers should be aware of, see the [7.0.0 release](https://github.com/MetaMask/eth-json-rpc-middleware/releases).
2021-11-11 12:26:49 -08:00
Niranjana Binoy
7cf4a16a63
EIP-1559 V2 : Adding advancedGasFee property to Preference Controller (#12577) 2021-11-11 14:18:50 -05:00
Dan J Miller
9fa15dda6f
Support for Layer 2 networks with transaction fees on both layers (#12658)
* Support for Layer 2 networks with transaction fees on both layers

* Use  variable name in transaction-breakdown

* Add comment on code source to ui/helpers/utils/optimism/fetchEstimatedL1Fee.js

* Fix unit tests

* Ensure values passed to  are defined

* Fix activity log
2021-11-11 13:16:45 -03:30
kumavis
3c749190d8
metametrics - ensure segment submission failures do not bubble up (#12573)
* metametrics - ensure segment submission failures do not bubble up

* metametrics - differentiate between trackEvent and submitEvent

* metametrics - validate event in trackEvent

* metametrics - re-throw error on clean stack

* lint fix

* controllers/metametrics - take a captureException option

* controllers/metametrics - capture and report any errors in trackPage

* Update app/scripts/controllers/metametrics.js

Co-authored-by: Mark Stacey <markjstacey@gmail.com>

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-11-10 17:27:04 -10:00
Mark Stacey
faebdd0ccd
Add platform-specific build type manifest modifications (#12638)
The build system now supports platform-specific modifications to the
manifest for each build type. The need to customize the `id` on Firefox
motivated this change.

To support this, a new directory was made in each build type directory
for manifest changes. The images currently in this directory were moved
into an `images` subdirectory.

This new `manifest` directory can include each manifest file currently
in `app/manifest`. The `_base.json` file is assumed to exist, but the
platform manifest modifications are optional.
2021-11-10 19:33:59 -03:30
David Walsh
3f9ec40107
Use gas estimate type constants (#12460) 2021-11-10 13:50:43 -06:00
shichangzhi
9a37e44c58
Update Chinese translations: correct typos. (#12586) 2021-11-10 11:53:05 -06:00
ryanml
9ab6293129
Fix untranslated header text in AccountImportSubview (#12640)
* Fix untranslated header text in AccountImportSubview

* use styling for link spacing
2021-11-10 10:29:22 -07:00
igorms-cons
2c410f534d
Fix/ux papercuts account details issue #12292 (#12399)
* account details - updating ui

* account details - updating ui - version 2

* update qr-code scss in details account view

* account detail screen - create local eng label

* account detail update copy state
2021-11-09 07:28:21 -03:30
ryanml
05aa19a05d
Replacing instances of 'testnets' with 'test networks' (#12626) 2021-11-08 14:55:49 -07:00
ryanml
7c60757814
Implementing display solution for testnets in the network dropdown (#12564)
* Implementing display solution for testnets in the network dropdown

* Update setting from 'Test networks' -> 'Show test networks'

* Add capability to dismiss testnets message

* span -> a
2021-11-08 13:58:23 -07:00
Alex Miller
722c4e5b63
Support for GridPlus Lattice1 hardware wallet (#12053)
* GridPlus: Adds support for GridPlus Lattice1 hardware wallet

* Fixes issue with switching hardware HD path
The main `Select HD Path` piece of the account selection component was not
properly hooked up to the state manager (`onPathChange`) and the extra
`Popover` component was being used instead.
I'm not sure what the origin of this is, but I don't see why the Popover
is needed at all. I have remove it and hooked `onPathChange` directly into
the HD path selector dropdown.
This was an issue that nearly every Lattice user who had come from Ledger
has contacted us about.

* GridPlus: Addresses QA issues
* Adds Lattice tutorial + image
* Cleans up connectivity issues (see: https://github.com/GridPlus/eth-lattice-keyring/pull/16)

* GridPlus: Adds Firefox support
To connect to the Lattice you need to open a new tab/window and get
login data from it. We were not able to do this for Firefox because
we relied on the `window` API. This is now fixed.
See corresponding changes:
* `eth-lattice-keyring`: https://github.com/GridPlus/eth-lattice-keyring/pull/17
* Lattice connector: https://github.com/GridPlus/wallet-web/pull/152

* GridPlus: Adds missing error path for Firefox
See: 242a93f559
2021-11-08 11:18:41 -03:30
David Walsh
17b64e94fc
Use gas recommendation constants throughout app (#12461) 2021-11-05 19:59:23 -05:00