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

152 Commits

Author SHA1 Message Date
David Walsh
220a82b53f
Fix 9435 - Allow speeding up of underpriced transactions (#9687) 2020-10-28 16:56:58 -05:00
Whymarrh Whitby
6038a1f3f5
Fix dot-notation issues (#9679)
Refs #9663

This change enables `dot-notation` and fixes the issues raised by the rule.
2020-10-22 14:37:02 -02:30
Brad Decker
e5688c024e
consolidate segment setup (#9617)
Consolidates the background and UI segment implementations into a shared solution.

This results in the introduction of our first shared module.

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-10-21 16:10:55 -05:00
Dan J Miller
3191d9e014
Help users avoid insufficient gas prices in swaps (#9624)
* Don't show average (slowest) button in custom gas modal while in swaps

* In swaps, show warning in custom gas modal if price set below average price

* Update ui/app/selectors/custom-gas.js

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

* Fix typo

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-10-17 06:43:51 -02:30
Mark Stacey
ded43cbcdf
Remove unused code (#9564)
A number of unused parameters and `propTypes` have been merged, along
with an unused function.
2020-10-13 11:18:22 -02:30
Erik Marks
e071b4482e
Use chainId values for the address book (#9565)
* Delete CachedBalancesController.cachedBalances

* Migrate provider to Rinkeby instead of deleting it

* Convert hex transaction metamaskNetworkId values to decimal

* Don't migrate provider state in e2e tests

* Don't kick custom RPC users to Rinkeby unnecessarily

* Use provider.chainId for address book chainId values

* Add address book migration

* Fix failing unit test

* fixup! Merge branch 'develop' into address-book-use-chainId

* Select address book entries for display by chainId

* Merge all address book entry keys

* fixup! Merge all address book entry keys
2020-10-12 16:35:55 -07:00
Dan J Miller
0e37904692
Add useFastestButtons options to gas-customization modal and utilize it in swaps. (#9548) 2020-10-12 14:21:17 -02:30
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
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
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
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
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
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
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
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
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
2ae4720443
Fix words (#9038) 2020-07-20 14:32:49 -02:30
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
cd4903f65e
remove ramda (#8932) 2020-07-08 15:17:53 -05: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
Erik Marks
28cf728067 delete targetDomainMetadata selector 2020-06-16 11:34:08 -07:00
Erik Marks
d79bf8db2e fix getTargetDomainMetadata selector 2020-06-16 10:15:53 -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
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
Erik Marks
a84eedb7da
Permissions: Do not display HTTP/HTTPS URL schemes for unique hosts (#8768)
* only show URL.host in connected-accounts component

* strip scheme from URL for unique hosts

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-06-09 13:56:24 -07:00
Erik Marks
53c55d8522
Order accounts on connect page (#8762) 2020-06-08 13:23:48 -07:00
Erik Marks
bb78512bd6
Fix permissions connect close and redirect behavior (#8751)
* fix permissions connect close/redirect behavior

* improve permissions connect fullscreen close behavior

* fix multi ui perm conf redirect; consolidate perm selectors
2020-06-05 13:24:38 -07:00
Mark Stacey
8e1f40aedb
Handle connected accounts with no last active time (#8746)
The "Connected accounts" modal was throwing an exception when
attempting to render an account that has no `lastActive` time. The
component and related selector has been updated to no longer expect
the `lastActive` time to be set.

Prior to #8653 there was a guarantee that all connected accounts had a
`lastActive` time set, as the time would be set on any account returned
from the `eth_requestAccounts` call. But after #8653 only the primary
account was returned, so only the primary account had a `lastActive`
time set.

Fixes #8733
2020-06-05 13:07:23 -03:00
Erik Marks
616a446832
Use URL origin instead of hostname for permission domains (#8717)
* use URL.origin instead of hostname for tabs and permissions
2020-06-01 16:24:27 -07:00
Mark Stacey
df85ab6e10
Implement asset page (#8696)
A new page has been created for viewing assets. This replaces the old
`selectedToken` state, which previously would augment the home page
to show token-specific information.

The new asset page shows the standard token overview as seen previously
on the home page, plus a history filtered to show just transactions
relevant to that token.

The actions that were available in the old token list menu have been
moved to a "Token Options" menu that mirrors the "Account Options"
menu.

The `selectedTokenAddress` state has been removed, as it is no longer
being used for anything.

`getMetaMetricState` has been renamed to `getBackgroundMetaMetricState`
because its sole purpose is extracting data from the background state
to send metrics from the background. It's not really a selector, but
it was convenient for it to use the same selectors the UI uses to
extract background data, so I left it there for now.

A new Redux store has been added to track state related to browser history.
The most recent "overview" page (i.e. the home page or the asset page) is
currently being tracked, so that actions taken from the asset page can return
the user back to the asset page when the action has finished.
2020-06-01 14:54:32 -03:00
Mark Stacey
ddaa492751
Use send state for send flow token (#8695)
The chosen token in the `send` flow was set from one of two places:
`metamask.selectedTokenAddress` or `metamask.send.token`. The former is
used most of the time, but the latter is used for the 'Edit' button
shown in the upper-left of the confirmation UI.

The send flow will now exclusively use `metamask.send.token` for the
token state during the send flow. `metamask.selectedTokenAddress` is
now only used for the selected token state on the Home screen. This
simplifies the Redux state, as the send token is now in one place
instead of two, and `metamask.selectedTokenAddress` has only one
purpose.
2020-05-29 14:46:10 -03:00
Mark Stacey
88bed7181f
Refactor token selectors (#8671)
Unused token selectors have been removed, and the remaining token
selector has been moved to the `metamask` Redux store.
2020-05-28 21:43:44 -03:00
Mark Stacey
7ff3b4c928
Extract selected token from token input (#8692)
The `TokenInput` component now takes the token as a prop, instead of
using the `selectedTokenAddress` state. The `UserPreferencedTokenInput`
component that wrapped `TokenInput` has also been updated to take the
token as a prop.
2020-05-28 19:08:11 -03:00
Mark Stacey
8ed4510d90
Remove unused getSelectedTokenAssetImage selector (#8691)
This selector has been unused as of #8637
2020-05-28 17:17:04 -03:00
Mark Stacey
795676d3ec
Remove getTxParams (#8676)
This function primarily ensured that there was a reasonable fallback
for `txParams` if the given transaction was missing it. This fallback
was only used in one place: the customize gas modal, during the send
flow specifically.

The helper function has been removed, and the default `txParams` is set
in the one place it was needed. In the future we should attempt to
simplify this modal so it doesn't need to know details about the
context in which it's being used.
2020-05-28 16:39:33 -03:00
Mark Stacey
95a95ee4bc
Refactor transaction list token filtering (#8669)
The transaction list now filters by token in the `TransactionList`
component instead of in the transaction selector. This was done in
preparation for the asset page work.

Technically this approach is slightly less efficient than before, as
we're now filtering the transactions after they've been grouped
together rather than beforehand. The difference is minimal though, and
this method is more correct.

The old filtering was broken because it inappropriately filtered out
cancel transactions. Cancel transactions always have the `to` address
set to the same as the `from` address, and the token filter only
returned transactions where the `to` address was set to the token
address.

Now that we're only filtering by the `to` address of the initial
transaction, token transaction groups will be included in their
entirety, including any cancel transactions.
2020-05-28 00:11:15 -03:00
Whymarrh Whitby
4802ed1df5
Localize permission descriptions (#8661) 2020-05-27 18:15:10 -02:30
Brad Decker
706dc02cb4
Implement new transaction list design (#8564)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-05-26 15:49:11 -05:00
Whymarrh Whitby
ab11e0b623
Rename preferencesSelector selector to getPreferences (#8647) 2020-05-26 03:41:58 -02:30
Whymarrh Whitby
e4b8cddf02
Disallow all anonymous default export, aside from CSF and migrations (#8535)
CSF = Storybook’s Component Story Format (CSF)

See https://storybook.js.org/docs/formats/component-story-format/

Note that the migrations still use CommonJS require, so the default export as
an object is quite ergonomic (& I don't want to touch the migrations).
2020-05-18 21:18:11 -02:30
Whymarrh Whitby
3244449ab9
Use activeTab.origin where possible (#8617)
This changeset updates the `getOriginOfCurrentTab` selector and the container
for the ConnectedSites page to use `activeTab.origin` instead of parsing the
URL. The `activeTab` URL is parsed in `queryCurrentActiveTab` before the UI is
launched and any subsequent parsing of the URL is unnecessary.

See `queryCurrentActiveTab` in `ui.js:86` [1].

  [1]:e7bb0876f5/app/scripts/ui.js (L86-L118)
2020-05-18 20:04:51 -02:30
Mark Stacey
0033a64e5d
Connected accounts secondary sort order (#8608)
The connected accounts are now ordered by keyring controller order
whenever the `lastSelected` time is equal. This ensures the order is
identical to what connected sites see. This is especially important
when no accounts have been selected, as it ensures the correct account
is marked as the "Primary" account.
2020-05-18 13:31:11 -03:00
Whymarrh Whitby
d488c16df5
Add Connected Accounts modal (#8313) 2020-05-15 15:53:52 -03:00
Mark Stacey
f9eb1440e4
Always return a Boolean from getShowFiatSelector (#8585)
`getShowFiatSelector` would return the `showFiatInTestnets` value
directly when on mainnet, which could be `undefined`. Now it is cast to
a Boolean instead.

This was done to fix a PropType warning in a component that will be
included in a future PR, where this selector was used for a required
prop.
2020-05-13 11:53:27 -03:00
Erik Marks
0470386326
Delete recent blocks controller (#8575)
* delete recent blocks controller

* delete percentile from direct dependencies
2020-05-12 12:40:33 -07:00
Brad Decker
0aa41e397e
factor out containers for currency components (#8543) 2020-05-12 14:07:35 -05:00
Erik Marks
54b423d407
Fix domain selector (#8574)
* fix domain selector

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-05-12 09:29:45 -07:00