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

1017 Commits

Author SHA1 Message Date
Erik Marks
0813cc5c88
Fix encrypt/decrypt beforeunload bugs (#8816) 2020-06-16 07:40:00 -07:00
Mark Stacey
1fb15a52bb
Stop reporting failed transactions to Sentry (#8795)
These error reports are not useful.
2020-06-12 16:41:57 -03:00
Mark Stacey
37da64aa7e
Omit state snapshot from Sentry errors (#8794)
The state snapshot we were attaching to Sentry errors was too large.
As a temporary solution, it has been removed completely. We can re-add
it later after reducing its size.
2020-06-12 16:13:14 -03:00
Mark Stacey
e85b162651
Add MESSAGE_TYPE enum (#8743)
Each "message" requiring a user confirmation has a unique `type`
property. These `type` properties have all been added as enums, and the
enum is now used wherever the literal string was used previously.
2020-06-04 16:22:45 -03: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
9e2e353a24
Define global web3 as non-enumerable (#8634)
We inject `web3` globally on most websites. This has been breaking
websites that attempted to serialize the `window` object, because any
attempt to access certain `web3` properties (such as `web3.eth.mining`)
would throw an error. This is because `web3` defined a getter for these
properties that would call `.send([method])`, which doesn't work for
most methods.

An example of a site that this breaks is `Storybook`, when the
`@storybook/addon-actions` addon is being used. When using storybook
with this addon and with the MetaMask extension installed, actions
would not be properly dispatched because an error would be thrown in
the attempt to serialize the event (which includes a reference to the
`window`).

The `web3` global we inject is now defined as non-enumerable, so it
will be skipped automatically in any attempt to serialize the `window`
object.
2020-05-20 20:18:25 -07:00
Erik Marks
f748664638
Cleanup network enums (#8627)
* cleanup & consolidate network enums
2020-05-20 08:57:45 -07:00
Whymarrh Whitby
9c1eae2965
Delete unused util functions (#8622) 2020-05-20 10:36:41 -02:30
Whymarrh Whitby
a03ef1b002
Memoize getEnvironmentType function (#8624)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-05-20 10:36:18 -02:30
Whymarrh Whitby
97d65b645a
Delete the ABTestController and its state (#8620) 2020-05-19 13:27:06 -02:30
Henrique Dias
890bc25e28
Support IPNS address translations (#8502)
License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>

Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
2020-05-14 07:56:27 -02:30
Mark Stacey
7e75eb15ef
Delete Balance controller and pending balances calculator (#8542)
This controller was not used. It was used by the
`ComputedBalancesController`, which was removed in #7057 (as it was
also unused).

The pending balances calculator was only used by the balances
controller.
2020-05-06 20:19:28 -03:00
Whymarrh Whitby
ceb5970afd
Remove unused NotificationManager#closePopup (#8530) 2020-05-05 21:02:29 -02:30
Whymarrh Whitby
6b5bbe50ee
Delete createDnodeRemoteGetter.js (#8523) 2020-05-05 20:10:07 -02:30
Whymarrh Whitby
f5a125fe61
Move export defaults statements alongside their objects (#8525) 2020-05-05 19:49:38 -02:30
Erik Marks
786e82791e
Reorganize selectors directory (#8497) 2020-05-02 12:41:17 -07:00
Brad Decker
0c7269f599
fixes firefox popup location (#8467)
Co-Authored-By: Whymarrh Whitby <whymarrh.whitby@gmail.com>
2020-04-29 17:04:03 -05:00
Erik Marks
c011c0406b
Add new inpage provider package (#8442)
* add @metamask/inpage-provider

* fix failing e2e tests

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-04-28 17:14:51 -07:00
Whymarrh Whitby
d612f9988e
Move default export declaration to Migrator class (#8407) 2020-04-26 00:02:41 -02:30
Mark Stacey
cc41dee92c
Remove leftover references to Coinbase (#8403)
Coinbase was removed as a deposit option some time ago.
2020-04-23 20:32:15 -03:00
Brad Decker
f9989c52c5
Position notification relative to last focused window (#8356) 2020-04-19 19:30:17 -02:30
Mark Stacey
5ee1291662
Prevent accidental use of globals (#8340)
Previously all browser globals were allowed to be used anywhere by
ESLint because we had set the `env` property to `browser` in the ESLint
config. This has made it easy to accidentally use browser globals
(e.g. #8338), so it has been removed. Instead we now have a short list
of allowed globals.

All browser globals are now accessed as properties on `window`.

Unfortunately this change resulted in a few different confusing unit
test errors, as some of our unit tests setup assumed that a particular
global would be used via `window` or `global`. In particular,
`window.fetch` didn't work correctly because it wasn't patched by the
AbortController polyfill (only `global.fetch` was being patched).
The `jsdom-global` package we were using complicated matters by setting
all of the JSDOM `window` properties directly on `global`, overwriting
the `AbortController` for example.

The `helpers.js` test setup module has been simplified somewhat by
removing `jsdom-global` and constructing the JSDOM instance manually.
The JSDOM window is set on `window`, and a few properties are set on
`global` as well as needed by various dependencies. `node-fetch` and
the AbortController polyfill/patch now work as expected as well,
though `fetch` is only available on `window` now.
2020-04-15 14:23:27 -03:00
Mark Stacey
852277b2ae
Refactor notification manager and triggerUi to use extension platform (#8317)
The notification manager has been refactored to use the extension
platform module instead of using `extensionizer` directly. The
extension platform API presents a more ergonomic API, and it correctly
handles errors (which the old notification manager did not). Methods
that the extension platform lacked have been added.

It has been updated to use `async/await` instead of callbacks as well,
for readability.

The `triggerUI` function has also been updated to use the extension
platform instead of `extensionizer`.
2020-04-11 12:12:45 -03:00
Mark Stacey
28e2354583
Fix Sentry error processing for errors missing a stack (#8179)
Errors without stack traces would break the Sentry error processing,
which assumes the presence of a stack trace. Many errors don't have any
stack trace though, such as uncaught promises.

This breakage resulting in the app state being missing from the error
report, and a console warning.
2020-03-12 10:51:05 -03:00
Erik Marks
2df8b85c5f
LoginPerSite: Support multiple accounts without automatic switching (#8079)
* transaction editing: use txParams 'from' account

* signature-request: use txParams 'from' account

* signature-request-original: use txParams 'from' account

* encryption/decryption: use txParams 'from' account

* update tests

* set 'send' state 'from' address in confirm containers
2020-03-06 13:34:56 -08:00
Dan J Miller
1d2c57a2f3
Assign tabId to middleware request, if provided (#7695)
The `tabId` of the message sender is now added to the middleware
request object. This step is omitted if the `tabId` is not provided.
This is done early in the middleware stack, so the `tabId` should be
available for any subsequent middleware to use.

The Onboarding Middleware has also been modified to get the `tabId`
from the request object, rather than expecting it as a parameter upon
creation.

This refactor will enable further uses of the `tabId`.
2020-02-20 18:39:00 -04:00
Konstantin
6f47fece56
Implementation encrypt/decrypt feature (#7831)
Implement `eth_decrypt` and `eth_getEncryptionPublicKey`. This allows decryption backed by the user's private key. The message decryption uses a confirmation flow similar to the messaging signing flow, where the message to be decrypted is also able to be decrypted inline for the user to read directly before confirming.
2020-02-19 14:24:16 -04:00
Jenny Pollack
c1453c7528
Merge pull request #8056 from whymarrh/arrow-parens
Enable arrow-parens ESLint rule
2020-02-17 15:26:43 -07:00
Whymarrh Whitby
a78cf0ef3a Enable arrow-parens ESLint rule 2020-02-15 17:04:21 -03:30
Mark Stacey
62c5ea4f80
Update Wyre ETH purchase url (#8051)
* Revert "Revert "Update Wyre ETH purchase url" (#7631)"

This reverts commit bc67d1eeca.

* Restrict widget to just debit card payments

Apple Pay apparently only works on Safari.
2020-02-14 14:07:24 -08:00
Erik Marks
8e307f8d71
update inpage-provider; minor fixes (#7997) 2020-02-06 07:57:54 -08:00
Whymarrh Whitby
0159670214
Update ENS registry addresses (#7954) 2020-01-30 12:03:28 -03:30
Mark Stacey
ee415058cc
Only resolve ENS on mainnet (#7944)
The ENS resolver will now bail on any network other than mainnet.
2020-01-29 20:57:14 -04:00
Mark Stacey
cbfe5484d8
Add Sentry environment (#7923)
Any error sent to Sentry will now be marked with the environment they
were sent from. The environment is set at build time, and is set
dependant upon the build flags and CI-related environment variables.

Setting the environment will let us filter error reports in Sentry to
focus specifically upon reports sent from production, release
candidates, PR testing, or whatever else.
2020-01-29 17:03:49 -04:00
Mark Stacey
398a45bfdd
Replace clone dependency with cloneDeep from lodash (#7926)
This was done to reduce the number of direct dependencies we have. It
should be functionally equivalent. The bundle size should not change,
as we use `clone` as a transitive dependency in a number of places.
2020-01-29 13:14:33 -04:00
Mark Stacey
b8cdc928f6
Report errors in tests to test-metamask Sentry project (#7924)
Previously, all errors encountered during testing or production were
sent to the primary `metamask` Sentry project, whereas development
errors were sent to `test-metamask` instead. This change ensures that
errors encountered during tests are sent to `test-metamask` as well.
2020-01-29 12:12:49 -04:00
Mark Stacey
38a71a6067
Update Sentry to v5.x (#7880)
Theses changes were made in accordance with the provided migration
guide [1].

The two integrations added were included by default on v4.x, so this
shouldn't result in any change in behavior.

[1]:  https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md
2020-01-26 12:49:58 -04:00
Mark Stacey
86c6280bc3
Remove unnecessary get environment type parameter (#7891)
* Remove unnecessary `getEnvironmentType` parameter

The default value of the first parameter is `window.location.href`, so
there is no need to pass it in explicitly.

* Remove junk parameter from `getEnvironmentType` invocation

`getEnvironmentType` doesn't need to be passed any parameter, as the
default value is `window.location.href` which is generally what is
wanted. In this case, the variable `location.href` was always
`undefined` anyway. This particular `location` variable is from React
Router, and does not have an `href` property.

* Fix comment for `getEnvironmentType`

One of the possible return values was referred to by the wrong name.
2020-01-24 15:12:58 -04:00
Whymarrh Whitby
76a31c3175 Clean up Migrator test cases (#7835) 2020-01-15 13:54:28 -08:00
Whymarrh Whitby
a891fa36b6
Remove MetaMask Mesh testing client (#7818) 2020-01-14 15:44:12 -03:30
Mark Stacey
ac01c5c89a
Consistent jsdoc syntax (#7755)
* Specify type before parameter name

Various JSDoc `@param` entries were specified as `name {type}` rather
than `{type} name`.

A couple of `@return` entries have been given types as well.

* Use JSDoc optional syntax rather than Closure syntax

* Use @returns rather than @return

* Use consistent built-in type capitalization

Primitive types are lower-case, and Object is upper-case.

* Separate param/return description with a dash
2020-01-13 14:36:36 -04:00
Whymarrh Whitby
92971d3c87
Migrate codebase to use ESM (#7730)
* Update eslint-plugin-import version

* Convert JS files to use ESM

* Update ESLint rules to check imports

* Fix test:unit:global command env

* Cleanup mock-dev script
2020-01-09 00:04:58 -03:30
Mark Stacey
69d418a5a3
Login per site onboarding (#7602)
* Remove unused onboarding stream

* Pass `sender` through to `setupProviderEngine`

The Port `sender` has been passed down a few more layers. This allows
us to get more information from the sender deeper in the stack, but
also simplifies things a bit as well. For example, now the "fake"
URL object with the `metamask` hostname is no longer needed.

* Create onboarding middleware

This middleware intercepts `wallet_registerOnboarding` RPC messages. It
will register the sender as an oboarding initiator if possible, and
otherwise ignores the message.
2019-12-20 12:02:31 -03:30
Whymarrh Whitby
62d5e47bcb
Remove unused DiagnosticsReporter class (#7701) 2019-12-13 12:03:50 -03:30
Whymarrh Whitby
2a8e586142
Remove unused methods from one of the many utils files (#7702) 2019-12-13 11:21:07 -03:30
pldespaigne
0ef7f603d6 Ipfs cid v1 base32 (#7362)
add ipfs gateway to advanced settings
use ipfs gateway from settings
use ipfs.dweb.link as default CID gateway
disallow gateway.ipfs.io as gateway
2019-12-12 11:28:07 -08:00
Whymarrh Whitby
f49bc58c09
Remove unused methods from the app/scripts/ (#7692) 2019-12-12 15:07:18 -03:30
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
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
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