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

546 Commits

Author SHA1 Message Date
David Walsh
a79d3eb928
Dark Mode: Select Quote Popover (#14054) 2022-03-21 08:33:22 -05:00
David Walsh
bb41494ccd
Dark Mode: Token Details (#14056) 2022-03-21 08:33:06 -05:00
Daniel
95f830438a
Add a new fiat onboarding option via MoonPay (#13934) 2022-03-21 10:26:52 +01:00
Guillaume Roux
64d35458b0
Dark Mode : Onboarding flow (#14020) 2022-03-18 19:43:33 -05:00
Guillaume Roux
2454bd8124
confirmation screen dark mode (#14024) 2022-03-18 14:10:20 -07:00
David Walsh
c0e930ea53
Dark Mode: Standardize error colors (#14029) 2022-03-18 15:15:41 -05:00
David Walsh
79d00f72e1
Dark Mode: Update swaps link colors (#14033) 2022-03-18 13:07:07 -07:00
Alex Donesky
8df8f81df7
Deprecate extensionizer for webextension-polyfill (#13960)
* deprecate extensionizer for webextension-polyfill

* fix tests

* remove extensionizer

* fix browser windows api calls

* fix broken on firefox

* fix getAcceptLanguages call

* update more browser apis that are now promisified

* remove unnecessary console error ignoring in e2e tests
2022-03-18 14:07:05 -05:00
David Walsh
3bdfd7f6a0
Dark Mode: Settings Search Bar (#13997) 2022-03-18 12:35:43 -05:00
Alex Donesky
e3ea4f2cd0
Fix issue where we show contract address as recipient when calling safe transfer method on erc721 or erc1155 contracts (#13535)
* fix issue where we show contract address as recipient when calling safe transfer method on erc721 or erc1155 contracts

* updates function name getTransactionData -> parseStandardTokenTransactionData, and adds documentation
2022-03-17 13:35:40 -05:00
David Walsh
9373f51e97
Dark Mode: Swaps Colors (#13976) 2022-03-17 13:04:01 -05:00
David Walsh
b5c120c6a3
Dark mode: Settings / Contacts colors (#13988) 2022-03-17 13:03:47 -05:00
David Walsh
a5ee4097f5
Dark Mode: Fix Onboarding image text color (#13983) 2022-03-16 17:22:13 -05:00
David Walsh
e2a6bcfc6b
Dark Mode: ENS Input (#13984) 2022-03-16 17:21:55 -05:00
Brad Decker
116d6b0eb8
add asset_type to transactions (#13858) 2022-03-16 17:15:03 -05:00
David Walsh
13e9a2a479
Dark Mode: Update login screeen colors (#13992) 2022-03-16 14:03:10 -05:00
Guillaume Roux
ad28c81a39
General backgrounds and borders design token updates (#13764)
Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
Co-authored-by: George Marshall <george.marshall@consensys.net>
Co-authored-by: David Walsh <davidwalsh83@gmail.com>
2022-03-16 15:49:25 +01:00
Mark Stacey
c7fabbff87
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-15 20:42:37 -02:30
David Walsh
cd28e64539
Dark Mode: Select Account Hardware Wallets (#13917) 2022-03-15 14:35:23 -05:00
David Walsh
cd11f90f8f
Add labels to provide better accessibility during onboarding v2 (#13890) 2022-03-14 20:27:02 -05:00
David Walsh
8143222f92
Dark Mode: Fix currently selected network color (#13918) 2022-03-14 20:26:51 -05:00
VSaric
060c6d651c
Remove usages of useMetricEvent hook (#13930) 2022-03-14 13:12:38 -05:00
Frederik Bolding
c81912f6c5
Show snap version on install (#13931)
* Add version to Snap install page

* Fix text sizing inconsistency

* Use a localized string for shorthand versions
2022-03-14 18:40:21 +01:00
Daniel
5aff1863ca
Improve slippage input validation in Swaps (#13914)
* Improve client-side validation for the slippage input

* Improve validation of the slippage input field

* Use Number instead of toNumber
2022-03-14 15:41:03 +01:00
George Marshall
8e0f71a008
Fixing dropdown caret for dark and light mode (#13911) 2022-03-11 11:09:15 -06:00
David Walsh
a6924b1224
Dark Mode: Import account text field (#13909) 2022-03-11 10:45:26 -06:00
Ariella Vu
fa15b32fab
ConfirmAddSuggestToken: replace mapDispatchToProps & mapStateToProps; Add Tests (#13526)
* ConfirmAddSuggestedToken: component.js -> .js

* replace mapStateToProps w/ useSelector
ConfirmAddSuggestedToken

* replace mapDispatchToProps w/ useDispatch
ConfirmAddSuggestedToken

* ConfirmAddSuggestedToken: useHistory

* ConfirmAddSuggestedToken: revert scss
reuse ConfirmImportToken styles for now

* ConfirmAddSuggestToken: add tests

* ConfirmAddSuggestedToken: rm unused controls

* ConfirmAddSuggestedToken: rm snapshot

* use `metamark.svg` instead of `metamask.svg`

* ConfirmAddSuggestedToken: update useSelectors

* Revert "ConfirmAddSuggestedToken: revert scss"

This reverts commit 07aed4576caaf247cb38ad481d79a339ba3d3947.

* ConfirmAddSuggestedToken:  === undefined
w/ strict mode

* ConfirmAddSuggestedToken: use useNewMetricEvent

* ConfirmAddSuggestedToken: run useEffect once

* ConfirmAddSuggestedToken: rm unused async

* ConfirmAddSuggestedToken: rm mock redux store

* ConfirmAddSuggestedToken: duplicate ConfirmImportToken styles

* ConfirmAddSuggestedToken: update metrics logic

* ConfirmAddSuggestedToken: metricEvent-> trackEvent

* ConfirmAddSuggestedToken:clean useEffect w/ new fn
- PR suggestion: https://github.com/MetaMask/metamask-extension/pull/13526#discussion_r818007393

* ConfirmAddSuggestedToken: rm unused .token-balance styles
2022-03-10 23:40:06 -03:00
Shane
1f55af3151
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-10 14:01:55 -08:00
George Marshall
a056baf944
Updating ActionableMessage to use theme colors (#13899) 2022-03-10 12:35:56 -08:00
Shane
adce5c558d
Fixed serialization of error parameter for rejectPendingApproval across JSON-RPC (#13847)
* Fixed serialization of error parameter for rejectPendingApproval across JSON-RPC

* Fixed linting

* Added serialize error to add-ethereum-chain
2022-03-10 09:55:25 -08:00
Ariella Vu
f09459cb84
ConfirmImportToken: rm unused .token-balance style (#13900) 2022-03-10 14:15:28 -03:00
Frederik Bolding
0d961a655e
Fix permission site origin overflow (#13868)
* Fix permission site origin overflow

* Standardize connect flow a bit

* Another standardization change

* Fix another chip width issue

* Standardize snap install

* Fix lint

* Fix overflow after rebase
2022-03-10 18:03:32 +01:00
filipsekulic
c439953d94
Fixed issues in onboarding flow (#13826) 2022-03-10 10:33:53 -06:00
Alex Donesky
c77f736378
fix small bug where max transaction fee isn't properly passed through confirmation screen flow (#13893) 2022-03-09 16:13:26 -06:00
Hennadii Ivtushok
c666849c31
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-09 22:20:48 +02:00
George Marshall
fa4d884a87
Find and replace of all typography colors to design tokens (#13885) 2022-03-09 07:24:53 -08:00
Alex Donesky
3747ace06b
Refactor token send/method confirmation flow (trimmed down) (#13788)
* make use of getTokenStandardAndDetails method exposed on assetsContractController to determine how to represent the contract being interacted with in token contract method calls
2022-03-09 08:38:12 -06:00
David Walsh
cf46dbf654
Ensure only accounts list scrolls in Permissions popup (#13859)
Co-authored-by: ceamkrier <ceamkrier@gmail.com>
2022-03-08 17:06:05 -06:00
George Marshall
55abc00c34
Updating all caret icons for dark mode 🥕 (#13861)
* Updating all caret icons

* lint fixes

* Fixing settings search list
2022-03-08 13:50:35 -08:00
filipsekulic
ac9f263e1a
Write down your SRP page fixes (#13729)
* Fixed few things in 'Write down srp page' flow

* Applied requested changes

* Modified messages

Co-authored-by: Alex Donesky <adonesky@gmail.com>
2022-03-08 09:38:07 -06:00
Brad Decker
9cea401022
extract determineTransactionType from tx controller (#13737) 2022-03-07 12:54:36 -06:00
Niranjana Binoy
4bb3ba4aef
Adding new settings dropdown for Dark mode in Experimental tab (#13097) 2022-03-07 12:53:19 -06:00
dragana8
658f0be63f
Update privacy page text (#13795) 2022-03-07 11:37:54 -06:00
Niranjana Binoy
f52fbd4684
Showing new message while converting token to NFT (#13838)
* adding new message while converting token to nft if the nft is already added via nft flow.

* updating the copy

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

Co-authored-by: Alex Donesky <adonesky@gmail.com>
2022-03-07 10:42:22 -06:00
VSaric
bea907e437
Create password page (#13792) 2022-03-07 09:35:03 -06:00
George Marshall
395806943f
Updating colors in various components js and css (#13831) 2022-03-04 08:47:32 -08:00
Alex Donesky
039c405314
create branching logic for different types of contract interactions for identifying the contract address (#13776) 2022-03-03 13:56:20 -06:00
ryanml
52981e1967
Restoring create password form layout (#13824) 2022-03-03 13:50:58 -03:30
ryanml
ce495d7a66
Revert "Allow sending up to 15 decimals on the send screen (#12707)" (#13823)
This reverts commit 8597cd1401.
2022-03-02 17:28:56 -07:00
ryanml
0a01c0e260
Persisting token address via URL (Token Details page) (#13807) 2022-03-02 09:01:53 -07:00
Olusegun Akintayo
6d54897cfb
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 19:59:31 +04:00
Jyoti Puri
137b47370e
Confirm transaction page: show contract address details in title (#13683) 2022-03-02 20:56:53 +05:30
Ariella Vu
e4181ec581
ConfirmImportToken: update metrics logic (#13775) 2022-03-02 11:03:44 -03:00
Daniel
42fd5d19f4
Content and UI updates for the STX modal (#13798)
* Update content and UI for STX modal

* Update the main header image for STX

* Capitalize Smart Transactions in the button label
2022-03-01 19:18:20 +01:00
Niranjana Binoy
96ab979e7c
UI/UX update - Error message in Import NFT (#13772) 2022-02-25 20:17:42 -05:00
ryanml
fda5b54def
Handling undefined case for token balance (Token Details) (#13759) 2022-02-25 17:00:51 -07:00
Guillaume Roux
23e6c073c4
Dark Theme setup and button theming (#13651)
* Add design-tokens and apply colors to button

* swap more colors

* tweak button and add dark theme switch to storybook

* tweak buttons

* fix typo

* remove comments

* add dep to ignored list

* fix linting issue

* fix linting issues

* Updating some styles and removing some deprecated buttons (#13742)

* Updating some styles and removing some deprecated buttons

* Warning button fixes

* Fixing warning text for darkmode

* bump design tokens and update storybook theme strategy

Co-authored-by: George Marshall <george.marshall@consensys.net>
2022-02-25 14:11:22 -08:00
VSaric
bd54fafe7d
Import SRP page (#13568)
* Import SRP page

* Moved url link for SRP to the zendesk urls constant in the constants folder
2022-02-25 10:15:57 -06:00
amerkadicE
3ed08a09e4
[FIX #12760] Highlighting on search (#13730) 2022-02-24 13:06:30 -06:00
Daniel
6dd141ebfd
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 22:10:28 +01:00
ryanml
d4f694c49f
Fix token details icon when 'Use Token Detection' is enabled (#13726) 2022-02-23 13:43:41 -07:00
Hassan Malik
219f8e6299
minor fixes per snaps pr comments (#13721) 2022-02-23 15:16:41 -05:00
ryanml
e600ecedbf
Fixing blockies on token detail page (#13728) 2022-02-23 11:57:16 -07:00
VSaric
a0602f1c0e
Success page (#13570) 2022-02-23 10:41:06 -06:00
VSaric
6b996a7979
Secure your wallet page (#13571)
* Secure you wallet page

* Remove seedPhraseIntroSidebarBulletThree from messages.json

* Change the second bullet from Figma design

* Requested review changes
2022-02-23 10:36:58 -06:00
Alex Donesky
7ddd8cfede
fix issue where token details page unnecessarily relies on send asset state (#13717) 2022-02-23 10:20:42 -06:00
dragana8
662c19d4da
Implement Network specific insufficient currency warning #12965 (#13182)
* added warning

fix

added warning for send screen

fix

changed condition

fix

fixed test

review updates

* review updates

* fix

* fixed failing test

* added check for transaction type

* fixed failing unit test

* added description for localization

* review updates

* review updates
2022-02-23 11:33:01 -03:30
igorms-cons
f5e86d0351
Feat/settings search (#13214)
* fix error with color variable - fix rebase

* clean list search & fuse threshold decreased

* update search-icon , fix tests

* nice to have highlighting text & cleaning

* unit test on settings & search input ui up on expanded view

* fix color variable in alert scss

* setting search input padding right up

* fix dom warning

* util/search test added & Dom element warning fix

* renaming files

* fix color text in settings search

* settings search highlight text refacto & fix ui

* fix settings-search test & renaming

* Fix styling on search field for edge cases, update components and e2e

E2E tests update for search feature

Update components from class to functional component

		#

Fix storybook for search box

Fix styling

Fix unit tests

fix: remove z-index

Fix unit tests

Co-authored-by: amerkadicE <amer.kadic@endava.com>
2022-02-22 17:28:21 -03:30
AndreasGassmann
355e5ab399
Add AirGap Vault detail links (#13650) 2022-02-22 13:00:51 -06:00
Niranjana Binoy
bf8f331297
Update "Forgot Password?" copy (#13493) 2022-02-22 10:45:19 -05:00
Jyoti Puri
60aa69a624
Confirm transaction page: use method name only for contract transactions (#13643) 2022-02-22 11:28:04 +05:30
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
Daniel
120603e6df
Enable Avalanche for Swaps (#13653) 2022-02-18 15:24:47 +01: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
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
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
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
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
dragana8
31eb5fc88a
[BUILD FIX #12920] Updated style for full screen mode in settings page (#13569) 2022-02-09 11:49:41 -06:00
Guillaume Roux
f82ce7ddd3
Fix network edition error (#13527)
* check if blockExplorer exists in rpcPrefs

* revert unnecessary change
2022-02-09 15:40:57 +01:00
dragana8
47e2e37712
Setting search feature - Setting component UI updates #12761 (#12920)
* updated settings page

removed unused messages

fixed width

moved icons into one folder

review comments update

removed unused strings

renamed components

removed class

added prop

updated e2e test

e2e

extracted icons

* locales fix

* update

* margin-inline
2022-02-08 13:00:20 -03:30
Alex Donesky
48cc9d5ad3
Add currency symbol validation in the add network form (#12431)
* validate ticker symbol in add/edit network form
2022-02-04 12:14:52 -06:00
Mark Stacey
429451de23
Extract "create vault" form to separate component (#13461)
The form used for creating a vault on the "Import" page of onboarding
and on the "Restore vault" page is nearly identical, yet the
implementation is totally separate. It has now been extracted to a
separate component, consolidating the two implementations.

There is a "terms of use" checkbox on the import page that isn't on the
restore vault page, so that part has been made optional. The "submit"
button text differs between the two uses as well, so that is
customizable.

There are slight styling differences between the old and new versions
of this form. The fonts and spacing are all using our new standard
design system guidelines, and we're using our standard checkbox now as
well. The spacing and font sizes were chosen somewhat arbitrarily by me
to resemble the old styles, so please feel free to suggest changes if
you think they can be improved upon.

There are some slight copy changes to the "Restore vault" page as well;
the placeholder text and the label for the "Secret Recovery Phrase"
field now matches the "Import" page copy.
2022-02-03 10:36:43 -03:30
Jyoti Puri
760ed3457d
Removing EIP_1559_V2 feature flag (#13481) 2022-02-03 05:58:28 +05:30
MG
3301fd8121
Feat/hide 0 balances (#13306)
* Added token list functional component

* Added list - img not showing up

* Changed render list

* Removed unused code

* Clean up

* Lint

* Linted

* Add newline

* Filter out isERC721

* Added token list

* Cleaned up style

* Fixed typography

* Fixed lint

* Fixed spacing measure

* Lint cleanup
2022-02-02 12:32:16 +01:00
Jyoti Puri
cc1861a34e
Adding metrics events for EIP-1559 V2 flow (#13329) 2022-02-01 23:23:03 +05:30
Ariella Vu
a5b114c4f9
Use ActionableMessage for ConfirmAddSuggestionToken warnings (#13402)
* ConfirmAddSuggestedToken: update duplicate logic

* ConfirmAddSuggestedToken: update duplicate fn names

* ConfirmAddSuggestedToken: add ActionableMessage
- fixes #13347

* base-styles.scss: deprecate .warning

* ConfirmAddSuggestedTokens: update @param desc

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

* ConfirmAddSuggestedTokens: update @param desc

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

* ConfirmAddSuggestedTokens: update @param desc

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

* ConfirmAddSuggestedTokens: update @param desc

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

* ConfirmAddSuggestedToken: clean JSDoc comments
- following GitHub suggestion commits

* ConfirmAddSuggestedToken: warning Learn More btn

* add zendesk-url constants
- use for ConfirmAddSuggestedToken & ImportToken pages

* storybook: add ConfirmAddSuggestedToken controls

* stories: add ConfirmAddSuggestedTokens states

* stories: rm unused args ConfirmAddSuggestedToken

* rn ZENDESK_URL -> ZENDESK_URLS

* AddSuggestedToken: check case-insensitive symbols

Co-authored-by: Alex Donesky <adonesky@gmail.com>
2022-02-01 15:30:15 +00:00
Hassan Malik
2825b74a55
added extension changes from snaps branch (#13433) 2022-01-28 12:39:32 -05:00
thickforest
fd46f97e35
Fix className misspelling in awaiting-swap.js 2022-01-27 14:47:25 -06:00
Alex Donesky
be65eb7339
More nft ux fixes (#13388)
* a batch of nft ux fixes
2022-01-27 11:26:33 -06:00
Jyoti Puri
a0e97f4681
EIP-1559 v2 - small fixes (#13392) 2022-01-26 23:48:43 +05:30
Ariella Vu
667350d15a
Convert ConfirmAddSuggestedToken to a functional component + cleanup (#13377)
* FC: ConfirmAddSuggestedToken
- change class to functional component

* clean: reorganize functions (no logic change)

* FC: ConfirmAddSuggestedToken pt. 2
- preserve trackEvent logic -> metricsEvent

* clean: rm _ prefix from fn name
- why? now, only 3 other functions remain prefixed w/ '_'

* clean: update useEffect hook

* clean: alphabetize props

* clean: functions in ConfirmAddSuggestedToken

* clean: use arrow fn for FC
2022-01-25 20:16:56 +00:00
Jyoti Puri
119e5497ff
UI fixes in EIP-1559 V2 screens (#13367) 2022-01-22 05:53:02 +05:30
filipsekulic
b2a9b72c04
Refactor currency input component and ensure currency toggle persists between settings (#12813) 2022-01-20 09:42:13 -06:00
Ariella Vu
683aa22b56
Update global link hover color from orange to blue (--Blue-400) (#13344)
* base-styles.scss: update a:hover to --Blue-400
- deprecates #df6b0e

* preserve a.warning:hover orange color w/ #ceafa22

* Revert "preserve a.warning:hover orange color w/ #ceafa22"

This reverts commit d0efb923808bbc43e7f955fd8ce3e95f6a124c1f.

* create-account: rm .warning style from help link
- supports #ceafa2
2022-01-19 11:59:52 -07:00
Alex Donesky
f087e501a1
Add modal with directions to re-add token as NFT (#13291)
* Add modal pop for NFTs previously added as tokens - with directions to re-add as NFTs
2022-01-19 12:42:41 -06:00
Jyoti Puri
5b92dc4cf0
Adding e2e test for edit gas fee modal (#13303) 2022-01-20 00:04:43 +05:30
Jyoti Puri
5b5b2cd7df
Fixing warnings in unit test cases (#13349) 2022-01-20 00:04:22 +05:30
Alex Donesky
f7849a0b7c
Add error that redirects users to Import NFT page when they attempt to add an NFT on the Import Token page (#13271)
* Add error that redirects users to Import NFT page when they attempt to add an NFT on the Import Token page
2022-01-19 08:38:33 -06:00
VSaric
cb815a91ad
SendHeader, ContactListTab and AdvancedTab story: converted knobs and actions to controls / args (#13230)
* SendHeader, ContactListTab and AdvancedTab story: converted knobs and actions to controls / args

* Added the other function type props to action controls

* Requested review changes
2022-01-17 10:58:12 -08:00
Elliot Winkler
8beaae3361
Fix UI issues at top of confirm page container (#13314)
This commit fixes a few issues with ConfirmPageContainerSummary (which
holds the contract being used or action being performed and the money
being sent):

* Remove fixed height so that the secondary currency doesn't get cut off
  or spill over
* Add missing padding
* Fix font size of primary and secondary currencies
* Add top border when there is a "address not in your address book"
  alert at the top

Co-authored-by: Ariella <ariellavu@gmail.com>
2022-01-14 20:12:20 -07:00
Niranjana Binoy
58ff673bcd
V10.9.0: Disconnect all accounts flow (#13309) 2022-01-13 18:05:35 -05:00
Alejandro Garcia Anglada
5d7094cafc
Improve first time flow css - select action (#12799)
* Improve first time flow css - select action

* Update ui/pages/first-time-flow/select-action/index.scss

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

* Update ui/pages/first-time-flow/select-action/index.scss

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

Co-authored-by: George Marshall <georgewrmarshall@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
2022-01-13 09:46:38 -08:00
dragana8
76bfc399b6
convert knobs and actions to controls / args (#13203)
* changed knobs

* review updates
2022-01-13 08:06:27 -03:30
Jyoti Puri
88faef7e19
Adding user setting option for EIP-1559 V2 (#13242) 2022-01-12 00:47:56 +05:30
Alex Donesky
4826c8c95e
Feat/collectibles send flow (#13048)
* Add collectibles send flow
2022-01-10 10:23:53 -06:00
Elliot Winkler
7b963cabd7
Alert users when the network is busy (#12268)
When a lot of transactions are occurring on the network, such as during
an NFT drop, it drives gas fees up. When this happens, we want to not
only inform the user about this, but also dissuade them from using a
higher gas fee (as we have proved in testing that high gas fees can
cause bidding wars and exacerbate the situation).

The method for determining whether the network is "busy" is already
handled by GasFeeController, which exposes a `networkCongestion`
property within the gas fee estimate data. If this number exceeds 0.66 —
meaning that the current base fee is above the 66th percentile among the
base fees over the last several days — then we determine that the
network is "busy".
2022-01-07 12:18:02 -07:00
Mark Stacey
3732c5f71e
Add JSDoc ESLint rules (#12112)
ESLint rules have been added to enforce our JSDoc conventions. These
rules were introduced by updating `@metamask/eslint-config` to v9.

Some of the rules have been disabled because the effort to fix all lint
errors was too high. It might be easiest to enable these rules one
directory at a time, or one rule at a time.

Most of the changes in this PR were a result of running
`yarn lint:fix`. There were a handful of manual changes that seemed
obvious and simple to make. Anything beyond that and the rule was left
disabled.
2022-01-07 12:27:33 -03:30
Elliot Winkler
af971cd5b6
Remove dupe Prettier config from ESLint config (#13234)
The ESLint config for the extension explicitly includes support for
Prettier. However, this is already being provided by our global ESLint
config (`@metamask/eslint-config`). Therefore there is no need to
include it here. In fact, this is causing weird issues where the `curly`
option is getting overridden somehow. After this change, these syntaxes
are invalid:

``` javascript
if (foo) return;
```

``` javascript
if (foo) return 'bar';
```
2022-01-06 15:56:51 -07:00
Jyoti Puri
0c531f8b01
EIP-1559 V2 UI fixes (#13222) 2022-01-07 04:10:31 +05:30
David Walsh
10dc686505
Dark Mode Part 1: Switch to Using CSS Variables (#13147) 2022-01-06 11:35:49 -06:00
Jyoti Puri
f5dcd12293
using 1559 V2 for cancel speed up flows (#13019) 2022-01-06 08:17:26 +05:30
Erik Marks
dbfdf3b0eb
Update Flask support links and home footer (#13226)
* Update support links for Flask

* Disable 'prefer-const' in code fence linting

* Add bespoke home footer for Flask and update logic

* fixup! Add bespoke home footer for Flask and update logic

* Fix code fence lint failure

* Fix support request link in account menu

* Fix unit test failure
2022-01-05 21:25:20 -03:30
Mark Stacey
94dc287bb1
Fix missing targetSubjectMetadata.name propType error (#13218)
There was a propType error shown on the snap install screen about the
`name` property of `targetSubjectMetadata` being missing despite it
being marked as required. This property should not have been required,
it does not always exist.
2022-01-05 19:02:44 -03:30
dragana8
fc185e3139
mainnet tokens autopopulate add token form fields when on custom networks #12087 (#12800)
Co-authored-by: Alex Donesky <alex.donesky@consensys.net>
2022-01-05 12:19:28 -06:00
Mark Stacey
22f931e6b2
Prevent automatic rejection of confirmations (#13194)
* Prevent automatic rejection of confirmations

Confirmations are now only automatically rejected if a user explicitly
closes the notification window. If we close the window programmatically
because there are no notifications left to show, nothing gets rejected.

This partially avoids a race condition where a confirmation gets
rejected automatically without the user having seen the confirmation
first. This could happen if the confirmation was processed just as the
notification window was being closed.

It's still possible for a confirmation that the user has never seen to
get rejected as a result of the user closing the window. But at least
now it's no longer possible for a confirmation to get rejected in this
manner after the user resolves the last confirmation in the queue.

* Fix bug that prevented automatic closure detection

All windows were being detected as explicit window closures,
essentially just as they were previously, because this variable was
cleared too soon.

* Re-open popup when necessary

After the window is automatically closed, a confirmation may have been
queued up while the window was closing. If so, the popup is now re-
opened.
2022-01-05 13:39:19 -03:30
Mark Stacey
75b9f71d45
Remove unnecessary mounted state from Home component (#13202)
The `mounted` state was used to derive state from props before the
first render of the Home component. Instead this state is now derived
in the constructor, which is also run before the first render. This
should behave exactly the same, except now we don't need the `mounted`
state or the `deriveStateFromProps` function anymore.

The call to `closeCurrentWindow` that was made in `componentDidUpdate`
has been moved to the constructor as well. There is no need to delay
that call, and this saves us from having to compare current with
previous state in that lifecycle function.
2022-01-04 19:19:06 -03:30
Mark Stacey
3563a246fe
Allow templates without alerts (#13150)
The confirmation page template system allows templates to have alerts,
but it throws an uncaught Promise rejection if a template has no
alerts. This is the unintended side-effect of input validation.

The `getTemplateAlerts` function was updated to always return an array.
The one callsite was updated to expect an empty array if there were no
alerts to render, rather than expecting `undefined`.
2022-01-03 11:32:15 -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
Jyoti Puri
19c3d021ea
Using EIP-1559 V2 for swaps (#12966) 2021-12-12 04:56:28 +05:30
ricky
2085352de8
Make restore vault a form so an user can submit via keyboard (#12989)
* Make this a form

Similar to "import-with-seed-phrase" I would like to be able to restore my vault by pressing `<enter>` on my keyboard.

* actually test enter

* preventDefault()
2021-12-10 14:32:13 -05:00
filipsekulic
bdc7e1df57
Fix order of account list (#12999) 2021-12-10 10:46:24 -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
igorms-cons
e41ac173d1
display hex data on send screen fixed (#12709) 2021-12-09 06:56:49 -03:30
Etienne Dusseault
068e97314e
Fix dropdown-input-pair component to for new Storybook format (#12895)
* input pair

* proptype comments

* Update

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2021-12-07 09:44:25 -08:00
Matthew Epps
311ea021f3
Optimize rest of swaps flow (#12939) 2021-12-07 11:33: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
Etienne Dusseault
9fcfbe7609
Fix unlock-page component for new Storybook format (#12894)
* unlock-page

* Updating comments and removing broken args table

Co-authored-by: georgewrmarshall <george.marshall@consensys.net>
2021-12-06 15:08:13 -08:00
ryanml
bab48c809a
Clear the clipboard after seed phrase is pasted (Restore vault) (#12987) 2021-12-06 12:17:56 -07:00
Jyoti Puri
2af45a656f
Adding validations for advance gas fee input fields (#12879) 2021-12-07 00:17:26 +05:30
Jyoti Puri
6fc9b6b7a2
Using EIP-1559 V2 for approve transaction flow (#12906) 2021-12-06 22:09:35 +05:30
Mark Stacey
b75ef5f0eb
Remove redundant EIP_1559_V2_ENABLED comparison (#12954)
A redundant comparison for the `EIP_1559_V2_ENABLED` variable has been
removed. This variable is a boolean, so it can be treated as a boolean
directly in most cases.

One such comparison has been preserved for the purpose of allowing unit
testing, because `process.env` entries are always strings in Node.js. A
comment was added to explain this.
2021-12-06 11:23:02 -03:30
Jyoti Puri
cd4ddffd9c
Adding gas limit section on advance gas fee modal (#12865) 2021-12-03 21:29:48 +05:30
Mark Stacey
91af73b211
Remove invalid disableRipple prop (#12948)
The `disableRipple` prop was resulting in a React error in development
builds because it was unrecognized by React. This prop dates back to
when we were using the `@material-ui` Button class. It no longer serves
any purpose, so it has been removed.
2021-12-03 11:22:14 -03:30
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