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

3326 Commits

Author SHA1 Message Date
Whymarrh Whitby
f5c496ffcd
Convert Menu, Item, Divider, and CloseArea components to use JSX (#7547) 2019-11-25 10:01:44 -03:30
Whymarrh Whitby
2b4c99e031
Split WalletView into component and container files (#7546) 2019-11-25 10:00:46 -03:30
Whymarrh Whitby
1ffaa330ad
Split AccountModalContainer into container and component files (#7549)
Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2019-11-24 19:11:08 -03:30
Whymarrh Whitby
22a2d21796
Convert Alert component to use JSX (#7542) 2019-11-24 19:10:16 -03:30
Whymarrh Whitby
666277b4fa
Convert TokenMenuDropdown component to use JSX (#7552) 2019-11-24 19:09:10 -03:30
Whymarrh Whitby
d948a3b195
Convert NotificationModal component to use JSX (#7550) 2019-11-24 18:32:53 -03:30
Whymarrh Whitby
6e73d2be69
Convert HideTokenConfirmationModal component to use JSX (#7551) 2019-11-24 18:31:56 -03:30
Whymarrh Whitby
8311617b95
Convert LoadingScreen component to use JSX (#7545) 2019-11-24 17:51:50 -03:30
Whymarrh Whitby
04442318d3
Convert EditableLabel component to use JSX (#7543) 2019-11-24 17:51:21 -03:30
Whymarrh Whitby
1cac6f2768
Convert SimpleDropdown component to use JSX (#7540) 2019-11-24 17:48:58 -03:30
Whymarrh Whitby
7d2b5b26a5
Delete unused SeedImportSubview component (#7530)
* Delete unused SeedImportSubview component
* Remove 2 unused messages
2019-11-24 17:48:34 -03:30
Whymarrh Whitby
50c5365933
Add isRequired flag to MobileSyncPage props (#7544) 2019-11-24 14:46:57 -03:30
Whymarrh Whitby
ec938686a9
Split MobileSyncPage into container and component, with JSX (#7534) 2019-11-24 13:46:25 -03:30
Whymarrh Whitby
a849218f81
Adjust QrCodeView propTypes for its Qr.messages prop (#7529) 2019-11-24 13:45:35 -03:30
Whymarrh Whitby
3377228b74
Split ShiftListItem into container and component files with JSX (#7539) 2019-11-24 01:41:30 -03:30
Whymarrh Whitby
c3e834d17b
Convert CustomizeGasModal component to use JSX (#7537) 2019-11-24 01:32:14 -03:30
Whymarrh Whitby
439fce8901
Convert Mascot component to use JSX (#7535) 2019-11-24 01:29:18 -03:30
Whymarrh Whitby
c51914c1a5
Convert the RevealSeedPage component to use JSX (#7536) 2019-11-24 01:28:32 -03:30
Whymarrh Whitby
f15237b1a5
Convert ExportTextContainer component to use JSX (#7538) 2019-11-24 01:24:22 -03:30
Whymarrh Whitby
6849595326
Delete unused to-autocomplete (#7533) 2019-11-24 01:20:48 -03:30
Whymarrh Whitby
340559b805
Convert TokenList component to use JSX (#7541) 2019-11-24 01:19:51 -03:30
Whymarrh Whitby
49dfb5ec2c
Convert ConnectHardwareForm component to JSX (#7517) 2019-11-23 14:44:09 -03:30
Whymarrh Whitby
80badb10c1
Convert ConnectScreen to use JSX (#7525) 2019-11-23 12:53:09 -03:30
Whymarrh Whitby
3086c0db71
Convert AccountList component to use JSX (#7524) 2019-11-23 12:52:52 -03:30
Whymarrh Whitby
9841845b30
Convert PrivateKeyImportView component to use JSX (#7522) 2019-11-23 12:52:27 -03:30
Whymarrh Whitby
99e94dadbd
Convert Tooltip component to JSX (#7516) 2019-11-23 12:51:59 -03:30
Whymarrh Whitby
9f7438e756
Convert FiatValue component to JSX (#7515) 2019-11-23 12:51:37 -03:30
Whymarrh Whitby
f5824ffad7
Convert CopyButton component to JSX (#7513)
Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2019-11-23 12:51:21 -03:30
Whymarrh Whitby
c555ea659c
Convert NetworkDropdownIcon component to JSX (#7511)
Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2019-11-23 12:50:47 -03:30
Whymarrh Whitby
4fe147f82f
Convert MenuDroppoComponent component to JSX (#7531) 2019-11-23 12:49:36 -03:30
Whymarrh Whitby
0d6b5b627d
Delete unused Copyable component (#7526)
* Delete unused Copyable component

* Delete unused copy localized message
2019-11-23 01:47:08 -03:30
Whymarrh Whitby
3203c75ee4
Delete commented-out CSS code (#7528) 2019-11-23 01:46:54 -03:30
Whymarrh Whitby
089c6915df
Fix accessibility of first-time-flow terms checkboxes (#7501) 2019-11-23 01:26:39 -03:30
Whymarrh Whitby
a3d0b71320
Convert ReadOnlyInput component to use JSX (#7512) 2019-11-23 00:44:44 -03:30
Whymarrh Whitby
1454426e3e
Convert AccountImportSubview to use JSX (#7520) 2019-11-23 00:44:12 -03:30
Whymarrh Whitby
d7fabae847
Convert JsonImportSubview component to use JSX (#7521) 2019-11-23 00:43:48 -03:30
Whymarrh Whitby
c775a842d1
Convert QrCodeView to use JSX (#7504) 2019-11-23 00:10:35 -03:30
Whymarrh Whitby
7d097dedaf
Convert Dropdown and DropdownMenuItem components to JSX (#7510) 2019-11-22 23:53:16 -03:30
Whymarrh Whitby
7a0e40829a
Convert AccountDetailsDropdown component to use JSX (#7509) 2019-11-22 23:52:41 -03:30
Whymarrh Whitby
1d9787c0d8
Convert GasModalCard component to use JSX (#7507) 2019-11-22 23:28:33 -03:30
Whymarrh Whitby
df88e7656d
Delete unused GasSlider component (#7508) 2019-11-22 23:26:02 -03:30
Whymarrh Whitby
3d598473a0
Convert AccountPanel component to use JSX (#7505) 2019-11-22 22:48:46 -03:30
ryanml
878e0e3164 Fixing hardware connect error display (#7519) 2019-11-22 22:24:59 -03:30
Whymarrh Whitby
6820a245b5
Convert InputNumber component to use JSX (#7503) 2019-11-22 20:13:58 -03:30
Whymarrh Whitby
5235d8db96
Remove unused onClick prop from Dropdown component (#7500) 2019-11-22 17:23:27 -03:30
Thomas Huang
eecaa4ef26
Merge pull request #7491 from MetaMask/send-gas
Update gas when asset is changed on send screen.
2019-11-22 11:59:24 -08:00
Mark Stacey
f763979bed
Add support for one-click onboarding (#7017)
* Add support for one-click onboarding

MetaMask now allows sites to register as onboarding the user, so that
the user is redirected back to the initiating site after onboarding.
This is accomplished through the use of the `metamask-onboarding`
library and the MetaMask forwarder.

At the end of onboarding, a 'snackbar'-stype component will explain to the
user they are about to be moved back to the originating dapp, and it will
show the origin of that dapp. This is intended to help prevent phishing
attempts, as it highlights that a redirect is taking place to an untrusted
third party.

If the onboarding initiator tab is closed when onboarding is finished,
the user is redirected to the onboarding originator as a fallback.

Closes #6161

* Add onboarding button to contract test dapp

The `contract-test` dapp (run with `yarn dapp`, used in e2e tests) now
uses a `Connect` button instead of connecting automatically. This
button also serves as an onboarding button when a MetaMask installation
is not detected.

* Add new static server for test dapp

The `static-server` library we were using for the `contract-test` dapp
didn't allow referencing files outside the server root. This should
have been possible to work around using symlinks, but there was a bug
that resulted in symlinks crashing the server.

Instead it has been replaced with a simple static file server that
will serve paths starting with `node_modules` from the project root.
This will be useful in testing the onboarding library without vendoring
it.

* Add `@metamask/onboarding` and `@metamask/forwarder`

Both libraries used to test onboarding are now included as dev
dependencies, to help with testing. A few convenience scripts
were added to help with this (`yarn forwarder` and `yarn dapp-forwarder`)
2019-11-22 13:03:51 -04:00
Thomas
4736e3ed87 Finish test description 2019-11-21 17:21:24 -08:00
Thomas
d84b16a784 Update Gas when asset is changed 2019-11-21 17:19:33 -08:00
Thomas
359fbf3ace Change component props from string to object and associated tests to mimic actual in-use component
Add test to updateGas when asset is changed
2019-11-21 17:17:08 -08:00
ricky
bf57dd5ad9
Add overflow hidden (#7488) 2019-11-21 16:59:50 -05:00
Mark Stacey
71a0bc8b3f
Refactor signature-request-original (#7415)
The component has been updated to split the container from the base
component, and all hyperscript has been replaced with JSX. ES6 imports
are used throughout as well.
2019-11-20 18:03:49 -04:00
Mark Stacey
056e8cdf7e
Merge pull request #7479 from MetaMask/master
Master sync
2019-11-19 21:10:55 -04:00
Whymarrh Whitby
aa41057628
Update ESLint rules for curly braces style (#7477)
* eslint: Enable curly and brace-style

* yarn lint --fix
2019-11-19 20:33:20 -03:30
Whymarrh Whitby
ab0600ef0b Add Remind Me Later to SAI migration notification 2019-11-19 16:40:00 -03:30
Whymarrh Whitby
5f9e8867b4 Allow any renderable type in HomeNotification texts 2019-11-19 16:22:34 -03:30
Mark Stacey
5c356a4cac
Show transaction fee units on approve screen (#7468)
The units for the amounts shown on the approve screen in the
transaction fee section were missing. It appears that they were present
in an early version of the approve screen (#7271) but they got lost
somewhere along the way.
2019-11-19 09:41:28 -04:00
ricky
346c1f2622
Add additional rpcUrl verification (#7436)
* Add additional url verification

* Add commas

* Address PR feedback

* Use URL over URI

* Update key in other languages

* Add stateKey check

* Split validateUrl into two separate methods

* Remove unused variable

* Add isValidWhenAppended method
2019-11-19 00:11:50 -05:00
Thomas Huang
4ac247462b
Merge pull request #7469 from MetaMask/master
Master sync
2019-11-18 17:50:03 -08:00
Whymarrh Whitby
b0890b6b32
Enforce a single boolean attr notation in JSX (#7465)
This changeset enables the ESLint rule enforcing a single notation for boolean
attributes in JSX—explictly setting the value to `true` is no longer allowed
(as it was never needed).[1]

From the docs for JSX:[2]

> If you pass no value for a prop, it defaults to `true`.

  [1]:https://github.com/yannickcr/eslint-plugin-react/blob/80935658/docs/rules/jsx-boolean-value.md
  [2]:https://reactjs.org/docs/jsx-in-depth.html#props-default-to-true

I have chosen to use this default as it the most consistent with HTML (a la
`checked` and `disabled`).
2019-11-18 19:53:41 -03:30
Thomas
7f5d829880 Set default height and alignment of notification icon 2019-11-18 14:45:10 -08:00
Whymarrh Whitby
86b165ea83
Add migration notification for users with Sai (#7450)
Maker has upgraded its Dai token to "Multi-Collateral Dai" (MCD) and requires
all users interacting with Dai migrate their tokens to the new version. Dai
now exclusively refers to Multi-Collateral Dai and what was previouly called
Dai is now Sai (Single Collateral Dai).

In this description, Sai refers to what was (prior to the 2019-11-18) known as Dai.
Dai is the _new_ token.

This changeset:

1. Only affects users who had non-zero Sai at the old contract address
2. Displays a persistent notification for users with Sai
3. Updates the token symbol for users already tracking the Sai token
4. Bumps our direct and indirect eth-contract-metadata dependencies

The notification copy:

> A message from Maker: The new Multi-Collateral Dai token has been released. Your old tokens are now called Sai. Please upgrade your Sai tokens to the new Dai.

The copy is from the Maker team.
2019-11-18 18:16:28 -03:30
Thomas Huang
b3395502f2
Merge pull request #7463 from MetaMask/expand-home-notification-height
Expand home notification height
2019-11-18 12:32:38 -08:00
Mark Stacey
3003104a5d Expand home notification height
The home notification static height of 116px is too cramped for longer
messages, such as the one used for the Sai migration. The old height is
now used for the minimum height instead, with a margin to ensure the
text doesn't get too close to the buttons.
2019-11-18 16:04:43 -04:00
Mark Stacey
273ec7beef Import styles for showing multiple notifications
The styles for the multi-notification component on the home screen were
accidentally removed while resolving a merge conflict in #6891.

Fixes #7460
2019-11-18 15:56:47 -04:00
Whymarrh Whitby
51bfe56510
Disallow spaces around the equal sign in JSX (#7459) 2019-11-18 14:19:03 -03:30
Whymarrh Whitby
f1384e7522
Disable unnecessary curly braces in JSX (#7454) 2019-11-18 11:38:47 -03:30
Whymarrh Whitby
659b4360bc
Add ESLint rule forbidding extraneous defaultProps (#7453) 2019-11-18 11:38:10 -03:30
Sunghee Lee
a6e387fddc Add button disabled when password is empty (#7451) 2019-11-17 14:04:17 -03:30
Whymarrh Whitby
7a6f2693fe
Add defaultProps to MultipleNotifications (#7449) 2019-11-16 19:43:46 -03:30
Whymarrh Whitby
d41522d5c0
Cleanup MultipleNotifications jsx in Home (#7448) 2019-11-16 19:43:20 -03:30
Mark Stacey
23ab6e2d54
Add metricsEvent to contextTypes (#7439)
The metricsEvent context type was missing, resulting in an error when
it was called.
2019-11-15 14:04:36 -04:00
Mark Stacey
f5cec3e6b7
Ensure SignatureRequestOriginal 'beforeunload' handler is bound (#7414)
The 'beforeunload' handler was being bound to the module scope instead
of the instance scope, because the class was defined using prototypes
rather than the ES6 class syntax. The arrow functions were removed, and
the handler is now bound explicitly in the constructor.
2019-11-14 14:28:40 -04:00
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