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

4461 Commits

Author SHA1 Message Date
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
Mark Stacey
4350a1422e
Fix token validation in Send flow (#10045)
Additional validation was added in #9907 to ensure that the "Known
contract address" warning was shown when sending tokens to another
token address after switching assets on the Send screen. Unfortunately
this change had the unintended side-effect of preventing _all_ token
sends after switching assets, so long as the recipient was not an
internal address.

The problem is that the `validate` function expects to be passed the
address of the token send recipient in the case where a token is
selected. Instead the token address was being passed to the validate
function.

The `query` state is now used, which should always contain the
recipient address. This is the same state used in the only other place
the `validate` function is called.
2020-12-10 14:28:19 -03:30
Mark Stacey
6304ce15a2
Fix TokenList component name (#10030)
The TokenList component on the `add-token` page had the name `InfoBox`,
which doesn't seem applicable. It has been renamed to `TokenList`, to
match the module filename and the component name we use elsewhere.
2020-12-09 17:02:38 -03:30
Dan J Miller
da5e5cd8b6
Reapply view quote screen designs (#9905) 2020-12-08 10:47:53 -06:00
David Walsh
33b15b5c6f
Prevent props error in swaps gas modal (#10001) 2020-12-07 09:58:06 -06:00
David Walsh
5fd6d1a8a6
Fix 9906 - Prevent unwanted 'no quotes available' message when going back to build quote screen while having insufficient funds (#9994) 2020-12-07 09:13:24 -06:00
David Walsh
56f80ae9a9
Fix 9988 - Don't allow more than 15% slippage (#9991) 2020-12-07 09:12:55 -06:00
Mark Stacey
cce690c3d8
Remove unused state from Redux gas slice (#9975)
The `errors` and `total` state has been removed from the `gas` slice,
along with related functions. It appears to have been unused for a long
time, though I'm not exactly sure as of when.
2020-12-03 16:23:36 -03:30
David Walsh
42fd8b0ff0
Use strict equality in unit tests (#9966) 2020-12-03 09:46:22 -06:00
Dan J Miller
97d268c8ee
Remove use of ethgasstation; use metaswap /gasPrices api for gas price estimates (#9867)
* Remove use of ethgassthat; use metaswap /gasPrices api for gas price estimates

* Remove references to ethgasstation

* Pass base to BigNumber constructor in fetchExternalBasicGasEstimates

* Update ui/app/hooks/useTokenTracker.js

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

* Delete gas price chart

* Remove price chart css import

* Delete additional fee chart code

* Lint fix

* Delete more code no longer used after ethgasstation removal

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-12-02 19:55:19 -03:30
Brad Decker
0653a489b0
add new MetaMetricsController (#9857) 2020-12-02 15:41:30 -06:00
David Walsh
673371d013
Fix #9872 - Show price difference warning on swaps price quote (#9899) 2020-12-02 15:27:45 -06:00
Erik Marks
9d4b8a4903
@metamask/contract-metadata (#9968) 2020-12-01 14:55:01 -08:00
Mark Stacey
429847a686
Update to @storybook/*@6 (#9956)
Our Storybook dependencies have been updated to v6.1.9, from v5. This
was done to address a security vulnerability in a transitive dependency
of these packages (`highlight.js`).

The primary changes required by this Storybook update were the change
in import path for the `withKnobs` hook, the change in background
config format, and the webpack configuration. Storybook seems to work
correctly.

The migration was guided by the Storybook changelog[1] and the
Storybook v6 migration guide[2].

There is one Storybook error remaining; it fails to load the Euclid
font. This is a pre-existing error though, so we can fix it in a later
PR.

The `yarn.lock` file was deduplicated in this PR as well, as it was
required to fix various install warnings that were introduced with this
update.

[1]: https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md
[2]: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md
2020-11-30 16:40:46 -03:30
David Walsh
bf65c979d2
Use async storage instead of localstorage (#9919) 2020-11-24 09:38:04 -06:00
Brad Decker
b3fa1e534e
add version to page events (#9926) 2020-11-21 09:38:43 -06:00
David Walsh
0315c6c20d
Add alt text for images in list items (#9847) 2020-11-20 10:57:45 -06:00
Brad Decker
3ebba0d411
validate addresses in qr codes (#9916) 2020-11-19 15:44:42 -06:00
Thomas Huang
35af9ea301
Override font-weight from Paragraph and set to 900 (#9918)
* Override font-weight from Paragraph and set to 900

* Fix checkmark font-weight on swaps gas button selector
2020-11-19 12:29:35 -08:00
Dan J Miller
2325514a67
Use correct method name for createTokenTrackerLink in token-asset (#9917) 2020-11-19 15:19:45 -03:30
Thomas Huang
44448465ed
Validate sendToken address when component updates (#9907)
* Validate sendToken address when component updates

On a reproduction of trying to get the error message it seems that if an token address is provided in the address form with ETH selected then changing to a token address, the error message won't show.

This will validate the sendtoken address on prop change to properly update the warning message.

* Update test to include second doesAmountErrorRequireUpdate call when state is updated and component is updated
2020-11-19 07:35:42 -08:00
Thomas Huang
75de9086de
Include error string from ledger errors (#9911)
* Include error string from ledger errors

* Type check error message

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-19 07:35:20 -08:00
Mark Stacey
bb3a0423d4
Ensure custom slippage is a number (#9915)
This fixes a PropType error when using non-custom slippage, and it
fixes a type inconsistency when custom slippage is used.

Previously, `slippage` was being converted explicitly to a `Number` as
it was passed into `BuildQuote`, but not as it was passed into
`AwaitingSwap`. Also the PropType was set as `string`, despite the fact
that it's a number in most cases, and is used for math.

The PropType has been changed to `number`, and the selective casting to
`Number` has been removed. Instead, the `maxSlippage` value is cast to
a `Number` as it's being selected, so that the type is always
consistent.
2020-11-19 11:56:55 -03:30
Dan J Miller
a9fcf0ea86
Use getTokenTrackerLink for asset view etherscan link in token-asset.js (#9913) 2020-11-19 00:59:42 -03:30
Dan J Miller
1e895c3110
Revert view quote design updates (#9904)
* Revert "Update fee card designs to show savings and MM fee (#9629)"

This reverts commit d9924ca771.

* Revert "Update main-quote-summary designs/styles (#9612)"

This reverts commit 5456d55c88.
2020-11-18 22:10:24 -03:30
Dan J Miller
179e795b1f
Update asset page etherscan link to the address-filtered token page on Etherscan (#9909) 2020-11-18 21:57:29 -03:30
Brad Decker
5be20d105e
show failed token balance updates (#9896) 2020-11-18 16:13:28 -06:00
David Walsh
e90bddf44f
Revert "Show a 'send eth' button on home screen in full screen mode" (#9910) 2020-11-18 16:02:57 -06:00
Brad Decker
520ad05790
fix METAMASK-GH2B (#9900) 2020-11-17 16:49:19 -06:00
Dan J Miller
e4de763116
Add token verification message to swaps build quote screen (#9891)
* Add token verification message to swaps build quote screen

* Adds description for locale

* Use <a> tag for etherscan link

* Remove unnecessary span

* Update ui/app/pages/swaps/build-quote/build-quote.js

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-17 17:26:02 -03:30
Brad Decker
daf783a0d8
Track a new schema event when adding a token (#9810)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-17 11:39:21 -06:00
Thomas Huang
302b7dd731
Move add contact button in fullscreen/expanded view lower. (#9883)
* Move add contact button in fullscreen/expanded view.

Fixes #9868

Move the add contact button that is overlapping (x)/close setting icon lower, on the same line as Contacts in fullscreen/expanded view.
2020-11-16 12:07:48 -08:00
Nate Chastain
179dbcb41c
Remove CoinSwitch from Deposit screen(#9869)
Remove all CoinSwitch references and functionality, and bump Wyre to top spot on Deposit screen unless user on test network
2020-11-16 13:57:53 -03:30
David Walsh
70a3a7b09c
Merge pull request #9881 from darkwing/prevent-send-button-jump
Prevent jump when hovering over asset list items
2020-11-13 13:55:36 -06:00
David Walsh
9b42ead095
Merge pull request #9880 from darkwing/hardware-error
Properly detect U2F errors in hardware wallet
2020-11-13 13:51:08 -06:00
David Walsh
ed19ce44bd
Merge pull request #9853 from darkwing/image-updates
Provide alternative text for images where appropriate
2020-11-13 13:44:55 -06:00
David Walsh
587d07c730 Prevent jump when hovering over asset list items 2020-11-13 13:30:48 -06:00
David Walsh
d78e6dc821
Merge pull request #9855 from darkwing/edit-account-focus
Make editable action item a button, autofocus input contents
2020-11-13 13:07:40 -06:00
David Walsh
19a03d20c0 Properly detect U2F errors in hardware wallet 2020-11-13 12:34:03 -06:00
Mark Stacey
7830b85bf1
Fix malformed PropType declaraton (#9876)
`PropTypes.function` was used accidentally instead of `PropType.func`
2020-11-13 14:52:58 -03:30
Mark Stacey
a75949e62c
Fix broken LoadingScreen PropType declaration (#9877)
`PropTypes.oneOf` was used accidentally instead of
`PropTypes.oneOfType`. `oneOf` expects literal values, not types.
2020-11-13 14:52:48 -03:30
Mark Stacey
beb6047384
Revert "Add custom hd path option (#9367)" (#9875)
This reverts commit f30d261e69.

The custom HD path option was found to be unsafe to use, because the
displayed list of accounts would differ depending on which application
was open on the Ledger device. Essentially Ledger was accepting invalid
inputs, and returning junk responses.

This was too dangerous to ship, as it could leave users with an account
that they can't reliably recover. If we don't know how the derivation
is happening, then allowing this import puts our users at risk of
losing funds.

We can re-introduce this functionality after adding validation to
ensure that we only allow inputs that are handled correctly by Ledger.
2020-11-13 14:25:47 -03:30
David Walsh
9da719efef
Merge pull request #9871 from darkwing/hover-send
Show send text upon hover in main asset list
2020-11-13 11:39:08 -06:00
Dan J Miller
d9924ca771
Update fee card designs to show savings and MM fee (#9629)
* Update fee card designs to show savings and MM fee

css touch up

More semantic html and remove unnecessary container wrapper

Update message for case when there are no savings, in new swaps fee card designs

Improve display of tilde in savings designs

* Ensure terms of service is shown when insufficient eth warning is shown on view-quote screen

* Logic simplification in fee-card.js

* Better center info tooltip icons in fee-card

* Add comment about use of \!important in fee card css

* Use container class property on info tooltip in fee card

* Remove function call that was made redundant with 980b14089 but not removed during rebase
2020-11-13 13:42:50 -03:30
David Walsh
9677d090d1 Show send text upon hover in main asset list 2020-11-13 10:52:29 -06:00
David Walsh
67303b7865
Fix BigNumber issues (#9860)
* Document where we need BigNumber-related changes

* Fix 1 unit test

* Debug progress

* Add required values for each upstream usage of getBigNumber

* Switch to base 10

* Address feedback
2020-11-13 14:08:18 +08:00
Erik Marks
0dbeae583a Fix mock signature in test 2020-11-12 16:41:01 -08:00
Erik Marks
406f06dae8 Fix gas-modal-page-container gas price selection call 2020-11-12 16:37:16 -08:00
Erik Marks
8c6c944d14 Fix unit tests 2020-11-12 15:04:29 -08:00
Erik Marks
bb81ac7cd6 Fix setGasPrice dispatch function params 2020-11-12 14:57:29 -08:00
David Walsh
64657efdef
Merge pull request #9845 from darkwing/send-eth-button
Show a 'send eth' button on home screen in full screen mode
2020-11-12 13:29:47 -06:00
Dan J Miller
9849a9cf82
Fixes related to swaps custom gas limit (#9858)
* Fixes related to swaps custom gas limit

* Update ui/app/pages/swaps/view-quote/view-quote.js

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

* Move selectQuotePopover onSubmit dispatches to a single action creator

* Correct type of minimumGasLimit in view-quote.js

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-11-12 15:42:04 -03:30
David Walsh
9df5be903b
Use optional chaining for functions (#9799) 2020-11-12 11:13:21 -06:00
David Walsh
5f949d2c4f Show a 'send eth' button on home screen in full screen mode 2020-11-12 10:49:30 -06:00
David Walsh
56cff1a91a Fix unnecessary keyring check 2020-11-12 10:45:54 -06:00
Mark Stacey
d5076e142a
Prevent user from getting stuck on opt in page (#9856)
Failed metric events on the opt-in page no longer leave the user stuck
on that page. If the metric events fail, they still bubble up as errors
to be caught by Sentry and logged to the console, but the user is still
brought to the next page.

Fixes #9800
2020-11-11 18:33:11 -03:30
Erik Marks
876ca136b3 Throw instead of log error 2020-11-11 12:39:26 -08:00
Erik Marks
a714da8069 Ensure submission state is reset on onSubmit error 2020-11-11 12:28:20 -08:00
David Walsh
74866a6efb Make editable actoin item a button, autofocus input contents 2020-11-11 12:00:12 -06:00
David Walsh
a05230bba7 Provide alternative text for images where appropriate 2020-11-11 09:38:15 -06:00
Erik Marks
53bf9cb766 Disable save button while submitting 2020-11-10 23:39:49 -08:00
Erik Marks
4db9c8b36f Fix chainId display in network form on save 2020-11-10 22:41:19 -08:00
Mark Stacey
552ea136b7
Fix onboarding library integration (#9835)
The bug with our onboarding library integration was introduced in #8873
because of a change in when `completeOnboarding` was called. We hadn't
realized at the time that the onboarding integration relied upon the
onboarding completing event to know when the onboarding state should
be cleared. Because onboarding is now marked as completed earlier, the
state was cleared just as it was intended to be used.

The onboarding completed event has been moved back to where it was
before: after the user exits the "end of flow" page.

The original problem that #8873 was addressing was a routing issue,
where the user would be redirected back to the seed phrase confirmation
page despite already having confirmed their seed phrase. This was fixed
in a different way here, by updating the routing in the first time flow
switch to skip straight to the end of flow page if the seed phrase has
already been confirmed.

This does involve one user-facing change in behavior; if the user opens
any MetaMask UI before navigating away from the end-of-flow screen,
they will still be considered mid-onboarding so it'll redirect to the
end-of-flow screen. But we do mark onboarding as completed if the user
closes the tab/window while on the end of flow screen, which was
another goal of #8873.
2020-11-10 17:57:08 -03:30
Dan J Miller
2540ca77b9
Add a minimumGasLimit to the gas customization modal in swaps (#9600)
* Add a minimumGasLimit to the gas customization modal in swaps

* Remove fallback object for modal props in swaps-gas-customization-modal.container.js
2020-11-10 16:50:39 -03:30
Mark Stacey
65fb18e1aa
Fix PropType warning about quoteDataRows[0].rawNetworkFees (#9842)
The property `quoteDataRows[0]rawNetworkFees` was described as a number
rather than a string. In practice it is a string in all cases. The
PropType and the tests have both been updated to expect it to be a
string.
2020-11-10 14:17:55 -03:30
Dan J Miller
bcd5f2a7c1
Fix gas_fees properties collected for swaps analytics events (#9727) 2020-11-10 14:09:45 -03:30
Mark Stacey
14d85b1332
Make JSDoc formatting more consistent (#9796)
A few inconsistencies in JSDoc formatting have been fixed throughout
the project. Many issues remain; these were just the few things that
were easy to fix with a regular expression.

The changes include:

* Using lower-case for primitive types, but capitalizing non-primitive
 types
* Separating the parameter identifier and the description with a dash
* Omitting a dash between the return type and the return description
* Ensuring the parameter type is first and the identifier is second (in
 a few places it was backwards)
* Using square brackets to denote when a parameter is optional, rather
 than putting "(optional)" in the parameter description
* Including a type and identifier with every parameter
* Fixing inconsistent spacing, except where it's used for alignment
* Remove incorrectly formatted `@deprecated` tags that reference non-
 existent properties
* Remove lone comment block without accompanying function

Additionally, one parameter was renamed for clarity.
2020-11-10 14:00:41 -03:30
Mark Stacey
a6cc2d3d7c
Track whether seed phrase has been backed up (#9830)
The `seedPhraseBackedUp` now tracks whether or not the seed phrase has
been backed up. Previously this defaulted to `true`, which left no way
to distinguish whether it had been backed up or not during onboarding.

The default is now `null`, and the UI logic has been updated to account
for this, so that "existing users" (i.e. users that have a backup that
is years old) aren't mistakenly considered to have not backed up their
seed phrase. This value is already set explicitly to `true` or `false`
during onboarding, in both the create and import flow.

This change was made primarily to make it easier to fix the onboarding
library integration, which will be done in a subsequent PR.
2020-11-10 12:34:20 -03:30
Brad Decker
980b140891
track sensitiveProperties in a duplicate event. (#9807) 2020-11-10 09:49:01 -06:00
David Walsh
783d3bacfb
Prevent React prop warning for maxSlippage (#9834) 2020-11-09 17:54:04 -06:00
Dan J Miller
909795571b
Fix tradeValue assignment and reference in view-quote.js (#9837) 2020-11-09 20:06:00 -03:30
Dan J Miller
d094d2c227
Track total, performance and fee savings (and median metamask fee data) in metrics (#9833) 2020-11-09 16:19:41 -03:30
David Walsh
c4fad4b87f
Make QR code button focusable (#9822) 2020-11-09 09:52:06 -06:00
David Walsh
974ba4f691
Simplify the QR code component (#9828) 2020-11-09 09:23:08 -06:00
jimthematrix
e72f943951
Add support for rpcUrl with basic auth when retrieving chainId on net… (#9815) 2020-11-09 11:17:27 -03:30
Mark Stacey
4ef908aeb2
Revert "Remove unnecessary lock page (#9793)" (#9825)
This reverts commit f5265c24ab.

Apparently it wasn't unnecessary after all. The Lock page served a few
different purposes. First, it was used to safeguard the seed phrase, in
case the user was interrupted after setting a password. Otherwise
anyone could open MetaMask and see the seed phrase without verifying
the password. Second, the submit function for the initialization unlock
screen also returned the seed phrase, so that it could be set in React
state for the confirmation step. Third, the submit function was also
responsible for navigating back to the seed phrase reveal page.

Removing the lock page had the effect of causing an infinite render
loop if onboarding was interrupted in the "Create" flow after setting
a password but before seed phrase confirmation. That redirect loop has
now been fixed.
2020-11-09 10:20:24 -03:30
Brad Decker
a49a4a066c
expand transaction constants coverage (#9790)
* expand transaction constants coverage

* touchups

* dont import inside of e2e

* Update app/scripts/controllers/transactions/tx-state-manager.js

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

* Update test/unit/app/controllers/transactions/tx-controller-test.js

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-07 01:38:12 -06:00
Patryk Łucka
f30d261e69
Add custom hd path option (#9367)
* Add custom hd path option

* Update selectPathHelp locale message

Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-11-06 16:17:16 -08:00
Patryk Łucka
128efc5b52
Add sort and search to AddRecipient accounts list (#9257)
* sort and search accounts in AddRecipient component

* Update AddRecipient unit test

Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-11-06 15:16:51 -08:00
Patryk Łucka
ee205b893f
Create custom addHexPrefix function (#9306)
* create custom addHexPrefix function

* switch to custom addHexPrefix

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-11-06 13:18:00 -08:00
Brad Decker
9095ae3f47
add locale to page events (#9802) 2020-11-06 11:17:59 -06:00
Erik Marks
bff982017b
Fix send header cancel button alignment (#9812) 2020-11-05 15:04:01 -08:00
Erik Marks
efd36adaac
Never disable save button if props chain ID is invalid (#9808) 2020-11-05 14:57:11 -08:00
David Walsh
b1b78ff5a5
Don't use concatenized token value for ETH in asset list item (#9809) 2020-11-05 16:16:24 -06:00
Mark Stacey
3dbf5dbf65
Fix lint error (#9806)
A lint error was accidentally introduced recently when two PRs changed
the same area of code (#9793 and #9795). They didn't conflict, and the
lint passed for both, but when combined they left an unused variable.
2020-11-05 17:07:19 -03:30
David Walsh
cfbcc12398
Make all UI tabs accessible via keyboard (#9518) 2020-11-05 12:05:41 -06:00
David Walsh
cce269b632 Lint 2020-11-05 11:09:42 -06:00
Mark Stacey
f5265c24ab
Remove unnecessary lock page (#9793)
This page appears to serve the sole purpose of locking the extension
and redirecting back to the base route if the page is refreshed during
the onboarding flow. This ineffectual before the vault has been
initialized, and it's a barrier to resuming interrupted onboarding
flows when done after initialization.
2020-11-05 13:04:12 -03:30
David Walsh
8a3dabb230 Use optional chaining for functions 2020-11-05 10:28:24 -06:00
Mark Stacey
ad478f8393
Remove unreachable branches from first time flow switch (#9795)
The conditions `isUnlocked` and `!isUnlocked` did account for all
cases, so any branches after that were unreachable.
2020-11-05 12:41:56 -03:30
Mark Stacey
314125e6fd
Remove unused isImportedKeyring prop (#9794)
This prop was being passed to the `CreatePassword` component, but that
component has no prop with this name. In fact, no component in this
entire project does.
2020-11-04 19:56:17 -03:30
Dan J Miller
a0d7c71011
Switch gas price estimation in swaps to metaswap-api /gasPrices (#9599)
Adds swaps-gas-customization-modal and utilize in swaps

Remove swaps specific code from gas-modal-page-container/

Remove slow estimate data from swaps-gas-customization-modal.container

Use average as lower safe price limit in swaps-gas-customization-modal

Lint fix

Fix up unit tests

Update ui/app/ducks/swaps/swaps.js

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

Remove stale properties from gas-modal-page-container.component.js

Replace use of isCustomPrice safe with isCustomSwapsGasPriceSafe, in swaps-gas-customization-modal

Remove use of averageIsSafe in isCustomPriceSafe function

Stop calling resetCustomGasState in swaps

Refactor 'setter' type actions and creators to 'event based', for swaps slice custom gas logic

Replace use of advanced-tab-content.component with advanceGasInputs in swaps gas customization component

Add validation for the gasPrices endpoint

swaps custom gas price should be considered safe if >= to average

Update renderDataSummary unit test

Lint fix

Remove customOnHideOpts for swapsGasCustomizationModal in modal.js

Better handling for swaps gas price loading and failure states

Improve semantics: isCustomSwapsGasPriceSafe renamed to isCustomSwapsGasPriceUnSafe

Mutate state directly in swaps gas slice reducer

Remove unused params

More reliable tracking of speed setting for Gas Fees Changed metrics event

Lint fix

Throw error when fetchSwapsGasPrices response is invalid

add disableSave and customTotalSupplement to swaps-gas-customization container return

Update ui/app/ducks/swaps/swaps.js

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

Improve error handling in fetchMetaSwapsGasPriceEstimates

Remove metricsEvent from swaps-gas-customization-modal context

Base check of gas speed type in swaps-gas-customization-modal on gasEstimateType

Improve naming of variable and functions use to set customPriceIsSafe prop of AdvancedGasInputs in swaps-gas-customization-modal

Simplify sinon spy/stub code in gas-price-button-group-component.test.js

Remove unnecessary getSwapsFallbackGasPrice call in swaps-gas-customization-modal

Remove use of getSwapsTradeTxParams and clean up related gas price logic in swaps

Improve validator of SWAP_GAS_PRICE_VALIDATOR

Ensure default tradeValue
2020-11-04 12:44:08 -03:30
Erik Marks
ad838df3e6
Display decimal chain ID in network form (#9780)
* Display network form chain ID in decimal

* Hide chainId tooltip in view mode

* Display chain ID error message in entered format

* Update locale messages

* Rename on change chain ID validator
2020-11-03 20:10:52 -08:00
Brad Decker
026a06b39d
add shared transaction constants (#9459)
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-11-03 16:57:51 -06:00
David Walsh
5f828b4f41
Make the login screen's Restore and Import links accessible (#9746) 2020-11-03 13:42:47 -06:00
Mark Stacey
107ef3559c
Fix lint errors (#9779)
There were a few lint errors introduced in #9768 due to the recently
merged prettier PR. They have now been fixed.

Additionally, one line using the property `eth_accounts` was
intermittently failing for me locally. I've been seeing this lint
failure off-and-on for a few days now - I'm not sure why I haven't seen
it on CI. Either way though, it's now ignored.
2020-11-03 16:05:41 -03:30
Thomas Huang
f4bb199f90
Shorten unit input with and overflow and ellipsis it. (#9778) 2020-11-03 11:06:37 -08:00
David Walsh
51fc06cf06
Autofocus input, improve accessibility of restore page (#9748) 2020-11-03 12:40:12 -06:00
Brad Decker
2ebf8756a4
[RFC] add prettier to eslint (#8595) 2020-11-02 17:41:28 -06:00
Erik Marks
1a164cd3e4
Add confirmation for network dropdown delete action (#9763) 2020-10-30 12:22:21 -07:00
Erik Marks
ca7df8de0f
Update custom RPC network dropdown icons (#9764)
* Update custom RPC network dropdown icons

* Fix failing unit test
2020-10-30 12:22:04 -07:00
David Walsh
907e8d6a77
Remove border radius from transfer button (#9767) 2020-10-30 13:38:58 -05:00
David Walsh
a74aa45bdd
Use 1px borders on inputs and buttons (#9766) 2020-10-30 13:31:42 -05:00
David Walsh
77dc0ab008
Make swap arrows accessible, make swaps advanced options accessible (#9750) 2020-10-30 09:35:47 -05:00
Erik Marks
ab8083284b
Merge branch 'develop' into standardize-network-settings 2020-10-29 10:02:19 -07:00
Brad Decker
14161e37da
normalize page font styles (#9697) 2020-10-29 11:31:48 -05:00
Brad Decker
50728ed9ef
normalize deprecated itcss font styles (#9696) 2020-10-29 10:03:45 -05:00
Brad Decker
fe69182056
normalize app component font styles (#9695) 2020-10-29 10:03:29 -05:00
Brad Decker
186ee97d36
normalize UI component font styles (#9694) 2020-10-29 09:30:38 -05:00
Erik Marks
59a38a253f Remove unnecessary optional chaining 2020-10-28 23:34:40 -07:00
Erik Marks
2393749809 Simplify routing to fix breakage in popup 2020-10-28 23:34:40 -07:00
Erik Marks
58d19745c9 Add explanatory comment 2020-10-28 23:34:40 -07:00
Erik Marks
47d94489b7 Finish network settings redesign 2020-10-28 23:34:40 -07:00
Erik Marks
8d3091040c Fix network dropdown custom rpc link 2020-10-28 23:34:40 -07:00
Erik Marks
c3df1aab8d Style touchups 2020-10-28 23:34:40 -07:00
Erik Marks
64883aecb0 Improve fullscreen network form appearance 2020-10-28 23:34:40 -07:00
Erik Marks
4a219d9a10 Fix network name overflow 2020-10-28 23:34:40 -07:00
Erik Marks
4ad5e027be Fix network list arrow styling 2020-10-28 23:34:40 -07:00
Erik Marks
1373a90e27 Hide network form buttons when form is viewOnly 2020-10-28 23:34:40 -07:00
Erik Marks
8a1820c537 Add networks settings routes 2020-10-28 23:34:40 -07:00
Erik Marks
27118fdd98 Fix popup network form appearance; code style 2020-10-28 23:34:40 -07:00
Erik Marks
5530914776 Standardize appearance of network settings 2020-10-28 23:34:40 -07:00
David Walsh
220a82b53f
Fix 9435 - Allow speeding up of underpriced transactions (#9687) 2020-10-28 16:56:58 -05:00
David Walsh
336282d7d5
Focus on wallet address in buy workflow (#9715) 2020-10-28 11:34:06 -05:00
Brad Decker
96717cc9e0
expose variables for typography sizes (#9693)
This will allow usage in areas where getting the line-height, etc
of the typography settings will introduce issues. The mixins have been
updated to references these variables so that they can be changed in
one place in the future
2020-10-28 09:03:38 -05:00
David Walsh
5b67cf1009
Prevent React warning for custom slippage (#9706) 2020-10-28 08:58:31 -05:00
Thomas Huang
0494f72128
Check if swapTokenValue is negative and set prefix accordingly (#9743)
* Check if swapTokenValue is negative and set prefix accordingly

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-28 00:08:02 -07:00
Dan J Miller
557f9550d7
Use better value for average savings analytics (#9733) 2020-10-27 16:42:06 -02:30
Dan J Miller
a4f817e171
Include trade.value in calculation of displayed network fees (#9621)
* Ensure that trade.value fees are included in displayed network fees

* Remove unused getTotalEthCost function

* Remove unused getTotalEthCost function

* Update ui/app/pages/swaps/swaps.util.js

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

* Lint fix

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-27 16:32:21 -02:30
David Walsh
61e48b4a84
Switch to DIV for swaps dropdown accessibility (#9732) 2020-10-27 12:20:35 -05:00
Mark Stacey
d6d02053ff
Log when attempt to fetch quotes fails (#9723)
If the attempt to fetch quotes fails, an error message is now logged to
the console explaining why it failed. This makes it dramatically easier
to understand what's happening when quotes fail.

At some point later on we should also look specifically for errors we
expect to occur, and report to Sentry in unexpected cases. I've added a
TODO comment about this.
2020-10-26 19:52:46 -02:30
Brad Decker
7d50357684
remove matomo and route to segment (#9646) 2020-10-26 14:05:57 -05:00