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

4000 Commits

Author SHA1 Message Date
Mark Stacey
d13aabde23
Fix SES lockdown on older browsers (#10014)
On older browsers that don't support `globalThis`[1], the SES lockdown
throws an error. The `globalthis` shim has been added to all pages, to
the background process, and to the `contentscript`. This should prevent
the error on older browsers.

[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#Browser_compatibility
2020-12-08 15:08:31 -03:30
Dan J Miller
da5e5cd8b6
Reapply view quote screen designs (#9905) 2020-12-08 10:47:53 -06:00
Mark Stacey
f75c3c6f68
Fix unbound metrics track function (#10016)
The new metrics controller has a `trackEvent` function that was being
called unbound, so `this` references were undefined. It is now bound
early in both places where it is passed in as a parameter.
2020-12-08 12:40:55 -03:30
Mark Stacey
2bcb219501
Deobfuscate error message (#10012)
The SES lockdown added in #9729 had the effect of obfuscating our error
messages. Any messages printed to the console would have the error
message replaced with the string "Error #" followed by a number. The
stack was also updated to point at `lockdown.cjs`, though the original
stack was preserved beneath the top stack frame.

Marking the `console` API as untamed seems to have fixed both issues.
The original error message is now printed to the console, along with
the original stack.
2020-12-08 07:24:31 +08:00
Mark Stacey
7349801799
Add SES lockdown and Sentry to all pages (#10013)
When the SES lockdown was added in #9729, the lockdown and the Sentry
initialization were migrated from the main bundle into separate
modules, which were run as separate `<script>` tags. These extra tags
were accidentally omitted for `home.html` and `notification.html`. As
a result Sentry was not initialized on these pages, so any errors
thrown on them would not be collected. They also do not benefit from
the SES lockdown.

The SES lockdown and Sentry initialization modules have been added to
both pages where they were missing.
2020-12-07 18:46:03 -03:30
Erik Marks
6795298c65
Remove web3 injection (#9156)
* Remove web3 injection
* Implement logWeb3ShimUsage
2020-12-07 12:09:02 -08:00
Thomas Huang
26272d3557
Initialize network controller provider chainId to the appropriate default networks (#9999) 2020-12-07 11:40:42 -08:00
Erik Marks
4839e31e05
Fix Infura network chain IDs (#8629) 2020-12-07 11:39:39 -08:00
David Walsh
56f80ae9a9
Fix 9988 - Don't allow more than 15% slippage (#9991) 2020-12-07 09:12:55 -06:00
Mark Stacey
231e795143
Merge pull request #10002 from MetaMask/sync-master
Sync `master` with `develop`
2020-12-04 14:33:53 -03:30
Erik Marks
baea1b57fb
Update transaction params validation (#9992)
* Update transaction params validation

* fixup! Update transaction params validation

* Update to/data error message

* fixup! Update to/data error message
2020-12-03 18:15:59 -08:00
MetaMask Bot
9fab240c72 Version v8.1.6 2020-12-03 22:25:08 -03:30
Dan J Miller
1661953e23
Migration to remove legacy local storage keys from localStorage (#9986)
* Migration to remove legacy local storage keys from localStorage

* Update app/scripts/migrations/050.js

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

* Update app/scripts/migrations/050.js

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

* Fix unit tests for migration 50

* Fixing stubbing and localstorage reference in migration 50

* Update test/helper.js

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-12-03 20:25:23 -03:30
Erik Marks
c515591e7b
Add 48x48 icon (#9993) 2020-12-03 13:14:21 -08:00
Mark Stacey
703a063ad1
Fix metrics error when options are not used (#9985)
Attempts to send metrics would fail when no `options` were used. This
was because when the options parameter was not set, it was often sent
over our RPC connection as `undefined`, which gets serialized to `null`
when the message is converted to JSON. This `null` parameter didn't
trigger the default parameter set in the metametrics controller, as
default parameters are only used for `undefined`.

Instead the `options` parameter is now treated as fully optional, with
no default value set. The optional chaining operator is used to ensure
it won't blow up if it's not set. A fallback of `{}` was used for the
one destructure case as well.
2020-12-03 15:35:11 -03:30
Mark Stacey
52d25f0df8
Fix inflated gas estimates (#9984)
If a `gasPrice` was specified in a transaction sent via a dapp, we
would include it in our `eth_estimateGas` call, causing it to fail if
the user had insufficient balance (for either the transaction amount or
the gas fee). This resulted in the fallback gas estimate being used;
the block gas limit. The block gas limit is quite a bit larger than
most transactions need, so this resulted in wildly inflated gas costs
being shown on our confirmation screen.

The `gasPrice` has been removed from the `txParams` object we pass to
`eth_estimateGas`, so now it won't perform any balance checks anymore.
This ensures that we'll get a valid gas estimate, as long as geth is
able to simulate the contract execution properly.

Fixes #9967
2020-12-03 13:55:42 -03:30
Dan J Miller
97d268c8ee
Remove use of ethgasstation; use metaswap /gasPrices api for gas price estimates (#9867)
* Remove use of ethgassthat; use metaswap /gasPrices api for gas price estimates

* Remove references to ethgasstation

* Pass base to BigNumber constructor in fetchExternalBasicGasEstimates

* Update ui/app/hooks/useTokenTracker.js

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

* Delete gas price chart

* Remove price chart css import

* Delete additional fee chart code

* Lint fix

* Delete more code no longer used after ethgasstation removal

Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-12-02 19:55:19 -03:30
Brad Decker
0653a489b0
add new MetaMetricsController (#9857) 2020-12-02 15:41:30 -06:00
David Walsh
673371d013
Fix #9872 - Show price difference warning on swaps price quote (#9899) 2020-12-02 15:27:45 -06:00
Erik Marks
5fb2e544d4
Add __isMetaMaskShim__ property to injected web3 (#9972) 2020-12-02 12:35:45 -08:00
Erik Marks
1da9ad77a4
json-rpc-engine@6.1.0 (#9922) 2020-12-02 11:41:24 -08:00
Erik Marks
c3eb272af9
Use method middleware for watchAsset (#9943)
* Use method middleware for watchAsset
* Update validation error messages
* Make addSuggestedERC20Asset private
* Remove redundant check in _handleWatchAssetERC20
2020-12-02 08:49:49 -08:00
Erik Marks
9d4b8a4903
@metamask/contract-metadata (#9968) 2020-12-01 14:55:01 -08:00
Erik Marks
cb44cff168
Fix watchAsset symbol validation (#9960) 2020-11-30 12:59:01 -08:00
Etienne Dusseault
9f6fa64d67
Add SES lockdown to extension webapp (#9729)
* Freezeglobals: remove Promise freezing, add lockdown

* background & UI: temp disable sentry

* add loose-envify, dedupe symbol-observable

* use loose envify

* add symbol-observable patch

* run freezeGlobals after sentry init

* use require instead of import

* add lockdown to contentscript

* add error code in message

* try increasing node env heap size to 2048

* change back circe CI option

* make freezeGlobals an exported function

* make freezeGlobals an exported function

* use freezeIntrinsics

* pass down env to child process

* fix unknown module

* fix tests

* change back to 2048

* fix import error

* attempt to fix memory error

* fix lint

* fix lint

* fix mem gain

* use lockdown in phishing detect

* fix lint

* move sentry init into freezeIntrinsics to run lockdown before other imports

* lint fix

* custom lockdown modules per context

* lint fix

* fix global test

* remove run in child process

* remove lavamoat-core, use ses, require lockdown directly

* revert childprocess

* patch package postinstall

* revert back child process

* add postinstall to ci

* revert node max space size to 1024

* put back loose-envify

* Disable sentry to see if e2e tetss pass

* use runLockdown, add as script in manifest

* remove global and require from runlockdown

* add more memory to tests

* upgrade resource class for prep-build & prep-build-test

* fix lint

* lint fix

* upgrade remote-redux-devtools

* skillfully re-add sentry

* lintfix

* fix lint

* put back beep

* remove envify, add loose-envify and patch-package in dev deps

* Replace patch with Yarn resolution (#9923)

Instead of patching `symbol-observable`, this ensures that all
versions of `symbol-observable` are resolved to the given range, even
if it contradicts the requested range.

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-24 11:26:43 +08:00
MetaMask Bot
b86e0b1105 Version v8.1.5 2020-11-19 17:10:55 -03:30
Dan J Miller
1e895c3110
Revert view quote design updates (#9904)
* Revert "Update fee card designs to show savings and MM fee (#9629)"

This reverts commit d9924ca771.

* Revert "Update main-quote-summary designs/styles (#9612)"

This reverts commit 5456d55c88.
2020-11-18 22:10:24 -03:30
Dan J Miller
e4de763116
Add token verification message to swaps build quote screen (#9891)
* Add token verification message to swaps build quote screen

* Adds description for locale

* Use <a> tag for etherscan link

* Remove unnecessary span

* Update ui/app/pages/swaps/build-quote/build-quote.js

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-17 17:26:02 -03:30
Mark Stacey
31a3541105
Remove invalid matomo metric event option (#9897)
The `matomo` option passed to the send metrics function is invalid. The
intent was to set the `matomoEvent` option, but instead of rectifying
that, we've decide to keep sending this event to the production Segment
project for now. The invalid option has been removed.
2020-11-17 15:59:05 -03:30
Erik Marks
2687163dbb
Fix minor issues with web3 metrics (#9895)
* Fix minor issues with web3 metrics

* Log error, use try/catch
2020-11-17 11:07:59 -08:00
Brad Decker
daf783a0d8
Track a new schema event when adding a token (#9810)
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-17 11:39:21 -06:00
Mark Stacey
f9613b2eb9 Merge remote-tracking branch 'origin/develop' into sync-master
* origin/develop:
  Move add contact button in fullscreen/expanded view lower. (#9883)
  Remove CoinSwitch from Deposit screen(#9869)
  Consolidate notification UI openers (#9885)
  Prevent jump when hovering over asset list items
  @metamask/controllers@4.2.0 (#9849)
  Properly detect U2F errors in hardware wallet
  Fix malformed PropType declaraton (#9876)
  Fix broken LoadingScreen PropType declaration (#9877)
  Revert "Add custom hd path option (#9367)" (#9875)
  Update fee card designs to show savings and MM fee (#9629)
  Make editable actoin item a button, autofocus input contents
  Provide alternative text for images where appropriate
2020-11-16 16:55:27 -03:30
Mark Stacey
080dc7ad74 Revert "Revert "Update main-quote-summary designs/styles (#9612)" (#9844)"
This reverts commit 2214e1561d.
2020-11-16 16:55:16 -03:30
Nate Chastain
179dbcb41c
Remove CoinSwitch from Deposit screen(#9869)
Remove all CoinSwitch references and functionality, and bump Wyre to top spot on Deposit screen unless user on test network
2020-11-16 13:57:53 -03:30
Erik Marks
5a80f04dca
Consolidate notification UI openers (#9885)
* Consolidate notification UI openers

* Update tests
2020-11-16 08:32:53 -08:00
Dan J Miller
2214e1561d Revert "Update main-quote-summary designs/styles (#9612)" (#9844)
This reverts commit 5456d55c88.
2020-11-13 16:39:51 -03:30
MetaMask Bot
628865eb45 Version v8.1.4 2020-11-13 16:39:51 -03:30
David Walsh
ed19ce44bd
Merge pull request #9853 from darkwing/image-updates
Provide alternative text for images where appropriate
2020-11-13 13:44:55 -06:00
Mark Stacey
9a50bc0ca4 Revert "Add custom hd path option (#9367)" (#9875)
This reverts commit f30d261e69.

The custom HD path option was found to be unsafe to use, because the
displayed list of accounts would differ depending on which application
was open on the Ledger device. Essentially Ledger was accepting invalid
inputs, and returning junk responses.

This was too dangerous to ship, as it could leave users with an account
that they can't reliably recover. If we don't know how the derivation
is happening, then allowing this import puts our users at risk of
losing funds.

We can re-introduce this functionality after adding validation to
ensure that we only allow inputs that are handled correctly by Ledger.
2020-11-13 15:03:40 -03:30
Mark Stacey
beb6047384
Revert "Add custom hd path option (#9367)" (#9875)
This reverts commit f30d261e69.

The custom HD path option was found to be unsafe to use, because the
displayed list of accounts would differ depending on which application
was open on the Ledger device. Essentially Ledger was accepting invalid
inputs, and returning junk responses.

This was too dangerous to ship, as it could leave users with an account
that they can't reliably recover. If we don't know how the derivation
is happening, then allowing this import puts our users at risk of
losing funds.

We can re-introduce this functionality after adding validation to
ensure that we only allow inputs that are handled correctly by Ledger.
2020-11-13 14:25:47 -03:30
Dan J Miller
d9924ca771
Update fee card designs to show savings and MM fee (#9629)
* Update fee card designs to show savings and MM fee

css touch up

More semantic html and remove unnecessary container wrapper

Update message for case when there are no savings, in new swaps fee card designs

Improve display of tilde in savings designs

* Ensure terms of service is shown when insufficient eth warning is shown on view-quote screen

* Logic simplification in fee-card.js

* Better center info tooltip icons in fee-card

* Add comment about use of \!important in fee card css

* Use container class property on info tooltip in fee card

* Remove function call that was made redundant with 980b14089 but not removed during rebase
2020-11-13 13:42:50 -03:30
David Walsh
a05230bba7 Provide alternative text for images where appropriate 2020-11-11 09:38:15 -06:00
Dan J Miller
bcd5f2a7c1
Fix gas_fees properties collected for swaps analytics events (#9727) 2020-11-10 14:09:45 -03:30
Mark Stacey
14d85b1332
Make JSDoc formatting more consistent (#9796)
A few inconsistencies in JSDoc formatting have been fixed throughout
the project. Many issues remain; these were just the few things that
were easy to fix with a regular expression.

The changes include:

* Using lower-case for primitive types, but capitalizing non-primitive
 types
* Separating the parameter identifier and the description with a dash
* Omitting a dash between the return type and the return description
* Ensuring the parameter type is first and the identifier is second (in
 a few places it was backwards)
* Using square brackets to denote when a parameter is optional, rather
 than putting "(optional)" in the parameter description
* Including a type and identifier with every parameter
* Fixing inconsistent spacing, except where it's used for alignment
* Remove incorrectly formatted `@deprecated` tags that reference non-
 existent properties
* Remove lone comment block without accompanying function

Additionally, one parameter was renamed for clarity.
2020-11-10 14:00:41 -03:30
Mark Stacey
a6cc2d3d7c
Track whether seed phrase has been backed up (#9830)
The `seedPhraseBackedUp` now tracks whether or not the seed phrase has
been backed up. Previously this defaulted to `true`, which left no way
to distinguish whether it had been backed up or not during onboarding.

The default is now `null`, and the UI logic has been updated to account
for this, so that "existing users" (i.e. users that have a backup that
is years old) aren't mistakenly considered to have not backed up their
seed phrase. This value is already set explicitly to `true` or `false`
during onboarding, in both the create and import flow.

This change was made primarily to make it easier to fix the onboarding
library integration, which will be done in a subsequent PR.
2020-11-10 12:34:20 -03:30
Dan Finlay
8443c3bdde
Warn instead of throw on duplicate web3 and do not inject (#9832) 2020-11-09 10:40:40 -08:00
Erik Marks
e005a03e75
eth-sig-util@3.0.0 (#9831)
* eth-sig-util@3.0.0

* Only import used sig-util exports in the typed message manager
2020-11-09 09:30:33 -08:00
Dan J Miller
c044b6f2b4
Alternative savings fix (#9675)
* Alternative savings fix

* Further required changes to savings fix

* Further fix to savings calculations that properly accounts for metamask fees

* metaMaskFeeInEth property on quotes to decimal string

* Fix swaps controller unit tests

* Improve documentation in swaps controller

* Prevent getMedianEthValueQuote from mutation passed quotes array with .sort() call

* Another fix and refactor to savings calculations in _findTopQuoteAndCalculateSavings

Cleaner structuring of conditionals for setting tokenValueOfQuoteForSorting, ethValueOfQuote and metaMaskFeeInEth in swaps controller

Stop subtracting medianMetaMaskFee from savings, but include it in savings data

Another fix and refactor to savings calculations in _findTopQuoteAndCalculateSavings

* Add and update unit tests for _findTopQuoteAndCalculateSavings

* Improve calculation of overallValueOfQuoteForSorting for case where ETH is the source token

* Clean up getMedianEthValueQuote code, test and comments

* Clean up _findTopQuoteAndCalculateSavings, create test input and expected results helper functions

* Update getMedianEthValueQuote to account for multiple quotes with overall values equal to the median

* Add jsdoc comment for meansOfQuotesFeesAndValue

* Fix jsdoc comment for getMedianEthValueQuote
2020-11-09 13:39:38 -03:30
Erik Marks
0555cb856e Only import used sig-util exports 2020-11-09 08:59:44 -08:00
Erik Marks
6aa6052318 eth-sig-util@3.0.0 2020-11-09 08:57:18 -08:00
Mark Stacey
248f171b65
Move externally_connectable from base to Chrome manifest (#9824)
The `externally_connectable` property of the extension manifest is not
recognized by Firefox. It has been moved from the base manifest to the
Chrome manifest, so that we no longer get a warning about this property
on Firefox.

We would like to eventually remove it from the Chrome manifest as well,
but we'll wait until we can batch it with other permission changes so
that it doesn't unnecessarily re-prompt the user (see #9804)
2020-11-09 10:21:09 -03:30
Brad Decker
a49a4a066c
expand transaction constants coverage (#9790)
* expand transaction constants coverage

* touchups

* dont import inside of e2e

* Update app/scripts/controllers/transactions/tx-state-manager.js

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

* Update test/unit/app/controllers/transactions/tx-controller-test.js

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-07 01:38:12 -06:00
Patryk Łucka
f30d261e69
Add custom hd path option (#9367)
* Add custom hd path option

* Update selectPathHelp locale message

Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-11-06 16:17:16 -08:00
Patryk Łucka
ee205b893f
Create custom addHexPrefix function (#9306)
* create custom addHexPrefix function

* switch to custom addHexPrefix

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-11-06 13:18:00 -08:00
Patryk Łucka
d1430e733e
Do not check popupIsOpen on Vivaldi (#9271) 2020-11-06 10:38:48 -08:00
Erik Marks
6426816411
Log web3 usage for functions and nested properties only (#9797)
* Log web3 usage for functions and nested properties only

* Change web3 metrics source to legacy

* Update web3 metrics properties and event name

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-11-05 14:55:28 -08:00
Erik Marks
ad838df3e6
Display decimal chain ID in network form (#9780)
* Display network form chain ID in decimal

* Hide chainId tooltip in view mode

* Display chain ID error message in entered format

* Update locale messages

* Rename on change chain ID validator
2020-11-03 20:10:52 -08:00
Brad Decker
026a06b39d
add shared transaction constants (#9459)
Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com>
2020-11-03 16:57:51 -06:00
Brad Decker
2ebf8756a4
[RFC] add prettier to eslint (#8595) 2020-11-02 17:41:28 -06:00
Mark Stacey
55bff07bbf
Use chainId for incoming transactions controller (#9583)
The incoming transactions controller now uses the `chainId` for the
current network instead of the `networkId`. This ensures that custom
RPC endpoints for the built-in supported networks do correctly receive
incoming transactions.

As part of this change, the incoming transactions controller will also
cease keeping track of the "last block fetched" for networks that are
not supported. This piece of state never really represented the last
block fetched, as _no_ blocks were fetched for any such networks. It
been removed.
2020-10-30 22:28:12 -02:30
David Walsh
77dc0ab008
Make swap arrows accessible, make swaps advanced options accessible (#9750) 2020-10-30 09:35:47 -05:00
Mark Stacey
4bacb9144f
Add description for the incoming transactions controller (#9759)
This comment block describes the responsibilities of this controller.
This was motivated by a suggestion made during review of #9755 [1]

[1]: https://github.com/MetaMask/metamask-extension/pull/9755#discussion_r514400479
2020-10-30 11:33:35 -02:30
Brad Decker
ff7ce81c73
fix for METAMASK-GKF5 (#9760) 2020-10-29 17:18:52 -05:00
Mark Stacey
4086f7b4d6
Fix error when fetchParams is null (#9757)
If the swaps state is cleared in between the initial quote fetch and
the subsequent poll fetch, a `TypeError` will be thrown due to
`fetchParams` being set to `null`.

This is of no functional consequence, as `fetchParams` _should_ be
`null` in this case, and and no further action should be taken.

The optional chaining operator is now used to ensure the call no longer
throws.
2020-10-29 15:52:04 -02:30
Mark Stacey
9ce5d0d0f0 Revert "Revert "Update main-quote-summary designs/styles (#9612)" (#9722)"
This reverts commit d5b8a4ade9. This
restores the new "main-quote-summary" designs that were initially
implemented in #9612.
2020-10-29 00:13:08 -02:30
Mark Stacey
d5b8a4ade9 Revert "Update main-quote-summary designs/styles (#9612)" (#9722)
This reverts commit 5456d55c88.
2020-10-28 16:35:29 -02:30
MetaMask Bot
795658a7f0 Version v8.1.3 2020-10-28 16:35:29 -02:30
Mark Stacey
1294955d81
Fix swaps when initial network not Mainnet (#9745)
This is a continuation of #9726, which did not fix the problem
described.

If the initial network when the extension is started is something other
than Mainnet, the swaps controller will never successfully retrieve
swap quotes. This is because `ethers` will continue to communicate
with whichever network the provider was initially on.

We tried fixing this by hard-coding the `chainId` to Mainnet's
`chainId` when constructing the Ethers provider, but this did not work.
I suspect this failed because the `provider` we pass to `ethers` is not
compliant with EIP 1193, as `ethers` doubtless expects it to be.

Instead the entire `ethers` provider is now reconstructed each time the
network changes. This mirrors the approach we take in some other
controllers.
2020-10-28 16:17:32 -02:30
Dan J Miller
a4f817e171
Include trade.value in calculation of displayed network fees (#9621)
* Ensure that trade.value fees are included in displayed network fees

* Remove unused getTotalEthCost function

* Remove unused getTotalEthCost function

* Update ui/app/pages/swaps/swaps.util.js

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

* Lint fix

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-27 16:32:21 -02:30
Mark Stacey
3bbc1d1fa4
Fix fetching of swap quotes when initial network was testnet (#9726)
If the initial network when the extension is started is something other
than Mainnet, the swaps controller will never successfully retrieve
swap quotes. This is because the `ethers` provider used by the swaps
controller doesn't allow network changes by default - it assumes that
the network remains the same as when the provider was initialized.

This was fixed by hard-coding Mainnet as the initial chain ID for this
`ethers` provider used by the swaps controller.

Some adjustments needed to be made to the `provider` stub to allow
setting `1` as the network ID and chain ID in unit tests.
2020-10-27 13:22:21 -02:30
Brad Decker
7d50357684
remove matomo and route to segment (#9646) 2020-10-26 14:05:57 -05:00
Mark Stacey
d496cf18f2 Merge remote-tracking branch 'origin/develop' into sync-master
* origin/develop: (57 commits)
  Remove unused parameter in styles build script (#9710)
  Fix `yarn build styles:dev` (#9709)
  Update main-quote-summary designs/styles (#9612)
  @metamask/test-dapp@3.2.0 (#9707)
  Add ses lockdown to build system (#9568)
  Robustify waiting logic in e2e test (#9704)
  Prevent React error for close
  Prevent memory leak from selected account copy tooltip
  Lint
  Clean up events
  Make the dropdown widgets for swaps keyboard accessible
  Fix mocha/max-top-level-suites issues (#9699)
  Provide image sizing so there's no jump when opening the swaps token search
  Bump @metamask/controllers from 3.1.0 to 3.2.0 (#9692)
  Fix pull request template location
  Bump @metamask/inpage-provider from 6.1.0 to 6.3.0 (#9691)
  Fix 9632 - Prevent old fetches from polluting the swap state
  Remove broken Storybook stories (#9690)
  Add a GitHub Dependabot config (#9664)
  Fix PropType error on Awaiting Swap page (#9688)
  ...
2020-10-26 14:10:26 -02:30
David Walsh
6e89b60a4a
Merge pull request #9671 from darkwing/9632-simple-abort
Fix 9632 - Prevent old fetches from polluting the swap state
2020-10-26 08:09:58 -05:00
Dan J Miller
5456d55c88
Update main-quote-summary designs/styles (#9612)
* Update main-quote-summary designs/styles

* Clean up css: use className instead of element types

* Style fixes to symbol elements in main-quote-view

* Use correct source for token iconUrls passed to main-quote-view

* Improve vertical spacing on view-quote screen and with new main-quote-view designs

* Remove unused classes

* Tweak space around large quote amount text in main-quote-summary
2020-10-25 10:53:34 -02:30
David Walsh
5c1c9c8f16 Fix 9632 - Prevent old fetches from polluting the swap state 2020-10-23 10:59:02 -05:00
Dan J Miller
5cc40bff41
Gas metrics tweaks for swaps failed and completed events (#9676)
* Change base of estimated_gas sent to analytics

* Add suggested_gas_price and used_gas_price to analytics
2020-10-22 17:34:34 -02:30
Whymarrh Whitby
6df17dc90e
Fix accessor-pairs issues (#9680)
Refs #9663

See [`accessor-pairs`][1] for more information.

This change enables `accessor-pairs` and fixes the issues raised by the rule.

  [1]:https://eslint.org/docs/rules/accessor-pairs
2020-10-22 14:36:44 -02:30
Whymarrh Whitby
362e717eef
Fix node/no-deprecated-api issues (#9670)
Refs #9663

See [`node/no-deprecated-api`][1] for more information.

This change enables `node/no-deprecated-api` and fixes the issues raised by the rule.

  [1]:https://github.com/mysticatea/eslint-plugin-node/blob/v11.1.0/docs/rules/no-deprecated-api.md

The change to the way that `punycode` is imported is to address the fact that
third-party module is hidden by the built-in. This is a silly hack but it works.
2020-10-22 11:33:45 -02:30
Mark Stacey
07cffe92c6
Fix ENS resolution of .eth URLs with query strings (#9674)
Our ENS resolver for the browser address bar was incorrectly resolving
addresses that included query strings. We were concatenating the `path`
property with the `search` property, despite the fact that the `path`
property already contains `search`. As a result, `search` was
duplicated in the resolved addresses.

For example, if an IPFS content ID was found for this address, the
resolved address for `metamask.eth/?foo=bar` would have the path
`/?foo=bar?foo=bar`

The original intent was likely to use `pathname` in place of `path`.
The resolver has been updated to use `pathname`, and the query string
now appears only once in the resolved address.
2020-10-22 10:45:26 -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
Mark Stacey
7d0a7ab301
Update @metamask/eslint-config to v4.1.0 (#9663)
`@metamask/eslint-config` has been updated to v4.1.0. This update
requires that we update `eslint` to v7 as well, which in turn requires
updating most `eslint`-related packages.

Most notably, `babel-eslint` was replaced with `@babel/eslint-parser`,
and `babel-eslint-plugin` was replaced by `@babel/eslint-plugin`. This
required renaming all the `babel/*` rules to `@babel/*`.

Most new or updated rules that resulted in lint errors have been
temporarily disabled. They will be fixed and re-enabled in subsequent
PRs.
2020-10-21 14:01:03 -02:30
Whymarrh Whitby
3c492a2ff7
Remove incorrect Migrator comment (#9659)
This change removes an incorrect comment about migrations
2020-10-20 11:34:55 -02:30
Erik Marks
7de7e7d8c2
Add swaps savings calculation (#9611)
* Calculate savings per swap relative to median values

* Update test mock quotes, add getMedian tests

* Identify assets by sourceToken and destinationToken
2020-10-19 14:52:47 -07:00
MetaMask Bot
a284660986 Version v8.1.2 2020-10-19 21:32:37 +00:00
Dan J Miller
c8526bc687
Update view-quote designs to better represent the metamask fee (#9633)
* Update view-quote designs to better represent the metamask fee

* Code clean up

* Copy updates
2020-10-19 17:15:32 -02:30
Dan J Miller
7925a767b8
Add a minimumGasLimit to the original gas customization modal (#9623)
* Add a minimumGasLimit to the gas customization modal in swaps

* Update app/_locales/en/messages.json

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

* Set default for minimum gas limit in gas-modal-page-container.container and make required in sub components

* Update unit tests

* Default value for minimumGasLimit in advanced-gas-inputs.component.js

* Preserve existing gasLimitTooLow message key by creating new gasLimitTooLowWithDynamicFee

* Fix failing unit test

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Erik Marks <rekmarks@protonmail.com>
2020-10-19 10:41:23 -02:30
Dan J Miller
397e3a2c7f
Update swaps network fee tooltip (#9614)
* Update network fee tooltip in fee-card to match latest designs

* Clean up css classes and div
2020-10-19 05:54:59 -02:30
Mark Stacey
003f1306d3
Split the account tracker doc comments (#9574)
The account tracker had one doc comment above the constructor that
partially served to document the constructor, but mostly contained a
type definition for the class itself. It has been split into two
blocks; one for the class, one for the constructor. The constructor doc
comment has also been expanded to document all constructor options.
2020-10-15 13:09:13 -02:30
Mark Stacey
a53121a763
Use chainId in account tracker (#9573)
The `chainId` is now used by the account tracker to identify the
current network, instead of the `networkId`. This should have no
functional impact, aside from that different chains with the same
`networkId` will now be correctly distinguished from each other.
2020-10-15 11:18:30 -02:30
MetaMask Bot
bb854e17f8 Version v8.1.1 2020-10-14 21:51:22 -02:30
David Walsh
d0152aad51
Use localizations for placeholders in Swap (#9587) 2020-10-14 14:15:44 -02:30
Erik Marks
4149fed6e0
Update text content of invalid custom network (#9601) 2020-10-14 09:38:12 -07:00
Mark Stacey
360d8ded1f
Fix exception upon failure to get next nonce (#9598)
An attempt to safely release the `nonceLock` upon failure has instead
made failure worse by masking it with a new error. If the call to get
the `nonceLock` throws an exception, then the `finally` block here
would attempt to call `releaseLock` on the `nonceLock` variable, which
is guaranteed to be `undefined` if the previous call failed. The
attempt to call a method on `undefined` throws another error, masking
the original error.

It is safer to obtain the `nonceLock` and release it without using any
`try` or `finally` block. The `nonceLock` is synchronously released
immediately after it is obtained, and any errors bubble up correctly
without being masked. There is no case where the lock is left
unreleased.
2020-10-14 13:34:08 -02:30
Mark Stacey
e53f970458
Use localized strings for MetaMetrics opt-in page (#9593)
The MetaMetrics opt-in page during onboarding now uses localized
strings. This allows us to add translations.
2020-10-14 13:33:34 -02:30
Mark Stacey
320e8c0af9
Fix TypeError when signTypedData throws (#9596)
If the `signTypedData` background function threw an exception, it would
return `undefined` to the UI, which would throw another exception in
the UI. It now re-throws the error if an error is thrown, which
allows the UI to handle the error.

I'm not sure why this might fail, and I'm not sure we're handling this
failure well, but this is an improvement at least.
2020-10-13 21:20:50 -07:00
Dan J Miller
00c8609f95
Add data point to 'Swaps Completed' segment event: estimated vs used gas (#9571)
* Add data point to 'Swaps Completed' segment event: estimated vs used gas

* Linted

* Correct property name for estimated gas on swapMetaData in _trackSwapsMetrics()

* Set estimated_gas property on swapMetaData to a hex string

* Correct base when dividing by estimated_gas

Co-authored-by: Dan Finlay <dan@danfinlay.com>
2020-10-13 16:11:26 -02:30
MetaMask Bot
5b7cd5a9d1 Version v8.1.0 2020-10-13 11:49:43 -02:30
Erik Marks
6e8c9aede8
Migrate 'localhost' tokens (#9570)
* Delete localhost state from incoming tx controller

* Migrate localhost tokens

Co-authored-by: Dan Finlay <542863+danfinlay@users.noreply.github.com>
2020-10-13 07:07:00 -07:00
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
4ce04b5cb9
Delete localhost state from incoming tx controller (#9569) 2020-10-13 06:18:24 -07:00
Erik Marks
f9e0c64abe
Fix migration 048 chainId conversion (#9567) 2020-10-12 19:24:45 -07:00
Erik Marks
31d373e62c
Use networkVersion as the network state for all networks (#9555) 2020-10-12 17:06:25 -07:00
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
Erik Marks
bdd6416ba0
Update migration 048 (#9560)
* 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
2020-10-12 14:09:08 -07:00
Dan J Miller
f3bd717184
Account for approval gas costs in eth received (#9559)
* Account for approval gas costs in eth received

* Pass approval txMeta to getSwapsTokensReceivedFromTxMeta in swaps/index.js
2020-10-12 17:26:53 -02:30
Erik Marks
45ba657ca1
Fix signTypedData_v4 chainId param validation (#9552) 2020-10-12 12:10:19 -07:00
Erik Marks
5b8c07817a
Remove localhost provider type (#9551)
* Delete localhost provider type

* Use ganache-cli default chain ID for tests

* Delete unused test firstTimeState variable

* Migrate default ganache-cli network to frequentRpcListDetail

* Add default test provider state

* Add test functionality to createJsonRpcClient

* Lint locales

* Update test middleware creation

* fixup! Update test middleware creation
2020-10-12 12:05:40 -07:00
Dan J Miller
33b755fa66
Update #2 to the MetaSwap contract address (#9557) 2020-10-12 14:50:37 -02:30
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
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
Dan J Miller
d67a446131
Tweak copy of swapIntroPopupSubTitle message (#9547) 2020-10-09 17:28:34 -07:00
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
d35db87447
Simplify _findTopQuoteAggId call in fetchAndSetQuotes (#9542) 2020-10-09 11:00:20 -07:00
Dan J Miller
5fd4657588
Stop calling _findTopQuoteAggId twice in _findTopQuoteAggId (#9530)
* Stop calling _findTopQuoteAggId twice in _findTopQuoteAggId

* Update app/scripts/controllers/swaps.js

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-09 14:44:10 -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
Dan J Miller
325dd9c036
call this.txStateManager.setTxStatusConfirmed before async call in confirmTransaction (#9522)
* call this.txStateManager.setTxStatusConfirmed before async call in confirmTransaction in the transactions controller

* Clone txMeta before setTxStatusConfirmed in confirmTransaction

* Correctly updateTx in confirmTransaction

* Track swaps event only if it is a swap transaction
2020-10-08 11:31:35 -07:00
Erik Marks
7870d6d194
Use Segment for web3 usage metrics; fix background Segment bugs (#9525)
* Use segment for window.web3 usage metrics
* Add Segment referrer information
* Fix track segment event bug
* Fix missing category bug in tx segment event

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-08 11:00:56 -07:00
Erik Marks
30d6ad83f7
Refactor background Segment usage (#9509)
* Create wrapper function for segment events
* Extract transaction controller metrics calls into own function

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-10-08 09:41:23 -07:00
Whymarrh Whitby
4411f0eb9c
Fix environment variable inlining (#9517) 2020-10-08 13:52:14 -02:30
Dan J Miller
443c280b4a
quote_vs_executionRatio property to Swap Completed segment event (#9508) 2020-10-07 23:54:04 -02:30
Whymarrh Whitby
b89c8fec13
Fix version used by TransactionController#confirmTransaction (#9503) 2020-10-07 14:27:39 -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
Mark Stacey
17f7ca2cfe
Update address book state upon custom RPC chainId edit (#9493)
When the `chainId` for a custom RPC endpoint is edited, we now migrate
the corresponding address book entries to ensure they are not orphaned.

The address book entries are grouped by the `metamask.network` state,
which unfortunately was sometimes the `chainId`, and sometimes the
`networkId`. It was always the `networkId` for built-in Infura
networks, but for custom RPC endpoints it would be set to the user-set
`chainId` field, with a fallback to the `networkId` of the network.

A recent change will force users to enter valid `chainId`s on all
custom networks, which will be normalized to be hex-prefixed. As a
result, address book contacts will now be keyed by a different string.
The contact entries are now migrated when this edit takes place.

There are some edge cases where two separate entries share the same set
of contacts. For example, if two entries have the same `chainId`, or if
they had the same `networkId` and had no `chainId` set. When the
`chainId` is edited in such cases, the contacts are duplicated on both
networks. This is the best we can do, as we don't have any way to know
which network the contacts _should_ be on.

The `typed-message-manager` unit tests have also been updated as part
of this commit because the addition of `sinon.restore()` to the
preferences controller tests ended up clearing a test object in-between
individual tests in that file. The test object is now re-constructed
before each individual test.
2020-10-07 15:02:17 -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
Mark Stacey
e8774f615d
Fix unbound function in swaps controller (#9496)
The `_fetchAndSetSwapsLiveness` was accidentally passed to
`setInterval` without being bound first, so the `this` reference was
not defined when it was called. It is now bound before being passed to
`setInterval`.
2020-10-06 20:03:59 -07:00
Erik Marks
6a6600c730
Use networkVersion for network state; chainId for signing transactions (#9487) 2020-10-06 17:48:24 -02:30
Dan J Miller
1062e2a97d
Fix SwapsController handling of insufficient balance for gas when in max ETH mode 2020-10-06 17:47:58 -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
Patryk Łucka
f6d0deb80b
Fix 3Box sync and e2e tests (#9422)
Co-authored-by: Whymarrh Whitby <whymarrh.whitby@gmail.com>
2020-09-29 14:17:55 -02:30
Mark Stacey
97b49b7614
Add prettier-plugin-sort-json (#9450)
JSON files are now sorted by key with `prettier`, using the plugin
`prettier-plugin-sort-json`. This does not affect `package.json`
because `prettier` uses a special parser for that file, as it has
a more restrictive format than JSON.
2020-09-23 12:21:42 -02:30
Erik Marks
1b00062649
Refactor method middleware (#9436)
* Refactor method middleware

* Vastly improve comments
2020-09-18 11:55:05 -07:00
Brad Decker
37cbeb56a3
make gas edit tooltips use Tooltip (#9434) 2020-09-17 17:05:31 -05:00
Whymarrh Whitby
3eda318984 Merge 'sync-master' and 'develop' 2020-09-16 19:14:16 -02:30
Whymarrh Whitby
93b9a01fd6 Version v8.0.10 2020-09-16 17:24:02 -02:30
Pedro Pablo Aste Kompen
e205124db4
Update Wyre purchase URL (#9414) 2020-09-15 17:56:51 -02:30
Brad Decker
c97493cc13
rename Ethereum Main Network -> Etherum Mainnet (#9411) 2020-09-15 14:34:16 -05:00
Mark Stacey
ce66ddcf0d
Use prettier for JSON linting (#9396)
Instead of using `eslint-plugin-json` for linting JSON files,
`prettier` is now used. `prettier` is capable of detecting and
correcting more problems than `eslint-plugin-json` can, such as
indentation.

All JSON files have been run through `prettier`. The changes are all
superficial.
2020-09-11 10:57:39 -03:00
Kevin Holder
95acee95b5
nodeify removeFromAddressBook (#9395)
Right now when editing an address in "Settings > Contact", the contact
is lost after saving. This is because the code awaits
`removeFromAddressBook()` before creating the new contact but
`removeFromAddressBook()` never resolves. This change fixes this bug.
2020-09-11 09:58:51 -02:30
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
matteopey
ee36073eb5
Update italian translation (#9293) 2020-09-10 09:53:38 -02:30
Erik Marks
f02ba2d561
Ensure the extension can be unlocked without network access (#9295)
move checkForLatestBlock to separate catch block
add test case
remove duplicate checkForLatestBlock call
2020-09-08 22:29:24 -07:00
Patryk Łucka
3d4f1f45bd
Add messages to Ledger connection process (#9344) 2020-09-02 13:58:14 -02:30
Erik Marks
867dd33c1e
Remove 'Contact us' exclamation mark (#9307) 2020-08-25 13:54:33 -07:00
Erik Marks
81a1d0a23d
Remove unused diagnostics property (#9296)
* Remove unused diagnostics property
2020-08-25 13:54:15 -07:00
Erik Marks
29550e3e65 Remove 'Contact us' exclamation mark 2020-08-25 09:42:45 -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
Erik Marks
e08a55c8bc
Add messages for MetaMetrics opt-in (#9283)
* Add messages for MetaMetrics opt-in
2020-08-20 17:13:14 -07:00
Whymarrh Whitby
f656d3236e
Remove outdated comment from MetamaskController (#9284) 2020-08-20 21:03:52 -02:30
Mark Stacey
0c72d0bc3d Merge remote-tracking branch 'origin/develop' into sync-master
* origin/develop: (137 commits)
  Use @metamask/eslint-config@3.1.0 (#9275)
  Standardize scss import practices (#9183)
  Update ESLint shared config to v3 (#9274)
  Add lock icon to default networks (#9269)
  Adds toPrecisionWithoutTrailingZeros utility (#9270)
  Hide gas estimate on non-main network (#9189)
  Move the mascot component to its own directory (#9272)
  Use @metamask/controllers@2.0.5 (#9266)
  Fix padding, alignment of actionable-message; add left aligned story
  Code cleanup and simplification for actionable-message component
  Adds actionable message component and stories
  Fix lint issues (#9265)
  Fix prefer-destructuring issues (#9263)
  colocate confirm-decrypt-message page styles (#9252)
  Tidy up Migrator tests (#9264)
  Adds pulse loader component (#9259)
  Fix import/order issues (#9239)
  Fix radix issues (#9247)
  New info tooltip component (#9180)
  Improve scss naming
  ...
2020-08-19 17:53:20 -03: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
Mark Stacey
de354751fd Handle non-String web3 property access (#9256)
The web3 usage metrics added in #9144 assumed that all web3 properties
were strings. When a `Symbol` property is accessed, our `inpage.js`
script crashes because the `Symbol` cannot be serialized correctly.

A check has been added for non-string property access. The metric event
in these cases is set to the string "typeof ", followed by the type of
the key. (e.g. `typeof symbol` for a `Symbol` property).

Fixes #9234
2020-08-18 23:10:06 -03:00
MetaMask Bot
5c88d8d250 Version v8.0.9 2020-08-19 02:07:15 +00: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
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
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
Mark Stacey
27e1189c91
Handle non-String web3 property access (#9256)
The web3 usage metrics added in #9144 assumed that all web3 properties
were strings. When a `Symbol` property is accessed, our `inpage.js`
script crashes because the `Symbol` cannot be serialized correctly.

A check has been added for non-string property access. The metric event
in these cases is set to the string "typeof ", followed by the type of
the key. (e.g. `typeof symbol` for a `Symbol` property).

Fixes #9234
2020-08-18 12:01:43 -03:00
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
Mark Stacey
52fd72feac Merge remote-tracking branch 'origin/develop' into sync-master
* origin/develop: (107 commits)
  Clear Account Details in AppState (#9238)
  Permit all-caps addresses (#9227)
  Send web3 usage metrics once per origin/property (#9237)
  Fix import/no-extraneous-dependencies issues (#9232)
  Remove unused buyEth fn from bg (#9236)
  Fix max-statements-per-line issues (#9218)
  Consolidate ESLint config files (#9231)
  Delete page-container.component.test.js (#9229)
  Tidy up getAccountLink (#9223)
  Tidy ConnectHardwareForm#checkIfUnlocked (#9224)
  Fix require-unicode-regexp issues (#9212)
  Fix no-negated-condition issues (#9222)
  Fix no-empty-function issues (#9216)
  Fix import/extensions issues (#9217)
  Dedupe glob-parent versions (#9220)
  Fix no-template-curly-in-string issues (#9221)
  Fix no-process-exit issues (#9219)
  Fix prefer-rest-params issues (#9215)
  Fix no-prototype-builtins issues (#9213)
  Fix no-nested-ternary issues (#9214)
  ...
2020-08-14 20:32:32 -03:00
MetaMask Bot
5db866bc88 Version v8.0.8 2020-08-14 19:39:41 -03:00
Mark Stacey
d49c44426f Send web3 usage metrics once per origin/property (#9237)
The usage metrics for the injected web3 instance were being sent upon
each use, which exceeded the limits of our Matomo plan. These metrics
are now only being sent upon the first usage, for each origin and
property.
2020-08-14 19:15:40 -03:00
Mark Stacey
f77151003e
Send web3 usage metrics once per origin/property (#9237)
The usage metrics for the injected web3 instance were being sent upon
each use, which exceeded the limits of our Matomo plan. These metrics
are now only being sent upon the first usage, for each origin and
property.
2020-08-14 19:15:21 -03:00
Patryk Łucka
74decc3407 Fix Etherscan redirect on notification click (#9211) 2020-08-14 19:15:03 -03:00
Mark Stacey
4d499cc39e 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-14 19:05:27 -03:00
Whymarrh Whitby
c2edc342fb
Remove unused buyEth fn from bg (#9236) 2020-08-14 15:51:48 -02:30
Whymarrh Whitby
e021acdc0a
Fix max-statements-per-line issues (#9218)
See [`max-statements-per-line`](https://eslint.org/docs/rules/max-statements-per-line) for more information.

This change enables `max-statements-per-line` and fixes the issues raised by the rule.
2020-08-14 15:13:56 -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
3bd22a2058
Fix no-template-curly-in-string issues (#9221)
See [`no-template-curly-in-string`](https://eslint.org/docs/rules/no-template-curly-in-string) for more information.

This change enables `no-template-curly-in-string` and fixes the issues raised by the rule.
2020-08-13 19:01:55 -02:30
Whymarrh Whitby
82a0ee27f3
Fix prefer-rest-params issues (#9215)
See [`prefer-rest-params`](https://eslint.org/docs/rules/prefer-rest-params) for more information.

This change enables `prefer-rest-params` and fixes the issues raised by the rule.
2020-08-13 18:05:18 -02:30
Whymarrh Whitby
146127c474
Fix no-prototype-builtins issues (#9213)
See [`no-prototype-builtins`](https://eslint.org/docs/rules/no-prototype-builtins) for more information.

This change enables `no-prototype-builtins` and fixes the issues raised by the rule.
2020-08-13 18:04:51 -02:30
Patryk Łucka
5991043cd7
Fix Etherscan redirect on notification click (#9211) 2020-08-13 13:51:31 -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
76bd7f98b6
Fix prefer-spread issues (#9203)
See [`prefer-spread`](https://eslint.org/docs/rules/prefer-spread) for more information.

This change enables `prefer-spread` and fixes the issues raised by the rule.
2020-08-12 20:42:07 -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
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
9842b2f1ce
Fix no-useless-catch issues (#9198)
See [`no-useless-catch`](https://eslint.org/docs/rules/no-useless-catch) for more information.

This change enables `no-useless-catch` and fixes the issues raised by the rule.
2020-08-12 16:37:15 -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
Mark Stacey
3d9b545771 Merge remote-tracking branch 'origin/master' into sync-master
* origin/master: (44 commits)
  Add category in eventOpts (#9164)
  Update changelog for v8.0.7 (#9161)
  Version v8.0.7
  Remove web3 e2e tests (#9159)
  Add web3 usage metrics, prepare for web3 removal (#9144)
  Use `pathname` instead of URL for `currentPath` metrics parameter (#9158)
  Remove `url` parameter from `metricsEvent` (#9157)
  Change MetaMetrics category for background events (#9155)
  remove .network-name height
  Use luxon@1.24.1 (#9154)
  Update 'react-devtools' to ^4.8.0 (#9140)
  Fix connection removal bug (#9137)
  Add source map validator to CI (#9135)
  Update source map validator target files (#9133)
  Improve sourcemap validator console report (#9131)
  Add `validate-source-maps` npm script (#9134)
  Non-zero exit code upon failure to validate source maps (#9132)
  Update `brfs` from v1.6.1 to v2.0.2 (#9115)
  Factor out `getEnvironment` function in build script (#9114)
  Update `browserify` from v16.2.3 to v16.5.1 (#9113)
  ...
2020-08-10 15:12:07 -03:00
Mark Stacey
cb503d9403
Refactor assignment of "Background" metrics category (#9168)
The "Background" metrics category was being set in the
`backgroundMetaMetricsEvent` function. This function might not
necessarily include any event at all though, so setting it here seemed
inappropriate. It would also crash if `eventData.eventOpts` was not
set, which is not great since that property is optional.

The background category is now set in the `sendBackgroundMetaMetrics`
function in `metamask-controller`. This method is used solely for event
data, so it would make sense for this category to be always set.

There is no functional difference, since `backgroundMetaMetricsEvent`
is called solely by `sendBackgroundMetaMetrics`.
2020-08-10 12:38:56 -03:00
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
Thomas Huang
747f4bb5c3 Add category in eventOpts (#9164) 2020-08-09 00:43:20 -03:00
Thomas Huang
3a7097a4cf
Add category in eventOpts (#9164) 2020-08-09 00:42:36 -03:00
MetaMask Bot
8063a83d85 Version v8.0.7 2020-08-07 19:45:54 +00:00
Erik Marks
500dbf76cf 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 16:42:48 -03:00
Mark Stacey
f39498703e 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 16:42:48 -03:00
Mark Stacey
426ddc8010 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 16:42:48 -03:00
Mark Stacey
dc69e4e9d3 Change MetaMetrics category for background events (#9155)
Background events are now sent in the `Background` category, rather
than `backend`. Conventionally we use the term "background" over
"backend", as it's not really a "backend" in the normal sense since
it's a client background process. Also it's capitalized because all of
the other event categories are capitalized as well.

The metrics URL has been updated to use `background` instead of
`backend` as well, for consistency.

Luckily we don't have to worry about our metrics being disjointed due
to this name change, because the background metrics never worked to
begin with! So there will be none under the old name. The metrics will
be made functional in a separate PR.
2020-08-07 16:42:48 -03:00
Erik Marks
c33eecb33b Fix connection removal bug (#9137)
* fix remove connections bug
2020-08-07 16:42:48 -03:00
Whymarrh Whitby
e435291074 Use async/await for seedPhraseVerifier.verifyAccounts (#9100) 2020-08-07 16:42:48 -03:00
Whymarrh Whitby
a7089193c8 Use async/await for getRestrictedMethods (#9099) 2020-08-07 16:42:48 -03:00
Brad Decker
10a12b8033 update email us to contact us (#9104) 2020-08-07 16:42:48 -03:00
Mark Stacey
0b71e1a619 Use environment variable for production Sentry DSN (#9097)
The Sentry DSN is now expected to be provided via environment variable
for production builds. The build script will fail if it is missing, and
an error will be thrown at runtime if it is missing.

The `SENTRY_DSN` environment variable has been set in CI to the old
value for `SENTRY_PROD_DSN`. We can migrate to a new DSN at some point
in the future.
2020-08-07 16:42:47 -03:00
Mark Stacey
0fb931950c Disable Sentry in development (#9095)
In a non-production environment, Sentry was configured to send error
reports to a "test" MetaMask project. It will still do this during e2e
tests, but in development Sentry is now disabled completely.

In practice this was never useful in development.
2020-08-07 16:42:47 -03:00
Thomas Huang
f9e4023b04 Fix popup/notification when browser is in fullscreen, primarily on macOS. (#9075)
* Fix popup/notification when browser is in fullscreen, primarily on OSX.

The issue was reported internally via Slack. User was running Mac OSX Chrome in fullscreen mode where Chrome is created in a new Desktop workspace.

The issue reproduced on OSX Chrome in fullscreen/maximized view overrides the explicitly set width and height for `windows.create()`. Possibly not overrides, but creates a window based off of the window that it was created from. Found a related [Chromium bug](https://bugs.chromium.org/p/chromium/issues/detail?id=263092&q=window%20create%20width%20os%3DMac&can=2).
The fullscreen `popup.left` pixel will calculate the window position incorrectly since we set and assume the width of the created window. The incorrect `left` position the window and transition the focus Desktop/Workspace incorrectly and make is seem to lose focus of the new window/workspace. Incidentally this will make the popup full width/height, and create a new workspace for the view, which we have no control over until Chrome
fixes it.

This will check if the popup is 'fullscreen', which it gets passed from the origin window, if so then don't reposition the window. If Chrome fixes the issue we can revert this change.

* Feedback commit

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-08-07 16:42:47 -03:00
ryanml
230d43176d Fixes MetaMask/metamask-extension#8626 - verifies password on requesting seed phrase (#9063) 2020-08-07 16:42:47 -03: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
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
Mark Stacey
1d84f33dbd
Change MetaMetrics category for background events (#9155)
Background events are now sent in the `Background` category, rather
than `backend`. Conventionally we use the term "background" over
"backend", as it's not really a "backend" in the normal sense since
it's a client background process. Also it's capitalized because all of
the other event categories are capitalized as well.

The metrics URL has been updated to use `background` instead of
`backend` as well, for consistency.

Luckily we don't have to worry about our metrics being disjointed due
to this name change, because the background metrics never worked to
begin with! So there will be none under the old name. The metrics will
be made functional in a separate PR.
2020-08-07 13:45:49 -03:00
Erik Marks
658e478f29
Fix connection removal bug (#9137)
* fix remove connections bug
2020-08-04 13:02:48 -07:00
Whymarrh Whitby
002f021fc0
Use async/await for seedPhraseVerifier.verifyAccounts (#9100) 2020-07-29 19:50:38 -02:30
Whymarrh Whitby
e0cc84bbfa
Use async/await for getRestrictedMethods (#9099) 2020-07-29 19:50:20 -02:30
Brad Decker
1207d43945
update email us to contact us (#9104) 2020-07-29 16:05:19 -05:00
Mark Stacey
d7a5319222
Use environment variable for production Sentry DSN (#9097)
The Sentry DSN is now expected to be provided via environment variable
for production builds. The build script will fail if it is missing, and
an error will be thrown at runtime if it is missing.

The `SENTRY_DSN` environment variable has been set in CI to the old
value for `SENTRY_PROD_DSN`. We can migrate to a new DSN at some point
in the future.
2020-07-29 13:14:08 -03:00
Mark Stacey
869c252088
Disable Sentry in development (#9095)
In a non-production environment, Sentry was configured to send error
reports to a "test" MetaMask project. It will still do this during e2e
tests, but in development Sentry is now disabled completely.

In practice this was never useful in development.
2020-07-28 16:59:47 -03:00
Brad Decker
13aafa4702
Add euclid fontface (#9018) 2020-07-27 17:15:44 -05:00
Thomas Huang
ef1b1d5738
Fix popup/notification when browser is in fullscreen, primarily on macOS. (#9075)
* Fix popup/notification when browser is in fullscreen, primarily on OSX.

The issue was reported internally via Slack. User was running Mac OSX Chrome in fullscreen mode where Chrome is created in a new Desktop workspace.

The issue reproduced on OSX Chrome in fullscreen/maximized view overrides the explicitly set width and height for `windows.create()`. Possibly not overrides, but creates a window based off of the window that it was created from. Found a related [Chromium bug](https://bugs.chromium.org/p/chromium/issues/detail?id=263092&q=window%20create%20width%20os%3DMac&can=2).
The fullscreen `popup.left` pixel will calculate the window position incorrectly since we set and assume the width of the created window. The incorrect `left` position the window and transition the focus Desktop/Workspace incorrectly and make is seem to lose focus of the new window/workspace. Incidentally this will make the popup full width/height, and create a new workspace for the view, which we have no control over until Chrome
fixes it.

This will check if the popup is 'fullscreen', which it gets passed from the origin window, if so then don't reposition the window. If Chrome fixes the issue we can revert this change.

* Feedback commit

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

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
2020-07-27 11:33:25 -07:00
ryanml
b4663eb78b
Fixes MetaMask/metamask-extension#8626 - verifies password on requesting seed phrase (#9063) 2020-07-24 19:47:40 -03:00
Whymarrh Whitby
93978f139e
Fix typo (#9069) 2020-07-23 18:01:13 -02:30
Whymarrh Whitby
1c8a4e36ad
Update revealSeedWords to use "phrase" (#9065) 2020-07-23 16:22:47 -02:30
MetaMask Bot
e033a1c280 Version v8.0.6 2020-07-22 20:47:51 -03:00
Whymarrh Whitby
bf6578c6b8
Enable guard-for-in rule (#9000) 2020-07-21 18:40:45 -02:30
Brad Decker
e463a47588
do not show amounts for approvals (#9032) 2020-07-21 10:45:14 -05:00
Whymarrh Whitby
2ae4720443
Fix words (#9038) 2020-07-20 14:32:49 -02:30
Mark Stacey
4d66223f5c
Initialize extra report property (#9033)
The `extra` property of errors sent to Sentry is sometimes not
initialized when we add the application state. A check has been added
to initialize it if it's missing.

I suspect that this changed with v5 of `@sentry/browser`, though I
can't find any explicit confirmation of this in their changelog.
2020-07-17 20:31:18 -03:00
Whymarrh Whitby
68a64af5b3
Fix callback-return issues (#8996)
See [`callback-return`](https://eslint.org/docs/rules/callback-return) for more information.

This change enables `callback-return` and fixes the resulting issues.
2020-07-17 20:19:52 -02:30
MetaMask Bot
fef44e2303 Version v8.0.5 2020-07-17 12:42:51 -02:30
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
Thomas Huang
f02478e026
Clear AccountTracker accounts and CachedBalances on createNewVaultAndRestore (#9023) 2020-07-16 19:09:38 -07:00
Thomas Huang
7b2218ac6e
Clear unapprovedTxs on createNewVaultAndRestore (#9026)
Clear unapproved transactions from txStateManager.transactions on createNewVaultAndRestore
2020-07-16 18:37:56 -07:00
Whymarrh Whitby
c7fad8f400
Limit number of transactions passed outside of TransactionController (#9010)
Refs #8572
Refs #8991

This change limits the number of transactions (`txMeta`s) that are passed
outside of the `TransactionController`, resulting in shorter serialization and
deserialization times when state is moved between the background and UI
contexts.

`TransactionController#_updateMemstore`
---------------------------------------

The `currentNetworkTxList` state of the `TransactionController` is used
externally (i.e. outside of the controller) as the canonical source for
the full transaction history. Prior to this change, the method would iterate
the full transaction history and possibly return all of it.

This change limits it to `MAX_MEMSTORE_TX_LIST_SIZE` to make sure that:

1. Calls to `_updateMemstore` are fast(er)
2. Passing `currentNetworkTxList` around is fast(er)

(Shown in #8377, `_updateMemstore`, is called _frequently_ when a transaction
is pending.)

The list is iterated backwards because it is possible that new transactions are
at the end of the list. [1]

Results
-------

In profiles before this change, with ~3k transactions locally,
`PortDuplexStream._onMessage` took up to ~4.5s to complete when the set of
transactions is included. [2]

In profiles after this change, `PortDuplexStream._onMessage` took ~90ms to
complete. [3]

Before vs. after profile screenshots:

![Profile 1][2]
![Profile 2][3]

  [1]:5a3ae85b72/app/scripts/controllers/transactions/tx-state-manager.js (L172-L174)
  [2]:https://user-images.githubusercontent.com/1623628/87613203-36f51d80-c6e7-11ea-89bc-11a1cc2f3b1e.png
  [3]:https://user-images.githubusercontent.com/1623628/87613215-3bb9d180-c6e7-11ea-8d85-aff3acbd0374.png
  [8337]:https://github.com/MetaMask/metamask-extension/issues/8377
  [8572]:https://github.com/MetaMask/metamask-extension/issues/8572
  [8991]:https://github.com/MetaMask/metamask-extension/issues/8991
2020-07-16 17:52:41 -02:30
Mark Stacey
022ef13372
Fix migration 47 (#9014)
This migration had referred to the non-existent
`TransactionsController` instead of `TransactionController`, so it
effectively did nothing. Now it should work.

This migration hasn't been included in any release yet, so we can fix
it in-place instead of adding an additional corrected migration.

The migration comment has also been updated, as it was inaccurate.
2020-07-16 10:16:41 -03:00
Mark Stacey
01301087ea
Fix web3_clientVersion method (#8998)
This method was accidentally broken with the introduction of the
permissions controller, as this was missing from the list of safe
methods.

It is now included in the list of safe methods.

Fixes #8993
2020-07-15 15:34:10 -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
Whymarrh Whitby
46a6027a4e
Remove isBrave Sentry flag (#8967) 2020-07-10 17:23:57 -02:30
Whymarrh Whitby
c6d9416944
Remove unsupport.html (#8966)
This removes the `app/unsupport.html` file as it is unused. There are no references to it.
2020-07-10 14:58:04 -02:30
Whymarrh Whitby
511cf77895
Remove unused images (#8965) 2020-07-10 14:57:48 -02:30
Brad Decker
9c54b2d8d5
remove superfulous fonts (#8954) 2020-07-10 10:42:59 -05:00
Mark Stacey
f1bfb84b4b
Throw error upon currency update failure (#8944)
The currency rate controller is updated upon each network change, as
the "native currency" is network-dependent and might have changed.
However, any thrown errors were being caught and passed to an empty
callback.

The errors are now re-thrown in the callback. As a result, the errors
will now be printed to the console and sent to Sentry.
2020-07-08 18:44:38 -03:00
Mark Stacey
8ff1d05df3
Remove recipient blocklist checker (#8943)
It seems that this blocklist checker never worked correctly. Ever since
the initial commit, it was comparing the Number `1` to the `networkId`,
which is a string. Additionally, even if it did throw, the transaction
continued unhindered. The user could still approve it, and there was no
indication shown to the user that anything went wrong. Also some of the
blocklist entries were incorrectly mixed-case, and were never hit.

We can remove this for now, and re-add it later on after we rewrite the
transaction controller.
2020-07-08 18:34:54 -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
Mark Stacey
a71cc2b137
Fix display of incoming transactions (#8942)
The `metamaskNetworkId` property in the `txMeta` for incoming
transactions was incorrectly set as a Number instead of a String. This
change was made accidentally as part of #8627.

As a result incoming transactions were being excluded from the
transaction list, as they didn't have a matching network ID.

`metamaskNetworkId` is now set to a string, and a migration has been
added to ensure `metamaskNetworkId` is converted to a string for any
incoming transactions in state.
2020-07-08 16:48:39 -03:00
MetaMask Bot
015008c147 Version v8.0.4 2020-07-07 22:29:28 +00:00
Mark Stacey
429af23ea0
Fix account tracker optimization (#8936)
An optimization in `account-tracker.js` was being skipped consistently
due to a type error (a number was being compared to a string).

The optimization in this case was to update the balances for all
accounts with a single request, rather than one request per account.
2020-07-07 19:16:38 -03:00
MetaMask Bot
8362609b5c Version v8.0.3 2020-07-06 15:50:43 -03:00
matteopey
d7f6c26fd5
Update Italian translations (#8917) 2020-07-06 11:09:30 -02:30
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
Mark Stacey
264a32d268
Merge pull request #8915 from MetaMask/master
Sync `master` with `develop`
2020-07-03 15:33:21 -03:00
Erik Marks
69fb521c7a
Begin consolidating network enums (#8914) 2020-07-03 11:10:58 -07:00
MetaMask Bot
e0c3277287 Version v8.0.2 2020-07-03 14:29:23 -03:00
Erik Marks
f97f95cc86
Fix kovan chain ID constant (#8913) 2020-07-03 10:14:43 -07:00
MetaMask Bot
03bbd400d9 Version v8.0.1 2020-07-02 21:52:50 -03:00