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

3253 Commits

Author SHA1 Message Date
Mark Stacey
5a8e8c61ea
Reject connection request on window close (#7401)
This was first implemented in #7335, but the final version didn't work
because the `_beforeUnload` handler was not bound early, so `this` was
not defined when it was triggered.
2019-11-13 11:03:11 -04:00
Dan J Miller
6acd5cec37
Get prop for signed typed data from domain instead of message (#7402) 2019-11-13 09:11:21 -05:00
Thomas Huang
069a24c1b9 Revert "Adds Wyre Widget (#6434)" (#7385)
This reverts commit 6a4df0dc3f.
2019-11-11 16:18:57 -05:00
ricky
78224601b9 Fix grid-template-columns (#7366)
* Fix grid-template-columns

* Add fullscreen check
2019-11-10 21:17:00 -05:00
Mark Stacey
42279c474b
Set default advanced tab gas limit (#7379)
* Set default advanced tab gas limit

The advanced tab of the transaction confirmation screen would enter
into an infinite loop and crash if the given gas price was falsy and
some interaction was made with the gas limit field.

To prevent this infinite loop, a default value of 0 has been set. The
user will still need to update the gas limit in order to confirm the
transaction, as zero is too low a gas limit (the lowest is 21000).
21000 cannot be the default gas limit at this layer, because the limit
used is from a layer above this, which wouldn't have that same 21000
set.

* Set default gas limit to minimum allowed

A transaction initiated from a dapp might not set a gas limit, which
would result in a default of zero being used in the advanced tab. The
default gas limit in that case has been changed to 21,000, the minimum
allowed gas limit, so that users aren't forced to manually update it.
2019-11-10 21:15:38 -05:00
Mark Stacey
a8175eb799
Fix advanced tab gas chart (#7380)
The gas chart on the advanced tab was not converting the gas price
selected into hex before setting it in state, resulting in the UI
throwing errors and the price being set incorrectly. It now converts
in the same manner as the input fields.
2019-11-10 21:14:53 -05:00
matteopey
efe240195b Hide accounts dropdown scrollbars on Firefox (#7374) 2019-11-10 02:43:36 -05:00
Mark Stacey
ec1f3fa19a
Fix threebox last updated proptype (#7375)
* Use child components for multiple notifications component

The multiple notifications component has been updated to take its child
components as children rather than as a props array, so that the child
components are never executed in the case where they aren't needed.

* Fix threebox last updated proptype
2019-11-10 01:30:07 -05:00
ricky
02aebc2e03
Add onbeforeunload and have it call onCancel (#7335)
* Add onbeforeunload and have it call onCancel

* Address PR feedback

* Get integration tests passing again

* Add underscores

* Add ENVIRONMENT_TYPE_NOTIFICATION check

* Add _beforeUnload + metricsEvent
2019-11-06 12:04:44 -05:00
hjlee9182
9ed01dff7a fix account menu width (#7354) 2019-11-05 11:31:28 -04:00
Dan J Miller
2673eef3c4
Redesign approve screen (#7271)
* Redesign approve screen

* Add translations to approve screen components

* Show account in header of approve screen

* Use state prop bool for unlimited vs custom check in edit-approval-permission

* Set option to custom on input change in edit-approval-permission

* Allow setting of approval amount to unlimited in edit-approval-permission

* Fix height of confirm-approval popup

* Ensure decimals prop passted to confirm-approve.component is correct type

* Ensure first param passed to calcTokenValue in confirm-approve.util is the correct type

* Fix e2e test of permission editing

* Remove unused code from edit-approval-permission.container
2019-11-05 11:43:48 -03:30
Mark Stacey
99b8f2d544
Fix provider approval metadata (#7349)
* Omit MetaMask `extensionId` from site metadata

The site metadata was updated in #7218 to include the extension id of
the extension connecting to MetaMask. This was done to allow external
extensions to connect with MetaMask, so that we could show the id on
the provider approval screen.

Unbeknownst to me at the time, the extension id was being set for all
connections to MetaMask from dapps. The id was set to MetaMask's id,
because the connections are made through MetaMask's contentscript.

This has been updated to only set the id when accepting a connection
from a different extension.

* Fix `siteMetadata` property names

In #7218 a few things were added to the site metadata, so the provider
approval controller was middleware was updated to accept the site
metadata as an object rather than accepting each property as a separate
parameter. Unfortunately we failed to notice that the site name and
icon were named differently in the site metadata than they were in the
provider approval controller, so the names of those properties were
unintentionally changed in the controller state.

The provider approval controller has been updated to restore the
original property names of `siteTitle` and `siteIcon`. An unused prop
that was added to the provider approval page in #7218 has also been
removed.
2019-11-04 17:28:50 -04:00
hjlee9182
eef570cf95 fix width in first time flow button (#7348) 2019-11-04 15:08:17 -04:00
Mark Stacey
dbd14d796c
Clear beforeunload handler after button is pressed (#7346)
On the signature request and transaction confirmation notification
pages, the closure of the notification UI implies that the request has
been rejected. However, this rejection is being submitted even when the
window is closed as a result of the user explicitly confirming or
rejecting. In practice, I suspect this has no effect because the
transaction, after being explicitly confirmed or rejected, has already
been moved out of a pending state. But just in case there is some
present or future edge case that might be affected, the `beforeunload`
handler is now removed once the user has explicitly made a choice.

This mistake was introduced recently in #7333
2019-11-04 14:03:57 -04:00
Dan J Miller
6a4df0dc3f
Adds Wyre Widget (#6434)
* Adds Wyre widget to the deposit modal.

* Move wyre widget code to vendor directory

* Get Wyre widget working without metamask connect/sign steps

* Code cleanup for wyre changes

* Change wyre widget to using prod environment

* Remove code allowing signing of wyre messages without confirmations

* Update wyre vendor code for wyre 2.0

* Remove unnecessary changes to provider approval constructor, triggerUI and openPopup

* Fix Wyre translation message

* Delete no longer used signature-request-modal

* Fix documentation of matches function in utils/util.js

* Code cleanup on wyre branch

* Remove front end code changes not needed to support wyre v2
2019-11-04 11:13:24 -03:30
Terry Smith
57a29668f3 New signature request v3 UI (#6891)
* Refactoring signature-request out to a new component. Wip

* Styling polish and a better message display.

* Update signature request header to no longer use account dropdown mini

* Clean up code and styles

* Code cleanup for signature request redesign branch

* Fix signature request design for full screen

* Replace makenode with object.entries in signature-request-message.component.js

* Remove unused accounts prop from signature-request.component.js

* Use beforeunload  instead of window.onbeforeunload in signature-request
2019-11-04 09:10:46 -03:30
Whymarrh Whitby
eed4a9ed65
ENS Reverse Resolution support (#7177)
* ENS Reverse Resolution support
* Save punycode for ENS domains with Unicode characters
* Update SenderToRecipient recipientEns tooltip
* Use cached results when reverse-resolving ENS names
* Display ENS names in tx activity log
2019-11-01 15:24:00 -02:30
Kristian Tapia
f9cd775eae Add Estimated time to pending tx (#6924)
* Add estimated time to pending transactions

* add sytles for pending transactions component

* add media queries styling for pending transactions component

* fix lint errors, remove extra spaces

* refactor code to call `fetchBasicGasAndTimeEstimates` method once

* refactor code to call `getgetRenderableTimeEstimate` method once

* fix, correct export to use `transaction-time-remaining-component`

* fix indentation issues after running `yarn lint`

* newBigSigDig in gas-price-chart.utils supports strings

* Code cleanup

* Ensure fetchBasicGasAndTimeEstimates is only called from tx-list if there are pending-txs

* Move gas time estimate utilities into utility file

* Move getTxParams to transaction selector file

* Add feature flag for display of remaining transaction time in tx history list

* Fix circular dependency by removing unused import of transactionSelector in selectors.js

* Use correct feature flag property name transactionTime

* Ensure that tx list component correctly responds to turning tx time feature on

* Prevent precision errors in newBigSigDig

* Code clean up for pending transaction times

* Update transaction-time-remaining feature to count down seconds, countdown seconds and show '< 30'

* Code clean up for transaction-time-remaining feature
2019-10-31 23:21:28 -02:30
Mark Stacey
fe28e0d134
Cleanup beforeunload handler after transaction is resolved (#7333)
* Cleanup beforeunload handler after transaction is resolved

The notification window was updated to reject transactions upon close
in #6340. A handler that rejects the transaction was added to
`window.onbeforeunload`, and it was cleared in `actions.js` if it was
confirmed or rejected.

However, the `onbeforeunload` handler remained uncleared if the
transaction was resolved in another window. This results in the
transaction being rejected when the notification window closes, even
long after the transaction is submitted and confirmed. This has been
the cause of many problems with the Firefox e2e tests.

Instead the `onbeforeunload` handler is cleared in the
`componentWillUnmount` lifecycle function, alongside where it's set in
the first place. This ensures that it's correctly unset regardless
of how the transaction was resolved, and it better matches user
expectations.

* Fix indentation and remove redundant export

The `run-all.sh` Bash script now uses consistent indentation, and is
consistent about only re-exporting the Ganache arguments when they
change.

* Ensure transactions are completed before checking balance

Various intermittent e2e test failures appear to be caused by React
re-rendering the transaction list during the test, as the transaction
goes from pending to confirmed. To avoid this race condition, the
transaction is now explicitly looked for in the confirmed transaction
list in each of the tests using this pattern.

* Enable all e2e tests on Firefox

The remaining tests that were disabled on Firefox now work correctly.
Only a few timing adjustments were needed.

* Update Firefox used in CI

Firefox v70 is now used on CI instead of v68. This necessitated
rewriting the function where the extension ID was obtained because the
Firefox extensions page was redesigned.
2019-10-31 13:27:22 -03:00
Mark Stacey
ab0eae1ed3
Rename ConfirmPageContainerHeader class (#7322)
The class has been renamed to reflect that it is a header, to avoid
having the same name as the `ConfirmPageContainer` component. Multiple
components with the same name can lead to confusing error messages.
2019-10-30 16:18:57 -03:00
Thomas
9d793015d3 Add static defaultProps 2019-10-29 17:55:10 -07:00
Thomas
d90b3feab8 Add back placeholder addAlias for nickname 2019-10-29 16:42:56 -07:00
Thomas
cbd1d47559 Allow removing of contact details to change details. 2019-10-29 16:21:18 -07:00
Thomas
df8b825a67 Adjust copy-to-clipboard svg width and height on edit contact screen 2019-10-29 16:14:18 -07:00
Thomas
9285a10be6 Adds the chainId to remove accounts from state 2019-10-29 10:53:51 -07:00
Mark Stacey
8dfb0e8154
Add hostname and extensionId to site metadata (#7218)
If the extension ID is set, an alternate title and subtitle are used
for the Connect Request screen. The title is always `External
Extension`, and the subtitle is `Extension ID: [id]` instead of the
origin (which would just be `[extension-scheme]://[id]` anyway).

The hostname for the site is used as a fallback in case it has no
title.

The artificial hostname set for internal connections has been renamed
from 'MetaMask' to 'metamask' because URL objects automatically
normalize hostnames to be all lower-case, and it was more convenient to
use a URL object so that the parameter would be the same type as used
for an untrusted connection.
2019-10-29 13:14:41 -03:00
ricky
7181779576
Refactor new-account.js (#7312)
* Start refactor

* Use import syntax

* Add create-account.component

* Continue refactor

* Add new line

* Start using JSX and make tabs a bit more DRY

* 👋 bye-bye hyperscript

* These can be disabled when active

* Start JSX in new account component

* 👋 bye-bye hyperscript

* Move newAccountNumber into container

* Validate newAccountNumber prop
2019-10-29 12:12:41 -04:00
Dan J Miller
b89d96e61a
Specify row height in grid template of transaction list items to fix status spacing issue (#7319) 2019-10-28 20:48:33 -02:30
ricky
af888d0ab2 Add "Retry" option for failed transactions (#7296)
* Begin mocking out retry ui

* Remove "Failed"

* I guess this works?

* Update corresponding test

* wip

* Ok, this appears to be working now

* cleanup

* Move this back to 3

* I don't think I need this

* Rename showRetry to showSpeedUp

* Address PR feedback

* Remove notes

* Rename shouldShowRetry -> shouldShowSpeedUp

* oops
2019-10-28 10:58:46 -02:30
Mark Stacey
ba25d52670
Use AdvancedGasInputs in AdvancedTabContent (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`

The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.

The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.

Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.

The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.

Closes #6872

* Cleanup send components

Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
2019-10-23 09:23:15 -03:00
Dan J Miller
55bc9936c6 Turn off full screen vs popup a/b test (#7298) 2019-10-21 20:59:02 -03:00
Dan J Miller
994a8a3167
Add metrics events for clicking and saving tx speed ups (#7275) 2019-10-21 14:23:26 -02:30
Thomas Huang
a646bfb506 Lessen the length of ENS validation to 3 (#7285) 2019-10-17 13:03:14 -03:00
Thomas Huang
9d9f3685bb Prevent Logout Timer that's longer than a week. (#7253) 2019-10-17 12:25:37 -03:00
Mark O'Sullivan
ee913edf9f fix issue of xyz ens not resolving (#7266) 2019-10-09 09:30:48 -03:00
Dan J Miller
1a0b0ce7c7 Fix e2e tests and gas default (#7267)
* Add extra delay after second send3eth.click() in the 'adds multiple transactions' test

* Remove use of ARBITRARY_HIGH_BLOCK_GAS_LIMIT as fallback
2019-10-08 14:14:20 -03:00
Dan J Miller
38df64783d Ensure correct tx category when sending to contracts without tx data (#7252)
* Ensure correct transaction category when sending to contracts but there is no txParams data

* Update gas when pasting address in send

* Gracefully fall back is send.util/estimateGas when blockGasLimit from background is falsy

* Remove network request frontend fallback for blockGasLimit

* Add some needed slow downs to e2e tests
2019-10-08 04:29:37 +09:00
Thomas Huang
d7a4dfebeb
Merge pull request #7260 from MetaMask/notranslate-seed-phrases
Do not transate on seed phrases
2019-10-07 11:08:22 -07:00
ryanml
3383eabc9d Use translated string for state log (#7255) 2019-10-07 14:54:44 -03:00
Thomas
aa95e5a4c8 Do not transate on seed phrases 2019-10-07 10:45:12 -07:00
Mark Stacey
8b5ac9340b Fix custom nonce placeholder type (#7243)
The placeholder for the custom nonce needed to be converted into a
string. The placeholder is omitted if `nextNonce` isn't set, as may be
the case for the initial render.
2019-10-02 18:12:52 -02:30
Dan J Miller
e6e8897434
Custom nonce fixes (#7240)
* Allow default nextNonce to be the custom nonce in cases where highest locally pending is higher than nextNonce

* Reset custom nonce in cases of transaction submission failures

* Make the recommended nonce in the custom nonce field the true 'nextNonce'

* Revert automatic setting of custom nonce to nextNonce

* Make the nextNonce the default placeholder value

* Fix getNextNonce

* Remove unused nonceFieldPlaceholder message

* Fix nits in getPendingNonce and getNextNonce

* Properly handle errors in getNextNonce

* Improve placeholder and value defaults in custom nonce field

* Remove custom error message from getNextNonce
2019-10-02 15:42:04 -02:30
Thomas Huang
45a8fdebf7 Update ETH logo, update deposit Ether logo height and width (#7239) 2019-10-02 10:15:44 -06:00
Thomas Huang
b69982da84 Remove logging of action.value of set_next_nonce (#7233) 2019-09-30 19:17:45 -03:00
ricky
5f254f7325 Add advanced setting to enable editing nonce on confirmation screens (#7089)
* Add UseNonce toggle

* Get the toggle actually working and dispatching

* Display nonce field on confirmation page

* Remove console.log

* Add placeholder

* Set customNonceValue

* Add nonce key/value to txParams

* remove customNonceValue from component state

* Use translation file and existing CSS class

* Use existing TextField component

* Remove console.log

* Fix lint nits

* Okay this sorta works?

* Move nonce toggle to advanced tab

* Set min to 0

* Wrap value in Number()

* Add customNonceMap

* Update custom nonce translation

* Update styles

* Reset CustomNonce

* Fix lint

* Get tests passing

* Add customNonceValue to defaults

* Fix test

* Fix comments

* Update tests

* Use camel case

* Ensure custom nonce can only be whole number

* Correct font size for custom nonce input

* UX improvements for custom nonce feature

* Fix advanced-tab-component tests for custom nonce changes

* Update title of nonce toggle in settings

* Remove unused locale message

* Cast custom nonce to string in confirm-transaction-base.component

* Handle string conversion and invalid values for custom nonces in handler

* Don't call getNonceLock in tx controller if there is a custom nonce

* Set nonce details for cases where nonce is customized

* Fix incorrectly use value for deciding whether to getnoncelock in approveTransaction

* Default nonceLock to empty object in approveTransaction

* Reapply use on nonceLock in cases where customNonceValue in approveTransaction.

* Show warning message if custom nonce is higher than MetaMask's next nonce

* Fix e2e test failure caused by custom nonce and 3box toggle conflict

* Update nonce warning message to include the suggested nonce

* Handle nextNonce comparison and update logic in lifecycle

* Default nonce field to suggested nonce

* Clear custom nonce on reject or confirm

* Fix bug where nonces are not shown in tx list on self sent transactions

* Ensure custom nonce is reset after tx is created in background

* Convert customNonceValue to number in approve tranasction controller

* Lint fix

* Call getNextNonce after updating custom nonce
2019-09-27 00:30:36 -04:00
Dan J Miller
970e90ea70
Add migration on 3box imports and remove feature flag (#7209)
* Delete unused code

* Run threebox imports through migrations

* Remove 3box feature flag

* Remove unnecessary use of 'type' in threebox._updatePlugin

* Fix threebox controller getLastUpdated

* Turn off threebox by default

* Rename restoredFromThreeBox to showRestorePrompt

* Remove accientally added method from threebox controller

* Restore from threebox on import from unlock screen

* Throw on non 404 errors from Box.getconfig in new3Box
2019-09-26 03:24:52 -04:00
Dan J Miller
1bd22b58c0
Add a/b test for full screen transaction confirmations (#7162)
* Adds ab test controller with a fullScreenVsPopup test

* Add migration for fullScreenVsPopup state

* Move abtest state under an 'abtests' object.

* MetaMask shows fullScreen group of a/b test unapproved txs in a full browser tab

* Ensure cancel metrics event in confirm-transaction-base.component.js is sent in all cases

* Switch to existing tab for unapproved tx if it exists when opening in full screen

* Send metrics event for entering a/b test from confirm screen

* Fix lint, unit and integration tests related to a/b test code

* Remove unnecessary tabs.query call in triggerUiInNewTab
2019-09-24 17:08:38 -04:00
Jenny Pollack
e86cebde3b address book entries by chainId (#7205) 2019-09-21 14:36:05 -03:00
Mark Stacey
f100d753cf
Report missing en locale messages to Sentry (#7197)
Any missing messages in the `en` locale are now reported to Sentry as
errors. They are printed to the console as an error upon the first
encounter as well.

If a missing message is found during e2e testing, the error is thrown.
This will likely break the e2e test even if it isn't looking for
console errors, as the UI with the missing message will fail to render.

The `tOrDefault` method was updated to no longer attempt looking for
messages with a key that is a falsey value (e.g. `undefined`). There
are a few places where they key is determined dynamically, where it's
expected during the normal flow for it to be `undefined` sometimes.
In these cases we don't want the error to be thrown.
2019-09-21 13:31:45 -03:00
Mark Stacey
48bf2f8731
Remove unused locale messages (#7190)
* Switch to using string literals for locale keys

Various message keys were being specified with a string template
instead of a string literal. They have been switched to use string
literals so that the script for detecting unused messages can find
them.

* Remove unused locale messages

A number of unused locale messages have been removed - probably
leftover from old UI elements that have since been removed.

The `verify_locale_strings` script has been augmented to search the UI
for string literals, and match those against the locale message keys in
the `en` locale. Any messages without a corresponding string literal
are assumed to be unused.

The script has also been updated with an optional `--fix` parameter,
which will automatically delete any unused messages from locales.

148 unused messages were found in this case, out of a total of about
650 messages. Another 70 messages are _potentially_ unused and require
further investigation, but weren't as easy to rule out because they
were found in string literals.

* Remove additional unused locale messages

The following messages were more difficult to rule out because they
were present as string literals in the UI. They do appear to be
unused as locale keys though.
2019-09-18 20:29:46 -03:00
Mark Stacey
624139a00f
Remove unused components (#7191)
* Remove unused sendWarnings

The send warnings state and associated component is no longer used
anywhere.

* Remove unused subtitleParams

The `subtitleParams` SendHeader prop was being ignored. It has been
removed, along with associated selectors and tests.
2019-09-18 18:41:36 -03:00
Sunghee Lee
87ac07bb35 Refactor validation function (#7187)
* Update invalidBlockExplorerURL message

* Refactor validation function
2019-09-18 10:57:18 -03:00
Mark Stacey
638149d861
Remove unused modals (#7184)
These modals were no longer referenced anywhere.
2019-09-18 10:09:41 -03:00
Mark Stacey
8a08b320e5
Remove unused customize-gas modal (#7185)
This modal hasn't been used since #5704, where it was replaced.
2019-09-18 10:09:32 -03:00
Dan J Miller
5641f1be29
Fix recipient field of approve screen (#7171) 2019-09-16 17:05:21 -02:30
Dan J Miller
7985f4f4f8
3box integration 2.0 (#6972)
* Adds threebox controller

* Adds threebox approval modal

* Fix unit tests and lint after addition of threebox

* Correct threebox behaviour after rejecting request for backup; fixes e2e tests.

* Update threebox controller for automatic syncing

* Ensure frontend locale updates when preferences are changed via direct update within controller

* Add toggle in settings for 3box syncing

* Update threebox controller for latest 3box version

* Delete unnecessary frontend changes for threebox integration

* Backing up address book contacts with threebox

* Update unit tests for 3box-integration additions

* Only enable threebox by default for new wallets

* Mock globals for correct unit tests

* 3box '1.10.2' -> '^1.10.2'

* Correct capilalization on 3Box

* Use log.debug instead of console.log in threebox controller

* Update yarn.lock

* Remove edge build

* Split 3box module into background deps js file

* extra bundle opts for bg-libs

* sync yarn.lock

* new3Box logic

* Show confirm threebox restore after import

* Remove bg-libs.js from manifest file for dev builds

* Switch 3Box controller to using the spaces api (instead of the profile api)

* Finalize switching to spaces api and only restoring from 3box after import

* Update metamask-controller-test.js for threebox controller changes

* Make threebox modal style consistent with others and update success button wording

* Use mock 3box when in test

* Correct 3box modal header

* Remove unnecessary property of threebox controller provider

* Remove unnecessary method calls after restoration from 3box in the threebox-restore-confirm modal.

* Replace setThreeBoxSyncingPermission calls in routes/index.js with turnThreeBoxSyncingOn

* Replace erroneous use of  with

* Replace erroneous use of threeboxSyncing with threeBoxSyncingAllowed in advancted-tab directory

* Lint fixes for 3box changes

* Log errors encountered when updating 3Box

* Remove unnecessary parameter from state update

* Add timeout to initial 3Box sync

The initial 3Box sync will now timeout after 1 minute. If the timeout
is triggered, 3Box is disabled and cannot be re-enabled unless the
initial sync does finally finish. If it never finishes, 3Box cannot
be enabled unless the extension is reinstalled.

The Advanced Settings page was updated to show this option as disabled
in that circumstance, with a new discription explaining why it's
disabled. The UI here could certainly be improved.

Additionally, "on" and "off" labels were added to the toggle to match
the other toggles on the Advanced Settings page.

* Use non-minified 3Box module

We had previously used the minified 3Box module to avoid a build error
encountered when `envify` was processing the `libp2p` module (which is
used by 3Box). The build would fail because `esprima` (used by `envify`)
is incompatible with the object spread/rest operator (which is used in
`libp2p`).

That issue has been solved by adding a global Babelify transformation
specifically for transpiling out the object rest/spread operator from
dependencies. It has been targetted to only affect `libp2p` to avoid
extending the build time too much. This workaround can be used until
a new version of `esprima` is released that includes this bug fix.

* Use app key addresses for threebox

* Replace use of modal for confirming 3box restoration with a home notification

* Adds e2e tests for restoring from threebox

* Update eth-keyring-controller to 5.1.0

* Correct parameters passed to getAppKeyAddress in threebox.js

* Add prefix to origin passed to getAppKeyAddress in threebox.js

* Remove unused locale message.

* Prevent CORS errors in firefox e2e tests

* Ensure extraneous scripts are excluded from the local test dev build

* Move threeBoxLastUpdate state from home.component to redux

* Threebox PR code cleanup

* Always use first address when initializing threebox

* Replace setRestoredFromThreeBox api with setRestoredFromThreeBoxToFalse and setRestoredFromThreeBoxToTrue

* Update development/metamaskbot-build-announce.js to include ui-libs and bg-libs in hard coded bundle list

* Update test/e2e/threebox.spec.js to use new helpers added with pull #7144

* Make setFeatureFlag available on the ui window during testing

* Hide threebox feature behind a feature flag that can only be activated via dev console

* Remove unnecessary migration of threebox feature flag

* Prevent this.init() call in threebox constructor if feature flag is not turned on

* Prevent threebox notification from showing if feature flag is falsy

* http://localhost/8889 -> http://localhost/* in gulp manifest:testing tasks
2019-09-16 14:41:01 -02:30
Erik Marks
38f6550951 fix rinkeby spelling (#7148) 2019-09-10 12:51:34 -10:00
Sunghee Lee
869c83fd2c Fix network-form block explorer URL validation (#7137) 2019-09-09 23:51:05 -03:00
Mark Stacey
0ffee10f19
Prevent invalid inline speed-ups (#7085)
Speeding up anything but the pending transaction with the lowest nonce
is ineffectual, as the transaction with the lowest nonce blocks the
others from completing first. The inline speed-up button in the
transaction activity log has been removed for these invalid cases.

The button will show up in the activity log for the pending transaction
with the lowest nonce, but not for the others.

Closes #6844
2019-09-09 16:59:00 -03:00
Mark Stacey
5363d6aa2a
Prevent multiple warnings for the same locale message (#7091)
* Prevent multiple warnings for the same locale message

Our i18n helper issues warnings whenever a requested message is
missing. These warnings are helpful in assisting translation efforts,
but they can be distracting otherwise. They're especially problematic
for locales that are missing many messages. My browser ended up
crashing on more than one occasion due to the sheer volume of warnings.

The warning has been updated to only be issued once per missing key.
This required updating the method to pass in the current locale. The
current locale was added to the warning itself as well, which could be
helpful for cases where a message is missing in both the current locale
and the fallback ('en').

* Change locale and localeMessages as single action

Updating the current locale and the locale messages resulted in two
renders, and during the first the state was inconsistent (it would say
the locale had changed to the new one, but still be using the old set
of locale messages). Instead the locale is now updated with one atomic
action.

This was required after adding the locale to the missing locale message
warning, as otherwise it would say the message was missing from the
wrong locale.
2019-09-06 10:47:07 -03:00
Mark Stacey
1e7b37d1cc
Combine fetch-with-timeout implementations (#7084)
There were two competing utility functions for calling fetch with a
timeout. They have been combined into one.
2019-09-04 17:00:11 -03:00
Mark Stacey
3e9d247d4b
Fix fetch-with-cache (#7083)
The `fetch-with-cache` utility was failing to actually cache anything.
It would cache an object with cache time and URL, and would return that
instead of a valid response. This resulted in the error:
`TypeError: fourByteResponse.json is not a function`

The utility was updated to call `.json()` within itself, and cache the
JSON response. The function signature was updated as well, to expect an
options object instead of just the `cacheRefreshTime` option. The
timeout was added to this options object, which helped with testing.

The utility method now also handles unsuccessfull responses, and
incompatible `fetch` options.
2019-09-04 16:10:23 -03:00
Nick Doiron
d589d2dec0 Right-to-left CSS (using module for conversion) (#7072)
* Create RTL stylesheets using `gulp-rtl`

* Handle RTL stylesheet special cases

Certain blocks of Sass  were set to bypass "rtlcss" using ignore
comments. Certain icons had to be flipped 180 degrees.

* Switch stylesheets when locale changes

A second stylesheet has been added to each HTML page for use with
right-to-left locales. It is disabled by default. It is enabled on
startup if a RTL locale is set, and when switching to a RTL locale.
Similarly the LTR stylesheet is disabled when a RTL locale is used.

Unfortunately there is an unpleasant flash of unstyled content when
switching between a LTR and a RTL locale. There is also a slightly
longer page load time when using a RTL locale (<1s difference). We
couldn't think of an easy way to avoid these problems.

* Set `dir="auto"` as default on `TextFields`
2019-09-03 14:47:54 -03:00
Mark Stacey
3a4b3f5510 Add dismiss button to privacy mode notification 2019-09-01 20:05:33 -03:00
Mark Stacey
bbbf68c8df Allow dismissing the privacy mode notification
The privacy mode notification was not able to be dismissed from the
popup UI. It should have been dismissed after clicking "Learn more",
but that button opens a new tab first before dismissing the flag.
Opening the new tab kills the pop UI process before it has a chance
to set that flag, so it never gets set.

Re-ordering the handler to set the flag first avoids this problem.
2019-09-01 19:59:12 -03:00
Mark Stacey
daa20b4b63
Return after rejecting promise in action (#7079)
* Add missing test descriptions

* Fix async tests that expect a rejection

These tests expected the function under test to return a rejected
promise, and had assertions to be run in the `catch` clause. However,
the tests would still pass if the function didn't reject, with
the assertions never being run.

The tests have been updated to fail if the function doesn't throw.

* Handle ignored promise rejection

In the case where `forceUpdateMetamaskState` rejects, the function
`setSeedPhraseBackedUp` would never resolve. It has been updated to
pass along the rejection instead.

* Return after rejecting promise in action

A few actions would continue after encountering an error, resulting in
errors being compounded. Instead all actions will now return after
encountering an error (which it looks like was the intention in these
cases anyway).
2019-08-31 13:34:27 -03:00
Mark Stacey
0f1edce403
Fix BigNumber conversion error (#7088)
In the case where the block gas limit in the MetaMask state is blank,
an exception is sometimes thrown when that blank value is passed to
`multiplyCurrencies` to be parsed as a hex number.

Instead the minimum gas limit is now used instead whenever the block
gas limit is falsy. This was already being done in one case anyway.
2019-08-31 13:29:31 -03:00
Mark Stacey
87cf0ced13
Fix confirm token transaction amount display (#7081)
The token amount displayed when confirming a token transaction was
wrongly being converted to a string in the container. As a result, the
conversion into the user's preferred currency would fail.

A default value of '0' was added for the token amount as well, to
prevent `undefined` from being rendered as the value. Really the value
should never be undefined, but it was rather difficult to handle that
case without a deeper investigation into how it might occur. The 0
default is consistent with existing rendering logic.
2019-08-31 13:26:49 -03:00
ricky
887b2572f5 Add breadcrumb spacing on Contacts page (#7087) 2019-08-31 13:01:53 -03:00
Thomas
302c815309 Get and set average gas price button estimation as default 2019-08-26 10:30:39 -07:00
Erik Marks
2306dbd75e Fix undefined tx id error (#7053)
Also delete unused function
2019-08-26 09:04:48 -03:00
Dan Finlay
fe2d053435
Merge pull request #7059 from MetaMask/Gas-Estimation-Api
Remove blockscale, replace with ethgasstation
2019-08-22 15:23:22 -07:00
Thomas
f9bdc80436 Remove blockscale, replace with ethgasstation 2019-08-22 07:04:52 -07:00
Whymarrh Whitby
ecbde20949
Remove ComputedbalancesController (#7057) 2019-08-22 10:26:43 -02:30
Whymarrh Whitby
35c29c732d
Right align "Total" line items in tx detail view (#7050) 2019-08-21 17:46:18 -02:30
Whymarrh Whitby
ef3859ff77
Add toggle for incoming transactions (#7049) 2019-08-21 16:12:14 -02:30
Whymarrh Whitby
e0e06709d3
Fix indentation of div.request-signature__rows code (#7045) 2019-08-21 09:12:08 -02:30
Brendan Chou
cc71b4f52b Add support for eth_signTypedData_v4 (#6930) 2019-08-20 17:22:59 -02:30
Whymarrh Whitby
e47448362d
Bug fixes for incoming transactions (#7043)
* Fix styling of `.transaction-list`
* Filter `incomingTxListSelector` by network as well
* Start and stop block tracker polling in incoming tx controller
* Add fetch with abort in bg for `IncomingTxController`
2019-08-20 16:22:00 -02:30
Dan J Miller
821529622e Fetch & display received transactions (#6996) 2019-08-16 16:24:10 -02:30
Whymarrh Whitby
247659ca65
Connections settings tab (#7013)
* Nix notification for Share Address

* Add Connections settings tab in place of privacy mode toggle

* Split ProviderApprovalController into two stores

* Remove privacyMode feature flag altogether

* Add migration to remove privacyMode feature flag
2019-08-15 18:37:18 -02:30
ryanml
4d9b095dd0 Using translated string for end of flow messaging (#7021) 2019-08-15 15:43:08 -03:00
Whymarrh Whitby
0ae5c09092
Rename Contacts List settings tab to Contacts (#7018) 2019-08-15 10:33:36 -02:30
Dan J Miller
043920c9ff
Address book fixes (#6978)
* Ensure address book send flow correctly matches address book addresses to ens addresses

* Use nodify on background.setAddressBook to receive correct result in actions.js

* Better error handling for actions.js addToAddressBook

* Eliminate unnecessary data normalization and move more data manipluation to ens-input and send-content containers
2019-08-13 20:43:05 -02:30
Whymarrh Whitby
ceace71bf5
Remove unused lostAccounts state (#6979) 2019-08-08 17:03:10 -02:30
Kristian Tapia
d4db2c3de3 Show recipient alias in confirm header if exists (#6944) 2019-08-08 16:15:30 -02:30
Mark Stacey
232600d928 Merge remote-tracking branch 'origin/develop' into Version-v7.0.0
* origin/develop:
  Update mobile sync (#6967)
2019-08-06 17:09:15 -03:00
Bruno Barbieri
835d4fbb13
Update mobile sync (#6967)
* update mobile sync

* update lockfile
2019-08-06 15:33:41 -04:00
Mark Stacey
b3833b1074 Prevent hidden popup overlay
A hidden overlay was preventing interactions with the lower 356 pixels
in the popup view when there are zero notifications. It was also
preventing interactions with the 100 pixels above the notifications in
the case where there were two notifications, which obscured the `Send`
button.

The first problem was solved by ensuring the notification wrapper isn't
rendered when there are no notifications. The second problem was solved
by updating the notification wrapper style to avoid setting a height.
2019-08-06 16:22:49 -03:00
Dan J Miller
3136dd39ea
Only show notification expand icon when there are > 1 notifications that 'shouldBeRendered' (#6965) 2019-08-06 00:54:36 -02:30
Dan J Miller
010e3927da
Show seed phrase challenge in browser (#6961)
* Open backup challenge screen, prompted from notification, in browser window

* Remove no longer used showingSeedPhraseBackupAfterOnboarding related code

* Make incremental-security.spec.js click through the seed phrase success screen
2019-08-06 00:54:19 -02:30
Dan Miller
1e5b678772 Ensure showing of add contact dialog on send accounts for checksum inputs 2019-08-05 15:27:50 -02:30
Dan J Miller
165f44d3a4
Address book name save fix (#6945)
* Fix address book name saving and ens input errors on good inputs on unsupported networks

* Add initial e2e test for address book send flow.

* No longer need to click recipient row in e2e tests

* Click write button in address book e2e test on seed confirm screen

* Use correct seed phrase and private key in address-book.spec tests
2019-08-02 20:30:50 -02:30
Dan J Miller
9d5be5d29f
New notification fixes (#6955)
* Replace use of backup-notification with use of home notification

* Pin notifications relative to window

* Remove unneeded isRequired condition on some home.component properties

* Refactor rendering of home notifications

* UX for multiple notifications

* Adds dismissal to provider request notification.

* Fix test failures

The e2e tests have been updated to reference `home-notification`
classnames instead of the removed `background-notification`. The
active tab proptypes and default values were updated as well.
2019-08-02 18:01:26 -02:30
Mark Stacey
75d5374582
Restrict unconnected notice to specific protocols (#6954)
The notice asking whether you wanted to connect to a site was showing
up in places it shouldn't, like on the Firefox/Chrome settings pages
and on our fullscreen extension. It has now been restricted to only
be displayed for active tabs with specific protocols:

* http
* https
* dat
* dweb
* ipfs
* ipns
* ssb

This prevents the notice from being shown on settings pages, browser
extensions, and files such as PDFs.
2019-08-02 16:29:28 -02:30
Mark Stacey
2649b9b8bb
Display seed phrase reminder if user has tokens (#6952)
The seed phrase reminder will now be triggered if the user has eth *OR*
if the user has added a token. This is to ensure that a user can't have
a positive token balance without being reminded to backup the account.

Checking for the token in preferences was easier than checking the
actual token balance, because the token balance is not yet in Redux.
That would require a more substantial refactor.
2019-08-02 16:13:15 -02:30
Dan J Miller
1b33d7fd4c Fixes use of 'Enter' key to save contact in address book modal (#6946) 2019-08-02 10:24:45 -02:30
Christopher Cooper
b7eae4ba80 split AccountDetails into a separate component (#6943) 2019-08-02 10:06:31 -02:30
Dan J Miller
3eff478775
I5849 incremental account security (#6874)
* Implements ability to defer seed phrase backup to later

* Adds incremental-security.spec.js, including test dapp that sends signed tx with stand alone localhost provider

* Update metamask-responsive-ui for incremental account security changes

* Update backup-notification style and fix responsiveness of seed phrase screen

* Remove uneeded files from send-eth-with-private-key-test/

* Apply linguist flags in .gitattributes for send-eth-with-private-key-test/ethereumjs-tx.js

* Improve docs in controllers/onboarding.js

* Clean up metamask-extension/test/e2e/send-eth-with-private-key-test/index.html

* Remove unnecessary newlines in a couple first-time-flow/ files

* Fix import of backup-notification in home.component

* Fix git attrs file
2019-08-02 01:27:26 -02:30
Thomas Huang
189e126f61 Remove logging of network dropdown props (#6940) 2019-08-01 15:37:12 -02:30
Whymarrh Whitby
e9a63d5d5b
Default Privacy Mode to ON, allow force sharing address (#6904) 2019-08-01 10:54:33 -02:30
Whymarrh Whitby
4d88e1cf86 Enable indent linting via ESLint (#6936)
* Enable indent linting via ESLint

* yarn run lint:fix
2019-07-31 10:17:11 -10:00
Dan J Miller
e9c7df28ed
Address book send plus contact list (#6914)
* Style Send Header

* Move Send to-row to send view and restyle

* Add "Recents" group to select recipient view

* Rename SendToRow to AddRecipient

* Basic UI and Layout

* New ENSInput component

* wip - fuzzy search for input

* small refactor

* Add Dialog

* contact list initial

* initial error on invalid address

* clean up edit

* Click to open modal

* Create AddToAddressBookModal component

* Modal styling and layout

* modal i18n

* Add to Addressbook

* ens wip

* ens wip

* ENS Resolution

* Reset input

* Send to explicit address

* Happy Path Complete

* Add back error checking

* Reset send-to when emptying input

* Add back warning object

* Fix linter

* Fix unit test #1 - fix import paths

* Remove dead tests

* One more to go

* Fix all unit tests

* add unit test for reducers and actions

* test rendering AddRecipient

* Add tests for dialog boxes in AddRecipient

* Add test for validating

* Fix linter

* Fix e2e tests

* Token send e2e fix

* Style View Contact

* Style edit-contact

* Fix e2e

* Fix from-import-beta-ui e2e spec

* Make section header say "add recipient” by default

* Auto-focus add recipient input

* Update placeholder text

* Update input title font size

* Auto advance to next step if user paste a valid address

* Ellipsify address when recipient is selected

* Fix app header background color on desktop

* Give each form row a margin of 16px

* Use .container/.component naming pattern for ens-input

* Auto-focus on input when add to addressbook modal is opened; Save on Enter

* Fix and add unit test

* Fix selectors name in e2e tests

* Correct e2e test token amount for address-book-send changes

* Adds e2e test for editing a transaction

* Delete test/integration/lib/send-new-ui.js

* Add tests for amount max button and high value error on send screen to test/e2e/metamask-ui.spec.js

* lint and revert to address as object keys

* add chainId based on current network to address book entry

* fix test

* only display contacts for the current network

* Improve ENS message when not found on current network

* Add error to indicate when network does not support ENS

* bump gaba

* address book, resolve comments

* Move contact-list to its own component

* De-duplicate getaddressbook selector and refactor name selection logic in contact-list-tab/

* Use contact-list component in contact-list-tab.component (i.e. in settings)

* Improve/fix settings headers for popup and browser views

* Lint fixes related to address book updates

* Add 'My accounts' page to settings address book

* Update add new contact button in settings to match floating circular design

* Improve styles of view contact page

* Improve styles and labels of the add-contact.component

* Further lint fixes related to address book updates

* Update unit tests as per address book updates

* Ensure that contact list groups are sorted alphabetically

* Refactor settings component to use a container for connection to redux; allow display of addressbook name in settings header

* Decouple ens-input.component from send context

* Add ens resolution to add contact screen in settings

* Switching networks when an ens address is shown on send form removes the ens address.

* Resolve send screen search for ensAddress to matching address book entry if it exists

* Show resolved ens icon and address if exists (settings: add-contact.component)

* Make the displayed and copied address in view-contact.component the checksummed address

* Default alias state prop in AddToAddressBookModal to empty string

* Use keyCode to detect enter key in AddToAddressBookModal

* Ensure add-contact component properly updates after QR code detection

* Fix display of all recents after clicking 'Load More' in contact list

* Fix send screen contact searching after network switching

* Code cleanup related to address book changes

* Update unit tests for address book changes

* Update ENS name not found on network message

* Add ens registration error message

* Cancel on edit mode takes user back to view screen

* Adds support for memo to settings contact list view and edit screens

* Modify designs of edit and view contact in popup environment

* Update settings content list UX to show split columns in fullscreen and proper internal navigation

* Correct background address book API usages in UI
2019-07-31 17:26:44 -02:30
Whymarrh Whitby
2761cc5a2d
Hide Copy Tx ID and block explorer link for txns w/o hash (#6928) 2019-07-29 22:12:29 -02:30
Mark Stacey
329c376449
Remove unused props from routes and network dropdown (#6919)
These props were discovered to be unused while I was working on #6680
2019-07-29 08:44:18 -03:00
Mark Stacey
1f45798707
Override ownProps with state props in SignatureRequest (#6911)
The `accounts` prop of `SignatureRequest` was throwing a PropType
warning because `accounts` was an object instead of an array. It looks
like when the `mergeProps` function was added in #6340, the ownProps
were accidentally set to override the state props.

The now ignored props have been removed from the parent `ConfirmTxScreen`
component as well. `conversionRate` was identical to the one retrieved
in `SignatureRequest`, and `selectedAddress` differed only in the
fallback behaviour when `state.metamask.selectedAddress` does not exist;
it will now default to the first account instead (as was the original
behavior, prior to #6340).
2019-07-26 10:39:13 -03:00
Mark Stacey
1112277cd6
Remove seedWords completely from metamask state (#6920)
`seedWords` used to be stored on the metamask state temporarily at
certain points. This hasn't been the case since #5994, but references
to this state remained. All of the logic remained for correctly updating
these `seedWords`, handling them during navigation, and scrubbing them
from the state.

However the state was never updated in practice. The `seedWords` are
still returned by `verifySeedPhrase`, and they're still stored in
component state in a few places. But they aren't ever set in the Redux
metadata state or the Preferences controller.

All references to this state have been removed, along with any logic
for interacting with this state. A few unused actions were removed as
well.
2019-07-26 10:35:21 -03:00
Mark Stacey
58965ed164
Remove unused route constants (#6918)
These constants were not referenced outside of this file
2019-07-26 08:26:27 -03:00
Mark Stacey
a578c725c8
Remove unused seedPhrase prop (#6913)
The `seedPhrase` prop has not been passed into the
`first-time-flow-switch` component since #5994.
2019-07-25 10:59:40 -03:00
Mark Stacey
adac1de822
Remove AccountDropdownMini component (#6906)
The `AccountDropdownMini` component featured the ability to switch
accounts using a dropdown, but this functionality was disabled in #6024.
It has been acting as a restyled `AccountListItem` since then.

The component has been removed, and the style changes moved to the sole
parent component (`RequestSignature`).
2019-07-25 08:55:43 -03:00
Mark Stacey
74639ab3ae
Remove unused time-remaining component (#6912)
The `time-remaining` component hasn't been used since #5704, aside from
a few styles. Those styles have been integrated into the
`advanced-tab-content` styles, and the unused component has been
deleted.
2019-07-25 08:55:18 -03:00
Kristian Tapia
934433e4be Single asset dropdown fix (#6900)
* Disable open dropdown for single asset

* add test to check single asset in dropdown

* fix lint errors, remove unused import
2019-07-23 21:21:13 -02:30
Mark Stacey
0f8a9a5d49
Serve CSS as an external file (#6894)
The CSS is now served as an external file instead of being injected.
This was done to improve performance. Ideally we would come to a middle
ground between this and the former behaviour by injecting only the CSS
that was required for the initial page load, then lazily loading the
rest. However that change would be more complex. The hope was that
making all CSS external would at least be a slight improvement.

Performance metrics were collected before and after this change to
determine whether this change actually helped. The metrics collected
were the timing events provided by Chrome DevTools:

* DOM Content Loaded (DCL) [1]
* Load (L) [2]
* First Paint (FP) [3]
* First Contentful Paint (FCP) [3]
* First Meaningful Paint (FMP) [3]

Here are the results (units in milliseconds):

Injected CSS:

| Run | DCL | L | FP | FCP | FMP |
| :--- | ---: | ---: | ---: | ---: | ---: |
| 1 | 1569.45 | 1570.97 | 1700.36 | 1700.36 | 1700.36 |
| 2 | 1517.37 | 1518.84 | 1630.98 | 1630.98 | 1630.98 |
| 3 | 1603.71 | 1605.31 | 1712.56 | 1712.56 | 1712.56 |
| 4 | 1522.15 | 1523.72 | 1629.3 | 1629.3 | 1629.3 |
| **Min** | 1517.37 | 1518.84 | 1629.3 | 1629.3 | 1629.3 |
| **Max** | 1603.71 | 1605.31 | 1712.56 | 1712.56 | 1712.56 |
| **Mean** | 1553.17 | 1554.71 | 1668.3 | 1668.3 | 1668.3 |
| **Std. dev.** | 33.41 | 33.43 | 38.16 | 38.16 | 38.16 |

External CSS:

| Run | DCL | L | FP | FCP | FMP |
| :--- | ---: | ---: | ---: | ---: | ---: |
| 1 | 1595.4 | 1598.91 | 284.97 | 1712.86 | 1712.86 |
| 2 | 1537.55 | 1538.99 | 199.38 | 1633.5 | 1633.5 |
| 3 | 1571.28 | 1572.74 | 268.65 | 1677.03 | 1677.03 |
| 4 | 1510.98 | 1512.33 | 206.72 | 1607.03 | 1607.03 |
| **Min** | 1510.98 | 1512.33 | 199.38 | 1607.03 | 1607.03 |
| **Max** | 1595.4 | 1598.91 | 284.97 | 1712.86 | 1712.86 |
| **Mean** | 1553.8025 | 1555.7425 | 239.93 | 1657.605 | 1657.605 |
| **Std. dev.** | 29.5375 | 30.0825 | 36.88 | 37.34 | 37.34 |

Unfortunately, using an external CSS file made no discernible improvement
to the overall page load time. DCM and L were practically identical, and
FCP and FMP were marginally better (well within error margins).

However, the first paint time was _dramatically_ improved. This change
seems worthwhile for the first paint time improvement alone. It also
allows us to delete some code and remove a dependency.

The old `css.js` module included two third-party CSS files as well, so
those have been imported into the main Sass file. This was easier than
bundling them in the gulpfile.

The resulting CSS bundle needs to be served from the root because we're
using a few `@include` rules that make this assumption. We could move
this under `/css/` if desired, but we'd need to update each of these
`@include` rules.

Relates to #6646

[1]: https://developer.mozilla.org/en-US/docs/Web/Events/DOMContentLoaded
[2]: https://developer.mozilla.org/en-US/docs/Web/Events/load
[3]: https://developers.google.com/web/fundamentals/performance/user-centric-performance-metrics
2019-07-23 14:10:13 -03:00
Terry Smith
33071e3014 Targets base inputs and only prevents outline if user uses a mouse (#6871) 2019-07-16 22:58:00 -02:30
Terry Smith
5cc4a5c6b7 Broke the close notification window logic out into it's own action. (#6864) 2019-07-16 06:25:52 -02:30
Terry Smith
721215973a Re enable the setMouseUserState styles. (#6860)
Typo
2019-07-16 00:06:57 -02:30
Whymarrh Whitby
c7c090d19c
Remove stray period from Learn More link (#6853) 2019-07-15 14:18:44 -02:30
Mark Stacey
270d1d0fa9
Add eslint dependency (#6842)
We had forgotten to add `eslint` as a dependency, even though we use it
directly. It had always worked because we have dependencies that also
depend upon it.

`eslint` has also been updated to v6, which necessitated two minor
changes.
2019-07-15 10:15:49 -03:00
Terry Smith
ded3dc1381 Add translation support for Learn more and All done on end-of-flow (#6847) 2019-07-14 23:22:20 -03:00
Thomas Huang
96a12a627e
Merge pull request #6832 from MetaMask/master-rebased
Master rebased
2019-07-12 10:58:19 -07:00
Mark Stacey
2eea388680
Remove unused expressions (#6839)
Unused expressions are generally a mistake, as they don't do anything.
The exceptions to this rule (short-circuit expressions and ternary
expressions) have been allowed.

The `webrtc-adapter` was previously ignored by eslint because it has a
side-effect upon being imported. I removed the local variable instead,
which should preserve the same side-effect without making eslint
complain.
2019-07-12 12:41:39 -03:00
Whymarrh Whitby
830c801ec3
Add React and Redux DevTools (#6793)
* Add React and Redux DevTools

* Conditionally load react-devtools

* Add start:dev npm script to run the app with devtools

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2019-07-11 12:27:06 -02:30
ryanml
daccb06a60 Create MetaFoxLogo component (#6819) 2019-07-09 14:47:58 -02:30
Dan J Miller
32a3f5ad7b
Address various UI styling issues (#6744)
* Add loading spinner to pending tx status label.

* Add border around account icon in top right

* Change style of settings toggle buttons; wrap with local components

* Eliminate large space after settings labels when no description

* Remove network form from advanced tab of settings

* Keep new account container height to contents when in full screen
2019-07-08 15:28:35 -02:30
Mark Stacey
6df65069a2
Replace react-addons-css-transition-group (#6816)
This package is deprecated, and is incompatible with React v16. It has
been replaced by `react-test-renderer`, which has a drop-in replacement
for `react-addons-css-transition-group`.

Strangely, `react-test-renderer` was already listed as a dependency
despite not being used. I had to downgrade it, as the version already
listed was for React v16, and we're still using React v15.
2019-07-08 10:12:00 -03:00
Mark Stacey
95f198550e
Declare variables before use (#6806)
While working on #6805, I noticed that many variables were being used
before they were declared. Technically this worked fine in practice
because we were using the `transform-es2015-block-scoping` Babel plugin,
which transforms `let` and `const` to `var`, which is hoisted. However,
after removing that Babel transformation, many things broke.

All instances of variables or classes being used before declared have
been fixed.

The `no-use-before-define` eslint rule has been added to catch these
cases going forward. The rule is disabled for function declarations for
the moment, because those are always hoisted. We could disable that too
if we want to, but it's purely stylistic and would require a lot more
changes.
2019-07-05 14:01:34 -03:00
Mark Stacey
ec40b2a325
Check for invalid gas estimates from local storage (#6800)
* Remove unused state 'gas.basicPriceAndTimeEstimates'

* Check for invalid estimates from local storage

Gas estimates were being cached in local storage then later retrieved,
but the retrieved values were not being checked. If the data failed to
save, failed to load, or was cleared since being saved, it would result
in the gas estimates being set to undefined.

The estimates retrieved from local storage are now checked before they
are used. If they are falsy, the estimates are retrieved from the
network instead.

This should fix this Sentry issue:
[METAMASK-6W0T](https://sentry.io/share/issue/cfe470314a5741768b19050815322aa4/)

A few additional changes were made to the gas-duck tests to accommodate
the use of `sinon.restore`. `restore` is strongly recommended by the
`sinon` team, as neglecting to use it can result in memory leaks. It has
the additional benefit of ensuring you create fresh stubs/spies for each
test, which means they no longer need to be reset between tests.
2019-07-04 16:18:12 -03:00
Dan J Miller
05e2120814 Version 6.7.2 gas limit fix (#6786)
* Introduce delay for eth_estimateGas calls with in test

* Add test that fails when gas estimates of contract method calls without gas are too high.

* Get transaction gas data from unApprovedTxs instead of confirmTransaction

* Fix selection of gas data in gas-modal-page-container.container

* Lint changes related to Version-6.7.2-gasLimitFix

* Fix e2e tests on Version-6.7.2-gasLimitFix

* Fix unit and integration tests for changes from Version-6.7.2-gasLimitFix

* more e2e fixes

* Add assertions for transaction values on confirm screen

* Fix display of transaction amount on confirm screen.
2019-07-04 14:14:03 -02:30
Whymarrh Whitby
df17853502
Remove UiMigrationAnnouncement and associated state (#6794) 2019-07-04 12:21:21 -02:30
Dan Finlay
797f0c6ced
Reduce time to show tx "speed up" buttons to 5 seconds. (#6797) 2019-07-03 22:10:17 -07:00
Mark Stacey
a44f38e640
Fix PropType warning (#6792) 2019-07-03 22:48:22 -03:00
Akshit Kr Nagpal
687984a938 Added Confirmation Modal for Delete Network (#6776) 2019-07-02 09:43:02 -02:30
Dan Finlay
448720327b
Merge pull request #6765 from MetaMask/master
Using admin privilege to bypass code owner review because it has already [been reviewed](https://github.com/MetaMask/metamask-extension/pull/6763) and those code owners are out today.
2019-07-01 10:58:25 -07:00
Dan Miller
789fc8b8ad Fixes display of confirm screen token decimals by not relying on confirmTransaction state. 2019-06-28 01:51:33 -03:00
Whymarrh Whitby
d566543bf5
Handle invalid strings during seed phrase import (#6743)
* Add tests for ImportWithSeedPhrase#parseSeedPhrase

* Handle importing whitespace-only seed phrases

Fixes #6694

This changeset fixes our parsing of seed phrases during import to handle the
case where a user tries to import a seed phrase that consists solely of whitespace.
We no longer produce an error and instead treat it as an incorrect seed phrase.

* Handle importing more invalid seed phrases
2019-06-27 14:44:41 -02:30
Mark Stacey
a6bfc6f441
Fix seed phrase import back button (#6758)
The back button on the import seed phrase page leaves the Redux store
with `appState.forgottenPassword` set to true, which prevents the user
from logging in. That flag is now unset when the user leaves the page.

Fixes #6740
2019-06-27 12:26:25 -03:00
Mark Stacey
6d191f2617
Refactor account-details-modal (#6751)
Refactor the AccountDetailsModal to follow newer conventions. Changes
include:
- Create a directory for the component with separate files for the
  component, the container, and the entrypoint.
- Use jsx rather than hyperscript

Fixes #6741
2019-06-27 12:03:18 -03:00
ryanml
59d3a3d312 Fixes #6760, correct PropTypes for nextRoute (#6761) 2019-06-27 10:41:16 -02:30
Thomas
a37a5acbe1 Add simulation failure to tx confirmation when transaction simulationFails 2019-06-25 12:42:35 -07:00
Mark Stacey
313def1ce2 Remove shapeshift deposit form (#6746)
Closes #6478
2019-06-24 14:17:48 -02:30
Whymarrh Whitby
748801f417 4byte fallback (#6551)
* Adds 4byte registry fallback to getMethodData() (#6435)

* Adds fetchWithCache to guard against unnecessary API calls

* Add custom fetch wrapper with abort on timeout

* Use opts and cacheRefreshTime in fetch-with-cache util

* Use custom fetch wrapper with timeout for fetch-with-cache

* Improve contract method data fetching (#6623)

* Remove async call from getTransactionActionKey()

* Stop blocking confirm screen rendering on method data loading, and base screen route on transactionCategory

* Remove use of withMethodData, fix use of knownMethodData, in relation to transaction-list-item.component

* Load data contract method data progressively, making it non-blocking; requires simplifying conf-tx-base lifecycle logic.

* Allow editing of gas price while loading on the confirm screen.

* Fix transactionAction component and its unit tests.

* Fix confirm transaction components for cases of route transitions within metamask.

* Only call toString on id if truthy in getNavigateTxData()

* Fix knownMethodData retrieval and data fetching from fourbyte
2019-06-18 09:47:14 -02:30
Dan J Miller
18179fd345 Add delete to custom RPC form (#6718, #6650) 2019-06-17 11:35:47 -02:30
Kirill Goncharov
a47370057e Fix styles on 'import account' page, update help link (#6700)
* Fix styles on 'import account' page, update help link

* Update changelog
2019-06-17 08:37:34 -02:30
Thomas Huang
6fb0d4af27 Wrap smaller custom block explorer url text (#6714) 2019-06-17 08:32:12 -02:30
Chi Kei Chan
9a1a207ffa
MetaMorph - Spacing and Typeface on Extension Main view (#6584)
* wip

* Style Update: Mobile App Header

* wip

* Style Update: mobile menu-bar

* Style Update: Primary and Secondary balance on mobile main view

* Style Update: Spacing for transaction-list and transaction-list-item

* Address PR Comments

* Fix full-width view

* line-height fixes
2019-06-12 19:56:04 -07:00
Esteban Miño
71390db4a3
Feature: sync with mobile v2 (#6673)
* handle two steps

* generate new qr each 30 secs

* handle change of channel cipher without changing qr code

* fix typo
2019-06-12 10:54:45 -04:00
Jenny Pollack
9180e39b08 Revert "fixed #5524"
This reverts commit c8cb4ba370.
2019-06-06 19:20:33 +02:00
Mathew Kamkar
79d2eaffac
lint cleanup 2019-05-24 22:16:56 -07:00
Mathew Kamkar
c7266067ce
Enable Ledger hardware wallet support on Firefox
Firefox 67 support U2F by default
2019-05-24 21:42:48 -07:00
Dan J Miller
5e2fd8ae86
Ensures that transactions cannot be confirmed if gas limit is below 21000. (#6625) 2019-05-23 11:26:40 -02:30