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

3827 Commits

Author SHA1 Message Date
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