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

5185 Commits

Author SHA1 Message Date
Shane
059d5d0488 Fixed firefox Snaps + add initial end-to-end tests (#13671)
* Changed registryUrl for snaps only in firefox
Fixed getPlatform to only be imported into metamask-controller in flask
Removed snaps specific testrunner script and use run-all with a cli option

* Fixed flakey tests

* Removed unneeded await

* Added delay

* Fixed linting
2022-03-22 19:54:33 -07:00
Hennadii Ivtushok
0461bbcded Snap removal confirmation (#13619)
* Add Snap removal confirmation

* Add styling for Snap removal confirmation

* Update styling

* Update button margin

* Re-use styling code

* Address comments

* Update Popover props

* Lint

* Lint

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2022-03-22 19:54:33 -07:00
Hassan Malik
e795c29b3f Update snap install warning per designs and fix for popover component (#13844)
* updated snap install warning per designs, hotfix for popover component to remove box styles from it's scss file and introduce them as default props

* small fix
2022-03-22 19:54:33 -07:00
Hassan Malik
dcdfa29a8e Add custom CSS to Popover (#13740)
* add boxes to popover sections for custom css

* updated doc strings

* added default props

* render Boxes only if the props are not empty

* possible fix

* second fix

* removed prop check function, converted header, footer and div elements to Box components and updated storybook and readme.mdx

* remove non existing prop

* fixed export issue

* updated storybook
2022-03-22 19:54:33 -07:00
Hassan Malik
9bb668d958 minor fixes per snaps pr comments (#13721) 2022-03-22 19:54:33 -07:00
Mark Stacey
49e65a7061 Fix SrpInput small viewport styles (#14087)
The styles for smaller viewports were broken because I forgot to update
the small-screen grid template after adding the "paste-tip". The styles
have now been updated to fit the content properly on all of our
supported screen sizes.
2022-03-21 23:05:42 -02:30
Mark Stacey
00341cd3b3 Split SRP input by word (#14016)
* Initial implementation of new SrpInput component

This new version of the SrpInput component uses a separate field for
each word of the SRP. Only one field can be revealed at a time, making
it less likely that it gets accidentally revealed to somebody.

* Fix copy mistakes

* Move container div from 'create vault' to 'srp-input', and setup grid layout

* Increase size of title

* Remove hard-coded width in Storybook to allow testing different viewport sizes

* Improve layout

* Improve margins

* Update dropdown text

* Expand SRP input section

* Remove unused localized messages

* Update dropdown option names in unit tests

* Replace checkbox with show/hide toggle

* Remove unused localized message

* Fix 'data-testid' prop name

* Fix e2e test imports using paste

* Use 'ActionableMessage' component for error message

* Convert error popover to actionable message

* Add tip about pasting the SRP

* Remove invalid prop

The "info" style of `ActionableMessage` is the default, so no type is
required.

* Use more readable test convenience methods

The method `toBeInTheDocument()` is now used over `not.toBeNull()` to
improve the readability of tests. Likewise, the convenience method
`.clear` is now used to clear fields rather than manually entering the
key combination to clear a field.

* Fix misspelled word
2022-03-21 18:53:07 -02:30
Mark Stacey
4adadd3325 Add ShowHideToggle component (#13979)
Add a new component for controlling whether a field should be shown
or hidden. This will be used in later PRs as a control for sensitive
fields that are hidden by default.

This component should be fully accessible. Both mouse and keyboard
interactions have been tested, and `aria-label` attributes have been
added to explain the two "eye" icons that don't have any corresponding
text.

Thorough unit tests have been written, testing all props except
`className` (I don't know how to test that using Jest/`jsdom`).
2022-03-21 18:51:19 -02:30
Mark Stacey
c154145e85 Add IconEye and IconEyeSlash icon components (#13978)
Add two new FontAwesome icon components. The first is an eye, and the
second is an eye with a slash through it. These will be used in a
subsequent PR for a "Show/Hide" toggle.
2022-03-21 18:51:18 -02:30
Mark Stacey
851f9b30b4 Add data-test-id prop to TextField component (#13973)
The `data-test-id` prop has been added to `TextField`. This prop allows
selecting this component more easily from e2e and unit tests. This is
required for a subsequent PR that includes a text field that cannot be
selected for by placeholder or contents or label (any of which would
have been preferable).
2022-03-21 18:51:18 -02:30
Mark Stacey
1eecc59969 Improve unit tests for SrpInput component (#13803)
The library `@testing-library/user-event` has been updated to the
latest beta version, so that our unit tests better model real user
interactions. In particular, I found that previously the `paste` event
was missing the `clipboardData` API, so it was impossible to implement
any custom handling of paste events (which we will need in later PRs).

See the `v14.0.0-beta.1` release notes for a list of all breaking
changes [1]. The main change is that all methods now return Promises.
The `paste` method has also been dramatically simplified.

The unit tests have also been updated to reset all mocks before each
test. These tests don't have any shared mocks, but this is generally a
good practice, to ensure that tests don't develop accidental inter-
dependencies.

[1]: https://github.com/testing-library/user-event/releases/tag/v14.0.0-beta.1
2022-03-21 18:51:18 -02:30
Mark Stacey
22f9de9a2c Refactor: Extract SRP input from create vault component (#13720)
This is a pure refactor that extracts the SRP input from the
`CreateNewVault` component. This is intended to make future changes to
the SRP input easier, and to reduce duplication between the old and new
onboarding flows.

Extensive unit tests have been added for the new SRP input component.

A new test library was added (`@testing-library/user-event`) for
simulating user events with components rendered using the
`@testing-library` library.

A new helper method has been added (`renderWithLocalization`) for
rendering components using `@testing-library` with just our
localization contexts added as a wrapper. The localization contexts
were already added by the `renderWithProviders` helper function, but
there is no need for a Redux provider in these unit tests.
2022-03-21 18:51:18 -02:30
Olusegun Akintayo
13f385aa30 Fix for connected sites throwing error if name is null. (#13974)
* Fix for connected sites throwing error if name is null.

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

* Reverted yarn.lock changes.

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-03-16 10:55:29 -02:30
André Ogle
0361aa6a93 Use pre-wrap instead of pre for signature content (#13828) 2022-03-11 11:34:11 -03:30
Daniel
b879bf1359 Set up the right gasLimit for STX (#13891)
* Set up the right gasLimit for STX

* Trigger Build

Co-authored-by: Dan J Miller <danjm.com@gmail.com>
2022-03-09 23:50:02 -03:30
Mark Stacey
c3feabf4de Update SRP representation
An array of integers is now used to represent the SRP in three cases:

* In the import wallet flow, the UI uses it to pass the user-provided
  SRP to the background (which converts the array to a buffer).
* In the create wallet flow, the UI uses it to retrieve the generated
  SRP from the background.
* When persisting the wallet to state, the background uses it to
  serialize the SRP.

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
2022-03-08 17:15:11 -03:30
Ariella Vu
34bf555e50 Fix v10.11: Unable to find value of key "eth_accounts" for locale "en" in Permissions Modal (#13833)
* ConnectedAccountsPermissions: convert to FC

* permissions: add usePermissionsDescriptions
- fix ConnectedAccountsPermissions eth_accounts i18n

* ConnectedAccountsPermissions: rm .component
from path

* ConnectedAccountsPermissions: fix toggleExpanded

ensure we change previous state value

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2022-03-04 13:40:58 -03:30
ryanml
98b3da31c7 Restoring create password form layout (#13824) 2022-03-03 11:52:17 -07:00
ryanml
532cf54307 Revert "Allow sending up to 15 decimals on the send screen (#12707)" (#13823)
This reverts commit 8597cd1401.
2022-03-02 17:30:40 -07:00
ryanml
47661fc58d Persisting token address via URL (Token Details page) (#13807) 2022-03-02 09:05:41 -07:00
Olusegun Akintayo
eb5dc7d8b0 Fixed these issues in v10.11.0 (#13806)
After landing on Swap, a disclaimer of Smart Transactions appear, and an error on devTools shows the following: “invalid prop ‘type’ of value ‘ul’” supplied to ‘Typography’
    After enabling Smart Transactions, an error on devTools shows the following: “invalid prop ‘smartTransactionsOptInSatus’ of type ‘boolean supplied to ‘SlippageButtons’

Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
2022-03-02 09:05:24 -07:00
Daniel
730f977939 Small fixes for Swaps (#13732)
* Fix: Insufficient number of substitutions for key "stxSuccessDescription"

* Only calculate "approvalGas" if the "approvalNeeded" param is truthy in a quote

* "Swap from" has to be set to enable "Review Swap", set a default token for "Swap from"

* Fix: Unable to find value of key "undefined" for locale

* Use array destructuring
2022-02-23 14:28:31 -07:00
ryanml
1883af8ab4 Fix token details icon when 'Use Token Detection' is enabled (#13726) 2022-02-23 14:28:20 -07:00
ryanml
b3b5d3c8d9 Fixing blockies on token detail page (#13728) 2022-02-23 14:28:06 -07:00
Alex Donesky
1abac424f4 fix issue where token details page unnecessarily relies on send asset state (#13717) 2022-02-23 14:27:53 -07:00
fadnesscharlie
3d5da527f9
Added Controls and Action ArgType, took out @storybook/addon-knobs (#13660)
* added controls and took out unused code

* Fix Lint Issues
2022-02-21 08:13:11 -06:00
Daniel
2585f45bde
Add support for Smart Transactions (#12676) 2022-02-18 17:48:38 +01:00
Tom McGuire
d2c292bead
Add argTypes for color-indicator (#13659) 2022-02-18 10:00:07 -06:00
Daniel
120603e6df
Enable Avalanche for Swaps (#13653) 2022-02-18 15:24:47 +01:00
Rob Dawson
ef3199ebd1
Mįgrate truncated definition list stories from addon knobs to use controls. (#13628) 2022-02-17 10:14:24 -06:00
Rob Dawson
e082334da8
Fixed Add Recipient Stories and migrated to use control args. (#13633) 2022-02-17 10:14:10 -06:00
Rob Dawson
93af95f968
Minimal fix to the TokenSearch story to ensure it compiles and works. (#13623) 2022-02-17 10:13:30 -06:00
Rob Dawson
4a6082f1d7
Updated the Callout story to convert knobs and actions to controls / args. (#13624) 2022-02-17 10:11:17 -06:00
Daniel
cbf8a737dc
Change "Quote X of Y" to "Fetching quote X of Y" (#13663)
* Change "Quote X of Y" to "Fetching quote X of Y"

* Update a test

* Trigger Build
2022-02-17 17:08:53 +01:00
Benjamin Bourgeois
207436d11c
convert SendGasRow stories with argtypes (#13554) 2022-02-16 15:18:30 -08:00
David Walsh
009c6e1455
Use hardware wallet constants when possible (#13634) 2022-02-16 14:54:30 -06:00
Ariella Vu
fadad601b8
ConfirmImportToken: Convert to Functional Component; Add storybook controls (#13594)
* ConfirmImportToken: convert to FC

* ConfirmImportToken: reorganize

* ConfirmImportToken: rm component from path

* replace mapStateToProps w/ useSelector
ConfirmImportToken

* replace mapDispatchToProps w/ useDispatch
ConfirmImportToken

* ConfirmAddSuggestedToken: useHistory

* ConfirmImportToken: add storybook controls

* ConfirmImportToken: rm 1st entry overwrite

* ConfirmImportToken: add tests

* ConfirmImportToken: use real Redux store in tests

* ConfirmImportToken: do not use mock-state.json
https://github.com/MetaMask/metamask-extension/pull/13594#discussion_r805022647

* ConfirmImportToken: tokenAddedEvent -> trackTokenAddedEvent

* Update ui/pages/confirm-import-token/confirm-import-token.js

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>

* ConfirmImportToken: update useSelector logic

* ConfirmImportToken: replace typeof check w/ === undefined

* ConfirmImportToken: rm unnecessary /rendering from path

* ConfirmImportToken: fix add token redirect

* ConfirmImportToken: use useNewMetricEvent

* ConfirmImportToken: rename vars using "addedToken"

* ConfirmImportToken: setAddedToken to obj copy

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
2022-02-16 18:03:54 +00:00
ryanml
b954ca447d
Ensure pre-selected account on connect screen is visible in list (#13621)
* Ensure pre-selected account on connect screen is visible in list

* adding smooth scroll behavior

* Change conditional
2022-02-16 11:00:44 -07:00
dragana8
5095071083
Make default icons the same on mobile and extension #13264 (#13408) 2022-02-16 11:03:17 -06:00
VSaric
2cd242252f
Created "Token details" page (#13216)
* Created new screen/page "Token details"

* Change color in scss

* Modify elements to the latest requirements and added unit tests

* Review requested changes

* Condensing files into one component

* Added unit tests for token details page

* Added redirection when switching networks, added image for a token and update unit tests

* Requested review changes

* Modify index.scss regarding of the requested review

* Delete data-testid's from Typography and token-details-page.js

* Requested review changes
2022-02-16 13:29:39 -03:30
Dan J Miller
d1c5274738
Ensure sign message button is only enabled on scroll (#13645)
* Ensure sign message button is only enabled on scroll

* Add button for message scrolling to signature request screen

* lint fix

* Only show scroll button if message is scrollable

Co-authored-by: ryanml <ryanlanese@gmail.com>
2022-02-15 16:59:59 -07:00
ryanml
40269ad13c
Fixing sign type data message formatting, requiring content scroll before sign (#13642)
* Fixing signature request formatting, requiring scroll before sign

* Ensure sign button not disable when no scroll is required

* Test fix attempt #1

* Clean up e2e tests

Co-authored-by: Dan Miller <danjm.com@gmail.com>
2022-02-15 11:39:57 -07:00
Erik Marks
35ac762e10
Add Snaps via Flask (#13462)
This PR adds `snaps` under Flask build flags to the extension. This branch is mostly equivalent to the current production version of Flask, excepting some bug fixes and tweaks.

Closes #11626
2022-02-14 16:02:51 -08:00
Jyoti Puri
2b5b787ca9
Fix: advance defaults should never be used for swaps (#13617) 2022-02-15 00:37:46 +05:30
Niranjana Binoy
b42e1f75fa
Include transactions from all networks in state logs (#13599) 2022-02-14 13:29:24 -05:00
ryanml
2ad0b85cb1
Untranslated string fix (#13615) 2022-02-14 08:52:04 -07:00
Jyoti Puri
eb39290dcd
Fixes in EIP-1559 V2 implementation (#13574)
* Fixes in EIP-1559 V2 implementation

* Adding check for transaction.id in useTransactionEventFragment hook

* Update ui/components/app/advanced-gas-fee-popover/advanced-gas-fee-gas-limit/advanced-gas-fee-gas-limit.js

Co-authored-by: Alex Donesky <adonesky@gmail.com>

* fix

* fix

* fix

* fix

* fix

* fix build

Co-authored-by: Dan J Miller <danjm.com@gmail.com>
Co-authored-by: Alex Donesky <adonesky@gmail.com>
2022-02-11 10:59:17 -03:30
Dan J Miller
8597cd1401
Allow sending up to 15 decimals on the send screen (#12707) 2022-02-10 17:35:41 -05:00
Alex Donesky
7223d4cd2c
fix opensea/autodetect setting dependency relation (#13575) 2022-02-10 14:02:06 -06:00
Alex Donesky
7148607906
remove infura project_id from networks form field (#13539)
* remove infura project_id from networks form field
2022-02-10 13:23:52 -06:00