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

4387 Commits

Author SHA1 Message Date
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
David Walsh
2822379bdc
Improve browser detection code (#12456)
* Improve browser detection code

* Add unit tests for platform detection

* Add test

* Use key check instead of object presence
2021-11-05 17:28:44 -07:00
ryanml
accfd0b049
Updating default collectibles tab view (#12575) 2021-11-05 14:23:28 -07:00
hupfis
ea0192df7b
Update German translations (#12547) 2021-11-05 14:19:56 -07:00
David Walsh
042bd84c87
Minor code cleanup of _viewOnEtherscan (#12609) 2021-11-05 16:18:07 -05:00
Dan J Miller
a6d0f379ad
Add Ledger connection flow warning message for failed to connect device error (#12604) 2021-11-05 18:02:53 -02:30
Jyoti Puri
3dfc1cc5f6
Edit transaction screen changes for EIP-1559 V2 (#12493)
Edit transaction screen changes for EIP-1559 V2
2021-11-05 22:53:15 +05:30
Dan J Miller
e6ae6e09b8
Ensure proper transport type is set before attempting to connect ledger wallet (#12594)
* Ensure proper transport type is set before attempting to connect ledger wallet

* Fix unit tests
2021-11-05 13:43:29 -02:30
Niranjana Binoy
524725b24b
Network tab refactor (#12502) 2021-11-04 17:48:21 -04:00
Dan J Miller
843bb6e047
Check if ledger was successfully able to establish transport on confirm screen mount (#12535)
* Check if ledger was successfully able to establish transport on mount of confirm screens

* Update ledger message/action if transport creation was blocked by existing connection

* TEMP: point eth-ledger-bridge-keyring to commite, REMOVE BEFORE MERGE

* Update eth-ledger-bridge-keyring to v0.10.0
2021-11-04 15:49:53 -02:30
Dan J Miller
958535d5df
Ledger WebHID What's New popup (#12501)
* Add notification for ledger live users about how they can switch to WebHID

* Add action button so that users can go right to settings from the what's new popup

* Fix

* Add notification 8 to e2e fixtures

* Lint fix

* Update ledger webhid notification wording

* Update app/_locales/en/messages.json

* Update ui/selectors/selectors.js
2021-11-03 20:05:39 -02:30
Dan J Miller
401c8ee7b2
Ensure ledger transport preference is set on import (#12557) 2021-11-03 13:53:13 -02:30
Olusegun Akintayo
95e3be4a85
UX improvements to the "Permission Request" section on the approve screen (#12553)
* UX improvements to the "Permission Request" section on the approve screen

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

* Fix locales.

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

* Check that hidden elements are hidden in test

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

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-11-03 02:15:05 +04:00
Mark Stacey
e902b931c3
Update the 3D beta logo (#12497)
The 3D beta logo has been updated to match this demo: https://metamask.github.io/logo/beta/index.html
2021-11-02 15:55:15 -02:30
Erik Marks
5560b7c3e5
Update build system lockdown parameter (#12556)
* Update build system lockdown parameter

* Add @reduxjs/toolkit patch

* Fix Mozilla lint syntax error

* Standardize a thing

* Remove redundant check for globalThis
2021-11-01 22:13:22 -10:00
Olusegun Akintayo
7e7d0c13f4
Show error if user have insufficient gas. (#12531) 2021-10-29 19:45:50 +04:00
filipsekulic
6221365980
Update icons on the settings page (#12359) 2021-10-29 09:25:23 -02:30
Mark Stacey
90e55a445e
Add static files for the Flask build (#12518)
Static files have been added for the Flask build. This includes logos
of each size and variety that we use, and it includes the 3D model JSON
file.

Closes #12427
2021-10-28 23:05:58 -02:30
David Walsh
a83d50a489
Provide instructions for users switching from Ledger Live to WebHID (#12519) 2021-10-28 18:38:58 -05:00
Mark Stacey
e067379f48
Remove the partially-applied dark mode styles used for beta (#12489)
The beta build currently has a couple of UI elements (the horizontal
logo and the app header) set to "dark mode", even though nothing else
in our UI supports dark mode yet. These styles have been removed. We
should make the entire UI support dark mode all at once at a later
date.

Also the horizontal logo used for beta was named incorrectly; the dark
and non-dark logos were swapped. They have been switched back so that
the logo that ends with `-dark` is for dark mode.
2021-10-28 17:29:20 -02:30
Olusegun Akintayo
b6673731e2
Implement Network Switcher designs (#12260)
* Show test networks toggle button in settings/advanced tab.

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

* Apply toggle testnet settings and show/hide testnets when on/off
Add localhost to testnet.

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

* Lint fixes.

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

* Show add network button

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

* Open full screen when add network is called.

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

* Show custonm rpc before testnet rpcs
lint fixes.

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

* Test cases for network dropdown.

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

* Test cases for toggle test networks in advanced tab component.

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

* Lint fixes.

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

* Fix Locales.

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

* E2E Tests: Custom RPC is now called Add Network

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

* Lint fix

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

* E2E: When Add Network button is clicked, wait for the full screen window to
be visible

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

* findVisibleElement should use a class. i.e start with a dot

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

* Hide Dropdown when Add Netwok is clicked.
Only show full screen if it's not already showing.
E2E tests passing.

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

* Lint fixes

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

* Fix tests for jest

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

* Testnets are not being shown by default anymore, tests should use
Mainnet instead.

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

* Import Button from ui
Change selector name to getShowTestnetworks
Fix button to show full width

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

* Fix e2e tests

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

* Remove localhost from INFURA provider types.

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

* Fix errors in Advanced Tab Component tests

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

* Lint fixes

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

* Fix unit tests for advanced tab component.

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

* Remove deleted elements from e2e tests

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

* Make sure all tests passed.

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

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-10-28 23:31:05 +04:00
Niranjana Binoy
e42fb0d640
Approve screen header and sub-header improvement (#12360) 2021-10-28 15:16:03 -04:00
Daniel
e85248aaf5
Fix parallel calls for quotes in swaps (#12484) 2021-10-28 08:53:26 +02:00
David Walsh
b5e601bc87
Use TRANSACTION_ENVELOPE_TYPES for legacy transaction type testing (#12455) 2021-10-27 18:55:02 -05:00
Dan Finlay
0880093f40
Improve token detection wording (#12498)
Previous wording implies that we don't have token detection without this feature enabled.
2021-10-27 11:09:23 -07:00
ryanml
05a80ebeba
Adding collectibles feature flag, default NFT tab (#12463)
* Adding COLLECTIBLES_V1 feature flag

* Adding NFT's tab to home screen, default CollectiblesList view

* Handling null children in Tabs component
2021-10-27 09:55:14 -07:00
Niranjana Binoy
532927368d
Network Form Design and switch to full screen enhancements (#12302) 2021-10-25 16:38:43 -04:00
Mark Stacey
345ed9f6f2
Add build type to Sentry environment (#12441)
The build type (i.e. the distribution) is now included in the Sentry
environment during setup, for all builds except the "main" build. This
will allow us to track Flask and beta errors separately from other
errors.

A constant was created for the build types. The equivalent constant in
our build scripts was updated to match it more closely, for
consistency. We can't use the same constant in both places because our
shared constants are in modules that use ES6 exports, and our build
script does not yet support ES6 exports.

The singular `BuildType` was used rather than `BuildTypes` to match our
naming conventions elsewhere for enums. We name them like classes or
types, rather than like a collection.

Relates to #11896
2021-10-25 14:27:30 -02:30
David Walsh
b7b21ed20b
Use rejected constant within transaction state manager (#12458) 2021-10-25 08:01:30 -05:00
ryanml
a4ddeed799
Adding estimate fields to updateTransaction, createCancelTransaction and createSpeedUpTransaction (#12398) 2021-10-22 13:42:20 -07:00
Dan J Miller
9d70c60c22
Connect Ledger via WebHID (#12411)
* Connect ledger via webhid if that option is available

* Explicitly setting preference for webhid

* Use ledgerTransportType enum instead of booleans for ledger live and webhid preferences

* Use single setLEdgerTransport preference methods and property

* Temp

* Lint fix

* Unit test fix

* Remove async keyword from setLedgerTransportPreference function definition in preferences controller

* Fix ledgelive setting toggle logic

* Migrate useLedgerLive preference property to ledgerTransportType

* Use shared constants for ledger transport type enums

* Use constant for ledger usb vendor id

* Use correct property to check if ledgerLive preference is set when deciding whether to ask for webhid connection

* Update eth-ledger-bridge-keyring to v0.9.0

* Only show ledger live transaction helper messages if using ledger live

* Only show ledger live part of tutorial if ledger live setting is on

* Fix ledger related prop type errors

* Explicitly use u2f enum instead of empty string as a transport type; default transport type to webhid if available; use constants for u2f and webhid

* Cleanup

* Wrap ledger webhid device request in try/catch

* Clean up

* Lint fix

* Ensure user can easily connect their ledger wallet when they need to.

* Fix locales

* Fix/improve locales changes

* Remove unused isFirefox property from confirm-transaction-base.container.js

* Disable transaction and message signing confirmation if ledger webhid requires connection

* Ensure translation keys for ledger connection options in settings dropdown can be properly detected by verify-locales

* Drop .component from ledger-instruction-field file name

* Move renderLedgerLiveStep to module scope

* Remove ledgerLive from function and message names in ledger-instruction-field

* Wrap ledger connection logic in ledger-instruction-field in try catch

* Clean up signature-request.component.js

* Check whether the signing address, and not the selected address, is a ledger account in singature-request.container

* Ensure ledger instructions and webhid connection button are shown on signature-request-original signatures

* Improve webhid selection handling in select-ledger-transport-type onChange handler

* Move metamask redux focused ledger selectors to metamask duck

* Lint fix

* Use async await in checkWebHidStatusRef.current

* Remove unnecessary use of ref in ledger-instruction-field.js

* Lint fix

* Remove unnecessary try/catch in ledger-instruction-field.js

* Check if from address, not selected address, is from a ledger account in confirm-approve

* Move findKeyringForAddress to metamask duck

* Fix typo in function name

* Ensure isEqualCaseInsensitive handles possible differences in address casing

* Fix Learn More link size in advanced settings tab

* Update app/scripts/migrations/066.js

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

* Update ui/pages/settings/advanced-tab/advanced-tab.component.test.js

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

* Add jsdoc comments for new selectors

* Use jest.spyOn for mocking navigator in ledger webhid migration tests

* Use LEDGER_TRANSPORT_TYPES values to set proptype of ledgerTransportType

* Use LEDGER_TRANSPORT_TYPES values to set proptype of ledgerTransportType

* Fix font size of link in ledger connection description in advanced settings

* Fix return type in setLedgerTransportPreference comment

* Clean up connectHardware code for webhid connection in actions.js

* Update app/scripts/migrations/066.test.js

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

* Update ui/ducks/metamask/metamask.js

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

* Add migration test for when useLedgerLive is true in a browser that supports webhid

* Lint fix

* Fix inline-link size

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-10-21 16:47:03 -02:30
VSaric
5fea5fac8c
Adding copy to SRP import screen to warn users (#12400)
* Added copy to SRP import screen to warn users that there current wallet will be replaced

* Fixing test-lint error

* Remove padding and edit warning message
2021-10-21 06:20:17 -02:30
Akintayo A. Olusegun
03e3edb00c
Refactor checking if address is contract into a new module. (#12354)
* Refactor checking if address is contract into a new module.
Tests for new module.

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

* addressIsContract is an async function, use await when calling it.

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

* Lint fixes

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

* Mock ethQuery
change variable names
refactor in transaction.utils.
fix possible boolean destructiring.

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

* Refactor isContractAddress boolean checks.

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

* Lint fixes

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-10-20 16:12:07 +01:00
Matthew Epps
7b34c7263d
Fix weth->eth direct wrapping allowance issue (#12405)
* chore: fix weth->eth direct wrapping allowance issue

* chore: clean up url issue
2021-10-20 13:07:34 +02:00
Alex Donesky
22378e4f72
fix issue where regional locales are not matched against our locales list (#12403)
* fix issue where regional locales are not matched against our locales list
2021-10-19 14:32:13 -05:00
David Walsh
d90ac2d8e6
Fix 12192 - Implement new metametrics onboarding screen (#12282) 2021-10-19 12:01:42 -05:00
David Walsh
16d741348e
Fix #12190 - Implement new pin extension view for onboarding (#12290) 2021-10-18 17:33:42 -05:00
ryanml
2712048c0e
Removing unused TokenRatesController (#12376) 2021-10-18 09:29:07 -07:00
Alex Donesky
71f91568db
Migrate completedOnboarding and firstTimeFlowType state into onboardingController (#12356)
* migrate completedOnboarding state into onboardingController

* migrate firstTimeFlowType state from preferencesController to onboardingController
2021-10-15 13:52:52 -05:00
Akintayo A. Olusegun
319ab42bc1
Fix for #11503: when you send a transaction with value as 0x, you get a Bignumber error (#11996)
* Fix for #11503: when you send a transaction with value  as 0x, you get a
Bignumber error. Fix this by setting value to 0x0 is it's 0x.

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

* 1. Fix this in app/scripts/controllers/transactions/lib/utils.js
2. Make sure other non-hex non-valid strings for value return 0x0

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

* Linting Fixes.

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

* Instead of returning 0x0 for invalid hex values, throw a descriptive
error

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

* Unit tests.
Lint fixes.

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

* assert.throws takes a function

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

* Lint Fixes.

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

* Use standardized error message.

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

* remove fixHexValue
move code validating hex value to validateTxParams

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

* Change message displayed if hex string is invalid.

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

* Fixed missing second quote mark on message.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-10-15 13:04:14 +01:00
Mark Stacey
864800b035
Normalize extension verison to SemVer (#12254)
The extension version used throughout the wallet is now normalized to a
SemVer-compliant version that matches the version used in
`package.json`. We use this version for display on the "About" page,
and we attach it to all error reports and metric events, so it's
important that we format it consistently so that we can correlate
events on the same version across different browsers.

This normalization step is necessary because Firefox and Chrome both
have different requirements for the extension version, and neither is
SemVer-compliant.
2021-10-14 18:50:14 -02:30
Erik Marks
20b921f520
Fix inpage provider behavior on unlock (#12339)
This fixes a bug where we were failing to notify the inpage provider of the user's currently selected account when the extension becomes unlocked.
2021-10-14 10:50:07 -07:00
Alex Donesky
398ea62029
Add Import Secret Recovery Phrase View (#12289)
* Add import secret recovery phrase to onboarding flow
2021-10-13 12:41:24 -05:00
David Walsh
72a3db7c0c
Use hardware constants everywhere (#12329) 2021-10-13 09:25:27 -05:00
David Walsh
77f8ec4d3a
Fix 12265 - Update onboarding welcome screen (#12275) 2021-10-13 09:22:51 -05:00
Alex Donesky
a8ec9ada2a
Onboarding V2 Creation Successful view (#12248)
* add creation-successful onboarding view
2021-10-11 09:43:25 -05:00
Jean P
3332a11f77
Update warning message when Ledger app has contract data/blind signing setting disabled (#12256) 2021-10-09 10:30:46 -07:00
Alex Donesky
3d36fbd8ce
Onboarding V2 Privacy settings view (#12253)
* add Set Advanced Privacy Settings onboarding view
2021-10-08 14:50:36 -05:00
Alex Donesky
614228cba7
Onboarding V2 Secure Your Wallet view (#12208)
* secure-your-wallet onboarding view
2021-10-06 13:52:25 -05:00
Jyoti Puri
fc41321470
Support for type 0 transaction (#12252)
Support for type 0 transaction
2021-10-06 23:59:57 +05:30
Mark Stacey
3a5538bd50
Migrate beta version to the main version field (#12246)
The main `version` field in `package.json` will now include the beta
version (if present) rather than it being passed in via the CLI when
building. The `version` field is now a fully SemVer-compatible version,
with the added restriction that any prerelease portion of the version
must match the format `<build type>.<build version>`.

This brings the build in-line with the future release process we will
be using for the beta version. The plan is for each future release to
enter a "beta phase" where the version would get updated to reflect
that it's a beta, and we would increment this beta version over time as
we update the beta. The manifest gives us a place to store this beta
version. It was also important to replace the automatic minor bump
logic that was being used previously, because the version in beta might
not be a minor bump.

Additionally, the filename logic used for beta builds was updated to
be generic across all build types rather than beta-specific. This will
be useful for Flask builds in the future.
2021-10-06 15:14:48 -02:30
ryanml
cd09e5b0bb
Restoring mobile sync warning text (#12284) 2021-10-06 05:02:50 -07:00
kumavis
cb174ff8e6
Lavamoat build system integration for WebApp (#12242)
* lavamoat - add lavamoat to webapp background

* test:e2e - add delay to resolve failure

* test:e2e - add delay to resolve failure

* build - add a switch for applying lavamoat, currently off for all

* test/e2e - remove delays added for lavamoat

* Revert "test/e2e - remove delays added for lavamoat"

This reverts commit 79c3479f15c072ed362ba1d4f1af41ea11a17d63.
2021-10-05 12:06:31 -10:00
kumavis
f9ea9e4b43
lockdown - breakout making globalThis properties non-writable (#12258)
* lockdown - breakout making globalThis properties non-writable into lockdown-more.js

* Update app/scripts/lockdown-more.js

Co-authored-by: David Walsh <davidwalsh83@gmail.com>

* Update app/scripts/lockdown-more.js

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2021-10-01 08:53:12 -10:00
Bogdan A
1c5489e046
Locale en message fix- "not connected this site" (#12186) 2021-09-30 11:04:57 -05:00
Niranjana Binoy
e238cbc568
Turning OFF token detection for test nets (#12232) 2021-09-29 14:53:56 -04:00
Daniel
acce73c943
Fix form prefilling in Swaps on the Build Quote page (#12244)
* Fix form prefilling in Swaps on the Build Quote page

* Fix UTs

* Clean up tokens when resetting swaps state, in case a user is changing a network
2021-09-29 18:13:34 +02:00
Matthew Epps
53f2c84209
Add client id to GasFeeController (#12221)
* chore: Add client id to GasFeeController

* chore: change EXTENSION_CLIENT_ID to SWAPS_CLIENT_ID in constants file
2021-09-29 10:41:19 -02:30
Niranjana Binoy
77581256ca
Hiding refresh list on non-Mainnet networks (#12210) 2021-09-27 13:42:51 -04:00
Akintayo A. Olusegun
08dff86be0
Add target object word to "View on Etherscan" links (#12100)
* Add target object word to "View on Etherscan" links
Fix for: #9476

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

* Fix Swap tests checking for View $1 at or View $1 on

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

* Linter Fixes

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

* Fix  ui/hooks/useTransactionDisplayData.test.js expected result should
be May 13, 2020

Update Jest snapshot for view on etherscan test

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

* Add description of the variables in messages.

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

* 1. localize all of the blockExplorerViewAction values
2. Apply this nit. https://github.com/MetaMask/metamask-extension/pull/12100#discussion_r708343532

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

* Lint fixes.

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

* Fix locale value not used on GUI error lint error.

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

* Reverted this commit, on circle ci, the date is May 12.

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

* Add description to link block explore actions to where it's used.

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

* Fix missing messages.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-09-24 21:14:07 +04:00
Thomas Huang
02a4da9ad2
Fix 12145 - Ledger errors being set as Error: [object, object] (#12176)
* Fixes #12145

When transactions fail, preserve error message when presented with an error object. Fallback to stringified error for other cases.

* Perserve error stack when err.stack is present, else set stack to message.

* Use optional chaining
2021-09-22 10:41:23 -07:00
Thomas Huang
1cc45774dc
Jestify continue (#12173) 2021-09-22 08:15:40 -07:00
Jyoti Puri
c9ce848f47
Fix case of password env variable (#12120) 2021-09-21 23:27:24 +05:30
Thomas Huang
e78e82205a
Jestify migrations/ (#12106)
* Jestify migrations/

* Lint exclude migrations from mocha config, and add inclusion to jest config

* Add migration tests to jest config

* Exclude/ignore migration tests

* Set process.env.IN_TEST to true when running tests locally
2021-09-21 09:28:13 -07:00
Niranjana Binoy
9929820b88
Adding a Token detection announcement in Search tab (#12152) 2021-09-20 15:42:58 -04:00
Decentraliser
3edd544274
Fix translation (#12161) 2021-09-20 14:05:44 -05:00
Niranjana Binoy
e03d3dd5f0
Moving UseTokenDetection toggle to new Experimental tab (#12136) 2021-09-20 12:22:04 -04:00
ryanml
8df521df8a
Updating swaps availability tooltip text (#12157)
* Updating swaps availability tooltip text

Fixes MetaMask/metamask-extension#12156

* text update
2021-09-20 06:51:22 -07:00
Dan J Miller
0f86f678f8
Add notification about need for ledger firmware update (#12144)
* Add notification about need for ledger firmware update

* Update messaging for ledger firmware notice

* Code cleanup
2021-09-17 14:20:16 -02:30
Jyoti Puri
ade9e4ac4b
Changing cancel button labels in send screen when in editing stage (#12056)
* Changing cancel button labels in send screen when in editing stage

* Re-route user to home page when reject is clicked on edit transaction page
2021-09-17 10:07:50 +05:30
Muin Momin
ae84b0cb6d
Fixes #12073: Extra account with zero balance always added when importing wallet with seed and when first account's balance is non-zero (#12074)
* add command to debug unit tests

* remove extra zero balance account potentially created from seeking ahead

* Add PR 12074 to CHANGELOG

* Revert "Add PR 12074 to CHANGELOG"

This reverts commit 9f6f7eec1cac163c0ce1c711b1c205322aa5b2af.

* Remove test debug command
2021-09-16 16:20:57 -05:00
Niranjana Binoy
66c3414433
Changing Use Token detection to OFF by default (#12129) 2021-09-16 13:07:23 -04:00
ryanml
792f9efa56
Adding "Enable smart contract data" step to Ledger Instructions (Confirmation Screen) (#12115) 2021-09-16 09:52:42 -07:00
Alex Donesky
2a9fbffb6c
Replace hardcoded sent ether label on confirm screen (#11802)
* Replace hardcoded sent ether label on confirm screen

* replace transaction type SENT_ETHER with network agnostic SENDING_NATIVE_ASSET

* remove sentEther translation base

* make backwards compatible with lingering transaction of legacy sentEther type

* update localalization files

* fixup legacy sentEther transaction type

* changing new transaction type away from localization string

* revert migration tests

* update fixtures and test data

* update name of new transaction type

* add migration

* remove legacy SENT_ETHER from transaction types enum object
2021-09-15 16:54:51 -05:00
Alex Donesky
9d968bae1e
Hook up shared TokenRatesController (#12066) 2021-09-15 14:02:28 -05:00
Daniel
28fc2d471f
Quotes prefetching in Swaps (#11915) 2021-09-15 15:13:18 +02:00
Niranjana Binoy
0c2af43d3a
changing token address to lowercase for dynamic token list (#12071) 2021-09-10 23:55:23 -04:00
Niranjana Binoy
05aadb38f2
Adding fake token warning and replacing Add Token labels with Import Tokens (#11798) 2021-09-10 16:21:04 -04:00
Niranjana Binoy
769beb2a26
Adding Refresh list and import tokens link to the main page (#11755) 2021-09-10 14:03:42 -04:00
Niranjana Binoy
18c35ad91e
Adding Token Detection Toggle to Security & Privacy (#11851) 2021-09-10 14:02:30 -04:00
Alex Donesky
490d3b8d40
Integrate TokensController (#11552)
* Integrate controllers/tokensController

* address rebase issues

* small cleanup

* addressing feedback

* more feedback
2021-09-10 12:37:19 -05:00
Niranjana Binoy
eb987a47b5
Integrating the TokenListController to Extension (#11398) 2021-09-09 16:56:27 -04:00
ryanml
5cf3e19910
Merge pull request #12044 from MetaMask/dev-olu-12028
Use the same wording during onboard for importing a wallet, secret recovery phrase, and remove the term vault
2021-09-09 12:51:40 -07:00
David Walsh
dd62d17c7f
Update verbiage of Main Net to Mainnet (#11880) 2021-09-09 13:31:07 -05:00
David Walsh
7b827ca5e7
Create MetaMask Beta build (#10985) 2021-09-08 15:08:23 -05:00
Akintayo A. Olusegun
515f8561b7 Use the same wording during onboard for importing a wallet, secret recovery phrase, and remove the term vault
Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-09-08 22:32:11 +04:00
Daniel
6f0d6b1693
Add support for swaps via a direct contract for wrapping and unwrapping (#11845)
* Update contract address validations in swaps for different networks

* Add support for direct contract swaps for wrapping and unwrapping

* Add WETH_RINKEBY_CONTRACT_ADDRESS
2021-09-08 20:08:55 +02:00
Elliot Winkler
a35f22fcdf
Add Max Fee Per Gas to transaction breakdown (#12042)
This comes through in EIP-1559 transactions and so it is helpful to show
this to users.
2021-09-08 12:06:16 -06:00
Daniel
93cdd3c159
Use Swaps dev APIs based on an env variable (#11924) 2021-09-08 19:26:37 +02:00
Maksim
0b5b7de2f2
A typo in the button name
Unnecessary quotes in russian locale.
2021-09-08 18:54:01 +03:00
kumavis
5daf8cc77c
Update eth_sign warning language (#12034)
* Update messages.json

* Update messages.json
2021-09-07 16:10:55 -10:00
ryanml
17fe978c82
Adding usage instructions for Ledger Live users to confirmation screen (#12020)
* Adding usage instructions for Ledger Live users to confirmation screen

* Using design system components

* Hiding first step on Firefox
2021-09-07 14:46:15 -07:00
Ferit Tunçer
dc85f375f8
fix(locales): bad Turkish translation for rejecting a transaction (#12021) 2021-09-07 14:26:02 -05:00
ryanml
449da1d095
Improving warning text for eth_sign (#12013)
* Improving warning text for eth_sign

* Copy update
2021-09-06 10:28:34 -07:00
Shane
362b54b2dd
Added getPersistentState support for V2 controllers persist metadata (#12007) 2021-09-05 19:33:37 -07:00
ryanml
fe59cbfe66
Autofilling new issue link with url and domain (Phishing detect page) (#12000) 2021-09-03 11:22:28 -07:00
Alex Donesky
e8ab578ed0
bump @metamask/controllers to v15.0.2 and remove AbortController workaround in e2e tests (#11988)
* bump @metamask/controllers to v15.0.1 and remove AbortController workaround in e2e tests

* remove old abortcontroller polyfill

* bump @metamask/controllers to v15.0.2
2021-09-03 09:34:21 -05:00
Alex Donesky
da305656bd
cap resubmit transaction retries to within 50 blocks of first submission (#12003) 2021-09-02 16:06:31 -05:00
Dan Finlay
2df159841a
Add eth_feeHistory to safe method list (#11999)
So that we can expose this method to dapps.
2021-09-02 10:26:32 -07:00
Erik Marks
8d9989cea0
Bump minimum Chrome version to 66 (#11995)
This PR updates our minimum supported Chrome version from 63 to 66, so that we may use the `AbortController` browser API without polyfilling it.

Our minimum Firefox version supports the `AbortController`, but our current minimum Chrome version (63, released in December 2017) does not. Chrome shipped the `AbortController` in version 66, in April 2018. We have determined that an extremely small number of users are on Chrome 63 < 66, and that this change is therefore acceptable.
2021-09-01 13:19:03 -07:00
Akintayo A. Olusegun
aba396870a
Update copy in dapp suggested gas fee tooltip to: "Edit to use MetaMask's recommended gas fee based on the latest block." #11952 (#11986)
* Change the [domain] suggested gas fee (i) to Estimated gas fee (i)
Change that line's color from orange to black
Under that line, add Site suggested in italics in gray.

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

* liinter fixes.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2021-09-01 11:02:01 -07:00
Dan J Miller
a4c0133bc5
1559 ledger (#11951)
* EIP-1559 - Provide support for Ledger

* Update ui/selectors/selectors.js

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

* Add shared constants for hw types

* bump eth-ledger-bridge-keyring to v0.7.0

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Alex <adonesky@gmail.com>
2021-09-01 11:25:06 -05:00
Erik Marks
8a8ce3a0c0
@metamask/controllers@15.0.0 (#11975)
Adds the latest version of `@metamask/controllers`, and updates our usage of the `ApprovalController`, which has been migrated to `BaseControllerV2`. Of [the new `controllers` release](https://github.com/MetaMask/controllers/releases/tag/v15.0.0), only the `ApprovalController` migration should be breaking.

This is the first time we use events on the `ControllerMessenger` to update the badge, so I turned the messenger into a property on the main `MetaMaskController` in order to subscribe to events on it in `background.js`. I confirmed that the badge does indeed update during local QA.

As it turns out, [MetaMask/controllers#571](https://github.com/MetaMask/controllers/pull/571) was breaking for a single unit test case, which is now handled during setup and teardown for the related test suite (`metamask-controller.test.js`).
2021-08-31 12:27:13 -07:00
Erik Marks
1175b4bfa7
Make all named intrinsics non-modifiable (#11953)
This PR makes ~all named intrinsics in all of our JavaScript processes non-modifiable. A named intrinsic is any property specified by the ECMAScript specification that exists on `globalThis` when the JavaScript process starts. We say that a property is non-modifiable if it is non-configurable and non-writable. We make exceptions for properties that meet any of the following criteria:

1. Properties that are non-configurable by the time `lockdown-run.js` is executed are not modified, because they can't be.
2. Properties that have accessor properties (`get` or `set`) are made non-configurable, but their writability cannot be modified, and is therefore left unchanged. It's unclear how many of the named intrinsics this applies to, if any, but it's good defensive programming, regardless.
2021-08-30 14:30:48 -07:00
ryanml
6c97720319
Updating message about disabled Mobile Sync (#11935) 2021-08-25 15:21:28 -07:00
ryanml
9c675ec033
Temporarily Disabling Mobile Sync (#11931) 2021-08-25 11:54:23 -07:00
ryanml
b021c35f7b
Fixing error handling for publish() (MobileSync) (#11909) 2021-08-25 09:16:12 -07:00
ryanml
dc3e74a66a
Localize import account warning messages (#11910) 2021-08-25 09:14:42 -07:00
Alex Donesky
33849bfec6
Fix issue with chainId comparison in sign typed message param validation (#11900) 2021-08-24 11:23:29 -05:00
Elliot Winkler
0d63aa0402
Update header on Send page to be more accurate (#11895)
Change "Add Recipient" to "Send to".
2021-08-20 09:44:41 -06:00
ryanml
ac9660d573
Gas controls copy updates (EIP-1559) (#11889) 2021-08-19 07:01:53 -07:00
Dan Finlay
44ab05044c
Fix typo in mobile sync warning message (#11888) 2021-08-18 19:36:11 -07:00
ryanml
a4360e7201
Adding subtitles for additional languages (SRP Video) (#11849)
Adding support for: Spanish, Hindi, Indonesian, Japanese, Korean, Portuguese, Russian, Tagalog, and Vietnamese
2021-08-18 09:09:11 -07:00
ryanml
87cc7e3961
Using "Secret Recovery Phrase" throughout the onboarding flow (#11850)
Fixes MetaMask/metamask-extension#11848
2021-08-18 06:20:06 -07:00
Dan J Miller
a42c15a3f7
Update copy on tooltip shown when gas suggests gas fees (#11873) 2021-08-18 08:57:02 -02:30
ryanml
d96973e55b
Improving handling for non-existent props in state migrations (#11829) 2021-08-17 19:18:53 -07:00
Dan Finlay
932474127e
Increase saliency of mobile sync warning (#11862)
* Increase warning saliency of qr sync

* Remove duplciate locale entries

* Revise wording per Antonela feedback

* Avoid all caps

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2021-08-17 18:19:09 -07:00
ryanml
5cbece90c0
Removing unnecessary console log from the preferences controller (#11828) 2021-08-17 01:56:18 -07:00
ryanml
e7dc42be0b
Do not attempt to track tx metrics events if txMeta is not available (#11823) 2021-08-16 17:28:56 -07:00
Christophe Chantraine
09bcafc976
Improve traduction "off" in french (#11844)
Co-authored-by: Chantraine Christophe <christophe.c@djmdigital.be>
2021-08-16 13:28:30 -07:00
David Walsh
01fd2a609e
Gas Timing with Negative attitude should be bold with tooltip (#11772) 2021-08-14 17:46:55 -05:00
David Walsh
b5baa6c1d1
EIP-1559 - Update tooltip text for gas fees (#11805) 2021-08-13 19:13:21 -05:00
ryanml
e57a2da647
Adjusting Max Fee label in EditGasDisplay per designs (#11796) 2021-08-10 15:36:35 -07:00
Dan J Miller
e6543a83ef
Ensure transaction activity log supports EIP-1559 (#11794)
* Ensure transaction activity log supports EIP-1559

* unit test fix

* Add estimated base fee to swaps txMeta

* fix lint and tests

* Improve activity log copy
2021-08-06 19:48:53 -02:30
Dan J Miller
bfde5a1d77
Fixes updates on the confirm screen. (#11788)
* Fixes updates on the confirm screen.

* Better handling of internal send transactions

* maxFee -> maxFeePerGas property name fix

* Remove redundant setEstimateToUse call in onManualChange

* Fix unit tests

* rebase error fix

* Fixes to speedup loading and transaction breakdown priority fee

* Fix lint and unit tests

* Ensure gas price based transaction that have been customized (e.g. speed up and retry) are properly initialized in useGasFeeInputs

* Clean up

* Link fix
2021-08-06 14:31:30 -05:00
Daniel
827e6a6efc
Fix fee level content (#11790) 2021-08-06 15:52:28 +02:00
Alex Donesky
751534e665
fix confirm transaction details to match spec (#11779) 2021-08-05 20:07:04 -05:00
Alex Donesky
804fefcd36
Separate out non blocking gas errors (#11783) 2021-08-05 17:53:48 -05:00
Alex Donesky
d359429f04
Stop GasFeeController polling when pop closes (#11746)
* Stop GasFeeController polling when pop closes

* Stop estimate gas polling on window unload

* lint + comments

* Improve client closed logic

* lint

* Add back _beforeUnload on unmount in gas-modal-page-container

* Add full check and call onClientClosed method for notifcation environment

* Add gas pollingToken tracking to appStateController and use to disconnect polling for each environment type

* remove unused method

* move controller manipulation logic from background.js to metamask-controller, disaggregate methods

* add beforeunload handling to reset gas polling tokens from root of send page

* cleanup, lint and address feedback

* clear appState gasPollingTokens when all instances of all env types are closed, fix pollingTokenType arg from onEnvironmentTypeClosed call in metamask-controller

* mock new methods to fix tests

* final bit of cleanup + comments

Co-authored-by: Dan Miller <danjm.com@gmail.com>
2021-08-04 16:53:13 -05:00