1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
Commit Graph

4392 Commits

Author SHA1 Message Date
Mark Stacey
1ed75b45f7
Remove unused hasHexData prop (#10529)
This prop was never passed in, nor can I see any reason for it to exist
in the first place.
2021-03-02 12:13:53 -03:30
Dan J Miller
46ecf70741
Update swaps failure copy to help users get support (#10525) 2021-03-01 13:02:02 -03:30
Brad Decker
7532e7ce3f
fix links in add ethereum chain (#10536) 2021-03-01 09:36:39 -06:00
David Walsh
8013e85c20
Accommodate for 0 sources verifying swap token (#10521) 2021-03-01 09:20:38 -06:00
Brad Decker
616b71271a
add chainId to all new transaction metadata (#10528) 2021-03-01 09:15:42 -06:00
Mark Stacey
0f7e2dbf20
Show warnings on Add Recipient page of Send flow (#10530)
Warnings were not shown on the Add Recipient page of the send flow. Now
any send warnings will be shown. This can be tested using an ENS name
with a confusable character in it (the confusable character warning
will be shown).

A condition was also removed that prevented any warnings or errors from
rendering when the user had non-zero contacts or recent addresses. I
have no idea why you'd want to hide warnings or errors if the user had
no contacts or recent addresses. None of these errors even pertain to
contacts or recent addresses.
2021-03-01 09:47:22 -03:30
ty
b04120dd0f
Warn users when an ENS name contains 'confusable' characters (#9187)
* Add warning system for 'confusable' ENS names (#9129)

Uses unicode.org's TR39 confusables.txt to display a warning when
'confusable' unicode points are detected.

Currently only the `AddRecipient` component has been updated, but the new
`Confusable` component could be used elsewhere

The new `unicode-confusables` dependency adds close to 100KB to the
bundle size, and around 30KB when gzipped.

Adds 'tag' prop to the tooltop-v2 component

Use $Red-500 for confusable ens warning

Lint Tooltip component

Update copy for confusing ENS domain warning.

* Fix prop type

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-02-27 01:56:04 -03:30
Austin Akers
dedadee346
[Fixed] #7921 Message text overflow removed redundant title (#10485)
* fixed message text overflow

* reverted and removed mesage title inside message--root

* fixed margin problem in sign message

* removed dead css

* fixed large left padding on data signing
2021-02-26 09:29:03 -03:30
Brad Decker
1a2dc850a3
addEthereumChain bug fixes (#10520) 2021-02-25 16:25:51 -06:00
Brad Decker
15d78b8158
use chain id for enabling ENS IPFS resolution (#10507) 2021-02-25 05:40:57 -06:00
Mark Stacey
2b022cd759
Remove unused AppHeader props (#10506)
These two props were being passed into the AppHeader component by the
AppHeader container despite them being unused.
2021-02-23 15:41:40 -03:30
Dan J Miller
e7a0ca134b
Replace use of 'destinationAmountInEth' property with 'destinationAmountInETH' (#10500) 2021-02-23 13:22:04 -03:30
Dan J Miller
9c4af85664
Ensure that swap approve tx and swap tx always have the same gas price (#10501) 2021-02-23 13:21:43 -03:30
Dan J Miller
75a81c605a
Eliminate artificial delay in swaps loading screen after request loading is complete (#10496) 2021-02-23 13:21:19 -03:30
David Walsh
839693b685
Use chain ID instead of network name for getIsMainnet (#10488) 2021-02-23 10:27:32 -06:00
Brad Decker
aabe653240
Add Custom Network UI (#10310) 2021-02-22 10:20:42 -06:00
David Walsh
7e0525ec17
Fix #10447 - Prevent navigation from jumping vertically when clicking into token (#10471) 2021-02-19 13:03:59 -06:00
David Walsh
3d579dfcef
Remove react-select and SimpleDropdown, use Dropdown (#10468) 2021-02-19 13:03:44 -06:00
Niranjana Binoy
fab22ee05f
Fetch eth_gasprice in send flow on non-Mainnet networks (#10444) 2021-02-18 21:48:23 -05:00
David Walsh
59a9d4dc5c
Clean up network form form generation, autofocus the network name (#10473) 2021-02-18 10:25:13 -06:00
Thomas Huang
21aec63f41
Fix encypt/decrypt tx queueing (#10350)
Fixes #10231

Use unconfirmedTransactionsListSelector in the encypt/decrypt components to render the appropriate data to the component at the appropriate time(?).
I am still unsure how sometimes the state.confirmTransaction can we left empty sometimes on rendering the component, possibly the issue with the ConfirmTransaction componentDidUpdate constantly hitting this section.
https://github.com/MetaMask/metamask-extension/blob/develop/ui/app/pages/confirm-transaction/confirm-transaction.component.js#L94-L101

For now this seems to be an intermediate fix.
2021-02-17 12:47:01 -08:00
Dan J Miller
b056867c33
Correct use of useTokenTracker in viewQuote to ensure token data is not disrupted by faulty token in user account (#10456)
* Use the includeFailedTokens option with useTokenTracker in viewQuote

* Show appropriate error message if we do not have data on the balance of token on the view-quote screen

* Update app/_locales/en/messages.json

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-02-17 11:19:24 -03:30
Shane
f4819e408b
fix: confirm page header should show address in fullscreen (#10467)
fixes #9920
2021-02-16 18:06:54 -08:00
Thomas Huang
1f79250285
Fixes gas selection check mark on the notification view (#10465) 2021-02-16 15:09:52 -08:00
David Walsh
ffeaeea4b1
Disable BUY button from home screen when not on main network (#10453) 2021-02-16 09:31:16 -06:00
Brad Decker
8e2d4e6fdd
add MetaMaskTranslation component (#10405)
* add MetaMaskTranslation component

* add stories

* Update ui/app/components/app/metamask-translation/metamask-translation.js

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

* Update ui/app/components/app/metamask-translation/metamask-translation.js

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

* fix regex

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-02-12 11:24:50 -06:00
Erik Marks
e48053a6d5
Add custom network RPC method (#9724)
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
Co-authored-by: Brad Decker <git@braddecker.dev>
2021-02-12 09:25:58 -06:00
Thomas Huang
d8cda0b093
Fixes css override of token option menu icons. (#10424)
The `@include Paragraph` was added in one of the typography PRs but I believe it was intended for the token options text, not the icon. I believe the Paragraph only applies to text like everywhere else in the UI and this should be safe to remove from the icon to display the font-family from Font Awesome.
2021-02-11 15:02:38 -08:00
Thomas Huang
73f5d386fe
Fix color indicator size (#10421) 2021-02-11 13:08:25 -08:00
Brad Decker
bd1683402a
use native currency in asset row (#10413)
* use native currency in asset row

* set native currency on startup
2021-02-11 12:20:08 -06:00
Mark Stacey
6677bd9cce
Remove unused confirmTransaction state (#10396)
The `confirmTransaction` Redux slice had a lot of unused state and
action creators. They have all been removed.
2021-02-08 17:50:21 -03:30
Mark Stacey
88f1233852
Fix transferFrom localized message (#10395)
The `transferFrom` localized message has been unused at least since the
transaction list redesign was implemented. The `transactionCategory`
has been used directly as the localized message key since then. For
most of the other categories this was fine, but for `transferFrom` the
message differs slightly from the category (the category is
`transferfrom`, with a lower-cased 'f').
2021-02-08 14:00:27 -03:30
kumavis
85cf35b2d1
Storybook: Signature Request (#10400)
* storybook - add signature request storybook entry

* storybook + improve test data + lint

* styles - apply flex and align center to --network
2021-02-09 00:49:49 +08:00
Mark Stacey
b93046bdab
Use string literals for transaction category localized messages (#10391)
We now use string literals for all transaction category localized
messages. This makes it easier to verify that we have translations for
each of them, and that we aren't leaving any unused translations around.
2021-02-08 12:36:58 -03:30
David Walsh
531c35bc96
Ensure users reacknowledge price slippage risks when it changes (#10376) 2021-02-05 14:40:40 -06:00
Dan J Miller
27d6c6e0df
Make action elements in actionable message component accessible (#10386)
* Make action elements in actionable message component accessible by making them buttons

* Remove unnecessary cursor pointer
2021-02-05 14:57:48 -03:30
Dan J Miller
33ab480fbe
Swaps token sources/verification messaging update (#10346)
* Update standard swaps build quote screen token verification message

* Add actionable warning token verification message to swaps build quote screen

* Simplify swapTokenVerification translations

* Use original verifyThisTokenOn message instead of swapsConfirmTokenAddressOnEtherscan

* Restore verifyThisTokenOn message to hi locale

* Support type and the withRightButton option as parameters on the actionable message component

* Use 'continue' in place of swapPriceDifferenceAcknowledgementNoFiat message

* Use wrapperClassName property on infotooltip in actionable-message

* Remove unnecessary change

* Lint fix
2021-02-05 13:41:10 -03:30
Erik Marks
76a2a9bb8b
@metamask/eslint config@5.0.0 (#10358)
* @metamask/eslint-config@5.0.0
* Update eslintrc and prettierrc
* yarn lint:fix
2021-02-04 10:15:23 -08:00
Dan J Miller
e82ab94699
Change copy of submit button on swaps screen (#10373) 2021-02-04 14:42:43 -03:30
David Walsh
eeca0af5b9
Implement price impact acknowledgement button (#10347) 2021-02-04 09:58:46 -06:00
kumavis
efd280172f
ci - run storybook and add to build-artifacts (#10360)
* ci - run storybook and add to build-artifacts

* ci/storybook - rename storybook build path and fix artifact upload

* ci/storybook - rename link text

* clean - remove accidently committed storybook build dir

* storybook - fix image path to relative (#10364)
2021-02-04 22:30:22 +08:00
Richard Gordon
da18091d8e
fix(typo): unapprived unapproved (#10366) 2021-02-04 09:41:05 -03:30
Thomas Huang
df5f789391
Use nock to intercept gas call for gas-duck test (#10334)
* Use nock in to intercept gas call for gas-duck test

Use nock instead of stubbing out the window fetch. My suspicion is that when the test runs the window sometimes wouldn't be intialized/referenced, which could explain the intermittent test failures in those particular tests that call window.fetch.
Using nock allows the call to be intercepted more reliably.
2021-02-02 13:14:03 -08:00
Brad Decker
96933b3faf
add MetaMask Template Renderer (#10307)
* add MetaMask Template Renderer

* add areEqual fn and change acc var name

* use key
2021-02-02 12:14:04 -06:00
Brad Decker
12161bb0c6
add Callout component (#10309) 2021-02-02 09:21:56 -06:00
Brad Decker
469ccd20b3
Fixup prop types and use constants (#10306)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-02-01 12:59:24 -06:00
Brad Decker
9269615b26
add inverted info icon, and update props (#10305) 2021-02-01 12:10:19 -06:00
Mark Stacey
e6f4c89945
Fix signature confirmation PropType error (#10317)
Upon the first render, the "original" signature request confirmation
page would trigger a PropType error. This was caused by unexpected
mutation of the state props. The container has been updated to avoid
mutating the props, and now the PropType warning is no longer present.
2021-02-01 14:32:20 -03:30
Mark Stacey
f381f41cb2
Fix network dropdown button (#10312)
This fixes a bug where the network menu would remain present after a
second click on the network menu button. The bug was caused by the
click being handled _twice_, by two separate handlers. First it was
caught by the external click handler of the dropdown menu, which closed
the menu. Second, it was caught by the network button itself, which re-
opened the menu. This all happens quickly enough that to the user it
appears to stay open.

The external click handler of the menu now only fires if the menu is
open. Additionally, any click that is caught by the network menu is
stopped from propagating further, so that it can't trigger additional
click handlers.
2021-01-30 12:12:55 -03:30
Mark Stacey
6f46253e62
Fix menu-droppo external click handler (#10311)
The `menu-droppo` external click handler would fail to update when the
prop changed while the menu wasn't shown. This bug isn't exposed
anywhere yet as far as I know, but I ran into it when working on a
different bug fix.
2021-01-29 17:04:15 -03:30
Mark Stacey
d7d2de04bd
Fix PropType error for Chip component (#10319)
The Chip component was emitting a PropType error because it was missing
the `labelProps.children` prop. It was never supposed to be given that
prop - it was a mistake in the PropType declaration. The PropTypes have
been fixed to prevent this warning.
2021-01-29 13:35:32 -03:30
Mark Stacey
c053294781
Add origin to transaction confirmation (#10296)
Fixes #5611

The origin that suggests a transaction is now shown on the transaction
confirmation page. If the transaction was initiated from within
MetaMask (e.g. via the 'Send' flow or swaps), no origin is shown.

This was based upon designs that were linked in the PR #9377. This is a
temporary measure until our newer transaction confirmation designs can
be implemented.
2021-01-28 14:29:45 -03:30
Mark Stacey
d8993883b7
Add origin to signature request confirmation page (#10300)
Fixes #6071

The origin of the dapp that suggested signing has been added to the
signature request confirmation page. This only applies to `eth_sign`,
`personal_sign`, `eth_signTypedData`, and `eth_signTypedData_v1`. The
confirmation page for `eth_signTypedData_v3` and `eth_signTypedData_v4`
already featured the origin.
2021-01-28 14:29:25 -03:30
Brad Decker
471140fdea
Add Truncated Definition List (#10292) 2021-01-28 11:22:37 -06:00
Mark Stacey
ecff9dfcb0
Remove unused transaction base props (#10295)
These props were never given. They have been removed to simplify the
component.
2021-01-28 13:47:26 -03:30
Brad Decker
419897cba6
Add Definition List component (#10291) 2021-01-28 09:54:02 -06:00
Thomas Huang
425ec6228c
Use nativeCurrency in the confirm approve screen (#10298)
Gets nativeCurrency from state and uses in place of the previously hardcoded ETH value in the confirm approve component.
2021-01-27 22:44:04 -08:00
Brad Decker
293b8a0f53
Add box component (#10289) 2021-01-27 11:54:25 -06:00
Brad Decker
3806e0a2a6
Refactor NetworkDisplay, ConnectedStatusIndicator, etc to use ColorIndicator (#10214) 2021-01-27 10:51:59 -06:00
Alex Donesky
569672027c
Allow editing transaction amount after clicking max (#10278) 2021-01-27 13:13:28 -03:30
Dan J Miller
d0df03b89a
Cancel transaction when swaps submission is failed because the simulation fails (#10288)
* Cancel transaction when swaps submission is failed because the simulation fails

* Cleanup
2021-01-26 17:01:25 -03:30
Brad Decker
a036b0ebcd
Add color indicator component (#10209)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2021-01-22 15:45:37 -06:00
Dan J Miller
7f1f68399a
Do not publish swaps transaction if the estimateGas call made when adding the tx fails. (#9947) 2021-01-22 17:44:57 -03:30
Mark Stacey
9e7a799583
Remove unnecessary optional chain operator (#10256)
This operator is being used under a condition that guarantees that the
property is present, so the optional chain operator is useless.
2021-01-22 17:32:56 -03:30
Dan J Miller
b1fc4addfd
Reset swaps routeState in navigateBackToBuildQuote (#10166) 2021-01-22 15:30:56 -03:30
Mark Stacey
ab3b64e643
Fix decrypt message confirmation UI crash (#10252)
The decrupt message confirmation UI will crash if the origin metadata
is not present. This PR makes the UI tolerant of that metadata being
missing. It was always intended to be optional anyway.
2021-01-22 15:10:43 -03:30
Mark Stacey
288f60bff2
Fix design system error constants (#10246)
The design system error constants were missing a hyphen. Now they match
the CSS color variable they were intended to match.
2021-01-22 12:05:01 -03:30
Erik Marks
4fef2b7443
Add MAX_SAFE_CHAIN_ID and refactor chain ID validation (#10224)
* Add MAX_SAFE_CHAIN_ID constant
* Add isSafeChainId to shared utils module
* Move isPrefixedFormattedHexString to shared utils module
* Validate custom RPC chain IDs in network controller
* Update some network controller error messages.
* Add isSafeChainId validation to UI
2021-01-20 15:37:18 -08:00
Brad Decker
e9079be2b8
add chip component (#10199) 2021-01-20 17:06:01 -06:00
Brad Decker
29f4c93830
add new typography component (#10197) 2021-01-20 16:13:33 -06:00
Erik Marks
7077ee68dc
Add NETWORK_TYPE_RPC constant (#10203)
* Refactor network display props
* Add NETWORK_TYPE_RPC constant
* Consolidate network constants
2021-01-20 08:49:05 -08:00
Erik Marks
90289ec22a
Further improve organization of constants (#10200) 2021-01-20 08:13:14 -08:00
Dan J Miller
36ef9a228a
Disable the swaps submit button after the first time it is clicked (#10162) 2021-01-19 13:42:02 -03:30
Dan J Miller
5b6e524c90
Remove default to 18 decimals in quotesToRenderableData method (#10212) 2021-01-19 13:35:58 -03:30
Brad Decker
acbe38c260
use dart sass, and update related modules (#10208) 2021-01-19 10:54:32 -06:00
Erik Marks
7159dd6867
Fetch with a timeout everywhere (#10101)
* Use fetchWithTimeout everywhere
* Memoize getFetchWithTimeout
* Require specified timeout
2021-01-19 08:41:57 -08:00
Brad Decker
4f66af606e
improve design system scss (#10193) 2021-01-19 10:30:29 -06:00
Mark Stacey
87d181b347
Fix hardware account selection (#10198)
Fixes #9244

When trying to connect a Trezor account on a fresh install of MetaMask,
the radio buttons on the account selection page would not respond to
being clicked.

When debugging this, it looks like the `onChange` event was never
triggered. A radio `<input>` element should trigger `onChange` whenever
the selection state change, but seemingly this wouldn't happen if the
change in selection state was undone during the same render cycle. If
I paused at a breakpoint during the render, I could see the checkbox
get selected then unselected again without triggering `onChange`.

The simplest fix was to use `onClick` instead of `onChange`. This seems
more appropriate anyway because we're treating the radio button as a
controlled component here, so the state of the underlying element isn't
really of any concern.
2021-01-18 12:46:24 -03:30
ImanH
acc9a931e5
drop the fox in about (#10174) 2021-01-14 09:50:44 -03:30
Erik Marks
79f0ba9697
Fix eth-method-registry import (#10183) 2021-01-12 20:29:47 -08:00
Mark Stacey
9e03066157
Fix UI crash when domain metadata is missing (#10180)
The "Confirm public encryption key" page will now no longer crash when
the domain metadata is missing.
2021-01-12 22:22:58 -03:30
Dan J Miller
9a1e83cf4b
Disable swaps based on chainId, instead of network id (#10155) 2021-01-07 13:29:32 -03:30
Brad Decker
b5fc1f9314
improve handling of last selected provider (#10093) 2021-01-06 17:31:11 -06:00
Mark Stacey
6f18989582
Prevent malformed next nonce warning (#10143)
The "Next nonce" warning warns users when the custom nonce they set is
higher than our suggested nonce. This warning was mistakenly being
shown even when we didn't have a suggested nonce yet.

Fixes #9989
2021-01-05 14:16:30 -03:30
Dan J Miller
2957906101
Ensure that gas for swap tx submitted at same time as approval is in hex (#10135) 2021-01-04 14:43:44 -03:30
Erik Marks
d55f579447
Fix useTransactionDisplayData unit tests (#10134)
New year, new problems.

It's working as expected, but we had hard-coded some 2020 date values, and `formatDateWithYearContext` adds the year to its output formatted date if the date is not from the current year.
2021-01-04 09:45:54 -08:00
ivigamberdiev
869124c4c9
Fix network settings Kovan block explorer link (#10117) 2020-12-25 10:51:47 -08:00
David Walsh
d4d3d6a52a
Remove unnecessary swaps footer space when in dropdown mode (#10100) 2020-12-18 09:58:42 -06:00
Erik Marks
4b766fa538
Tighten up loading indication logic (#10103)
Ensures that `hideLoadingIndication` is always called in all actions that call `showLoadingIndication`. It's unclear how many of these actions were failing to hide the loading indication, because other actions superset `hideLoadingIndication`. 

At the very least, `updateTransaction` was probably failing to hide the loading indication in the error case.

This PR also refactors a lot of actions to call `hideLoadingIndication` once in `finally` blocks as opposed to multiple times across `try` and `catch` blocks. We avoided making changes to functions using `Promise` methods, because `Promise.finally` is not supported by Waterfox, and it's not properly transpiled by Babel.
2020-12-17 21:34:43 -08:00
Brad Decker
ce70c86774
set last provider when switching to a customRPC (#10084) 2020-12-16 09:48:42 -06:00
David Walsh
88525ec392
Fetch swap quote refresh time from API (#10069) 2020-12-15 16:54:22 -03:30
Mark Stacey
6c637bba9c
Fix fetch-with-cache handling of interwoven requests (#10079)
A data race was introduced in #9919 when the old synchronous storage
API was replaced with an async storage API. The problem arises when
`fetchWithCache` is called a second time while it's still processing
another call. In this case, the `cachedFetch` object can become
stale while blocked waiting for a fetch response, and result in a cache
being overwritten unintentionally.

See this example (options omitted for simplicity, and assuming an empty
initial cache):

```
await Promise.all([
  fetchWithCache('https://metamask.io/foo'),
  fetchWithCache('https://metamask.io/bar'),
]
```

The order of events could be as follows:

1. Empty cache retrieved for `/foo` route
2. Empty cache retrieved for `/bar` route
3. Call made to `/foo` route
4. Call made to `/bar` route
5. `/foo` response is added to the empty cache object retrieved in
  step 1, then is saved in the cache.
6. `/bar` response is added to the empty cache object retrieved in
  step 2, then is saved in the cache.

In step 6, the cache object saved would not contain the `/foo`
response set in step 5. As a result, `/foo` would never be cached.

This problem was resolved by embedding the URL being cached directly in
the cache key. This prevents simultaneous responses from overwriting
each others caches.

Technically a data race still exists when handing simultaneous
responses to the same route, but the result would be that the last call
to finish would overwrite the previous. This seems acceptable.
2020-12-15 16:51:13 -03:30
David Walsh
1b19f5e7ad
Fix 9874 - Improve gas maximum estimation (#10043) 2020-12-15 11:16:51 -06:00
Brad Decker
3cabe7525f
fix metametrics option tracking (#10071) 2020-12-14 15:54:33 -06:00
David Walsh
9a1548368f
Use Boolean for filters (#10066) 2020-12-14 11:03:59 -06:00
David Walsh
b16737454e
Prevent metaMaskFee prop error in FeeCard (#10047) 2020-12-11 12:03:51 -06:00
Nicholas Rodrigues Lordello
fcf75d6438
Display boolean values when signing typed data (#10048) 2020-12-11 11:40:34 -06:00
Erik Marks
54e9c53b27
Add web3 shim usage notification (#10039)
* Add web3 shim usage alert background state and logic
* Cleanup alert background state, constants
* Implement web3 shim usage notification and settings
* nodeify alert controller background hooks
* Remove svg icon, again
* Tweak alert controller initialization
* Add support article URL
* Un-thunk alert UI "actions"
* Delete connect.svg file (unused)
2020-12-10 15:40:29 -08:00
Erik Marks
db004d4486
Refactor home notification (#10046)
Co-authored-by: Brad Decker <git@braddecker.dev>
2020-12-10 12:02:21 -08:00
David Walsh
07c5527b1e
Use consistent font size for modal top right Close links (#10000) 2020-12-10 12:02:57 -06:00