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

9807 Commits

Author SHA1 Message Date
Miranda Ruiz
69def1fcab Create FUNDING.yml (#7669)
* Add our opencollective page
2019-12-12 12:34:40 -04:00
Whymarrh Whitby
b5040266a0
Add description to Reset Account in settings (#7686)
* Add description to Reset Account in settings
* Update description copy
2019-12-12 12:10:30 -03:30
Whymarrh Whitby
5958eccf46
Remove unused ExtensionPlatform#queryTabs method (#7691) 2019-12-11 18:45:19 -03:30
ricky
e5682eec38
Add lint:shellcheck:package (#7568)
* Add lint:shellcheck:package

* Add double quote as per jq suggestion

* Use single quotes

* Ignore SC2016

* Use shellcheck script

* Set some flags

* Put shellcheck --version on new line

* Disable SC2016 (singe quotes is actually what we want here)
2019-12-11 15:52:08 -05:00
Mark Stacey
12fb5ad985 Refactor webdriver setup (#7690)
The setup for each browser web driver instance has been extracted from
`helpers.js` and moved to the `webdriver` directory.
2019-12-11 11:14:58 -08:00
Mark Stacey
eadeaa7883 End-to-end test state fixtures (#7663)
* Add network store for testing

An alternative persistent state store has been created for use with e2e
tests. Instead of reading state from disk, it tries to load state from
a local fixture server running on port `12345` and serving state from
the path `/state.json`, and returns a blank state otherwise.

* Add e2e test fixture server

A fixture server has been added for serving background state, which the
background will read upon startup as part of restoring persisted state.

The `signature-request` e2e test has been updated to use a fixture to
bypass the registration step. The fixture used (`imported-account`) was
generated by pausing midway through that test run
2019-12-11 09:26:20 -08:00
Whymarrh Whitby
34b674c3d7
Remove unneeded Edge-specific encryption code (#7683) 2019-12-10 16:34:50 -03:30
Whymarrh Whitby
c8d8d8d93d
Remove link to missing Edge build from MMbot comment (#7682) 2019-12-10 16:33:58 -03:30
Mark Stacey
958ac69ba1
Consolidate E2E test helper functions into helper.js (#7684)
E2E test helper functions were split between `helper.js` and `func.js`.
They've now all been moved to `helper.js`.
2019-12-10 15:23:25 -04:00
Mark Stacey
885d30f90a
Remove unused test methods (#7679)
These helper methods were no longer used in any e2e tests.
2019-12-10 09:52:48 -04:00
Mark Stacey
3ce19ee11d
Remove unused gasExpress fetch mocks (#7681)
These fetch mocks have been unnecessary since #7059
2019-12-10 09:52:34 -04:00
Whymarrh Whitby
7af09d036f
yarn remove react-hyperscript (#7680) 2019-12-09 21:12:13 -03:30
Whymarrh Whitby
8afbcd8e86
Add INR currency option (#7673) 2019-12-09 20:58:33 -03:30
Mark Stacey
812c546acd
Contract test dapp improvements (#7587)
* Add Get Accounts button

This button calls `eth_accounts`. This button is always enabled, even
when not connected.

* Disable account buttons by default

The buttons that require you to have first connected have been disabled
by default. Previously they would be enabled until the JavaScript
finished initializing the page, at which point they'd be disabled. This
resulted in a distracting flash as the page loaded and the buttons
changed.

The `signTypedData` button was added to the accounts button set as
well, rather than being left enabled regardless of connected status.

* Allow connect button to become re-enabled

The Connect button was broken previously in that after being disabled,
it would stay disabled even if the dapp lost access to MetaMask. The
button will now be enabled whenever not connected.

* Stringify signTypedData results

* Defer metamask onboarding bundle to speed up page load
2019-12-09 14:31:47 -04:00
Whymarrh Whitby
29da5cc7e8
Remove some unused MetaMaskController methods (#7666) 2019-12-09 13:11:44 -03:30
Whymarrh Whitby
56d9c06402
Clean up list of available currencies (#7667) 2019-12-09 13:09:46 -03:30
Mark Stacey
476e422714
Use Ganache programmatically in e2e tests (#7664)
The `ganache.js` helper module uses `ganache-core` to start `ganache`
instead of `ganache-cli`, and allows all of the same customization.
Using `ganache` programmatically from our e2e tests is much faster, as
we don't have to wait that arbitrary 5 seconds before each test as we
wait for `ganache-cli` to start up.
2019-12-09 10:40:43 -04:00
Mark Stacey
49a525b9f8
Add react/no-unused-prop-types ESLint rule (#7655)
* Add `react/no-unused-prop-types` rule

All detected unused prop types have been removed. I have attempted to
ensure these props are no longer passed in either.

* Update handling of props to avoid false positive lint errors

These cases were detected by `react/no-unused-prop-types` as being
unused props, even though they were used. These minor adjustments
prevent them from being flagged as errors.

* Update unit tests

Many of these tests were just checking that specific props were passed
from containers or to a child component. These were deleted, as I can't
imagine how they'd be useful.

* Disable `react/no-unused-prop-types` in `componentWillReceiveProps

The rule `react/no-unused-prop-types` doesn't seem to be detecting
props used within `UNSAFE_componentWillReceiveProps`. The two cases
have been disabled temporarily until we can replace these unsafe
lifecycle functions.
2019-12-07 23:10:47 -04:00
Mark Stacey
265d253f09
Remove unused function parameter (#7656) 2019-12-06 12:14:50 -04:00
ricky
1c4f2aab8f React 16 upgrade (#7476)
* Use arrow property initializer functions

* Use pure components where applicable

* Add UNSAFE_ prefix for deprecated lifecycle hooks

* Add allow UNSAFE_

* Removed unused "Component"

* Replace boron with 'fade-modal'

* Upgrade react/no-deprecated to an error

* Paste react-tooltip-component source directly

* Use arrow functions to bind `this`

* Add UNSAFE_ prefix

* Update react-redux, react-router-dom

* Remove things from inlined 'fade-modal'

* Adjust mountWithRouter to get unit tests passing again

* Remove domkit

* Add Wrapper to render-helpers

* Upgrade @storybook/addon-knobs
2019-12-06 11:40:06 -04:00
Mark Stacey
975419db54
Add ESLint rule no-async-promise-executor (#7659)
This rule prevents using an async function as a Promise executor (e.g.
as the argument to a `Promise` constructor). This pattern is usually a
mistake because it implies that the Promise constructor was not
necessary in the first place. It also makes error handling difficult,
as any errors thrown would be uncaught unless you wrap the body in a
try/catch block.
2019-12-06 11:32:36 -04:00
Mark Stacey
e87e79870a
Add missing PropTypes (#7658)
The props for `send` were also sorted, to make them easier to compare.
I only bothered because they were _almost_ sorted already.
2019-12-06 11:32:03 -04:00
Mark Stacey
b34c663712
Rename render function props from Route (#7657)
The props parameter from the `Route` render function has been renamed
to `routeProps` to avoid confusion with the component props.
2019-12-06 09:43:50 -04:00
Mark Stacey
e060e4c71f
Improve Sentry publish script (#7417)
The script will now throw an error if it fails to upload build
artifacts, rather than failing silently.
2019-12-05 17:59:48 -04:00
Mark Stacey
63bd422840
Handle one specific permissions request per tab (#7620)
The connect route now takes a route parameter: the permissions request
id. This id is set whenever the permissions connect screen is opened,
ensuring that that tab is for that specific request alone.

This makes handling of multiple permissions requests a bit more
intuitive. Previously whenever opening multiple permissions requests,
the first one would be shown on each successive tab, whereas you
would expect each tab to show the request that prompted the tab to
open. Users may now address permissions request in whichever order
they'd like to, rather than being forced to deal with them
chronologically.
2019-12-05 17:05:50 -04:00
Frankie
446463bbf9 migrations - include 40 so that it runs on update (#7652) 2019-12-05 16:22:25 -04:00
Frankie
71a89df8ee
transactions/pending - buffer 3 blocks before dropping a tx (#7483)
* transactions/pending - buffer 3 blocks before dropping a tx

* transactions/pending - only increment for dropped txs
2019-12-05 09:34:10 -10:00
Mark Stacey
eeb329adf7
Fix the permissions connect screen MetaMask logo (#7641)
The MetaMask logo was throwing an exception because the `history` prop
from React Router wasn't being passed in. However, even if it was
passed in, clicking on the logo wouldn't have done anything because the
home route redirects back to the permission connect page.

Instead the logo now isn't given an `onClick` handler. The
`MetaFoxLogo` component has been updated to only set `cursor: pointer`
if given an `onClick` handler.
2019-12-04 19:57:30 -04:00
Dan Finlay
30304913eb
Merge pull request #7591 from whymarrh/eslint-object-curly-spacing
Enable object-curly-spacing rule for ESLint
2019-12-04 10:25:32 -08:00
Dan Finlay
6aa0bec751
Merge pull request #7573 from whymarrh/eslint-no-confusing-arrow
Enable no-confusing-arrow rule for ESLint
2019-12-04 10:23:57 -08:00
Thomas Huang
0b8f74ede5
Remove random comma (#7639) 2019-12-03 21:35:44 -08:00
Mark Stacey
5c5c90e70a
Ignore permission approval/rejection if request is missing (#7638)
Attempts to approve or reject a permissions request that is no longer
pending will now emit a warning instead of throwing an exception.

I _think_ this can happen by clicking 'Submit' on the Permission
Connect screen twice, though I've been unable to reproduce that. I know
that it can be done if using multiple windows though. While it is
possible we have a UI bug somewhere (e.g. maybe we're not preventing
'Submit' from being clicked twice), I don't think it's possible to
eliminate the chance of this happening altogether, so we'd best prepare
for it.
2019-12-03 23:13:47 -04:00
Whymarrh Whitby
03f53df3f3
Updates to account search functionality (#7637) 2019-12-03 23:25:00 -03:30
Mark Stacey
2d6ad7f6ca
Update permissions request parameter names and docs (#7636)
The parameter names and JSDoc comments for `approvePermissionsRequest`
and `rejectPermissionsRequest` were incorrect in a few places.
2019-12-03 22:52:14 -04:00
Paweł Lula
638e242ce6 Search accounts by name (#7261)
Co-Authored-By: Paweł Lula <pavloblack@hotmail.com>
Co-Authored-By: Mark Stacey <markjstacey@gmail.com>
2019-12-03 22:51:55 -03:30
Mark Stacey
6e0b8f80ad
Merge pull request #7633 from MetaMask/master-sync
Master sync
2019-12-03 21:35:17 -04:00
Thomas Huang
bc67d1eeca
Revert "Update Wyre ETH purchase url" (#7631)
* Revert "Update Wyre buy ETH URL (#7482)"

This reverts commit 015ba83c6e.

* Change test description from coinbase to wyre
2019-12-03 17:12:14 -08:00
Mark Stacey
31a4788bf9
Fix private key export (#7632)
There were a few older actions that were written such that they assumed
`this` referred to the `actions` object. That assumption no longer held
as of #7561. These actions have been updated to refer directly to the
actions object instead.
2019-12-03 19:39:26 -04:00
Mark Stacey
dfb63ee88b Merge remote-tracking branch 'origin/develop' into master-sync
* origin/develop:
  Fix SimpleDropdown event bubbling (#7627)
  Remove unneeded store connections (#7625)
  Replace wild random number key with index (#7629)
  Use ES6 exports for selectors (#7626)
  Fix a typo made comparing previous prop (#7628)
  Connect distinct accounts per site (#7004)
  eslint: Enable more react/jsx-* rules (#7592)
  Enable react/no-unused-state rule for ESLint (#7609)
  Enable no-var rule for ESLint (#7590)
  Process URL fragment for ens-ipfs redirects (#7604)
  add locale fix script (#7580)
  Prevent redux state mutation (#7598)
2019-12-03 18:45:35 -04:00
Whymarrh Whitby
4ec92ceed3
Fix SimpleDropdown event bubbling (#7627) 2019-12-03 17:44:19 -03:30
Whymarrh Whitby
b8e3957542
Remove unneeded store connections (#7625) 2019-12-03 17:34:16 -03:30
Whymarrh Whitby
274a9ecf53 yarn lint --fix 2019-12-03 17:20:55 -03:30
Whymarrh Whitby
5ed921cb76 eslint: Enable object-curly-spacing ESLint rule 2019-12-03 17:18:23 -03:30
Whymarrh Whitby
7e22244c03
Replace wild random number key with index (#7629) 2019-12-03 16:53:25 -03:30
Mark Stacey
d9bdba5948
Use ES6 exports for selectors (#7626)
This lets us get rid of the big `selectors` object that was unpleasant
to maintain.
2019-12-03 16:04:28 -04:00
Mark Stacey
b4fd7aea32
Fix a typo made comparing previous prop (#7628)
The prop `prevIsAccountMenuOpen` was referenced in `prevProps`, despite
it not existing. It seems clear from the context that the intention
was to check the `isAccountMenuOpen` prop from `prevProps`, and name
the local variable `prevIsAccountMenuOpen`.
2019-12-03 15:16:59 -04:00
Dan Finlay
1110287fe1
Merge pull request #7599 from MetaMask/Version-v7.7.0
Version v7.7.0 RC
2019-12-03 10:22:40 -08:00
Dan Miller
4100c1c104 Update changelog for v7.7.0 2019-12-03 13:39:25 -04:00
MetaMask Bot
ff85173329 Version v7.7.0 2019-12-03 13:39:25 -04:00
Dan Finlay
76b1699621 Connect distinct accounts per site (#7004)
* add PermissionsController

remove provider approval controller
integrate rpc-cap
create PermissionsController
move provider approval functionality to permissions controller
add permissions approval ui, settings page
add permissions activity and history
move some functionality to metamask-inpage-provider
rename siteMetadata -> domainMetadata

add accountsChange notification to inpage provider
move functionality to inpage provider
update inpage provider
Remove 'Connections' settings page (#7369)
add hooks for exposing accounts in settings
rename unused messages in non-English locales

Add external extension id to metadata (#7396)

update inpage provider, rpc-cap
add eth_requestAccounts handling to background
prevent notifying connections if extension is locked
update inpage provider
Fix lint errors
add migration
review fixes
transaction controller review updates
removed unused messages

* Login Per Site UI (#7368)

* LoginPerSite original UI changes to keep

* First commit

* Get necessary connected tab info for redirect and icon display for permissioned sites

* Fix up designs and add missing features

* Some lint fixes

* More lint fixes

* Ensures the tx controller + tx-state-manager orders transactions in the order they are received

* Code cleanup for LoginPerSite-ui

* Update e2e tests to use new connection flow

* Fix display of connect screen and app header after login when connect request present

* Update metamask-responsive-ui.spec for new item in accounts dropdown

* Fix approve container by replacing approvedOrigins with domainMetaData

* Adds test/e2e/permissions.spec.js

* Correctly handle cancellation of a permissions request

* Redirect to home after disconnecting all sites / cancelling all permissions

* Fix display of site icons in menu

* Fix height of permissions page container

* Remove unused locale messages

* Set default values for openExternalTabs and tabIdOrigins in account-menu.container

* More code cleanup for LoginPerSite-ui

* Use extensions api to close tab in permissions-connect

* Remove unnecessary change in domIsReady() in contentscript

* Remove unnecessary private function markers and class methods (for background tab info) in metamask-controller.

* Adds getOriginOfCurrentTab selector

* Adds IconWithFallback component and substitutes for appropriate cases

* Add and utilize font mixins

* Remove unused  method in disconnect-all.container.js

* Simplify buttonSizeLarge code in page-container-footer.component.js

* Add and utilize getAccountsWithLabels selector

* Remove console.log in ui/app/store/actions.js

* Change last connected time format to yyyy-M-d

* Fix css associated with IconWithFallback change

* Ensure tracked openNonMetamaskTabsIDs are correctly set to inactive on tab changes

* Code cleanup for LoginPerSite-ui

* Use reusable function for modifying openNonMetamaskTabsIDs in background.js

* Enables automatic switching to connected account when connected domain is open

* Prevent exploit of tabIdOriginMap in background.js

* Remove unneeded code from contentscript.js

* Simplify current tab origin and window opener logic using remotePort listener tabs.queryTabs

* Design and styling fixes for LoginPerSite-ui

* Fix permissionHistory and permission logging for eth_requestAccounts and eth_accounts

* Front end changes to support display of lastConnected time in connected and permissions screens

* Fix lint errors

* Refactor structure of permissionsHistory

* Fix default values and object modifications for domain and permissionsHistory related data

* Fix connecting to new accounts from modal

* Replace retweet.svg with connect-white.svg

* Fix signature-request.spec

* Update metamask-inpage-provider version

* Fix permissions e2e tests

* Remove unneeded delay from test/e2e/signature-request.spec.js

* Add delay before attempting to retrieve network id in dapp in ethereum-on=.spec

* Use requestAccountTabIds strategy for determining tab id that opened a given window

* Improve default values for permissions requests

* Add some message descriptions to app/_locales/en/messages.json

* Code clean up in permission controller

* Stopped deep cloning object in mapObjectValues

* Bump metamask-inpage-provider version

* Add missing description in app/_locales/en/messages.json

* Return promises from queryTabs and switchToTab of extension.js

* Remove unused getAllPermissions function

* Use default props in icon-with-fallback.component.js

* Stop passing  to permissions controller

* Delete no longer used clear-approved-origins modal code

* Remove duplicate imports in ui/app/components/app/index.scss

* Use URL instead of regex in getOriginFromUrl()

* Add runtime error checking to platform, promise based extension.tab methods

* Support permission requests from external extensions

* Improve font size and colour of the domain origin on the permission confirmation screen

* Add support for toggling permissions

* Ensure getRenderablePermissionsDomains only returns domains with exposedAccount caveat permissions

* Remove unused code from LoginPerSite-ui branch

* Ensure modal closes on Enter press for new-account-modal.component.js

* Lint fix

* fixup! Login Per Site UI (#7368)

* Some code cleanup for LoginPerSite

* Adds UX for connecting to dapps via the connected sites screen (#7593)

* Adds UX for connecting to dapps via the connected sites screen

* Use openMetaMaskTabIds from background.js to determine if current active tab is MetaMask

* Delete unused permissions controller methods

* Fixes two small bugs in the LoginPerSite ui (#7595)

* Restore `providerRequest` message translations (#7600)

This message was removed, but it was replaced with a very similar
message called `likeToConnect`. The only difference is that the new
message has "MetaMask" in it. Preserving these messages without
"MetaMask" is probably better than deleting them, so these messages
have all been restored and renamed to `likeToConnect`.

* Login per site no sitemetadata fix (#7610)

* Support connected sites for which we have no site metadata.

* Change property containing subtitle info often populated by origin to a more accurate of purpose name

* Lint fix

* Improve disconnection modal messages (#7612)

* Improve disconnectAccountModalDescription and disconnectAllModalDescription messages

* Update disconnectAccountModalDescription app/_locales/en/messages.json

Co-Authored-By: Mark Stacey <markjstacey@gmail.com>

* Improve disconnectAccount modal message clarity

* Adds cancel button to the account selection screen of the permissions request flow (#7613)

* Fix eth_accounts permission language & selectability (#7614)

* fix eth_accounts language & selectability

* fix MetaMask capitalization in all messages

* Close sidebar when opening connected sites (#7611)

The 'Connected Sites' button in the accounts details now closes the
sidebar, if it is open. This was accomplished by pulling the click
handler for that button up to the wallet view component, where another
button already followed a similar pattern of closing the sidebar.

It seemed confusing to me that one handler was in the `AccountsDetails`
container component, and one was handed down from above, so I added
PropTypes to the container component.

I'm not sure that the WalletView component is the best place for this
logic, but I've put it there for now to be consistent with the add
token button.

* Reject permissions request upon tab close (#7618)

Permissions requests are now rejected when the page is closed. This
only applies to the full-screen view, as that is the view permission
requests should be handled in. The case where the user deals with the
request through a different view is handled in #7617

* Handle tab update failure (#7619)

`extension.tabs.update` can sometimes fail if the user interacts with
the tabs directly around the same time. The redirect flow has been
updated to ensure that the permissions tab is still closed in that
case. The user is on their own to find the dapp tab again in that case.

* Login per site tab popup fixes (#7617)

* Handle redirect in response to state update in permissions-connect

* Ensure origin is available to permissions-connect subcomponents during redirect

* Hide app bar whenever on redirect route

* Improvements to handling of redirects in permissions-connect

* Ensure permission request id change handling only happens when page is not null

* Lint fix

* Decouple confirm transaction screen from the selected address (#7622)

* Avoid race condtion that could prevent contextual account switching (#7623)

There was a race condition in the logic responsible for switching the
selected account based upon the active tab. It was asynchronously
querying the active tab, then assuming it had been retrieved later.

The active tab info itself was already in the redux store in another
spot, one that is guaranteed to be set before the UI renders. The
race condition was avoided by deleting the duplicate state, and using
the other active tab state.

* Only redirect back to dapp if current tab is active (#7621)

The "redirect back to dapp" behaviour can be disruptive when the
permissions connect tab is not active. The purpose of the redirect was
to maintain context between the dapp and the permissions request, but
if the user has already moved to another tab, that no longer applies.

* Fix JSX style lint errors

* Remove unused state
2019-12-03 13:39:25 -04:00