From a664c229a8d802e029aa550d1b76773f8ed5b7a7 Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Mon, 8 Nov 2021 22:00:35 +0000 Subject: [PATCH 01/16] Version v10.6.0 --- CHANGELOG.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++- package.json | 4 +-- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01f3e7b4d..d9e42e369 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,81 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [10.6.0] +### Uncategorized +- Replacing instances of 'testnets' with 'test networks' ([#12626](https://github.com/MetaMask/metamask-extension/pull/12626)) +- Implementing display solution for testnets in the network dropdown ([#12564](https://github.com/MetaMask/metamask-extension/pull/12564)) +- Sync `master` with `develop` ([#12616](https://github.com/MetaMask/metamask-extension/pull/12616)) +- Adding 'gap' prop to Box ([#12611](https://github.com/MetaMask/metamask-extension/pull/12611)) +- Rename the function of the Ledger preference renaming ([#12459](https://github.com/MetaMask/metamask-extension/pull/12459)) +- Support for GridPlus Lattice1 hardware wallet ([#12053](https://github.com/MetaMask/metamask-extension/pull/12053)) +- Merge remote-tracking branch 'origin/develop' into master-sync +- Throw, and not just display, ledgerDeviceOpenFailureMessage on failed to open device error in ledger connect flow ([#12613](https://github.com/MetaMask/metamask-extension/pull/12613)) +- Use gas recommendation constants throughout app ([#12461](https://github.com/MetaMask/metamask-extension/pull/12461)) +- Improve browser detection code ([#12456](https://github.com/MetaMask/metamask-extension/pull/12456)) +- Updating default collectibles tab view ([#12575](https://github.com/MetaMask/metamask-extension/pull/12575)) +- Update German translations ([#12547](https://github.com/MetaMask/metamask-extension/pull/12547)) +- Minor code cleanup of _viewOnEtherscan ([#12609](https://github.com/MetaMask/metamask-extension/pull/12609)) +- Add Ledger connection flow warning message for failed to connect device error ([#12604](https://github.com/MetaMask/metamask-extension/pull/12604)) +- Fix build ([#12606](https://github.com/MetaMask/metamask-extension/pull/12606)) +- Edit transaction screen changes for EIP-1559 V2 ([#12493](https://github.com/MetaMask/metamask-extension/pull/12493)) +- Ensure proper transport type is set before attempting to connect ledger wallet ([#12594](https://github.com/MetaMask/metamask-extension/pull/12594)) +- update chromedriver to v95 ([#12603](https://github.com/MetaMask/metamask-extension/pull/12603)) +- Changed ETH decimal values to have 8 places for sending ([#12437](https://github.com/MetaMask/metamask-extension/pull/12437)) +- hide eth amount ([#12435](https://github.com/MetaMask/metamask-extension/pull/12435)) +- Network tab refactor ([#12502](https://github.com/MetaMask/metamask-extension/pull/12502)) +- Bump vm2 from 3.9.3 to 3.9.5 ([#12582](https://github.com/MetaMask/metamask-extension/pull/12582)) +- Bump tmpl from 1.0.4 to 1.0.5 ([#12581](https://github.com/MetaMask/metamask-extension/pull/12581)) +- Bump keypair from 1.0.1 to 1.0.4 ([#12583](https://github.com/MetaMask/metamask-extension/pull/12583)) +- Add beta and Flask builds to CI ([#12572](https://github.com/MetaMask/metamask-extension/pull/12572)) +- Check if ledger was successfully able to establish transport on confirm screen mount ([#12535](https://github.com/MetaMask/metamask-extension/pull/12535)) +- Heading on contact details view in popup should say "Details" instead of contact name ([#12380](https://github.com/MetaMask/metamask-extension/pull/12380)) +- Show account name & full address in send view - issue #12346 ([#12415](https://github.com/MetaMask/metamask-extension/pull/12415)) +- Fix fllWidth proptype error ([#12555](https://github.com/MetaMask/metamask-extension/pull/12555)) +- Sync `master` with `develop` ([#12571](https://github.com/MetaMask/metamask-extension/pull/12571)) +- Remove hexdata field from token send ([#12565](https://github.com/MetaMask/metamask-extension/pull/12565)) +- Merge remote-tracking branch 'origin/develop' into master-sync +- Sync `master` with `develop` ([#12568](https://github.com/MetaMask/metamask-extension/pull/12568)) +- Merge remote-tracking branch 'origin/develop' into master-sync +- Ensure ledger transport preference is set on import ([#12557](https://github.com/MetaMask/metamask-extension/pull/12557)) +- Fix/ux papercuts transaction details issue #12295 ([#12401](https://github.com/MetaMask/metamask-extension/pull/12401)) +- Warn the user of insufficient funds when approving a token ([#12496](https://github.com/MetaMask/metamask-extension/pull/12496)) +- Add lockdown e2e test ([#12562](https://github.com/MetaMask/metamask-extension/pull/12562)) +- deps - update sentry ([#12561](https://github.com/MetaMask/metamask-extension/pull/12561)) +- UX improvements to the "Permission Request" section on the approve screen ([#12553](https://github.com/MetaMask/metamask-extension/pull/12553)) +- Update the 3D beta logo ([#12497](https://github.com/MetaMask/metamask-extension/pull/12497)) +- Update build system lockdown parameter ([#12556](https://github.com/MetaMask/metamask-extension/pull/12556)) +- Don't show ledger live option in advanced settings if using firefox ([#12494](https://github.com/MetaMask/metamask-extension/pull/12494)) +- Exclude files from builds by build type ([#12521](https://github.com/MetaMask/metamask-extension/pull/12521)) +- Fixed approve confirmation logic ([#12511](https://github.com/MetaMask/metamask-extension/pull/12511)) +- Adding flexWrap prop to Box ([#12542](https://github.com/MetaMask/metamask-extension/pull/12542)) +- Fixing COLORS.GRAY ([#12538](https://github.com/MetaMask/metamask-extension/pull/12538)) +- Fix off-by-one error in code fence transform ([#12540](https://github.com/MetaMask/metamask-extension/pull/12540)) +- Add settings-component to Storybook ([#12086](https://github.com/MetaMask/metamask-extension/pull/12086)) +- update anonymous id ([#12503](https://github.com/MetaMask/metamask-extension/pull/12503)) +- Docs/12367 Adding storybook essentials addons ([#12393](https://github.com/MetaMask/metamask-extension/pull/12393)) +- Adding backgroundColor prop to Box ([#12524](https://github.com/MetaMask/metamask-extension/pull/12524)) +- Show error if user have insufficient gas. ([#12531](https://github.com/MetaMask/metamask-extension/pull/12531)) +- Deleting old GasFeeInputs hook ([#12526](https://github.com/MetaMask/metamask-extension/pull/12526)) +- Update icons on the settings page ([#12359](https://github.com/MetaMask/metamask-extension/pull/12359)) +- Add static files for the Flask build ([#12518](https://github.com/MetaMask/metamask-extension/pull/12518)) +- Provide instructions for users switching from Ledger Live to WebHID ([#12519](https://github.com/MetaMask/metamask-extension/pull/12519)) +- Remove the partially-applied dark mode styles used for beta ([#12489](https://github.com/MetaMask/metamask-extension/pull/12489)) +- Implement Network Switcher designs ([#12260](https://github.com/MetaMask/metamask-extension/pull/12260)) +- Approve screen header and sub-header improvement ([#12360](https://github.com/MetaMask/metamask-extension/pull/12360)) +- Don't show "Unavailable on this network" if Swaps button is enabled ([#12513](https://github.com/MetaMask/metamask-extension/pull/12513)) +- Adding metrics event for Advanced Options (EditGasDisplay) ([#12507](https://github.com/MetaMask/metamask-extension/pull/12507)) +- Use TRANSACTION_ENVELOPE_TYPES for legacy transaction type testing ([#12455](https://github.com/MetaMask/metamask-extension/pull/12455)) +- Create function for hardware keyring checking ([#12457](https://github.com/MetaMask/metamask-extension/pull/12457)) +- Improve token detection wording ([#12498](https://github.com/MetaMask/metamask-extension/pull/12498)) +- Adding collectibles feature flag, default NFT tab ([#12463](https://github.com/MetaMask/metamask-extension/pull/12463)) +- Fix production builds ([#12488](https://github.com/MetaMask/metamask-extension/pull/12488)) +- Update `@metamask/logo` from v3.0.1 to v3.1.0 ([#12490](https://github.com/MetaMask/metamask-extension/pull/12490)) +- Add secrets for beta and Flask builds ([#12440](https://github.com/MetaMask/metamask-extension/pull/12440)) +- Fix builds from forks ([#12485](https://github.com/MetaMask/metamask-extension/pull/12485)) +- Network Form Design and switch to full screen enhancements ([#12302](https://github.com/MetaMask/metamask-extension/pull/12302)) +- Improve autorebuilding in dev to reduce CPU load ([#11886](https://github.com/MetaMask/metamask-extension/pull/11886)) + ## [10.5.0] ### Added - [#12411](https://github.com/MetaMask/metamask-extension/pull/12411): Add support for connecting Ledger devices to MetaMask via WebHID @@ -2546,7 +2621,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Uncategorized - Added the ability to restore accounts from seed words. -[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.5.0...HEAD +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.6.0...HEAD +[10.6.0]: https://github.com/MetaMask/metamask-extension/compare/v10.5.0...v10.6.0 [10.5.0]: https://github.com/MetaMask/metamask-extension/compare/v10.4.1...v10.5.0 [10.4.1]: https://github.com/MetaMask/metamask-extension/compare/v10.4.0...v10.4.1 [10.4.0]: https://github.com/MetaMask/metamask-extension/compare/v10.3.0...v10.4.0 diff --git a/package.json b/package.json index 434c61d7a..e8b581340 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metamask-crx", - "version": "10.5.0", + "version": "10.6.0", "private": true, "repository": { "type": "git", @@ -136,8 +136,8 @@ "eth-json-rpc-infura": "^5.1.0", "eth-json-rpc-middleware": "^6.0.0", "eth-keyring-controller": "^6.2.0", - "eth-method-registry": "^2.0.0", "eth-lattice-keyring": "^0.3.0", + "eth-method-registry": "^2.0.0", "eth-query": "^2.1.2", "eth-rpc-errors": "^4.0.2", "eth-sig-util": "^3.0.0", From b5fdfe6dea25a603f3c6ca2fa061b7c3bba993e7 Mon Sep 17 00:00:00 2001 From: ryanml Date: Tue, 9 Nov 2021 08:21:37 -0700 Subject: [PATCH 02/16] [skip e2e] Updating changelog for 10.6.0 (#12630) --- CHANGELOG.md | 111 ++++++++++++++++++--------------------------------- 1 file changed, 38 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e42e369..4fa780d55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,79 +7,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [10.6.0] -### Uncategorized -- Replacing instances of 'testnets' with 'test networks' ([#12626](https://github.com/MetaMask/metamask-extension/pull/12626)) -- Implementing display solution for testnets in the network dropdown ([#12564](https://github.com/MetaMask/metamask-extension/pull/12564)) -- Sync `master` with `develop` ([#12616](https://github.com/MetaMask/metamask-extension/pull/12616)) -- Adding 'gap' prop to Box ([#12611](https://github.com/MetaMask/metamask-extension/pull/12611)) -- Rename the function of the Ledger preference renaming ([#12459](https://github.com/MetaMask/metamask-extension/pull/12459)) -- Support for GridPlus Lattice1 hardware wallet ([#12053](https://github.com/MetaMask/metamask-extension/pull/12053)) -- Merge remote-tracking branch 'origin/develop' into master-sync -- Throw, and not just display, ledgerDeviceOpenFailureMessage on failed to open device error in ledger connect flow ([#12613](https://github.com/MetaMask/metamask-extension/pull/12613)) -- Use gas recommendation constants throughout app ([#12461](https://github.com/MetaMask/metamask-extension/pull/12461)) -- Improve browser detection code ([#12456](https://github.com/MetaMask/metamask-extension/pull/12456)) -- Updating default collectibles tab view ([#12575](https://github.com/MetaMask/metamask-extension/pull/12575)) -- Update German translations ([#12547](https://github.com/MetaMask/metamask-extension/pull/12547)) -- Minor code cleanup of _viewOnEtherscan ([#12609](https://github.com/MetaMask/metamask-extension/pull/12609)) -- Add Ledger connection flow warning message for failed to connect device error ([#12604](https://github.com/MetaMask/metamask-extension/pull/12604)) -- Fix build ([#12606](https://github.com/MetaMask/metamask-extension/pull/12606)) -- Edit transaction screen changes for EIP-1559 V2 ([#12493](https://github.com/MetaMask/metamask-extension/pull/12493)) -- Ensure proper transport type is set before attempting to connect ledger wallet ([#12594](https://github.com/MetaMask/metamask-extension/pull/12594)) -- update chromedriver to v95 ([#12603](https://github.com/MetaMask/metamask-extension/pull/12603)) -- Changed ETH decimal values to have 8 places for sending ([#12437](https://github.com/MetaMask/metamask-extension/pull/12437)) -- hide eth amount ([#12435](https://github.com/MetaMask/metamask-extension/pull/12435)) -- Network tab refactor ([#12502](https://github.com/MetaMask/metamask-extension/pull/12502)) -- Bump vm2 from 3.9.3 to 3.9.5 ([#12582](https://github.com/MetaMask/metamask-extension/pull/12582)) -- Bump tmpl from 1.0.4 to 1.0.5 ([#12581](https://github.com/MetaMask/metamask-extension/pull/12581)) -- Bump keypair from 1.0.1 to 1.0.4 ([#12583](https://github.com/MetaMask/metamask-extension/pull/12583)) -- Add beta and Flask builds to CI ([#12572](https://github.com/MetaMask/metamask-extension/pull/12572)) -- Check if ledger was successfully able to establish transport on confirm screen mount ([#12535](https://github.com/MetaMask/metamask-extension/pull/12535)) -- Heading on contact details view in popup should say "Details" instead of contact name ([#12380](https://github.com/MetaMask/metamask-extension/pull/12380)) -- Show account name & full address in send view - issue #12346 ([#12415](https://github.com/MetaMask/metamask-extension/pull/12415)) -- Fix fllWidth proptype error ([#12555](https://github.com/MetaMask/metamask-extension/pull/12555)) -- Sync `master` with `develop` ([#12571](https://github.com/MetaMask/metamask-extension/pull/12571)) -- Remove hexdata field from token send ([#12565](https://github.com/MetaMask/metamask-extension/pull/12565)) -- Merge remote-tracking branch 'origin/develop' into master-sync -- Sync `master` with `develop` ([#12568](https://github.com/MetaMask/metamask-extension/pull/12568)) -- Merge remote-tracking branch 'origin/develop' into master-sync -- Ensure ledger transport preference is set on import ([#12557](https://github.com/MetaMask/metamask-extension/pull/12557)) -- Fix/ux papercuts transaction details issue #12295 ([#12401](https://github.com/MetaMask/metamask-extension/pull/12401)) -- Warn the user of insufficient funds when approving a token ([#12496](https://github.com/MetaMask/metamask-extension/pull/12496)) -- Add lockdown e2e test ([#12562](https://github.com/MetaMask/metamask-extension/pull/12562)) -- deps - update sentry ([#12561](https://github.com/MetaMask/metamask-extension/pull/12561)) -- UX improvements to the "Permission Request" section on the approve screen ([#12553](https://github.com/MetaMask/metamask-extension/pull/12553)) -- Update the 3D beta logo ([#12497](https://github.com/MetaMask/metamask-extension/pull/12497)) -- Update build system lockdown parameter ([#12556](https://github.com/MetaMask/metamask-extension/pull/12556)) -- Don't show ledger live option in advanced settings if using firefox ([#12494](https://github.com/MetaMask/metamask-extension/pull/12494)) -- Exclude files from builds by build type ([#12521](https://github.com/MetaMask/metamask-extension/pull/12521)) -- Fixed approve confirmation logic ([#12511](https://github.com/MetaMask/metamask-extension/pull/12511)) -- Adding flexWrap prop to Box ([#12542](https://github.com/MetaMask/metamask-extension/pull/12542)) -- Fixing COLORS.GRAY ([#12538](https://github.com/MetaMask/metamask-extension/pull/12538)) -- Fix off-by-one error in code fence transform ([#12540](https://github.com/MetaMask/metamask-extension/pull/12540)) -- Add settings-component to Storybook ([#12086](https://github.com/MetaMask/metamask-extension/pull/12086)) -- update anonymous id ([#12503](https://github.com/MetaMask/metamask-extension/pull/12503)) -- Docs/12367 Adding storybook essentials addons ([#12393](https://github.com/MetaMask/metamask-extension/pull/12393)) -- Adding backgroundColor prop to Box ([#12524](https://github.com/MetaMask/metamask-extension/pull/12524)) -- Show error if user have insufficient gas. ([#12531](https://github.com/MetaMask/metamask-extension/pull/12531)) -- Deleting old GasFeeInputs hook ([#12526](https://github.com/MetaMask/metamask-extension/pull/12526)) -- Update icons on the settings page ([#12359](https://github.com/MetaMask/metamask-extension/pull/12359)) -- Add static files for the Flask build ([#12518](https://github.com/MetaMask/metamask-extension/pull/12518)) -- Provide instructions for users switching from Ledger Live to WebHID ([#12519](https://github.com/MetaMask/metamask-extension/pull/12519)) -- Remove the partially-applied dark mode styles used for beta ([#12489](https://github.com/MetaMask/metamask-extension/pull/12489)) -- Implement Network Switcher designs ([#12260](https://github.com/MetaMask/metamask-extension/pull/12260)) -- Approve screen header and sub-header improvement ([#12360](https://github.com/MetaMask/metamask-extension/pull/12360)) -- Don't show "Unavailable on this network" if Swaps button is enabled ([#12513](https://github.com/MetaMask/metamask-extension/pull/12513)) -- Adding metrics event for Advanced Options (EditGasDisplay) ([#12507](https://github.com/MetaMask/metamask-extension/pull/12507)) -- Use TRANSACTION_ENVELOPE_TYPES for legacy transaction type testing ([#12455](https://github.com/MetaMask/metamask-extension/pull/12455)) -- Create function for hardware keyring checking ([#12457](https://github.com/MetaMask/metamask-extension/pull/12457)) -- Improve token detection wording ([#12498](https://github.com/MetaMask/metamask-extension/pull/12498)) -- Adding collectibles feature flag, default NFT tab ([#12463](https://github.com/MetaMask/metamask-extension/pull/12463)) -- Fix production builds ([#12488](https://github.com/MetaMask/metamask-extension/pull/12488)) -- Update `@metamask/logo` from v3.0.1 to v3.1.0 ([#12490](https://github.com/MetaMask/metamask-extension/pull/12490)) -- Add secrets for beta and Flask builds ([#12440](https://github.com/MetaMask/metamask-extension/pull/12440)) -- Fix builds from forks ([#12485](https://github.com/MetaMask/metamask-extension/pull/12485)) -- Network Form Design and switch to full screen enhancements ([#12302](https://github.com/MetaMask/metamask-extension/pull/12302)) -- Improve autorebuilding in dev to reduce CPU load ([#11886](https://github.com/MetaMask/metamask-extension/pull/11886)) +### Added +- [#12053](https://github.com/MetaMask/metamask-extension/pull/12053): Add support for GridPlus Lattice1 hardware wallet +- [#12496](https://github.com/MetaMask/metamask-extension/pull/12496): Add warning for insufficient funds when approving a token +- [#12564](https://github.com/MetaMask/metamask-extension/pull/12564): Add dismissable link to advanced settings to the top of the networks dropdown + +### Changed +- [#12435](https://github.com/MetaMask/metamask-extension/pull/12435): Hide ETH amount on confirm screen for contract interactions where no ETH is being sent +- [#12626](https://github.com/MetaMask/metamask-extension/pull/12626): Replace instances of 'testnets' with 'test networks' throughout the extension +- [#12380](https://github.com/MetaMask/metamask-extension/pull/12380): Update heading on contact details in popup view to say "Details" instead of the contact name +- [#12437](https://github.com/MetaMask/metamask-extension/pull/12437): Change decimal precision for ETH send amounts from 6 -> 8 +- [#12415](https://github.com/MetaMask/metamask-extension/pull/12415): Show account name when entering a user's own account address in the recipient field +- [#12498](https://github.com/MetaMask/metamask-extension/pull/12498): Change token detection option wording from "Turn on Token Detection" -> "Turn on enhanced token detection" +- [#12359](https://github.com/MetaMask/metamask-extension/pull/12359): Update settings page icon colors with different gray values +- [#12531](https://github.com/MetaMask/metamask-extension/pull/12531): Show error if user has insufficient gas during send flow +- [#12553](https://github.com/MetaMask/metamask-extension/pull/12553): Update the "Permission Request" section on the approve screen + - Update header from "Permission" -> "Permission Request" + - Update "Amount" label -> "Approved Amount" + - Update "To" label -> "Granted to" + - Specify in the "Granted to" field whether amount is designated to a contract address +- [#12401](https://github.com/MetaMask/metamask-extension/pull/12401): Update transaction details view + - Left align all content and adjust padding + - Truncate "To" and "From" addresses, show icons for addresses +- [#12360](https://github.com/MetaMask/metamask-extension/pull/12360): Update approval screen + - Update header copy: -> "Give permission to access your [token]?” + - Update subheader copy -> "By granting permission, you are allowing the following [contract/account] to access your funds” + - Include contract address and accompanying icon +- [#12302](https://github.com/MetaMask/metamask-extension/pull/12302): Open new full browser window for new network form upon clicking "Add Network" +- [#12260](https://github.com/MetaMask/metamask-extension/pull/12260): Update networks dropdown + - Change "Custom RPC" to "Add a network" button + - Hide test networks by default, and show them for users who have recently used them + - Add option to display test networks in dropdown in advanced settings + +### Removed +- [#12565](https://github.com/MetaMask/metamask-extension/pull/12565): Remove "hex data" field from the send flow for ERC-20 transactions + +### Fixed +- [#12513](https://github.com/MetaMask/metamask-extension/pull/12513): Fix "Unavailable on this network" tooltip showing on Swaps button when Swaps is enabled for the current network. +- [#12511](https://github.com/MetaMask/metamask-extension/pull/12511): Fix issue where approval confirmation says "Unlimited" though limited funds were specified ## [10.5.0] ### Added From 22468ffdb1c24349838abd2329dd97538a52e12d Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Tue, 9 Nov 2021 17:32:31 -0330 Subject: [PATCH 03/16] Run lavamoat:auto --- lavamoat/browserify/policy.json | 81 ++++++++++++- lavamoat/node/policy.json | 201 -------------------------------- 2 files changed, 77 insertions(+), 205 deletions(-) diff --git a/lavamoat/browserify/policy.json b/lavamoat/browserify/policy.json index b920f9059..4c2871474 100644 --- a/lavamoat/browserify/policy.json +++ b/lavamoat/browserify/policy.json @@ -649,9 +649,6 @@ "@sentry/browser": { "globals": { "XMLHttpRequest": true, - "document.body": true, - "document.createElement": true, - "document.head": true, "setTimeout": true }, "packages": { @@ -676,9 +673,11 @@ }, "@sentry/hub": { "globals": { - "setTimeout": true + "clearInterval": true, + "setInterval": true }, "packages": { + "@sentry/types": true, "@sentry/utils": true, "tslib": true } @@ -939,6 +938,11 @@ "safe-buffer": true } }, + "bitwise": { + "packages": { + "buffer": true + } + }, "bl": { "packages": { "buffer": true, @@ -1575,6 +1579,26 @@ "obs-store": true } }, + "eth-lattice-keyring": { + "globals": { + "addEventListener": true, + "browser": true, + "clearInterval": true, + "console.warn": true, + "open": true, + "setInterval": true + }, + "packages": { + "@ethereumjs/common": true, + "@ethereumjs/tx": true, + "bignumber.js": true, + "buffer": true, + "crypto-browserify": true, + "ethereumjs-util": true, + "events": true, + "gridplus-sdk": true + } + }, "eth-method-registry": { "packages": { "ethjs": true @@ -1730,6 +1754,11 @@ "@ethersproject/wordlists": true } }, + "ethers-eip712": { + "packages": { + "ethers": true + } + }, "ethjs": { "globals": { "clearInterval": true, @@ -1906,6 +1935,29 @@ "cross-fetch": true } }, + "gridplus-sdk": { + "globals": { + "console.error": true, + "setTimeout": true + }, + "packages": { + "aes-js": true, + "bech32": true, + "bignumber.js": true, + "bitwise": true, + "borc": true, + "bs58check": true, + "buffer": true, + "crc-32": true, + "elliptic": true, + "ethers": true, + "ethers-eip712": true, + "js-sha3": true, + "rlp-browser": true, + "secp256k1": true, + "superagent": true + } + }, "hamt-sharding": { "packages": { "is-buffer": true, @@ -4094,6 +4146,12 @@ "buffer": true } }, + "rlp-browser": { + "packages": { + "assert": true, + "buffer": true + } + }, "rn-host-detect": { "globals": { "__DEV__": true, @@ -4373,6 +4431,21 @@ "is-hex-prefixed": true } }, + "superagent": { + "globals": { + "ActiveXObject": true, + "XMLHttpRequest": true, + "btoa": true, + "clearTimeout": true, + "console.error": true, + "console.trace": true, + "console.warn": true, + "setTimeout": true + }, + "packages": { + "component-emitter": true + } + }, "textarea-caret": { "globals": { "document.body.appendChild": true, diff --git a/lavamoat/node/policy.json b/lavamoat/node/policy.json index 5526f328d..a9073f4cd 100644 --- a/lavamoat/node/policy.json +++ b/lavamoat/node/policy.json @@ -1025,16 +1025,6 @@ "buffer-equal": true } }, - "are-we-there-yet": { - "builtin": { - "events.EventEmitter": true, - "util.inherits": true - }, - "packages": { - "delegates": true, - "readable-stream": true - } - }, "arr-diff": { "packages": { "arr-flatten": true, @@ -1423,7 +1413,6 @@ "anymatch": true, "async-each": true, "braces": true, - "fsevents": true, "glob-parent": true, "inherits": true, "is-binary-path": true, @@ -1690,16 +1679,6 @@ "through2": true } }, - "detect-libc": { - "builtin": { - "child_process.spawnSync": true, - "fs.readdirSync": true, - "os.platform": true - }, - "globals": { - "process.env": true - } - }, "detective": { "packages": { "acorn-node": true, @@ -2396,45 +2375,6 @@ "process.version": true } }, - "fsevents": { - "builtin": { - "events.EventEmitter": true, - "fs.stat": true, - "path.join": true, - "util.inherits": true - }, - "globals": { - "__dirname": true, - "process.nextTick": true, - "process.platform": true, - "setImmediate": true - }, - "native": true, - "packages": { - "node-pre-gyp": true - } - }, - "gauge": { - "builtin": { - "util.format": true - }, - "globals": { - "clearInterval": true, - "process": true, - "setImmediate": true, - "setInterval": true - }, - "packages": { - "aproba": true, - "console-control-strings": true, - "has-unicode": true, - "object-assign": true, - "signal-exit": true, - "string-width": true, - "strip-ansi": true, - "wide-align": true - } - }, "get-assigned-identifiers": { "builtin": { "assert.equal": true @@ -2808,16 +2748,6 @@ "process.argv": true } }, - "has-unicode": { - "builtin": { - "os.type": true - }, - "globals": { - "process.env.LANG": true, - "process.env.LC_ALL": true, - "process.env.LC_CTYPE": true - } - }, "has-value": { "packages": { "get-value": true, @@ -2989,11 +2919,6 @@ "is-plain-object": true } }, - "is-fullwidth-code-point": { - "packages": { - "number-is-nan": true - } - }, "is-glob": { "packages": { "is-extglob": true @@ -3513,56 +3438,6 @@ "setTimeout": true } }, - "node-pre-gyp": { - "builtin": { - "events.EventEmitter": true, - "fs.existsSync": true, - "fs.readFileSync": true, - "fs.renameSync": true, - "path.dirname": true, - "path.existsSync": true, - "path.join": true, - "path.resolve": true, - "url.parse": true, - "url.resolve": true, - "util.inherits": true - }, - "globals": { - "__dirname": true, - "console.log": true, - "process.arch": true, - "process.cwd": true, - "process.env": true, - "process.platform": true, - "process.version.substr": true, - "process.versions": true - }, - "packages": { - "detect-libc": true, - "nopt": true, - "npmlog": true, - "rimraf": true, - "semver": true - } - }, - "nopt": { - "builtin": { - "path": true, - "stream.Stream": true, - "url": true - }, - "globals": { - "console": true, - "process.argv": true, - "process.env.DEBUG_NOPT": true, - "process.env.NOPT_DEBUG": true, - "process.platform": true - }, - "packages": { - "abbrev": true, - "osenv": true - } - }, "normalize-package-data": { "builtin": { "url.parse": true, @@ -3590,22 +3465,6 @@ "once": true } }, - "npmlog": { - "builtin": { - "events.EventEmitter": true, - "util": true - }, - "globals": { - "process.nextTick": true, - "process.stderr": true - }, - "packages": { - "are-we-there-yet": true, - "console-control-strings": true, - "gauge": true, - "set-blocking": true - } - }, "object-copy": { "packages": { "copy-descriptor": true, @@ -3696,54 +3555,6 @@ "readable-stream": true } }, - "os-homedir": { - "builtin": { - "os.homedir": true - }, - "globals": { - "process.env": true, - "process.getuid": true, - "process.platform": true - } - }, - "os-tmpdir": { - "globals": { - "process.env.SystemRoot": true, - "process.env.TEMP": true, - "process.env.TMP": true, - "process.env.TMPDIR": true, - "process.env.windir": true, - "process.platform": true - } - }, - "osenv": { - "builtin": { - "child_process.exec": true, - "path": true - }, - "globals": { - "process.env.COMPUTERNAME": true, - "process.env.ComSpec": true, - "process.env.EDITOR": true, - "process.env.HOSTNAME": true, - "process.env.PATH": true, - "process.env.PROMPT": true, - "process.env.PS1": true, - "process.env.Path": true, - "process.env.SHELL": true, - "process.env.USER": true, - "process.env.USERDOMAIN": true, - "process.env.USERNAME": true, - "process.env.VISUAL": true, - "process.env.path": true, - "process.nextTick": true, - "process.platform": true - }, - "packages": { - "os-homedir": true, - "os-tmpdir": true - } - }, "p-limit": { "packages": { "p-try": true @@ -4436,12 +4247,6 @@ "lru-cache": true } }, - "set-blocking": { - "globals": { - "process.stderr": true, - "process.stdout": true - } - }, "set-value": { "packages": { "extend-shallow": true, @@ -4690,7 +4495,6 @@ }, "string-width": { "packages": { - "code-point-at": true, "emoji-regex": true, "is-fullwidth-code-point": true, "strip-ansi": true @@ -5343,11 +5147,6 @@ "isexe": true } }, - "wide-align": { - "packages": { - "string-width": true - } - }, "write": { "builtin": { "fs.createWriteStream": true, From d4176a5e105ca791dcca399006551d9a31b35dd6 Mon Sep 17 00:00:00 2001 From: ryanml Date: Wed, 10 Nov 2021 10:57:41 -0700 Subject: [PATCH 04/16] Approval screen: Center justify address display content (#12639) * Approval screen: Center justify address display content * Removing width prop --- ui/pages/confirm-approve/confirm-approve-content/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/pages/confirm-approve/confirm-approve-content/index.scss b/ui/pages/confirm-approve/confirm-approve-content/index.scss index eaf0ff171..706ec06b8 100644 --- a/ui/pages/confirm-approve/confirm-approve-content/index.scss +++ b/ui/pages/confirm-approve/confirm-approve-content/index.scss @@ -34,11 +34,11 @@ &__address-display-content { display: flex; height: 27px; - width: 50%; padding: 12px 12px 14px 12px; background-color: $ui-1; border-radius: 100px; align-items: center; + justify-content: center; } &__siteimage-identicon { From 9d66f9090e44bd4fd1d1a4d2ecb1c165df1daa6e Mon Sep 17 00:00:00 2001 From: ryanml Date: Thu, 11 Nov 2021 09:49:10 -0700 Subject: [PATCH 05/16] Fixing MetaFox logo display on Approval Screen in full width (#12656) --- .../confirm-approve-content/index.scss | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/pages/confirm-approve/confirm-approve-content/index.scss b/ui/pages/confirm-approve/confirm-approve-content/index.scss index 706ec06b8..6422693e7 100644 --- a/ui/pages/confirm-approve/confirm-approve-content/index.scss +++ b/ui/pages/confirm-approve/confirm-approve-content/index.scss @@ -27,6 +27,18 @@ position: absolute; } + &__metafoxlogo { + .app-header { + &__metafox-logo--horizontal { + display: none; + } + + &__metafox-logo--icon { + display: block; + } + } + } + &__siteinfo { left: 39px; } From 00d2f90c7761d6678e74fa9c68e3f56d57ff1b1a Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 10 Nov 2021 19:33:59 -0330 Subject: [PATCH 06/16] Add platform-specific build type manifest modifications (#12638) The build system now supports platform-specific modifications to the manifest for each build type. The need to customize the `id` on Firefox motivated this change. To support this, a new directory was made in each build type directory for manifest changes. The images currently in this directory were moved into an `images` subdirectory. This new `manifest` directory can include each manifest file currently in `app/manifest`. The `_base.json` file is assumed to exist, but the platform manifest modifications are optional. --- .../beta/{ => images}/beta-mascot.json | 0 .../beta/{ => images}/icon-128.png | Bin app/build-types/beta/{ => images}/icon-16.png | Bin app/build-types/beta/{ => images}/icon-19.png | Bin app/build-types/beta/{ => images}/icon-32.png | Bin app/build-types/beta/{ => images}/icon-38.png | Bin app/build-types/beta/{ => images}/icon-48.png | Bin .../beta/{ => images}/icon-512.png | Bin app/build-types/beta/{ => images}/icon-64.png | Bin .../beta/{ => images}/info-logo.png | Bin .../beta/{ => images}/logo/metamask-fox.svg | 0 .../logo/metamask-logo-horizontal-dark.svg | 0 .../logo/metamask-logo-horizontal.svg | 0 .../beta/manifest/_base.json} | 0 app/build-types/beta/manifest/firefox.json | 7 +++ .../flask/{ => images}/flask-mascot.json | 0 .../flask/{ => images}/icon-128.png | Bin .../flask/{ => images}/icon-16.png | Bin .../flask/{ => images}/icon-19.png | Bin .../flask/{ => images}/icon-32.png | Bin .../flask/{ => images}/icon-38.png | Bin .../flask/{ => images}/icon-48.png | Bin .../flask/{ => images}/icon-512.png | Bin .../flask/{ => images}/icon-64.png | Bin .../flask/{ => images}/logo/metamask-fox.svg | 0 .../logo/metamask-logo-horizontal-dark.svg | 0 .../logo/metamask-logo-horizontal.svg | 0 .../flask/manifest/_base.json} | 0 app/build-types/flask/manifest/firefox.json | 7 +++ development/build/manifest.js | 57 +++++++++++++++--- development/build/static.js | 4 +- ui/helpers/utils/build-types.js | 4 +- 32 files changed, 66 insertions(+), 13 deletions(-) rename app/build-types/beta/{ => images}/beta-mascot.json (100%) rename app/build-types/beta/{ => images}/icon-128.png (100%) rename app/build-types/beta/{ => images}/icon-16.png (100%) rename app/build-types/beta/{ => images}/icon-19.png (100%) rename app/build-types/beta/{ => images}/icon-32.png (100%) rename app/build-types/beta/{ => images}/icon-38.png (100%) rename app/build-types/beta/{ => images}/icon-48.png (100%) rename app/build-types/beta/{ => images}/icon-512.png (100%) rename app/build-types/beta/{ => images}/icon-64.png (100%) rename app/build-types/beta/{ => images}/info-logo.png (100%) rename app/build-types/beta/{ => images}/logo/metamask-fox.svg (100%) rename app/build-types/beta/{ => images}/logo/metamask-logo-horizontal-dark.svg (100%) rename app/build-types/beta/{ => images}/logo/metamask-logo-horizontal.svg (100%) rename app/{manifest/_beta_modifications.json => build-types/beta/manifest/_base.json} (100%) create mode 100644 app/build-types/beta/manifest/firefox.json rename app/build-types/flask/{ => images}/flask-mascot.json (100%) rename app/build-types/flask/{ => images}/icon-128.png (100%) rename app/build-types/flask/{ => images}/icon-16.png (100%) rename app/build-types/flask/{ => images}/icon-19.png (100%) rename app/build-types/flask/{ => images}/icon-32.png (100%) rename app/build-types/flask/{ => images}/icon-38.png (100%) rename app/build-types/flask/{ => images}/icon-48.png (100%) rename app/build-types/flask/{ => images}/icon-512.png (100%) rename app/build-types/flask/{ => images}/icon-64.png (100%) rename app/build-types/flask/{ => images}/logo/metamask-fox.svg (100%) rename app/build-types/flask/{ => images}/logo/metamask-logo-horizontal-dark.svg (100%) rename app/build-types/flask/{ => images}/logo/metamask-logo-horizontal.svg (100%) rename app/{manifest/_flask_modifications.json => build-types/flask/manifest/_base.json} (100%) create mode 100644 app/build-types/flask/manifest/firefox.json diff --git a/app/build-types/beta/beta-mascot.json b/app/build-types/beta/images/beta-mascot.json similarity index 100% rename from app/build-types/beta/beta-mascot.json rename to app/build-types/beta/images/beta-mascot.json diff --git a/app/build-types/beta/icon-128.png b/app/build-types/beta/images/icon-128.png similarity index 100% rename from app/build-types/beta/icon-128.png rename to app/build-types/beta/images/icon-128.png diff --git a/app/build-types/beta/icon-16.png b/app/build-types/beta/images/icon-16.png similarity index 100% rename from app/build-types/beta/icon-16.png rename to app/build-types/beta/images/icon-16.png diff --git a/app/build-types/beta/icon-19.png b/app/build-types/beta/images/icon-19.png similarity index 100% rename from app/build-types/beta/icon-19.png rename to app/build-types/beta/images/icon-19.png diff --git a/app/build-types/beta/icon-32.png b/app/build-types/beta/images/icon-32.png similarity index 100% rename from app/build-types/beta/icon-32.png rename to app/build-types/beta/images/icon-32.png diff --git a/app/build-types/beta/icon-38.png b/app/build-types/beta/images/icon-38.png similarity index 100% rename from app/build-types/beta/icon-38.png rename to app/build-types/beta/images/icon-38.png diff --git a/app/build-types/beta/icon-48.png b/app/build-types/beta/images/icon-48.png similarity index 100% rename from app/build-types/beta/icon-48.png rename to app/build-types/beta/images/icon-48.png diff --git a/app/build-types/beta/icon-512.png b/app/build-types/beta/images/icon-512.png similarity index 100% rename from app/build-types/beta/icon-512.png rename to app/build-types/beta/images/icon-512.png diff --git a/app/build-types/beta/icon-64.png b/app/build-types/beta/images/icon-64.png similarity index 100% rename from app/build-types/beta/icon-64.png rename to app/build-types/beta/images/icon-64.png diff --git a/app/build-types/beta/info-logo.png b/app/build-types/beta/images/info-logo.png similarity index 100% rename from app/build-types/beta/info-logo.png rename to app/build-types/beta/images/info-logo.png diff --git a/app/build-types/beta/logo/metamask-fox.svg b/app/build-types/beta/images/logo/metamask-fox.svg similarity index 100% rename from app/build-types/beta/logo/metamask-fox.svg rename to app/build-types/beta/images/logo/metamask-fox.svg diff --git a/app/build-types/beta/logo/metamask-logo-horizontal-dark.svg b/app/build-types/beta/images/logo/metamask-logo-horizontal-dark.svg similarity index 100% rename from app/build-types/beta/logo/metamask-logo-horizontal-dark.svg rename to app/build-types/beta/images/logo/metamask-logo-horizontal-dark.svg diff --git a/app/build-types/beta/logo/metamask-logo-horizontal.svg b/app/build-types/beta/images/logo/metamask-logo-horizontal.svg similarity index 100% rename from app/build-types/beta/logo/metamask-logo-horizontal.svg rename to app/build-types/beta/images/logo/metamask-logo-horizontal.svg diff --git a/app/manifest/_beta_modifications.json b/app/build-types/beta/manifest/_base.json similarity index 100% rename from app/manifest/_beta_modifications.json rename to app/build-types/beta/manifest/_base.json diff --git a/app/build-types/beta/manifest/firefox.json b/app/build-types/beta/manifest/firefox.json new file mode 100644 index 000000000..79e3cda65 --- /dev/null +++ b/app/build-types/beta/manifest/firefox.json @@ -0,0 +1,7 @@ +{ + "applications": { + "gecko": { + "id": "webextension-beta@metamask.io" + } + } +} diff --git a/app/build-types/flask/flask-mascot.json b/app/build-types/flask/images/flask-mascot.json similarity index 100% rename from app/build-types/flask/flask-mascot.json rename to app/build-types/flask/images/flask-mascot.json diff --git a/app/build-types/flask/icon-128.png b/app/build-types/flask/images/icon-128.png similarity index 100% rename from app/build-types/flask/icon-128.png rename to app/build-types/flask/images/icon-128.png diff --git a/app/build-types/flask/icon-16.png b/app/build-types/flask/images/icon-16.png similarity index 100% rename from app/build-types/flask/icon-16.png rename to app/build-types/flask/images/icon-16.png diff --git a/app/build-types/flask/icon-19.png b/app/build-types/flask/images/icon-19.png similarity index 100% rename from app/build-types/flask/icon-19.png rename to app/build-types/flask/images/icon-19.png diff --git a/app/build-types/flask/icon-32.png b/app/build-types/flask/images/icon-32.png similarity index 100% rename from app/build-types/flask/icon-32.png rename to app/build-types/flask/images/icon-32.png diff --git a/app/build-types/flask/icon-38.png b/app/build-types/flask/images/icon-38.png similarity index 100% rename from app/build-types/flask/icon-38.png rename to app/build-types/flask/images/icon-38.png diff --git a/app/build-types/flask/icon-48.png b/app/build-types/flask/images/icon-48.png similarity index 100% rename from app/build-types/flask/icon-48.png rename to app/build-types/flask/images/icon-48.png diff --git a/app/build-types/flask/icon-512.png b/app/build-types/flask/images/icon-512.png similarity index 100% rename from app/build-types/flask/icon-512.png rename to app/build-types/flask/images/icon-512.png diff --git a/app/build-types/flask/icon-64.png b/app/build-types/flask/images/icon-64.png similarity index 100% rename from app/build-types/flask/icon-64.png rename to app/build-types/flask/images/icon-64.png diff --git a/app/build-types/flask/logo/metamask-fox.svg b/app/build-types/flask/images/logo/metamask-fox.svg similarity index 100% rename from app/build-types/flask/logo/metamask-fox.svg rename to app/build-types/flask/images/logo/metamask-fox.svg diff --git a/app/build-types/flask/logo/metamask-logo-horizontal-dark.svg b/app/build-types/flask/images/logo/metamask-logo-horizontal-dark.svg similarity index 100% rename from app/build-types/flask/logo/metamask-logo-horizontal-dark.svg rename to app/build-types/flask/images/logo/metamask-logo-horizontal-dark.svg diff --git a/app/build-types/flask/logo/metamask-logo-horizontal.svg b/app/build-types/flask/images/logo/metamask-logo-horizontal.svg similarity index 100% rename from app/build-types/flask/logo/metamask-logo-horizontal.svg rename to app/build-types/flask/images/logo/metamask-logo-horizontal.svg diff --git a/app/manifest/_flask_modifications.json b/app/build-types/flask/manifest/_base.json similarity index 100% rename from app/manifest/_flask_modifications.json rename to app/build-types/flask/manifest/_base.json diff --git a/app/build-types/flask/manifest/firefox.json b/app/build-types/flask/manifest/firefox.json new file mode 100644 index 000000000..7c8fb8f13 --- /dev/null +++ b/app/build-types/flask/manifest/firefox.json @@ -0,0 +1,7 @@ +{ + "applications": { + "gecko": { + "id": "webextension-flask@metamask.io" + } + } +} diff --git a/development/build/manifest.js b/development/build/manifest.js index 5df1f2511..a87fd53de 100644 --- a/development/build/manifest.js +++ b/development/build/manifest.js @@ -3,8 +3,6 @@ const path = require('path'); const { merge, cloneDeep } = require('lodash'); const baseManifest = require('../../app/manifest/_base.json'); -const betaManifestModifications = require('../../app/manifest/_beta_modifications.json'); -const flaskManifestModifications = require('../../app/manifest/_flask_modifications.json'); const { createTask, composeSeries } = require('./task'); const { BuildType } = require('./utils'); @@ -34,7 +32,7 @@ function createManifestTasks({ cloneDeep(baseManifest), platformModifications, browserVersionMap[platform], - getBuildModifications(buildType), + await getBuildModifications(buildType, platform), ); const dir = path.join('.', 'dist', platform); await fs.mkdir(dir, { recursive: true }); @@ -113,12 +111,53 @@ async function writeJson(obj, file) { return fs.writeFile(file, JSON.stringify(obj, null, 2)); } -function getBuildModifications(buildType) { - const buildModifications = {}; - if (buildType === BuildType.beta) { - Object.assign(buildModifications, betaManifestModifications); - } else if (buildType === BuildType.flask) { - Object.assign(buildModifications, flaskManifestModifications); +/** + * Get manifest modifications for the given build type, including modifications specific to the + * given platform. + * + * @param {BuildType} buildType - The build type. + * @param {string} platform - The platform (i.e. the browser). + * @returns {Object} The build modificantions for the given build type and platform. + */ +async function getBuildModifications(buildType, platform) { + if (!Object.values(BuildType).includes(buildType)) { + throw new Error(`Invalid build type: ${buildType}`); + } else if (buildType === BuildType.main) { + return {}; } + + const builtTypeManifestDirectoryPath = path.resolve( + __dirname, + '..', + '..', + 'app', + 'build-types', + buildType, + 'manifest', + ); + + const baseBuildTypeModificationsPath = path.join( + builtTypeManifestDirectoryPath, + '_base.json', + ); + const buildModifications = await readJson(baseBuildTypeModificationsPath); + + const platformBuildTypeModificationsPath = path.join( + builtTypeManifestDirectoryPath, + `${platform}.json`, + ); + try { + const platformBuildTypeModifications = await readJson( + platformBuildTypeModificationsPath, + ); + Object.assign(buildModifications, platformBuildTypeModifications); + } catch (error) { + // Suppress 'ENOENT' error because it indicates there are no platform-specific manifest + // modifications for this build type. + if (error.code !== 'ENOENT') { + throw error; + } + } + return buildModifications; } diff --git a/development/build/static.js b/development/build/static.js index 568bda910..1ec935502 100644 --- a/development/build/static.js +++ b/development/build/static.js @@ -23,13 +23,13 @@ module.exports = function createStaticAssetTasks({ const additionalBuildTargets = { [BuildType.beta]: [ { - src: './app/build-types/beta/', + src: './app/build-types/beta/images/', dest: `images`, }, ], [BuildType.flask]: [ { - src: './app/build-types/flask/', + src: './app/build-types/flask/images/', dest: `images`, }, ], diff --git a/ui/helpers/utils/build-types.js b/ui/helpers/utils/build-types.js index 675e0222b..8577b3905 100644 --- a/ui/helpers/utils/build-types.js +++ b/ui/helpers/utils/build-types.js @@ -1,8 +1,8 @@ ///: BEGIN:ONLY_INCLUDE_IN(beta) -import betaJson from '../../../app/build-types/beta/beta-mascot.json'; +import betaJson from '../../../app/build-types/beta/images/beta-mascot.json'; ///: END:ONLY_INCLUDE_IN ///: BEGIN:ONLY_INCLUDE_IN(flask) -import flaskJson from '../../../app/build-types/flask/flask-mascot.json'; +import flaskJson from '../../../app/build-types/flask/images/flask-mascot.json'; ///: END:ONLY_INCLUDE_IN const assetList = { From 58b7905b1896bee6dcedb0f29368a0f1193adb08 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Mon, 15 Nov 2021 12:15:01 -0600 Subject: [PATCH 07/16] GridPlus: Updates `eth-lattice-keyring` to v0.4.0 for UX improvements (#12649) Most notably this adds the ability to manage multiple Lattice/SafeCard wallets simultaneously. If a user makes a request from an address not associated with the device's active wallet, an error will display. See: https://github.com/GridPlus/eth-lattice-keyring/pull/19 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index e8b581340..b0eb1d298 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "eth-json-rpc-infura": "^5.1.0", "eth-json-rpc-middleware": "^6.0.0", "eth-keyring-controller": "^6.2.0", - "eth-lattice-keyring": "^0.3.0", + "eth-lattice-keyring": "^0.4.0", "eth-method-registry": "^2.0.0", "eth-query": "^2.1.2", "eth-rpc-errors": "^4.0.2", diff --git a/yarn.lock b/yarn.lock index 089e7872d..0ccc06bd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12435,10 +12435,10 @@ eth-keyring-controller@^6.1.0, eth-keyring-controller@^6.2.0, eth-keyring-contro loglevel "^1.5.0" obs-store "^4.0.3" -eth-lattice-keyring@^0.3.0: - version "0.3.5" - resolved "https://registry.yarnpkg.com/eth-lattice-keyring/-/eth-lattice-keyring-0.3.5.tgz#2e0aa5893206c62e4a184c5481abb13c49b07ad2" - integrity sha512-HWMfbwO+UCFA4OOuPS2tfY1mqG2u6k0+GLY9us+WLsFJTII6D/NzdN8OBQorYoYG+ce9VEJrJtRPjpOG11ZA1w== +eth-lattice-keyring@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/eth-lattice-keyring/-/eth-lattice-keyring-0.4.0.tgz#0afab94fe1c9b13377e1c78660a725c9bc0639a0" + integrity sha512-AB+FzgnyqapcZmdLeVMUDGZqA09yRQZxoVm/qZaT3kb5e4jhWon4BGRo/g65JuNagC8SltIQY6fpDh/q5gXNTQ== dependencies: "@ethereumjs/common" "^2.4.0" "@ethereumjs/tx" "^3.1.1" From 0c08cb6bf8dfbf7b0908dd0f201b8c32f0451456 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Mon, 15 Nov 2021 15:50:33 -0330 Subject: [PATCH 08/16] Add migration to set showTestNetworks to true if there is evidence of testnet use (#12675) * Add migration to set showTestNetworks to true if there is evidence the user has used a test network * Add migration to index file * Remove console.log * Clean up conditional structure in migration 67 --- app/scripts/migrations/067.js | 66 +++++++++ app/scripts/migrations/067.test.js | 217 +++++++++++++++++++++++++++++ app/scripts/migrations/index.js | 2 + 3 files changed, 285 insertions(+) create mode 100644 app/scripts/migrations/067.js create mode 100644 app/scripts/migrations/067.test.js diff --git a/app/scripts/migrations/067.js b/app/scripts/migrations/067.js new file mode 100644 index 000000000..98150edf7 --- /dev/null +++ b/app/scripts/migrations/067.js @@ -0,0 +1,66 @@ +import { cloneDeep } from 'lodash'; +import BigNumber from 'bignumber.js'; +import { TEST_CHAINS } from '../../../shared/constants/network'; + +const hexNumberIsGreaterThanZero = (hexNumber) => + new BigNumber(hexNumber || '0x0', 16).gt(0); + +const version = 67; + +/** + * Sets the showTestNetworks property to true if it was false or undefined, and there is evidence + * that the user has used a test net + */ +export default { + version, + async migrate(originalVersionedData) { + const versionedData = cloneDeep(originalVersionedData); + versionedData.meta.version = version; + const state = versionedData.data; + const newState = transformState(state); + versionedData.data = newState; + return versionedData; + }, +}; + +function transformState(state) { + const PreferencesController = state?.PreferencesController || {}; + const preferences = PreferencesController.preferences || {}; + + if (preferences.showTestNetworks) { + return state; + } + + const transactions = state?.TransactionController?.transactions || {}; + const provider = state.NetworkController?.provider || {}; + const cachedBalances = state.CachedBalancesController?.cachedBalances || {}; + + const userIsCurrentlyOnATestNet = TEST_CHAINS.includes(provider?.chainId); + const userHasMadeATestNetTransaction = Object.values( + transactions, + ).some(({ chainId }) => TEST_CHAINS.includes(chainId)); + const userHasACachedBalanceOnATestnet = TEST_CHAINS.some((chainId) => { + const cachedBalancesForChain = Object.values(cachedBalances[chainId] || {}); + const userHasABalanceGreaterThanZeroOnThisChain = cachedBalancesForChain.some( + hexNumberIsGreaterThanZero, + ); + return userHasABalanceGreaterThanZeroOnThisChain; + }); + const userHasUsedATestnet = + userIsCurrentlyOnATestNet || + userHasMadeATestNetTransaction || + userHasACachedBalanceOnATestnet; + + const newState = { + ...state, + PreferencesController: { + ...PreferencesController, + preferences: { + ...preferences, + showTestNetworks: userHasUsedATestnet, + }, + }, + }; + + return newState; +} diff --git a/app/scripts/migrations/067.test.js b/app/scripts/migrations/067.test.js new file mode 100644 index 000000000..85bfa76cf --- /dev/null +++ b/app/scripts/migrations/067.test.js @@ -0,0 +1,217 @@ +import { TEST_CHAINS } from '../../../shared/constants/network'; +import migration67 from './067'; + +describe('migration #67', () => { + it('should update the version metadata', async () => { + const oldStorage = { + meta: { + version: 66, + }, + data: {}, + }; + + const newStorage = await migration67.migrate(oldStorage); + expect(newStorage.meta).toStrictEqual({ + version: 67, + }); + }); + + it('should set showTestNetworks to true if the user is currently on a test network', async () => { + const oldStorage = { + meta: {}, + data: { + PreferencesController: { + preferences: { + showTestNetworks: false, + }, + }, + NetworkController: { + provider: { + chainId: TEST_CHAINS[0], + }, + }, + }, + }; + + const newStorage = await migration67.migrate(oldStorage); + expect( + newStorage.data.PreferencesController.preferences.showTestNetworks, + ).toBe(true); + }); + + it('should set showTestNetworks to true if there is a transaction on a test network in state', async () => { + const oldStorage = { + meta: {}, + data: { + PreferencesController: { + preferences: { + showTestNetworks: false, + }, + }, + NetworkController: { + provider: { + chainId: 'not a test net', + }, + }, + TransactionController: { + transactions: { + abc123: { + chainId: TEST_CHAINS[0], + }, + }, + }, + }, + }; + + const newStorage = await migration67.migrate(oldStorage); + expect( + newStorage.data.PreferencesController.preferences.showTestNetworks, + ).toBe(true); + }); + + it('should set showTestNetworks to true if the user has a cached balance on a test network', async () => { + const oldStorage = { + meta: {}, + data: { + PreferencesController: { + preferences: { + showTestNetworks: false, + }, + }, + NetworkController: { + provider: { + chainId: 'not a test net', + }, + }, + TransactionController: { + transactions: { + abc123: { + chainId: 'not a test net', + }, + }, + }, + CachedBalancesController: { + cachedBalances: { + '0x1': { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x0', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x0', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x0', + }, + [TEST_CHAINS[0]]: { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x0', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x1', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x0', + }, + [TEST_CHAINS[1]]: { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x0', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x0', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x0', + }, + }, + }, + }, + }; + + const newStorage = await migration67.migrate(oldStorage); + expect( + newStorage.data.PreferencesController.preferences.showTestNetworks, + ).toBe(true); + }); + + it('should leave showTestNetworks false if there is no evidence of test network usage', async () => { + const oldStorage = { + meta: {}, + data: { + PreferencesController: { + preferences: { + showTestNetworks: false, + }, + }, + NetworkController: { + provider: { + chainId: 'not a test net', + }, + }, + TransactionController: { + transactions: { + abc123: { + chainId: 'not a test net', + }, + }, + }, + CachedBalancesController: { + cachedBalances: { + '0x1': { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x10', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x20', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x30', + }, + [TEST_CHAINS[0]]: { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x0', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x0', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x0', + }, + [TEST_CHAINS[1]]: { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x0', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x0', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x0', + }, + }, + }, + }, + }; + const newStorage = await migration67.migrate(oldStorage); + expect( + newStorage.data.PreferencesController.preferences.showTestNetworks, + ).toBe(false); + }); + + it('should leave showTestNetworks true if it was true but there is no evidence of test network usage', async () => { + const oldStorage = { + meta: {}, + data: { + PreferencesController: { + preferences: { + showTestNetworks: true, + }, + }, + NetworkController: { + provider: { + chainId: 'not a test net', + }, + }, + TransactionController: { + transactions: { + abc123: { + chainId: 'not a test net', + }, + }, + }, + CachedBalancesController: { + cachedBalances: { + '0x1': { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x10', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x20', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x30', + }, + [TEST_CHAINS[0]]: { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x0', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x0', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x0', + }, + [TEST_CHAINS[1]]: { + '0x027d4ae98b79d0c52918bab4c3170bea701fb8ab': '0x0', + '0x2f318c334780961fb129d2a6c30d0763d9a5c970': '0x0', + '0x7a46ce51fbbb29c34aea1fe9833c27b5d2781925': '0x0', + }, + }, + }, + }, + }; + + const newStorage = await migration67.migrate(oldStorage); + expect( + newStorage.data.PreferencesController.preferences.showTestNetworks, + ).toBe(true); + }); +}); diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index 7baf840e3..2471381f5 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -70,6 +70,7 @@ import m063 from './063'; import m064 from './064'; import m065 from './065'; import m066 from './066'; +import m067 from './067'; const migrations = [ m002, @@ -137,6 +138,7 @@ const migrations = [ m064, m065, m066, + m067, ]; export default migrations; From e05c693279b13528a18c64105f0c744912c4bba5 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Mon, 15 Nov 2021 16:49:14 -0330 Subject: [PATCH 09/16] Adding scroll bar to handle overflow of long network lists (#12706) * Adding scroll bar to handle overflow of long network lists * set scroll property to auto * Add margin below scrollable network list --- .../app/dropdowns/network-dropdown.js | 27 ++++++++++--------- ui/css/itcss/components/network.scss | 6 +++++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ui/components/app/dropdowns/network-dropdown.js b/ui/components/app/dropdowns/network-dropdown.js index 4dd785874..7838a9864 100644 --- a/ui/components/app/dropdowns/network-dropdown.js +++ b/ui/components/app/dropdowns/network-dropdown.js @@ -338,20 +338,23 @@ class NetworkDropdown extends Component { ) : null} - {this.renderNetworkEntry('mainnet')} - {this.renderCustomRpcList(rpcListDetail, this.props.provider)} +
+ {this.renderNetworkEntry('mainnet')} -
- {this.renderNetworkEntry('ropsten')} - {this.renderNetworkEntry('kovan')} - {this.renderNetworkEntry('rinkeby')} - {this.renderNetworkEntry('goerli')} - {this.renderNetworkEntry('localhost')} + {this.renderCustomRpcList(rpcListDetail, this.props.provider)} + +
+ {this.renderNetworkEntry('ropsten')} + {this.renderNetworkEntry('kovan')} + {this.renderNetworkEntry('rinkeby')} + {this.renderNetworkEntry('goerli')} + {this.renderNetworkEntry('localhost')} +
{this.renderAddCustomButton()} diff --git a/ui/css/itcss/components/network.scss b/ui/css/itcss/components/network.scss index f7355fc1b..8772f1c38 100644 --- a/ui/css/itcss/components/network.scss +++ b/ui/css/itcss/components/network.scss @@ -128,6 +128,12 @@ width: 100%; } +.network-dropdown-list { + max-height: 330px; + overflow-y: auto; + margin-bottom: 8px; +} + .network-dropdown-divider { width: 100%; height: 1px; From c177ff31bb99ad7026145f3ff53128133781c7f8 Mon Sep 17 00:00:00 2001 From: Olusegun Akintayo Date: Tue, 16 Nov 2021 02:04:09 +0400 Subject: [PATCH 10/16] addresses an issue found in 10.6.0 QA (#12710) * addresses an issue found in 10.6.0 QA Signed-off-by: Akintayo A. Olusegun * update test cases. Signed-off-by: Akintayo A. Olusegun * Fixes unit test texts to pass Signed-off-by: Akintayo A. Olusegun --- app/_locales/en/messages.json | 8 ++++---- .../confirm-approve-content.component.test.js | 14 +++++++------- ui/pages/confirm-approve/confirm-approve.js | 4 +--- ...-gas-customization-modal.component.test.js.snap | 2 +- ...-gas-customization-modal.container.test.js.snap | 2 +- ...swaps-gas-customization-modal.container.test.js | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index f97b24f9b..24d6c5a68 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -187,7 +187,7 @@ "message": "Approved" }, "approvedAmountWithColon": { - "message": "Approved Amount:" + "message": "Approved amount:" }, "asset": { "message": "Asset" @@ -1066,7 +1066,7 @@ "message": "Goerli Test Network" }, "grantedToWithColon": { - "message": "Granted To:" + "message": "Granted to:" }, "happyToSeeYou": { "message": "We’re happy to see you." @@ -1821,7 +1821,7 @@ "message": "You have approved this permission" }, "permissionRequest": { - "message": "Permission Request" + "message": "Permission request" }, "permissionUncheckedIconDescription": { "message": "You have not approved this permission" @@ -2835,7 +2835,7 @@ "message": "Transaction encountered an error." }, "transactionFee": { - "message": "Transaction Fee" + "message": "Transaction fee" }, "transactionHistoryBaseFee": { "message": "Base Fee (GWEI)" diff --git a/ui/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js b/ui/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js index ab3b94b20..162332853 100644 --- a/ui/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js +++ b/ui/pages/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js @@ -58,7 +58,7 @@ describe('ConfirmApproveContent Component', () => { const editButtons = getAllByText('Edit'); - expect(queryByText('Transaction Fee')).toBeInTheDocument(); + expect(queryByText('Transaction fee')).toBeInTheDocument(); expect( queryByText('A fee is associated with this request.'), ).toBeInTheDocument(); @@ -72,13 +72,13 @@ describe('ConfirmApproveContent Component', () => { expect(props.showCustomizeNonceModal).toHaveBeenCalledTimes(1); const showHideTxDetails = getByText('View full transaction details'); - expect(queryByText('Permission Request')).not.toBeInTheDocument(); - expect(queryByText('Approved Amount:')).not.toBeInTheDocument(); - expect(queryByText('Granted To:')).not.toBeInTheDocument(); + expect(queryByText('Permission request')).not.toBeInTheDocument(); + expect(queryByText('Approved amount:')).not.toBeInTheDocument(); + expect(queryByText('Granted to:')).not.toBeInTheDocument(); fireEvent.click(showHideTxDetails); - expect(getByText('Permission Request')).toBeInTheDocument(); - expect(getByText('Approved Amount:')).toBeInTheDocument(); - expect(getByText('Granted To:')).toBeInTheDocument(); + expect(getByText('Permission request')).toBeInTheDocument(); + expect(getByText('Approved amount:')).toBeInTheDocument(); + expect(getByText('Granted to:')).toBeInTheDocument(); expect(getByText('0x9bc5...fef4')).toBeInTheDocument(); }); }); diff --git a/ui/pages/confirm-approve/confirm-approve.js b/ui/pages/confirm-approve/confirm-approve.js index dba7c95e2..a0f81be0d 100644 --- a/ui/pages/confirm-approve/confirm-approve.js +++ b/ui/pages/confirm-approve/confirm-approve.js @@ -145,9 +145,7 @@ export default function ConfirmApprove() { }, [checkIfContract]); const { origin } = transaction; - const formattedOrigin = origin - ? origin[0].toUpperCase() + origin.slice(1) - : ''; + const formattedOrigin = origin || ''; const { icon: siteImage = '' } = domainMetadata[origin] || {}; diff --git a/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap b/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap index 203c3c916..44ff12529 100644 --- a/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap +++ b/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap @@ -107,7 +107,7 @@ exports[`GasCustomizationModalComponent renders the component with initial props