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

4193 Commits

Author SHA1 Message Date
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
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