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

4225 Commits

Author SHA1 Message Date
Dan J Miller
a9d156e611
Fix and simplify account switching in Swaps (#9549)
* Ensure rendered swap from token balance updates when token balance changes

* Disable account switching on all swaps routes other than build quote
2020-10-12 14:21:01 -02:30
Dan J Miller
dc5edb5431
Fix calculation and display of eth received amounts in swaps (#9546)
* Update txMeta after postTxBalance has been retrieved

* Use gas used from txReceipt to calculate eth received

* Return null from getSwapsTokensReceivedFromTxMeta in tokenSymbol is ETH and txReceipt is missing

* Get latest txMeta before updating it with postTxBalance in case of a swaps tx in confirmTransaction

* Lint fix
2020-10-12 07:52:51 -02:30
Dan J Miller
6409caa081
Use initial transaction for settings swap transaction title params (#9543)
* Use initial transaction for settings swap transaction title params, and remove addition of swap properties to cancel transcations

* Update unit test data

* Use token symbol properties from initial transaction for filitering in transaction list
2020-10-10 17:20:20 -02:30
Thomas Huang
ac8f673716
Overflow primaryCurrency in tx-list-item & use primaryCurrency for tx breakdown details. (#9539)
* Set result of calcTokenAmount to base 10 string in useTokenDisplayValue

* Use primaryCurrency for amount in transaction breakdownd details

* Hidden overflow and text overflow ellipsis on long primary currency in transaction-list-item

* Empty prefix for token approvals

* Conditional render primaryCurrency title in tx breakdown to `Spend limit amount` when tx is a token approve.

* Add title to primaryCurrency in tx list item to show full amount on hover

* Update ui/app/components/app/transaction-breakdown/transaction-breakdown.component.js

DRY title conditional rendering.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-09 13:11:39 -07:00
Erik Marks
24d7d1ae2a
Parse inputs to BigNumber arithmetic in conversion util (#9502) 2020-10-09 13:01:15 -07:00
Dan J Miller
436b01387c
Add useSwapsEthToken hook and utilize wherever we need the ETH 'token' for swaps (#9537)
* Add useSwapsEthToken hook and utilize wherever we need the ETH 'token' for swaps
* Remove rawEthTokens param from useTokensToSearch calls

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-10-09 12:17:56 -07:00
Mark Stacey
d8818a47c4
Add margins between quote list columns (#9528)
The quote list columns have been adjusted to add more space in between
the columns. Additionally, the third column cells are now better
aligned under the header. A few unnecessary `<div>`s and CSS classes
have been removed as well.
2020-10-09 16:12:13 -02:30
Mark Stacey
4505ab5f2b
Update error message for missing substitutions (#9541)
This updated error message shows the key of the message instead of the
message text itself, followed by the locale code.

This will make it easier to filter messages we want to ignore in
Sentry. Currently it's difficult to filter because the message is
radically different for each locale. With this change, we can add a
filter and use a glob for the last part to filter it for all locales.

It's still important to include the locale code in the message, so that
we can catch cases where the message has the wrong number of
substitutions for a specific locale.
2020-10-09 14:22:51 -02:30
Dan J Miller
0ebc465221
Fix swap prop type errors (#9532)
* Fix swap prop type errors

* Fix prop type of sortColumn in sort-list
2020-10-09 13:08:01 -02:30
Dan J Miller
98f049f8cb
Only shows the swaps intro popup on mainnet (#9534)
* Only shows the swaps intro popup on mainnet

* Remove code that closes swaps popup from e2e tests

* correct casing on isMainnet prop in home component
2020-10-09 13:07:11 -02:30
Dan J Miller
89a0f75942
Corrects the copy in the amount receiving tooltip of the swaps sort-list (#9533) 2020-10-09 12:30:16 -02:30
Dan J Miller
549140f6f5
Remove max mode for eth feature from swaps (#9531)
* Remove max mode for eth feature from swaps

* Fix unit tests after removing maxMode from swaps
2020-10-09 12:26:23 -02:30
David Walsh
a301ce92d8
Prevent duplicate increment/decrement buttons in Firefox (#9523)
Fixes #9516
2020-10-08 14:53:14 -02:30
Mark Stacey
305e3ceb2e
Fix retry transaction button tooltip (#9524)
The tooltip for the Retry Transaction button would be erroneously set
to display a custom block explorer, if one was set for the current
network. It now displays the intended retry transaction text in all
cases.
2020-10-08 14:30:41 -02:30
David Walsh
25e5ac24b2
Prevent swaps value input placeholder from jumping when focused (#9520) 2020-10-08 13:38:36 -02:30
Dan J Miller
e389ad98af
Hide activity list retry button for failed swaps transctions (#9513) 2020-10-08 11:41:05 -02:30
Dan J Miller
a939853989
Ensure all of a token is swapped when clicking max in swaps (#9507) 2020-10-07 18:38:34 -07:00
Mark Stacey
cdfa2e66fd
Hide retry button for on-chain failures (#9506)
On-chain failed transactions have a transaction status of `confirmed`,
and should not be retried. Our retry function doesn't handle on-chain
failures yet, so it would inevitably fail due to the transaction having
the same nonce as a confirmed on-chain transaction.

When determining whether to show the retry button in the UI, we had
mistakenly been using a `status` variable that determined whether we
should show "Failed" on that transaction in the activity log. That
display status includes both network and on-chain failures, unlike
the `txMeta.status` property.

The `showRetry` logic has been updated to ensure it's only shown when
`txMeta.status` is `failed`, meaning on-chain failures will no longer
show the retry button. Additionally, the display-specific `status`
variable has been renamed to `displayedStatusKey`, to indicate that it
is a string that corresponds to a localized message, and that it's the
status meant for display purposes.
2020-10-07 14:59:38 -07:00
Dan J Miller
392f9eafc2
Stop passing a gas param to the estimateGas call initiated in the swaps controller (#9501)
* Stop passing a gas param to the estimateGas call initiated in the swaps controller timedoutGasReturn

* Stop passing gas params to timedoutGasReturn

* Lint fix

* Stop passing no longer used param to setInitialGasEstimate
2020-10-07 16:30:17 -02:30
Dan J Miller
7a28783924
Prevent user from submitting swap if they do not have enough for the max gas fee (#9500) 2020-10-07 09:55:38 -07:00
Mark Stacey
b98b0b6d01
Fix missing app header on Home screen (#9498)
The app header would sometimes mistakenly not get rendered while on the
Home screen. This could happen when a permission request was made while
the UI was open, to either the browser action popup or the fullscreen
UI.

This was caused by faulty logic in the top-level router component. It
would hide the app header if there was a pending permission request,
presumably because the author assumed that a redirect to the permission
flow would shortly follow. This redirect only happens on mount though,
not if the UI was already open when the permission request was
submitted.

The intent of this logic was to hide a brief flash of the app header
prior to rendering the permission flow. This brief flash has now been
restored, which is unfortunate, but is better than the missing app
header bug. We can revisit a solution to removing this flash in the
future, hopefully in a manner that avoids this bug and works for all
notification UI cases.
2020-10-07 14:15:39 -02:30
Brad Decker
9230d75ab0
pass entire tokenData object to getTokenAddressParam (#9499) 2020-10-07 11:40:39 -05:00
Mark Stacey
d1e8f5db86
Prevent redirecting to swaps in notification (#9497)
If a notification popup was opened while the user was partway through
the swaps flow, the notification would display the swaps flow instead
of whatever action triggered the popup (e.g. a connect request or a
confirmation). This is confusing and potentially dangerous, as the
user might mistakenly think the swap was triggered by a dapp.

The swap redirects are now prevented in the notification UI. The user
will still be redirected to an in-progress swap flow if they open the
browser action popup or the fullscreen UI, but not on the notification
popup that is triggered by dapp actions.
2020-10-07 13:49:47 -02:30
Erik Marks
bf1bb6ca7e
Check specified chain ID against endpoint return value (#9491)
Adds additional validation to chainId values in the network form, by comparing the specified value against the value returned by the endpoint.
2020-10-07 11:58:22 -02:30
Brad Decker
1ba4061f46
format quotes consistently on main-view and list-view (#9495) 2020-10-06 22:07:38 -02:30
Dan J Miller
534ac25a93
Ensure gas costs are accounted for when calculating the amount of eth received in a swap (#9494) 2020-10-06 21:38:09 -02:30
Erik Marks
46bcba2d63
Fix IconButton prop type (#9489)
* Fix IconButton prop type
2020-10-06 14:09:12 -07:00
Erik Marks
39d5bb73a7
Remove setSpecialRpc functionality (#9490) 2020-10-06 14:06:41 -07:00
Dan J Miller
94810ce9c9
Compare the networkId against the correct enum in eth and token overview components (#9485) 2020-10-06 17:34:53 -02:30
Dan J Miller
30d13422b5
Add MetaMask Swaps (#9482) 2020-10-06 15:58:38 -02:30
Erik Marks
088d4c34f1
Merge pull request from GHSA-c2xw-px2x-pr65
* Remove network config store
* Remove inline networks variable in network controller
* Re-key network controller 'rpcTarget' to 'rpcUrl'
* Require chainId in lookupNetwork, implement eth_chainId
* Require chain ID in network form
* Add alert, migrations, and tests
* Add chainId validation to addToFrequentRpcList
* Update public config state selector to match new network controller
state
* Use network enums in networks-tab.constants
* Ensure chainId in provider config is current
* Update tests
2020-10-06 15:27:02 -02:30
ricky
b00cd344d9
Use ethers to validate mnemonic during import (#9463) 2020-09-28 18:43:42 -02:30
Brad Decker
b3d3518bc0
Remove unnecessary functions (#9458)
Removes unnecessary functions with minor code changes to support extraction
2020-09-24 11:42:56 -05:00
Brad Decker
e75bfc4dbc
remove-unused-component (#9457) 2020-09-23 13:11:22 -05:00
Brad Decker
37cbeb56a3
make gas edit tooltips use Tooltip (#9434) 2020-09-17 17:05:31 -05:00
Thomas Huang
ee6e986f59
Fix dismiss button css on unconnected alert modal (#9430)
* Fix dismiss button on unconnected alert modal

Set button type to primary, rounded, and set `!important` on css class width

* Update ui/app/components/app/alerts/unconnected-account-alert/unconnected-account-alert.scss

* Add unconnected-account-alert to popover component classname to simplify css selector.

Co-authored-by: Brad Decker <git@braddecker.dev>
2020-09-17 13:23:37 -07:00
Erik Marks
550e49a64c
Gas modal styling fixes (#9433) 2020-09-17 13:02:00 -07:00
Brad Decker
c6a540419c
fix styles on tx detail popover buttons (#9432) 2020-09-17 12:12:42 -05:00
Brad Decker
f4a2a09713
increase specifity of button style overrides on notifications (#9427) 2020-09-17 09:08:02 -05:00
Brad Decker
1123adcb1d
fix overflow issue on approval container (#9415) 2020-09-16 15:18:39 -05:00
Thomas Huang
6f0a16a0e8
Fix button with on Deposit Ether / Buy Screen (#9424) 2020-09-16 12:42:11 -07:00
Brad Decker
86adca8486
Fix dropshadow permissions page (#9413) 2020-09-15 15:20:58 -05:00
Brad Decker
c97493cc13
rename Ethereum Main Network -> Etherum Mainnet (#9411) 2020-09-15 14:34:16 -05:00
Brad Decker
0c2404c6d7
fix button spacing on activity list (#9410) 2020-09-15 14:33:49 -05:00
Brad Decker
22ee3695f5
fix tooltip issue on firefox (#9409) 2020-09-15 13:19:46 -05:00
Brad Decker
ed28591b62
fix link regression (#9408)
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-09-15 13:03:05 -05:00
Dan J Miller
6b08ca428b
Fix left border of the first button in the gas price button group of the gas customization modal (#9406) 2020-09-15 12:52:39 -02:30
Brad Decker
8b24f624dd
add segment implementation of metametrics (#9382)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-09-14 12:04:05 -05:00
Mark Stacey
feab36710d
Remove unused connections route (#9394)
This route was used for the "Connections" page in Settings, which was
removed in #7004
2020-09-11 09:32:54 -03:00
Whymarrh Whitby
e2dedaacdb
Use Infura v3 API (#9368)
* Use eth-json-rpc-infura@5.0.0
* Use Infura v3 API
* Add example .metamaskrc file
2020-09-10 13:46:00 -02:30
Mark Stacey
b80ab53396
Add radiogroup ButtonGroup variant (#9383)
Add a prop to the `ButtonGroup` component to make it act as a group of
radio buttons, rather than a group of regular buttons. These commits
were written by @danjm - I just pulled them into this branch.
2020-09-10 13:08:38 -03:00
Erik Marks
eef4ec981f
Ensure token amounts are in fixed notation (#9381)
* Ensure token amounts are in fixed notation
2020-09-09 22:24:11 -07:00
Erik Marks
b349a5c8b1
Convert ConfirmTokenTransactionBase to functional component (#9373)
* Convert ConfirmTokenTransactionBase to functional component

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-09-09 22:00:04 -07:00
Erik Marks
c5917aa445 roundExponential: add docstring, remove unnecessary cast 2020-09-08 21:28:24 -07:00
Erik Marks
d532cdc459 Ensure tokenAmount is always a string 2020-09-08 14:00:28 -07:00
Erik Marks
23683c1630
Replace toNumber calls on BigNumbers with toString (#9369) 2020-09-08 08:49:51 -07:00
Dan J Miller
ccb7eb3ab7
Fix useTokenTracker useEffect bug (#9334)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Brad Decker <git@braddecker.dev>
2020-09-02 14:19:04 -05:00
Patryk Łucka
3d4f1f45bd
Add messages to Ledger connection process (#9344) 2020-09-02 13:58:14 -02:30
ricky
f281df3b36
Feature/hide seedphrase when restoring vault (#9329)
* hide seedphrase (by default) with option to show it
2020-09-02 11:45:09 -04:00
Whymarrh Whitby
1e99a7b0c3
Migrate to scoped @metamask/jazzicon (#9341) 2020-09-02 12:37:56 -02:30
Whymarrh Whitby
9a711e695a
Fix lookAtDirection prop passed to Mascot (#9343) 2020-09-02 12:37:39 -02:30
Thomas Huang
f3a37dc1e2
Fix alignment of restore vault screen (#9339)
* Fix alignment of restore vault screen

Fixes #9324

Possibly missed when #9183 was merged. The issue is that the same classname is overridding the intended flex-direction.

46ba1ef100/ui/app/css/itcss/components/newui-sections.scss (L98-L101)
2020-09-01 14:38:26 -07:00
Thomas Huang
a3f9e6d37b
Show token symbol when token amount string is long (#9333)
* Show token symbol when token amount string is long

Fixes #9318

This essentially separates the token cell list item title/token amount and the token symbol.
I do request advice/recomendations on how to better handle the new `subTtitle` which I set the token symbol to and the `subtitle` https://github.com/MetaMask/metamask-extension/blob/develop/ui/app/components/app/asset-list-item/asset-list-item.js#L99.

* Individually test token balance and token symbol and their associated css element

* Feedback commit

* Classname and css overflow for title with string.
2020-09-01 13:13:58 -07:00
Patryk Łucka
cd86d00cb7
Fix send warning dialog (#9321)
This change moves warning message from `add-recipient` component to `send-content`. Currently
whenever provided address is a valid eth address `send-content` is rendered instead of `add-recipient`
this is why warnings never popped up.
2020-08-28 12:57:07 -02:30
Thomas Huang
79d477009e
Use verifyPassword instead of submitPassword when exporting priv key (#9288)
* Use verifyPassword instead of submitPassword when exporting priv key

Fixes #9287 which was when submitPassword is called will fully clear the keyring state

https://github.com/MetaMask/KeyringController/blob/master/index.js#L155
ad823d0ac1/index.js (L562)
ad823d0ac1/index.js (L726)

Also, pass hideWarning action prop so it will clear the appState.warning if a correct password is never provided on componentWillUnmount

* Hide Warning on componentWillUnmount

* Update exportAccount tests to verifyPassword

* Update ui/app/store/actions.js
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-26 16:19:41 -07:00
Patryk Łucka
20b0e66cc9
fix ens error text on mainnet (#9314) 2020-08-26 19:56:14 -03:00
Erik Marks
3aaa41ef44
Replace abi-decoder with ethers (#9290)
* replace abi-decoder with ethers

* handle transaction parsing errors

* update token param getter function names

* add docstrings
2020-08-21 19:29:19 -07:00
Erik Marks
e08a55c8bc
Add messages for MetaMetrics opt-in (#9283)
* Add messages for MetaMetrics opt-in
2020-08-20 17:13:14 -07:00
Erik Marks
02d318d493
Add @metamask/logo (#9281)
* Remove metamask-logo
2020-08-20 10:48:43 -07:00
Dan J Miller
42f4c2e407
MetaMask mascot support for provided directions targets and toggling followMouse (#9166)
* MetaMask mascot support for provided directions targets and toggling followMouse

* Fixes for mascot.component.js

* Update metamask-logo version to 2.4.0

* Lint fix

* Fix mouse follow updating

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

* Improve mascot story name

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

* Update package.json

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

* Lint fix

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-20 05:29:03 -02:30
Thomas Huang
5f11273550
Add react-testing-library/react (#9249)
* Add react-testing-library

Adds react-testing-library as a dependency, creates a wrapper function with Provider store/I18n context support, and implements it in unconnected-account-alert.

* Refactor renderWithProvider store to extra param, instead of component prop store
2020-08-19 21:13:59 -07:00
Brad Decker
a04ec49a57
remove unnecessary files and scss (#9253)
this moves very little code around, to enable deleting files that are
no longer used or necessary. There are a few more things to move and
delete that will be handled in a seperate PR after this one.
2020-08-19 16:02:42 -05:00
Brad Decker
cfff01164a
Reuse the loading-screen component and colocate it's styles (#9177) 2020-08-19 16:02:26 -05:00
Brad Decker
c04cb63c63
Standardize scss import practices (#9183) 2020-08-19 11:41:56 -05:00
Whymarrh Whitby
b6ccd22d6c
Update ESLint shared config to v3 (#9274)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-19 13:57:05 -02:30
Patryk Łucka
50c4845d05
Add lock icon to default networks (#9269)
Co-authored-by: Patryk Łucka <patryk.lucka@consensys.net>
2020-08-19 10:01:58 -05:00
Dan J Miller
c0d78401fc
Adds toPrecisionWithoutTrailingZeros utility (#9270) 2020-08-19 11:34:50 -02:30
Patryk Łucka
9a3c559b3d
Hide gas estimate on non-main network (#9189)
* hide advance gas on non mainnet

* hide edit gas button on non mainnet
2020-08-19 11:03:15 -03:00
Dan J Miller
a8199be553
Move the mascot component to its own directory (#9272) 2020-08-19 11:23:44 -02:30
Dan Miller
6302154c40 Fix padding, alignment of actionable-message; add left aligned story 2020-08-18 18:23:25 -02:30
Dan Miller
f106128c41 Code cleanup and simplification for actionable-message component 2020-08-18 18:23:25 -02:30
Dan Miller
7695343a3b Adds actionable message component and stories 2020-08-18 18:23:25 -02:30
Whymarrh Whitby
ca35098f67
Fix lint issues (#9265) 2020-08-18 15:39:01 -05:00
Whymarrh Whitby
6ab12001e3
Fix prefer-destructuring issues (#9263)
See [`prefer-destructuring`](https://eslint.org/docs/rules/prefer-destructuring) for more information.

This change enables `prefer-destructuring` and fixes the issues raised by the rule.
2020-08-18 17:36:58 -02:30
Brad Decker
8b0a308449
colocate confirm-decrypt-message page styles (#9252)
Follows the previously set pattern of colocating styles along side the
consuming components. This one was really straight forward and just a
reorganization of files and imports. No code changes occurred.
2020-08-18 14:44:32 -05:00
Dan J Miller
74f0d473cb
Add exchange-rate-display component (#9260)
* Add exchange-rate-display component

* Improve scss naming
2020-08-18 16:55:05 -02:30
Dan J Miller
09e7f24b2d
Adds pulse loader component (#9259)
* Adds pulse loader component

* Move pulse-loader component to the UI directory
2020-08-18 16:53:36 -02:30
Whymarrh Whitby
c1e3c229bc
Fix import/order issues (#9239)
See [`import/order`](https://eslint.org/docs/rules/import/order) for more information.

This change enables `import/order` and fixes the issues raised by the rule.
2020-08-18 16:48:25 -02:30
Whymarrh Whitby
b7259e5d6a
Fix radix issues (#9247)
See [`radix`](https://eslint.org/docs/rules/radix) for more information.

This change enables `radix` and fixes the issues raised by the rule.
2020-08-18 16:38:22 -02:30
Dan J Miller
eb653dfb6e
New info tooltip component (#9180)
* Add info-tooltip and associated storybook stories

* Allow tooltip-v2 to support react-tippy themes

* Update info-tooltip to use tooltip-v2
2020-08-18 15:45:22 -02:30
Dan Miller
9787ca633b Improve scss naming 2020-08-18 15:27:47 -02:30
Whymarrh Whitby
4357cda7b8
Fix no-shadow issues (#9246)
See [`no-shadow`](https://eslint.org/docs/rules/no-shadow) for more information.

This change enables `no-shadow` and fixes the issues raised by the rule.
2020-08-18 14:06:45 -02:30
Brad Decker
d5a539e0e5
remove old tooltip component and styles (#9250)
The old tooltip component was only used in two places. Removing those usages
was simple and straight forward. So, instead of colocating the old tooltip
styles with the deprecated tooltip component, I removed all old styles and
made tooltip-v2 now simply 'tooltip' and removed the deprecated component.
2020-08-18 11:13:55 -05:00
Patryk Łucka
f7e4e209ef
move footer buttons to scrollable area (#9228)
Co-authored-by: Patryk Łucka <patryk.lucka@consensys.net>
2020-08-18 09:10:56 -05:00
Brad Decker
d5948f1cbe
colocate confirm-encryption-public-key page styles (#9251)
Follows the previously set pattern of colocating styles along side the
consuming components. This one was really straight forward and just a
reorganization of files and imports. No code changes occurred.
2020-08-18 09:10:15 -05:00
Brad Decker
2e565d02b2
Removes the dropdown menu and colocates old styles with account-menu (#9185)
The only place that these .menu styles were being used was the account-menu by way of components/app/dropdowns/menu. Because account-menu is the only place that used these styles I moved them to exist with the account-menu
2020-08-18 09:09:56 -05:00
Brad Decker
7bc2de006f
Colocate create-account styles with the create-account page (#9181)
Follows previous patterns of moving styles to exist alongside the components that use them. I would like these styles to be updated to use BEM syntax as well but I am holding off for a future PR to improve these styles.
2020-08-18 09:06:46 -05:00
Dan Miller
807acaa536 Add exchange-rate-display component 2020-08-18 11:23:54 -02:30
Whymarrh Whitby
e803807dd9
Fix no-param-reassign issues (#9235)
See [`no-param-reassign`](https://eslint.org/docs/rules/no-param-reassign) for more information.

This change enables `no-param-reassign` and fixes the issues raised by the rule.
2020-08-15 09:28:11 -02:30
Thomas Huang
87e5281a82
Clear Account Details in AppState (#9238)
* Clear Account Details in AppState

We store sensitive information in the AppState under accountDetail for when the modal is active and present. This adds a new action/reducer and componentWillUnmount to clean up the persisted data left after leaving the modal.

* Remove reduntant clearAccountDetails call when clicking done button
2020-08-14 16:08:26 -07:00
Patryk Łucka
aad840777d
Permit all-caps addresses (#9227)
* permit all-caps addresses

* handle empty address
2020-08-14 19:18:46 -03:00
Whymarrh Whitby
04bfe3772c
Delete page-container.component.test.js (#9229) 2020-08-14 12:52:38 -02:30
Whymarrh Whitby
2aa4b6bbee
Tidy up getAccountLink (#9223) 2020-08-14 12:31:59 -02:30
Whymarrh Whitby
937616565d
Tidy ConnectHardwareForm#checkIfUnlocked (#9224)
This change tidies up the implementation of `ConnectHardwareForm#checkIfUnlocked`—passing
an `async` function to `forEach` doesn't ensure that the one is run before the other.
2020-08-14 11:57:42 -02:30
Whymarrh Whitby
5d42a9b773
Fix require-unicode-regexp issues (#9212)
* Fix require-unicode-regexp issues

See [`require-unicode-regexp`](https://eslint.org/docs/rules/require-unicode-regexp) for more information.

This change enables `require-unicode-regexp` and fixes the issues raised by the rule.

* Remove case-insensitive flag from regexps
2020-08-14 09:18:42 -02:30
Whymarrh Whitby
884775cf71
Fix no-negated-condition issues (#9222)
See [`no-negated-condition`](https://eslint.org/docs/rules/no-negated-condition) for more information.

This change enables `no-negated-condition` and fixes the issues raised by the rule.
2020-08-14 09:17:43 -02:30
Whymarrh Whitby
c11888f287
Fix no-empty-function issues (#9216)
See [`no-empty-function`](https://eslint.org/docs/rules/no-empty-function) for more information.

This change enables `no-empty-function` and fixes the issues raised by the rule.
2020-08-14 09:17:02 -02:30
Whymarrh Whitby
9b78d3ab07
Fix import/extensions issues (#9217)
See [`import/extensions`](https://eslint.org/docs/rules/import/extensions) for more information.

This change enables `import/extensions` and fixes the issues raised by the rule.
2020-08-14 09:16:45 -02:30
Whymarrh Whitby
b91cf74d14
Fix no-nested-ternary issues (#9214)
See [`no-nested-ternary`](https://eslint.org/docs/rules/no-nested-ternary) for more information.

This change enables `no-nested-ternary` and fixes the issues raised by the rule.
2020-08-13 17:30:09 -02:30
Whymarrh Whitby
42e7d205b2
Fix no-dupe-else-if issues (#9208)
See [`no-dupe-else-if`](https://eslint.org/docs/rules/no-dupe-else-if) for more information.

This change enables `no-dupe-else-if` and fixes the issues raised by the rule.
2020-08-12 21:22:02 -02:30
Whymarrh Whitby
cd370be728
Fix no-invalid-this issues (#9207)
See [`no-invalid-this`](https://eslint.org/docs/rules/no-invalid-this) for more information.

This change enables `no-invalid-this` and fixes the issues raised by the rule.
2020-08-12 21:19:33 -02:30
Whymarrh Whitby
c0f05ccae6
Fix implicit-arrow-linebreak issues (#9201)
See [`implicit-arrow-linebreak`](https://eslint.org/docs/rules/implicit-arrow-linebreak) for more information.

This change enables `implicit-arrow-linebreak` and fixes the issues raised by the rule.
2020-08-12 21:19:10 -02:30
Whymarrh Whitby
310b15ba4a
Fix no-plusplus issues (#9206)
See [`no-plusplus`](https://eslint.org/docs/rules/no-plusplus) for more information.

This change enables `no-plusplus` and fixes the issues raised by the rule.
2020-08-12 20:36:44 -02:30
Whymarrh Whitby
548b0bbbd5
Fix no-eq-null issues (#9205)
See [`no-eq-null`](https://eslint.org/docs/rules/no-eq-null) for more information.

This change enables `no-eq-null` and fixes the issues raised by the rule.
2020-08-12 20:32:44 -02:30
Whymarrh Whitby
88f54e29fb
Fix no-empty issues (#9202)
See [`no-empty`](https://eslint.org/docs/rules/no-empty) for more information.

This change enables `no-empty` and fixes the issues raised by the rule.
2020-08-12 18:20:29 -02:30
Whymarrh Whitby
ef88d79fac
Fix no-useless-concat issues (#9200)
See [`no-useless-concat`](https://eslint.org/docs/rules/no-useless-concat) for more information.

This change enables `no-useless-concat` and fixes the issues raised by the rule.
2020-08-12 17:07:44 -02:30
Whymarrh Whitby
a8863a3446
Fix consistent-return issues (#9192)
See [`consistent-return`](https://eslint.org/docs/rules/consistent-return) for more information.

This change enables `consistent-return` and fixes the issues raised by the rule.
2020-08-12 16:36:57 -02:30
Whymarrh Whitby
885125ad03
Fix no-case-declarations issues (#9191)
See [`no-case-declarations`](https://eslint.org/docs/rules/no-case-declarations) for more information.

This change enables `no-case-declarations` and fixes the issues raised by the rule.
2020-08-12 14:11:27 -02:30
Brad Decker
b2813f0b54
colocate the base modal styles with the modal component (#9151)
finalizes the colocation of styles with the consuming components.
2020-08-12 12:49:45 -03:00
Erik Marks
163f45beed
Fix account modal back button styling (#9184) 2020-08-11 09:49:07 -07:00
Brad Decker
42be0645da
colocate original request-signature component styles (#9182)
Moves the styles out of the itcss folder and colocates them with the component, as per the pattern set elsewhere.
2020-08-11 11:29:19 -05:00
Erik Marks
ef68a7963c fix account modal back styling 2020-08-11 09:17:50 -07:00
Brad Decker
01f69d7e7a
colocate account modal styles with their components (#9150)
This one gets a bit more complicated because the styles were interwoven and needed to be untangled to be moved. Essentially, though, the goal is to put the styles where they make the most sense and colocate them with their components.
2020-08-11 11:07:47 -05:00
Brad Decker
6ba9e65712
colocate tab-bar styles with the tab-bar component (#9176)
Moves styles out of the itcss components folder and places them alongside the component.
2020-08-11 08:58:10 -05:00
Dan J Miller
b8edc32f48
Fee card component (#9169)
* Fee card component

* Clean up

* Style lint fixes
2020-08-11 10:59:24 -02:30
Mark Stacey
c557e25ba6
Add version dimension to background metrics (#9167)
The background metrics were missing the `version` custom dimension. It
has now been added to all background metric events.
2020-08-10 12:10:30 -03:00
Brad Decker
2e33b57d17
colocate hide-token-confirmation modal styles (#9149) 2020-08-07 14:31:02 -05:00
Erik Marks
e5cb63eea2
Add web3 usage metrics, prepare for web3 removal (#9144)
* add web3 usage metrics

* move web3 metrics method to new middleware

* rename some methods, files, and exports
2020-08-07 12:28:23 -07:00
Brad Decker
d59fc79e0f
colocate deposit-ether-modal styles (#9148)
Moves the still alive deposit-ether-modal styles to be colocated with it's component, as per the examples already in place in the components/modal folder
2020-08-07 13:57:33 -05:00
Mark Stacey
1419c14fb6
Use pathname instead of URL for currentPath metrics parameter (#9158)
The `currentPath` parameter passed to our metrics utility had been
passed the full URL rather than just the path, contrary to what the
name would imply. We only used the path portion, so passing the full
URL did lead to complications.

Now just the `pathname` is passed in, rather than the full URL. This
simplifies the metrics logic, and it incidentally fixes two bugs.

The main bug fixed is regarding Firefox metrics. Previously we had
assumed the `currentPath` would start with `chrome-extension://`, which
of course was not true on Firefox. This lead to us incorrectly parsing
the `currentPath`, so path tracking was broken for Firefox events.
This broken parsing is now bypassed entirely, so metrics should now
work the same on Firefox as on Chrome.

The second bug was that we were incorrectly setting the tracking URL
for background events during tests. As a result, we were incorrectly
detecting ourselves as an internal site that had referred the user to
us. But this was not of major concern, since it only affected test
metrics (which get sent to the development Matomo project).

Lastly, this change let us discard the `pathname` parameter used in
the `overrides` parameter of the `metricsEvent` function. Now that
`currentPath` is equivalent to `pathname`, the `pathname` parameter is
redundant.
2020-08-07 15:32:46 -03:00
Mark Stacey
8713927e5e
Remove url parameter from metricsEvent (#9157)
* Remove `url` parameter from `metricsEvent`

The `url` parameter was used to override the `currentPath`, but it
never worked correctly. It was supposed to be used for setting the
`url` query parameter that was sent to Matomo, but `currentPath` was
always used even if it `url` was set and `currentPath` was empty.

Instead, `currentPath` is now always used. There was never a need to
provide an "override" for `currentPath` when it can be set directly.
The metrics provider does set `currentPath` automatically by default,
but this can be overwritten already by passing a second parameter to
`metricsEvent`.

There were two places this `url` parameter was being used: background
events, and path changes. Background events were submitted with no
`currentPath`, so because of the bug with the `url` parameter, the
metrics utility would crash upon each event. So those were never
actually sent. This commit will fix that crash.

The `currentPath` parameter was supplied as an empty string for the
path change events, so those never crashed. They just had the `url`
query string parameter set incorrectly (to an empty string). It should
now be correctly populated, which should mean we'll be capturing all
path changes now. Previously we were only capturing path changes to
pages that happened to include an event, because of this blank `url`
problem.

* Use `url` query parameter as fallback for generating `pv_id`

The `pv_id` parameter currently isn't generated correctly on Firefox,
as the generation assumes that the current URL starts with
`chrome-extension://`. The `url` query parameter is still unique for
each path, so it's probably good enough for generating an id for each
page.

This is just a temporary fix; it will be removed in a future PR, where
Firefox will be properly supported.
2020-08-07 14:57:27 -03:00
Erik Marks
f18473a03d
Fix .network-name vertical alignment (#9152) 2020-08-07 09:05:31 -07:00
Brad Decker
f3ba18d79f
remove unused section scss (#9146) 2020-08-07 10:58:48 -05:00
Brad Decker
85e658993b
colocate notification-modal styles (#9147)
Follows former examples of colocating styles with the modals that use them.
2020-08-07 10:25:00 -05:00
Erik Marks
365a096e5b remove .network-name height 2020-08-06 15:45:02 -07:00
Dan J Miller
a914eae51e
Adds decETHToDecWEI util method (#9141) 2020-08-06 09:22:12 -07:00
Brad Decker
ecaa6c55dd
trim unused account-list-item code and co-locate styles (#9116) 2020-08-06 08:04:55 -05:00
Brad Decker
db1b72a95c
colocate editable label styles and code (#9120) 2020-08-05 08:44:17 -05:00
Brad Decker
b92475ac7c
Colocate alert styles (#9117) 2020-08-05 08:43:21 -05:00
Brad Decker
723e478689
move currency-display styles to where they are used (#9119) 2020-08-05 08:43:07 -05:00
Brad Decker
943d637cd2
remove unused tx-list styles (#9121) 2020-07-31 09:17:43 -05:00
Brad Decker
1c46715b46
delete unused confirm styles (#9118) 2020-07-31 09:17:29 -05:00
Brad Decker
1207d43945
update email us to contact us (#9104) 2020-07-29 16:05:19 -05:00
Brad Decker
46ba1ef100
Update font family globally (#9073) 2020-07-29 15:04:02 -05:00
Mark Stacey
b7715f6e70
Only log error on first occurrence of missing substitution (#9096)
A missing substitution for a localized message will now only log an
error upon the first occurrence. Further errors are generally not
useful.
2020-07-29 13:09:52 -03:00
Brad Decker
1582855e28
Use mixins for typography instead of placeholder selectors (#9072)
Using extend would not work inside of some css, namely
inside of media queries. This made it a clear choice to
use mixins for these styles.
2020-07-29 10:35:53 -05:00
Brad Decker
4cc3fff96a
Update css folder structure (#9071) 2020-07-28 15:16:30 -05:00
Mark Stacey
8a7c8e8aeb
Use environment variable for MetaMetrics project ID (#9094)
The MetaMetrics project ID can now be set via environment variable. It
has not been set yet in practice, so for now the old project IDs will
still be used. This is in preparation for migrating to a new project.
2020-07-28 16:59:27 -03:00
Mark Stacey
1e0ef76524
Use development metametrics project during tests (#9093)
e2e tests will now reference the development MetaMetrics project
instead of the production one. The metrics endpoint should be stubbed
out during e2e tests anyway, but this seemed like a better default
regardless.
2020-07-28 16:09:20 -03:00
Brad Decker
13aafa4702
Add euclid fontface (#9018) 2020-07-27 17:15:44 -05:00
ryanml
d9f07a796d
Complete onboarding upon importing/verifying seed (#8873)
Fixes #8679
2020-07-27 18:03:26 -03:00
Brad Decker
57715a8da1
support longer text in network dropdown (#9085) 2020-07-27 15:01:21 -05:00
ryanml
b4663eb78b
Fixes MetaMask/metamask-extension#8626 - verifies password on requesting seed phrase (#9063) 2020-07-24 19:47:40 -03:00
Brad Decker
df8eb494fe
Updates Typography Variables and styles. (#9017)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-07-24 11:26:45 -05:00
Bakhtiiar Muzakparov
1747f91bf1
Add tooltip to contacts (#8974)
Fixes #8790
2020-07-24 11:17:03 -03:00
Thomas Huang
17e9d85401
Resolve on 0x (#9048) 2020-07-22 11:05:23 -07:00
Mark Stacey
a0589d3290
Remove unused with-method-data HOC (#9050)
This higher-order-component has been unused since #6551
2020-07-22 12:41:16 -03:00
Whymarrh Whitby
bf6578c6b8
Enable guard-for-in rule (#9000) 2020-07-21 18:40:45 -02:30
Brad Decker
35a6ad98b3
Add accent-color usage from design system. (#9009) 2020-07-21 11:17:02 -05:00
Brad Decker
e463a47588
do not show amounts for approvals (#9032) 2020-07-21 10:45:14 -05:00
Whymarrh Whitby
2389777244
Fix invalid CSS rules (#9039) 2020-07-20 15:26:44 -02:30
Whymarrh Whitby
2ae4720443
Fix words (#9038) 2020-07-20 14:32:49 -02:30
Mark Stacey
7cd609b86b
Fix crash upon removing contact (#9031)
The UI would crash upon deleting a contact from the contact list. This
happened for two reasons: the deletion could result in a re-render
before the `history.push` finished navigating back to the contact list
(it was a race condition), and the contact entry left behind an invalid
`identities` entry when it was removed.

The first problem was fixed by making the container components for view
and edit contact more tolerant of being passed an `address` that
doesn't correspond to a contact. If they are given an address without a
contact, `null` is passed to the component via the `address` prop. The
component will redirect back to the list when this happens instead
rendering. This is more awkward than I'd like, but it was the most
sensible way of handling this I could think of without making much more
drastic changes to how we're handling routing here.

The second problem was caused by the `setAccountLabel` call, which was
used to ensure the contact entry for any wallet accounts was kept
in-sync with the account label. This was being called even for non-
wallet accounts though, which is where this problem arose. This step is
now skipped for non-wallet accounts.

Fixes #9019
2020-07-20 11:55:47 -03:00
Mark Stacey
ea8fa580be
Hide "delete" button when editing contact of wallet account (#9030)
Wallet accounts can't be deleted from the contact list. This button
never worked, nor should it.
2020-07-17 20:30:25 -03:00
Whymarrh Whitby
983e32274c Fix array-callback-return issues
See [`array-callback-return`](https://eslint.org/docs/rules/array-callback-return) for more information.

This change enables `array-callback-return` and fixes the issues raised by the
rule.
2020-07-17 16:03:33 -02:30
Brad Decker
549eb320e8
Narrow usages of 037DD6 to 'primary-blue' (#9008) 2020-07-17 13:11:04 -05:00
Brad Decker
9bf748eb44
Define Design System Colors (#9007)
Adds design system colors to the css/variables/colors file and deprecates
old colors in the deprecated itcss/variables folder
2020-07-17 11:13:45 -05:00
Mark Stacey
e8b33fb7c8
Restore state snapshot for Sentry errors (#9028)
The state snapshot that was attached to Sentry errors was removed
recently in #8794 because it had become too large. The snapshot has
now been restored and reduced in size.

A utility function has been written to reduce the state object to just
the requested properties. This seemed safer than filtering out state
that is known to be large or to contain identifiable information.
This is not a great solution, as now knowledge about the state shape
resides in this large constant, but it will suffice for now. I am
hopeful that we can decorate our controllers with this metadata in the
future instead, as part of the upcoming background controller refactor.

A separate `getSentryState` global function has been added to get the
reduced state, so that the old `getCleanAppState` function that we used
to use could remain unchanged. It's still useful to get that full state
copy while debugging, and in e2e tests.
2020-07-17 12:09:38 -03:00
Mark Stacey
fd2e02274a
Catch gas estimate errors (#9025)
There were two cases where bad gas estimate data was resulting in
crashes. These two places have been wrapped in a `try ... catch` to
handle the absence of gas estimate data.

The errors are still reported to Sentry so that we can track down the
root cause of this corrupted gas estimate data at some point in the
future. We plan on adding additional context to Sentry soon that should
help with this.

Fixes #8992
2020-07-16 20:29:22 -03:00
Brad Decker
c8e50c6b15
Deprecate itcss (#9005) 2020-07-16 15:14:07 -05:00
Mark Stacey
dbafa49448
Skip render when home page is closing or redirecting (#9012)
The Home page component is responsible for closing the notification
window and triggering redirects in various situations. When this
happens, the home page is briefly rendered before the redirect/close
happens. This is a waste of cycles, and is distracting for users.

We now render nothing if the page is in the process of redirecting or
reloading. None of the redirects handled in this component are for sub-
pages, so we don't need the Home page to render in any of these cases.

We were already doing this for redirects to transaction confirmations,
but now we're taking the same approach for all redirects, and for the
cases where the window is closed.
2020-07-16 15:23:07 -03:00
Mark Stacey
b97cd1dc04
Display pending notifications after connect flow (#9011)
The notification window is now kept open after the connect flow if
there are still pending confirmations. Previously, the notification
window would be closed after the connect flow no matter what, and any
pending confirmations would never be shown to the user.

This was accomplished by redirecting to the home screen after the
connect flow. The logic for deciding whether or not to close the window
is already handled by the home page. This does have the unfortunate
side-effect of briefly rendering the home page before the window
closes, but this is a minor problem that exists already in a number of
other scenarios, and it will be fixed in a subsequent PR.

Fixes #8973
2020-07-16 09:13:29 -03:00
Mark Stacey
7333d821b8
Hide loading indication after personal_sign (#9006)
The loading indication had remained after successfully signing with
`personal_sign`. This mistake was introduced accidentally in #8434.

This is noticeable if you confirm the signature in the popup UI or
fullscreen UI, as they remain open after signing. The notification UI
closes after signing without waiting for this loading indicator to be
removed.
2020-07-15 22:12:56 -03:00
Mark Stacey
acaa648779
Fix ListItem styles (#9002)
The styles for the `ListItem` component were recently broken in #8989
because of a change made by `stylelint`. It incorrectly removed the
`fr` unit because of the `length-zero-no-unit` rule. This was a bug
that has since been fixed in `stylelint`; it should have left the `fr`
unit in this case.
2020-07-15 17:13:33 -03:00
Mark Stacey
f46dda0195
Uncomment and fix all auto-fixable stylelint rules (#8989)
All stylelint rules that can be automatically fixed have been uncommented. The rules are:

* `at-rule-empty-line-before`
* `block-closing-brace-empty-line-before`
* `block-closing-brace-newline-before`
* `block-opening-brace-space-before`
* `color-hex-case`
* `color-hex-length`
* `comment-empty-line-before`
* `declaration-block-semicolon-newline-after`
* `declaration-block-semicolon-space-after`
* `declaration-block-trailing-semicolon`
* `declaration-colon-space-after`
* `declaration-empty-line-before`
* `function-comma-space-after`
* `function-comma-space-before`
* `indentation`
* `length-zero-no-unit`
* `no-eol-whitespace`
* `no-missing-end-of-source-newline`
* `number-leading-zero`
* `number-no-trailing-zeros`
* `rule-empty-line-before`
* `selector-list-comma-newline-after`
* `selector-pseudo-element-colon-notation`
2020-07-15 10:13:40 -03:00
Mark Stacey
a789c23faa
Replace inlined vendored CSS with import (#8986)
The vendored CSS required by `react-tippy` is now imported instead of
inlined. This should result in no functional changes, and it makes it
easier to lint our styles.

This was originally inlined in #3120 when `react-tippy` was first added
to the project. It has not been updated since then, so I don't think
there's any risk this has gotten out-of-sync.
2020-07-14 18:43:32 -03:00
Whymarrh Whitby
4f0a205369
Use eslint@6.8.0 (#8978)
* Use eslint@6.8.0
* yarn lint:fix
2020-07-14 12:50:41 -02:30
Mark Stacey
670ae111f0
Remove unnecessary optional chaining operator (#8892)
`state.activeTab` is always guaranteed to be set to an object before
the UI is initialized. This happens in `app/ui.js`.
2020-07-10 12:46:54 -03:00
Brad Decker
9c54b2d8d5
remove superfulous fonts (#8954) 2020-07-10 10:42:59 -05:00
Mark Stacey
d53c4f824e
Add personal_sign e2e test (#8958)
This tests the `personal_sign` method using the test dapp. This test
reflects part of the `confirm-sig-requests` integration test, which
tests the confirmation of a `personal_sign` signature request.

A `data-testid` prop was added to the 'Sign' button on the signature
request confirmation page, to make it easier to select the 'Sign'
button reliably.
2020-07-10 11:35:52 -03:00
Brad Decker
3cbcc913e9
update material-ui/core (#8950) 2020-07-09 16:05:44 -05:00
Mark Stacey
b485a9afb3
Add data-testid to the EthOverview balances (#8951)
Both the primary and secondary balance components on `EthOverview` now
have `data-testid` props, so that they can be more easily referenced in
e2e tests.

This required the addition of a `data-testid` prop to the component
`UserPreferencedCurrencyDisplay`, which is passed through to the
underlying `CurrencyDisplay` component.
2020-07-09 17:33:37 -03:00
Erik Marks
652db3fd36
Use string network and chain IDs (#8628)
* convert network id enums to string

* stringify appropriate chain/network ids in tests

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-07-08 14:05:09 -07:00
Brad Decker
cd4903f65e
remove ramda (#8932) 2020-07-08 15:17:53 -05:00
Dan J Miller
ac525572eb
Move checkExistingAddresses to helpers/utils/util and stop its use of ramda (#8868) 2020-07-07 19:18:18 -03:00
Thomas Huang
15d713f0ee
Standardize transaction activity conversion's currency to 'ETH' (#8934) 2020-07-07 15:15:42 -07:00
Erik Marks
8bc02d4b5e
rpc-cap@3.0.0 (#8924)
* rpc-cap@3.0.0

* adapt use of rpc-cap for new major version
2020-07-05 12:49:22 -07:00
Erik Marks
e20e42bb17
Rename confusing permissions-connect variable (#8925) 2020-07-05 12:38:02 -07:00
Mark Stacey
b0014a9b35
Handle suggested token resolved elsewhere (#8910)
When a suggested token was resolved in a different window, the popup
or notification UI could get stuck with an empty suggested token list,
where either action would throw an error.

This case is now handled by either redirecting or closing the window,
in the popup and notification cases respectively. This check is
performed on both component mount and update.
2020-07-03 13:16:31 -03:00
Mark Stacey
a4e7cff36e
Prevent confirming blank suggested token (#8909)
The "confirm suggested token" page allowed the confirm button to be
pressed even when there were no tokens to confirm. This can happen
sometimes when the page is in the process of redirecting.
2020-07-03 13:03:47 -03:00
Mark Stacey
4a989c339a
Fix activity log inline buttons (#8908)
The inline speedup and speedup cancellation buttons in the activity log
were broken. An exception would be thrown upon either button being
clicked, and nothing would happen from the user's perspective.

Both handlers were being passed a transaction id, which was a holdover
from before the transaction list redesign. The handlers passed for
these two actions now have the transaction id embedded, so it doesn't
need to be passed in anymore. They expect the click event to be passed
through instead.

The handlers passed also didn't handle closing the transaction details
modal when clicked. After fixing the first problem, they still didn't
work because the speedup/cancel dialog was shown behind the transaction
details modal.

Both issues are now fixed. Both buttons now close the transaction
details modal, and trigger the appropriate action.
2020-07-03 13:03:13 -03:00
Mark Stacey
564f76584b
Tolerate missing or falsey substitutions (#8907)
Previously the `getMessage` function would throw if a substitution was
falsey. Now it will accept any substitution, including `undefined`.

A substitution of `null` or `undefined` will still be reported to
Sentry and printed to the console as an error, but it will not
interrupt execution. Any `null` or `undefined` substitutions will be
rendered as empty strings.

Ideally we'd never pass in `null` or `undefined` as a substitution, but
in practice this sometimes just occurs breifly between renders, which
isn't a severe enough problem to justify crashing the UI.

The detection of React component substitutions has been updated as
well, to ensure that `null` values aren't counted as React
substitutions.
2020-07-03 13:02:35 -03:00
Mark Stacey
3832d694a4
Replace percentage opacity value (#8898)
The CSS `opacity` rule accepts percentages on newer browsers, but some
older browser versions we support (e.g. Firefox v60) doesn't support
them. A number is now used instead, which is supported by all browsers
we support.
2020-07-02 21:51:41 -03:00
Mark Stacey
f5d4ab1cc1
Include relative time polyfill locale data (#8896)
We were including the polyfill for the `Intl.RelativeTimeFormat` API,
but we weren't including any locale data. This polyfill doesn't work
without the locale data for whichever locale you're formatting.

The data for all locales we support is now included. The locale data
is loaded from disk as-needed (during app startup, and upon each change
in locale).
2020-07-02 21:34:48 -03:00
Mark Stacey
4855d1b423
Allow localized messages to not use substitutions (#8895)
The `getMessage` function in `i18n-helper` was assuming that any
substitutions passed into the transaction function were used by the
corresponding localized message. However, some messages are
intentionally ignoring substitutions passed in. This was done to
simplify the UI logic, so the same substitutions could be passed in for
many different messages, even if some don't use them.

For example, `transactionCancelSuccess` is passed two substitutions but
only uses the second one. `transactionErrored` is passed in two, but
uses neither.

`getMessage` has been updated to no longer make that assumption. It
will now only throw an error if the localized message expects a
substitution that was not given. A given substitution that is unused
results in no error.
2020-07-02 19:18:22 -03:00
Mark Stacey
d9a27fcf52
Prevent showing connected accounts without origin (#8891)
There was a case where the `activeTab.origin` was not set, yet the user
could still navigate to the "Connected accounts" modal, which assumes
that `activeTab.origin` is set. This would happen in Firefox when the
user opened the popup on a page internal to Firefox (e.g.
`about:blank`). The connected status indicator would still be shown,
but the UI would crash when it was clicked.

The connected status indicator is now hidden whenever
`activeTab.origin` is falsy. The 'Unconnected account' alert has also
been made impossible to trigger in that circumstance.
2020-07-02 18:26:30 -03:00
Brad Decker
68bcf38a65
fix language code format mismatch (#8889) 2020-07-02 15:13:23 -05:00
Mark Stacey
e4410724e9
Show origin in connect flow rather than site name (#8885)
The designs for the connect flow show the site `origin` below the site
icon rather than the site name. This was done for security reasons,
and because the site name is often set to an unwieldy long string.

This was accidentally undone in #8815 in the process of fixing a
separate bug. The origin has now been restored. More specific PropTypes
have been set on each use of the `domainMetadata` prop as well.
2020-07-02 14:08:43 -03:00
Dan J Miller
14fa80c105
Set min-height: 0 on page-container__bottom to fix overflow behaviour of add token list (#8874) 2020-07-01 05:52:36 -02:30
Whymarrh Whitby
80132f5580
Add envar for ETH Gas Station API key (#8870) 2020-06-29 14:56:21 -02:30
Esteban Miño
73257b1cd1
feature/sync imported accounts with mobile (#8631)
* sync imported accounts

* Update app/scripts/metamask-controller.js

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

* exportAccounts action

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-25 22:04:17 -03:00
Mark Stacey
2dbb151e0b
Fix account order on unconnected account alert (#8863)
The account list on the unconnected account alert was in the wrong
order; they were in the order provided by the permissions controller
rather than by last active.

The accounts are now sorted correctly; first by last active, second by
the keyring controller order.

The `getPermittedIdentitiesForCurrentTab` selector was removed because
it is no longer used.
2020-06-25 21:05:42 -03:00
Brad Decker
83fbf6608b
Restore list item title attributes (#8858) 2020-06-24 19:41:30 -03:00
Mark Stacey
5121fded67
Fix mobile sync redirect (#8860)
The mobile sync redirect was failing due to a typo in a prop. It would
fail to redirect correctly in the event of a timeout, or after pressing
'Cancel'.
2020-06-24 19:34:39 -03:00
Thomas Huang
85c81a5cfe
Align copy tooltip text and icon (#8861)
Add style prop to ReactTippy to override the inline display to flex display and align items to center
2020-06-24 15:34:18 -07:00
Mark Stacey
1d2644423e
Replace removed 'copy-to-clipboard' icon (#8853)
The 'copy-to-clipboard' icon was removed in #8190, and replaced with a
new 'Copy' icon component. It was still being used in two places
though, on the confirmation page for decryption and on the reveal seed
phrase screen..

The new Copy icon is now used in these two places instead. It has been
given a size of '17' to match the old icon size.
2020-06-24 12:10:29 -03:00
Mark Stacey
310d35c044
Stop upper-casing exported private key (#8850)
We were showing exported private keys in all upper case. This is
atypical, and many other wallets (e.g. MyCrypto) expect private keys
for imported accounts to be lower-cased. Our own account import is
tolerant of either case.
2020-06-24 10:34:10 -03:00
Brad Decker
41c8e486af
replace icons with Checkbox component (#8830)
in both permission flows the checkboxes were using the fa-check icon, and in the case
of the connected accounts popover the color of the icon was wrong. It occurred to me
while simply fixing that color would have been easier, we will be adding permissions
at some point in the future that a user will be able to 'uncheck'. This PR replaces
the usages of those icons with the Checkbox component that is equipped to handle the
interactivity of checking/unchecking.
2020-06-23 09:26:33 -05:00
Thomas Huang
4354e9eb93
Call getMethodDataAsync when knownMethodData[fourBytePrefix] object is empty (#8836)
Fixes #8835

In cases where the registry failed to load, and the sig is set to `{}` on this line: e85b162651/ui/app/helpers/utils/transactions.util.js (L78) this proceeds to set the method prefix to `{}` in knownMethodData.

Additionally check if the method prefix object is empty to proceed call getMethodDataAsync again.

I could only reproduce by intentionally failing the method registry lookup and found this solution. I could not find an instance where the registry consistently failed to lookup even on slow/throttled/high latency networks.
2020-06-22 21:30:45 -07:00
Erik Marks
b090625dc1
Update connected status popover content (#8834)
* update connected status popover content

* update highlight styling
2020-06-21 14:00:06 -07:00
Mark Stacey
c8be5d0779
Fix first time onboarding popup position (#8829)
The connected status indicator had been moved left since this popup was
first written. The position of the highlighted portion of the
background has been updated reflect this.
2020-06-17 15:12:41 -03:00
Brad Decker
c07bf62a73
fix overflowing contract names and origins (#8823)
* fix overflowing contract names and origins

Moves heading and subtitle into divs with h3/h2 children so that the
div can be display flex and still have ellipses overflow. Only the
heading was display flex but I wanted the two to have similar structure.
this allows subheading to be display flex in the future.

Also uses stripHttpSchemes to remove that from origin in the subheading

* rtl ellipses on domain

* Update ui/app/components/app/transaction-list-item/index.scss

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-17 11:38:15 -05:00
Mark Stacey
dafc5046ff
Hide 'Expand view' button in fullscreen (#8826)
The 'Expand view' button in the 'Account Options' menu was still being
shown on the fullscreen UI. This button is not useful in fullscreen, as
all it does is open the fullscreen UI. It is now hidden on the
fullscreen UI.
2020-06-17 00:40:56 -03:00
Erik Marks
b0187d3247
Fix permissions domain metadata retrieval (#8821)
* delete targetDomainMetadata selector

* fix permissions connect target domain metadata handling
2020-06-16 13:48:35 -07:00
Erik Marks
28cf728067 delete targetDomainMetadata selector 2020-06-16 11:34:08 -07:00
Brad Decker
4f3e9d70fa
remove top/bottom margin on info icon (#8822) 2020-06-16 13:05:03 -05:00
Brad Decker
61d9fcde35
add send token button on fullscreen asset list (#8812) 2020-06-16 13:04:51 -05:00
Erik Marks
d79bf8db2e fix getTargetDomainMetadata selector 2020-06-16 10:15:53 -07:00
Brad Decker
53e88b06b6
select current address in permissions connect (#8811)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-16 11:16:57 -05:00
Erik Marks
0813cc5c88
Fix encrypt/decrypt beforeunload bugs (#8816) 2020-06-16 07:40:00 -07:00
Mark Stacey
ec10323495
Fix site icon fallback letter (#8815)
The letter chosen for the fallback site icon was being set
inconsistently throughout the extension. The connect flow was using the
first letter of the `origin` for the letter (which was always `H`,
because `HTTP`), but the connect sites list and the account menu were
using the `name` from the domain metadata.

The `name` is now used for the fallback icon everywhere. A selector
that supplied a default domain metadata object has also been augmented
to use the `hostname` rather than the `origin` as a fallback name, to
match the behavior of the inpage provider.
2020-06-16 09:57:21 -03:00
Brad Decker
a6ee23cf9a
add hover style to list-item (#8813) 2020-06-15 17:36:32 -05:00
Mark Stacey
ad5e16cfa7
Fix site icon size (#8814)
A new `SiteIcon` component has been created for showing icons
representing web3 sites. The icon has a border and background, and it
has a fallback in case no icon is given. This new component accepts a
`size` prop that controls the size of the icon.

The old `IconWithFallback` component had a hard-coded size in the
SCSS styles for the icon, which was being overridden in a few places.
It was difficult to customize, and overly complicated.

The old `IconWithFallback` component is still used, but it's now
simpler. It only handles rendering the underlying `img` for the icon,
or the fallback letter if no image is given.

A separate `IconBorder` component has been created for the border and
white background used. It's solely used by `SiteIcon` for now, but I
intend to use it elsewhere as well, where this same pattern of a white
background is embedded.
2020-06-15 19:24:23 -03:00
Erik Marks
4dfe4e7463
Consolidate connected account alerts (#8802)
* update connected accounts appearance

* consolidate account alerts

* UnconnectedAccountAlert: use ConnectedAccountsList

* move switch account action out of menu in all views

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-15 12:08:53 -07:00
Brad Decker
955625278b
update button styling on home/asset page (#8800) 2020-06-15 12:02:38 -05:00
Mark Stacey
6ca18c3573
Fix handling of permissions of removed accounts (#8803)
Imported accounts can be removed, but the permissions controller is not
informed when this happens. Permissions are now removed as part of the
account removal process.

Additionally, the `getPermittedIdentitiesForCurrentTab` selector now
filters out any non-existent accounts, in case a render occurs in the
middle of an account removal.

This was resulting in a render crash upon opening the popup on a site
that was connected to the removed account.
2020-06-15 10:27:27 -03:00
Mark Stacey
bb087e3749
Hide token transfers on ETH asset page (#8799)
Token transfers will now be hidden on the ETH asset page. Arguably
token transfers are still relevant to show on the ETH asset page
because the gas for token transfers is paid in ETH, but they weren't
being displayed in a way that highlighted this (only the token amount
was shown inline - not the gas price).

We will likely restore token transfers to the ETH asset page at a later
date, after designs have been updated to highlight their relevance to
this page.
2020-06-12 23:06:33 -03:00
Mark Stacey
31bb86c596
Fix account name editing (#8801)
Editing the name of an account was accidentally made impossible when
FontAwesome was updated in #8256, because the icon we used to use for
the edit button (`fa fa-pencil`) was no longer free. The icon has been
switched to `fas fa-pencil-alt`, which is free.
2020-06-12 23:06:19 -03:00
Mark Stacey
f17aa87a65
Fix connect flow account list height (#8798)
The list of accounts shown on the first page of the connect flow takes
up the entire height of the window, even if there aren't enough
accounts to fill the space. This looks strange because of the border
around the account list, especially in the case where there are three
accounts in the list.

The list now cedes space to the footer if it can't fill the space
itself. The extra space is taken by whitespace between the footer and
the list.
2020-06-12 18:22:45 -03:00
Mark Stacey
53769a7b3a
Update color of menu item icons (#8797)
Menu item icons are now grey instead of black, as requested in design
QA feedback.
2020-06-12 17:09:47 -03:00
Mark Stacey
cf08131b49
Show fiat balance on token page (#8791)
The token page overview now shows the balance in fiat.
2020-06-12 15:47:39 -03:00
Mark Stacey
a100c55e64
Hide token fiat amounts on testnets (#8792)
The token amount is no longer shown in fiat on testnets, unless the
user has enabled the "Show fiat on testnets" setting.
2020-06-12 15:47:23 -03:00
Brad Decker
2f50e9fd72
Restore timing function (#8774)
* restore and enhance the time est feature

background: we had a feature for showing a time estimate on pending txs
that was accidently removed during the redesign implementation. This PR
restores that feature and also enhances it:
1. Displays the time estimate on all views instead of just fullscreen
2. Uses Intl.RelativeTimeFormat to format the time
3. Adds a way to toggle the feature flag.
4. Uses a hook to calculate the time remaining instead of a component

* Update app/_locales/en/messages.json

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

* do not display on test nets

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-12 13:46:01 -05:00
Erik Marks
5aabe2ac75
Warn users to only add custom networks that they trust (#8789)
* add warning when adding custom network

* give the settings subheader breathing space
2020-06-12 11:21:29 -07:00
Mark Stacey
3c98be4214
Show fiat amounts inline on token transfers (#8786)
Fiat amounts are now shown inline on token transfers in the transaction
list, where possible (i.e. where the conversion rates are known).

The logic for this hook is pretty tangled because it's used for so many
fundamentally different types of items (eth transactions, token
transactions, signature requests). In the future we should split these
into different components.

The documentation for the `useTokenFiatAmount` hook was updated to make
`tokenAmount` optional, but in practice it already worked as expected
without the amount being passed in.
2020-06-12 14:37:06 -03:00
Mark Stacey
016acd3e94
Refactor asset page component (#8788)
The asset page component has been split into three parts: the main
asset page wrapper, and a component for the content (either token or
native currency). This makes it easier to add functionality that is
specific to either token asset pages or native currency asset pages.
2020-06-12 14:04:40 -03:00
Erik Marks
1323233cfa
Make permission approval redirect flow consistent (#8755)
* make redirect flow consistent

* remove cancel redirect

* extract redirect component into own file
2020-06-12 09:38:20 -07:00
Brad Decker
73ba992125
use UI button for add token functionality (#8781) 2020-06-12 11:22:00 -05:00
Erik Marks
d1e645f671 fixup! fix redirect alignment and css class names 2020-06-12 09:09:42 -07:00
Erik Marks
0cec119fc8 fix redirect alignment and css class names 2020-06-12 09:09:24 -07:00
Erik Marks
d8e7fb4c42 address review feedback 2020-06-11 14:11:50 -07:00
Erik Marks
14a5e77edd fix classes 2020-06-11 13:56:29 -07:00
Mark Stacey
4ac4790cfa
Rename 'History' tab to 'Activity' (#8785)
'Activity' is a better name for this tab because it contains more than
just transactions. Signature requests are also included, and more non-
transaction activity may be included in the future.
2020-06-11 17:14:07 -03:00
Erik Marks
8bf1410f06 fix calling redirect immediately on cancel 2020-06-11 12:55:35 -07:00
Mark Stacey
058c63cf80
Use localized tab names on Home screen (#8784)
The tab names on the Home screen are now localized messages, rather
than being hard-coded as English.
2020-06-11 15:19:13 -03:00
ricky
71e7966b6a
Update Seed Phrase Functionality on Account Import (#8730)
Update seed phrase functionality to be able to conceal seed phrase (as a password field) so it remains hidden on screen.
2020-06-11 10:24:13 -04:00
Erik Marks
a5f4115969 fixup! only run beforeunload in notification UI 2020-06-10 22:14:17 -07:00
Erik Marks
222ccd9d44 only run beforeunload in notification UI 2020-06-10 22:13:55 -07:00
Erik Marks
c090bc7f40 remove home page flicker on notification close 2020-06-10 22:09:04 -07:00
Erik Marks
51956b2a14 handle multiple pending permissions requests 2020-06-10 21:50:49 -07:00