From 3ec3baa3a1bb05ac63c859c5efaf5a94938093d8 Mon Sep 17 00:00:00 2001 From: Etienne Dusseault Date: Thu, 23 Sep 2021 22:39:22 -0300 Subject: [PATCH 01/90] send-content (#12167) --- .storybook/test-data.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 766196d2f..0eb4766c4 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -1165,6 +1165,10 @@ const state = { balance: '0x0', details: null, }, + amount: '3782dace9d900000', + gas: { + price: null, + }, }, confirmTransaction: { txData: { From bf4e5654974cefb2e1093491b8dee3a6cfb87f50 Mon Sep 17 00:00:00 2001 From: Etienne Dusseault Date: Thu, 23 Sep 2021 22:40:03 -0300 Subject: [PATCH 02/90] edit-gas-display (#12165) --- .storybook/test-data.js | 38 +++++----- .../edit-gas-popover.stories.js | 70 +++++++++++++++++-- 2 files changed, 82 insertions(+), 26 deletions(-) diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 0eb4766c4..376182e34 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -1,5 +1,3 @@ -import { TRANSACTION_STATUSES } from '../shared/constants/transaction'; - const state = { invalidCustomNetwork: { state: 'CLOSED', @@ -21,6 +19,24 @@ const state = { 1559: true, }, }, + gasFeeEstimates: '0x5208', + swapsState: { + quotes: {}, + fetchParams: null, + tokens: null, + tradeTxId: null, + approveTxId: null, + quotesLastFetched: null, + customMaxGas: '', + customGasPrice: null, + selectedAggId: null, + customApproveTxData: '', + errorKey: '', + topAggId: null, + routeState: '', + swapsFeatureIsLive: false, + swapsQuoteRefreshTime: 60000, + }, isInitialized: true, isUnlocked: true, isAccountMenuOpen: false, @@ -103,24 +119,6 @@ const state = { }, }, }, - recipient: { - address: '0x39a4e4Af7cCB654dB9500F258c64781c8FbD39F0', - nickname: 'John Doe', - error: '', - warning: '', - }, - addresses: [ - { - address: '0x39a4e4Af7cCB654dB9500F258c64781c8FbD39F0', - name: 'DAI', - isEns: false, - }, - { - address: '1x39a4e4Af7cCB654dB9500F258c64781c8FbD39F0', - name: 'ETH', - isEns: true, - }, - ], contractExchangeRates: { '0xaD6D458402F60fD3Bd25163575031ACDce07538D': 0, }, diff --git a/ui/components/app/edit-gas-popover/edit-gas-popover.stories.js b/ui/components/app/edit-gas-popover/edit-gas-popover.stories.js index 93d7cc830..b18d834be 100644 --- a/ui/components/app/edit-gas-popover/edit-gas-popover.stories.js +++ b/ui/components/app/edit-gas-popover/edit-gas-popover.stories.js @@ -1,31 +1,89 @@ import React from 'react'; +import { Provider } from 'react-redux'; +import { action } from '@storybook/addon-actions'; +import { boolean } from '@storybook/addon-knobs'; +import { decGWEIToHexWEI } from '../../../helpers/utils/conversions.util'; +import configureStore from '../../../store/store'; +import testData from '../../../../.storybook/test-data'; +import { EDIT_GAS_MODES } from '../../../../shared/constants/gas'; import EditGasPopover from '.'; +const store = configureStore(testData); + export default { title: 'Edit Gas Display Popover', + decorators: [(story) => {story()}], id: __filename, }; -export const basic = () => { +export const Basic = () => { return (
- + action(`Close Edit Gas Popover`)()} + minimumGasLimit="5700" + />
); }; -export const basicWithDifferentButtonText = () => { +export const BasicWithDifferentButtonText = () => { return (
- + action(`Close Edit Gas Popover`)()} + minimumGasLimit="5700" + />
); }; -export const educationalContentFlow = () => { +export const EducationalContentFlow = () => { return (
- + action(`Close Edit Gas Popover`)()} + minimumGasLimit="5700" + />
); }; From 2a1d0cfd2c2504ab05a0ce991055d724a35371b8 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Fri, 24 Sep 2021 11:42:28 -0230 Subject: [PATCH 03/90] Update `caniuse-lite` (#12203) The dependency `caniuse-lite` has been updated using a Yarn resolution, because it was pinned to a specific version by some dependencies. All versions requested in our dependency tree are 1.x so this did not introduce any breaking changes. This resolves a frequent console warning that shows up during builds, and when running tests and the linter. --- package.json | 1 + yarn.lock | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c5cf5a091..ce8c9bc02 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ }, "resolutions": { "**/regenerator-runtime": "^0.13.7", + "**/caniuse-lite": "1.0.30001260", "**/configstore/dot-prop": "^5.1.1", "**/ethers/elliptic": "^6.5.4", "**/knex/minimist": "^1.2.5", diff --git a/yarn.lock b/yarn.lock index c763e1955..dcdf5a466 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7762,10 +7762,12 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -caniuse-lite@^1.0.30000810, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001097, caniuse-lite@^1.0.30001157: - version "1.0.30001162" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001162.tgz#9f83aad1f42539ce9aab58bb177598f2f8e22ec6" - integrity sha512-E9FktFxaNnp4ky3ucIGzEXLM+Knzlpuq1oN1sFAU0KeayygabGTmOsndpo8QrL4D9pcThlf4D2pUKaDxPCUmVw== +caniuse-lite@1.0.30001260, caniuse-lite@^1.0.30000810, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001097, caniuse-lite@^1.0.30001157: + version "1.0.30001260" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001260.tgz#e3be3f34ddad735ca4a2736fa9e768ef34316270" + integrity sha512-Fhjc/k8725ItmrvW5QomzxLeojewxvqiYCKeFcfFEhut28IVLdpHU19dneOmltZQIE5HNbawj1HYD+1f2bM1Dg== + dependencies: + nanocolors "^0.1.0" capture-exit@^2.0.0: version "2.0.0" @@ -19642,6 +19644,11 @@ nanoassert@^1.0.0: resolved "https://registry.yarnpkg.com/nanoassert/-/nanoassert-1.1.0.tgz#4f3152e09540fde28c76f44b19bbcd1d5a42478d" integrity sha1-TzFS4JVA/eKMdvRLGbvNHVpCR40= +nanocolors@^0.1.0: + version "0.1.12" + resolved "https://registry.yarnpkg.com/nanocolors/-/nanocolors-0.1.12.tgz#8577482c58cbd7b5bb1681db4cf48f11a87fd5f6" + integrity sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ== + nanoid@^2.0.0, nanoid@^2.1.6: version "2.1.11" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-2.1.11.tgz#ec24b8a758d591561531b4176a01e3ab4f0f0280" From a86129d23fd96e2cad5fdfb9c62676081fea80f8 Mon Sep 17 00:00:00 2001 From: Etienne Dusseault Date: Fri, 24 Sep 2021 11:47:40 -0300 Subject: [PATCH 04/90] fee-card (#12166) --- ui/pages/swaps/fee-card/fee-card.stories.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/pages/swaps/fee-card/fee-card.stories.js b/ui/pages/swaps/fee-card/fee-card.stories.js index 4597edad7..b25c4b575 100644 --- a/ui/pages/swaps/fee-card/fee-card.stories.js +++ b/ui/pages/swaps/fee-card/fee-card.stories.js @@ -1,6 +1,7 @@ import React from 'react'; import { action } from '@storybook/addon-actions'; import { text, boolean, number, object } from '@storybook/addon-knobs'; +import { MAINNET_CHAIN_ID } from '../../../../shared/constants/network'; import FeeCard from './fee-card'; const tokenApprovalTextComponent = ( @@ -31,6 +32,8 @@ export const WithAllProps = () => { fee: text('secondaryFee', '100 USD'), maxFee: text('secondaryMaxFee', '200 USD'), }} + chainId={MAINNET_CHAIN_ID} + networkAndAccountSupports1559={false} onFeeCardMaxRowClick={action('Clicked max fee row link')} tokenApprovalTextComponent={tokenApprovalTextComponent} tokenApprovalSourceTokenSymbol="ABC" @@ -68,6 +71,8 @@ export const WithoutThirdRow = () => { isBestQuote={boolean('isBestQuote', true)} savings={object('savings 1', { total: '8.55' })} metaMaskFee="0.875" + chainId={MAINNET_CHAIN_ID} + networkAndAccountSupports1559={false} /> ); @@ -86,6 +91,8 @@ export const WithOnlyRequiredProps = () => { metaMaskFee="0.875" onQuotesClick={action('Clicked quotes link')} numberOfQuotes={2} + chainId={MAINNET_CHAIN_ID} + networkAndAccountSupports1559={false} /> ); From 730ff250284f0489241ce881461ac71d458f183f Mon Sep 17 00:00:00 2001 From: ryanml Date: Fri, 24 Sep 2021 09:27:22 -0700 Subject: [PATCH 05/90] Fixing accounts scrollbar for chrome (#12205) --- ui/components/app/account-menu/index.scss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui/components/app/account-menu/index.scss b/ui/components/app/account-menu/index.scss index 5b7bda389..8f1f5c8c8 100644 --- a/ui/components/app/account-menu/index.scss +++ b/ui/components/app/account-menu/index.scss @@ -129,10 +129,6 @@ max-height: 256px; scrollbar-width: auto; - &::-webkit-scrollbar { - display: none; - } - @media screen and (max-width: $break-small) { max-height: 228px; } From 30105a19d1f7a135b9965c4d5c3aaadcf87a0ab5 Mon Sep 17 00:00:00 2001 From: ryanml Date: Fri, 24 Sep 2021 09:28:54 -0700 Subject: [PATCH 06/90] Fixing alignment of settings close button (#12202) --- ui/pages/settings/index.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/pages/settings/index.scss b/ui/pages/settings/index.scss index f0df002be..a77436eb9 100644 --- a/ui/pages/settings/index.scss +++ b/ui/pages/settings/index.scss @@ -22,7 +22,7 @@ flex: 1 0 auto; - @media screen and (max-width: 575px) { + @media screen and (max-width: $break-small) { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; @@ -108,6 +108,10 @@ } } + &__close-button { + margin-left: auto; + } + &__close-button::after { content: '\00D7'; font-size: 40px; From 08dff86be070ac0b43c53561f919cb0e3167f399 Mon Sep 17 00:00:00 2001 From: "Akintayo A. Olusegun" Date: Fri, 24 Sep 2021 21:14:07 +0400 Subject: [PATCH 07/90] Add target object word to "View on Etherscan" links (#12100) * Add target object word to "View on Etherscan" links Fix for: #9476 Signed-off-by: Akintayo A. Olusegun * Fix Swap tests checking for View $1 at or View $1 on Signed-off-by: Akintayo A. Olusegun * Linter Fixes Signed-off-by: Akintayo A. Olusegun * Fix ui/hooks/useTransactionDisplayData.test.js expected result should be May 13, 2020 Update Jest snapshot for view on etherscan test Signed-off-by: Akintayo A. Olusegun * Add description of the variables in messages. Signed-off-by: Akintayo A. Olusegun * 1. localize all of the blockExplorerViewAction values 2. Apply this nit. https://github.com/MetaMask/metamask-extension/pull/12100#discussion_r708343532 Signed-off-by: Akintayo A. Olusegun * Lint fixes. Signed-off-by: Akintayo A. Olusegun * Fix locale value not used on GUI error lint error. Signed-off-by: Akintayo A. Olusegun * Reverted this commit, on circle ci, the date is May 12. Signed-off-by: Akintayo A. Olusegun * Add description to link block explore actions to where it's used. Signed-off-by: Akintayo A. Olusegun * Fix missing messages. Signed-off-by: Akintayo A. Olusegun --- app/_locales/am/messages.json | 9 ------- app/_locales/ar/messages.json | 9 ------- app/_locales/bg/messages.json | 9 ------- app/_locales/bn/messages.json | 9 ------- app/_locales/ca/messages.json | 9 ------- app/_locales/da/messages.json | 9 ------- app/_locales/de/messages.json | 9 ------- app/_locales/el/messages.json | 9 ------- app/_locales/en/messages.json | 25 ++++++++++++++++--- app/_locales/es/messages.json | 9 ------- app/_locales/es_419/messages.json | 9 ------- app/_locales/et/messages.json | 9 ------- app/_locales/fa/messages.json | 9 ------- app/_locales/fi/messages.json | 9 ------- app/_locales/fil/messages.json | 9 ------- app/_locales/fr/messages.json | 9 ------- app/_locales/he/messages.json | 9 ------- app/_locales/hi/messages.json | 9 ------- app/_locales/hr/messages.json | 9 ------- app/_locales/ht/messages.json | 3 --- app/_locales/hu/messages.json | 9 ------- app/_locales/id/messages.json | 9 ------- app/_locales/it/messages.json | 9 ------- app/_locales/ja/messages.json | 9 ------- app/_locales/kn/messages.json | 9 ------- app/_locales/ko/messages.json | 9 ------- app/_locales/lt/messages.json | 9 ------- app/_locales/lv/messages.json | 9 ------- app/_locales/ms/messages.json | 9 ------- app/_locales/no/messages.json | 9 ------- app/_locales/ph/messages.json | 9 ------- app/_locales/pl/messages.json | 9 ------- app/_locales/pt_BR/messages.json | 9 ------- app/_locales/ro/messages.json | 9 ------- app/_locales/ru/messages.json | 9 ------- app/_locales/sk/messages.json | 9 ------- app/_locales/sl/messages.json | 9 ------- app/_locales/sr/messages.json | 9 ------- app/_locales/sv/messages.json | 9 ------- app/_locales/sw/messages.json | 9 ------- app/_locales/tl/messages.json | 9 ------- app/_locales/uk/messages.json | 9 ------- app/_locales/vi/messages.json | 9 ------- app/_locales/zh_CN/messages.json | 9 ------- app/_locales/zh_TW/messages.json | 9 ------- .../app/menu-bar/account-options-menu.js | 4 ++- .../account-details-modal.component.js | 4 ++- ...transaction-list-item-details.component.js | 9 +++++-- ui/pages/asset/components/asset-options.js | 4 ++- .../swaps/awaiting-swap/awaiting-swap.test.js | 2 +- .../view-on-ether-scan-link.test.js.snap | 4 +-- .../view-on-ether-scan-link.js | 7 ++++-- .../view-on-ether-scan-link.test.js | 6 +++-- 53 files changed, 50 insertions(+), 405 deletions(-) diff --git a/app/_locales/am/messages.json b/app/_locales/am/messages.json index 50fa63a2e..3217ceb56 100644 --- a/app/_locales/am/messages.json +++ b/app/_locales/am/messages.json @@ -1124,15 +1124,6 @@ "viewContact": { "message": "ዕውቂያን ይመልከቱ" }, - "viewOnCustomBlockExplorer": { - "message": "በ $1ይመልከቱ" - }, - "viewOnEtherscan": { - "message": "በ Etherscan ላይ ይመልከቱ" - }, - "viewinExplorer": { - "message": "በኤክስፕሎረር ተመልከት" - }, "visitWebSite": { "message": "ድረ ገጻችንን ይጎብኙ" }, diff --git a/app/_locales/ar/messages.json b/app/_locales/ar/messages.json index 5f37cb4e1..3c63ec354 100644 --- a/app/_locales/ar/messages.json +++ b/app/_locales/ar/messages.json @@ -1120,15 +1120,6 @@ "viewContact": { "message": "عرض جهة الاتصال" }, - "viewOnCustomBlockExplorer": { - "message": "عرض في $1" - }, - "viewOnEtherscan": { - "message": "عرضه على Etherscan" - }, - "viewinExplorer": { - "message": "عرض في متصفح Explorer" - }, "visitWebSite": { "message": "قم بزيارة موقعنا على الإنترنت" }, diff --git a/app/_locales/bg/messages.json b/app/_locales/bg/messages.json index 57196e3b3..ceaa2f9f6 100644 --- a/app/_locales/bg/messages.json +++ b/app/_locales/bg/messages.json @@ -1123,15 +1123,6 @@ "viewContact": { "message": "Преглед на контакта" }, - "viewOnCustomBlockExplorer": { - "message": "Преглед на $1" - }, - "viewOnEtherscan": { - "message": "Преглед на Etherscan" - }, - "viewinExplorer": { - "message": "Преглед в Explorer" - }, "visitWebSite": { "message": "Посетете нашият уеб сайт" }, diff --git a/app/_locales/bn/messages.json b/app/_locales/bn/messages.json index 19c45effd..84369b869 100644 --- a/app/_locales/bn/messages.json +++ b/app/_locales/bn/messages.json @@ -1127,15 +1127,6 @@ "viewContact": { "message": "পরিচিতি দেখুন" }, - "viewOnCustomBlockExplorer": { - "message": "$1 এ দেখুন" - }, - "viewOnEtherscan": { - "message": "Etherscan দেখুন" - }, - "viewinExplorer": { - "message": "এক্সপ্লোরারে দেখুন" - }, "visitWebSite": { "message": "আমাদের ওয়েবসাইট দেখুন" }, diff --git a/app/_locales/ca/messages.json b/app/_locales/ca/messages.json index fe3311ead..8f5c9aa15 100644 --- a/app/_locales/ca/messages.json +++ b/app/_locales/ca/messages.json @@ -1096,15 +1096,6 @@ "viewContact": { "message": "Veure Contacte" }, - "viewOnCustomBlockExplorer": { - "message": "Mostra a $1" - }, - "viewOnEtherscan": { - "message": "Veure a Etherscan" - }, - "viewinExplorer": { - "message": "Mostra a Explorer" - }, "visitWebSite": { "message": "Visita el nostre lloc web" }, diff --git a/app/_locales/da/messages.json b/app/_locales/da/messages.json index c4c147bda..64c677d92 100644 --- a/app/_locales/da/messages.json +++ b/app/_locales/da/messages.json @@ -1096,15 +1096,6 @@ "viewContact": { "message": "Vis kontakt" }, - "viewOnCustomBlockExplorer": { - "message": "Se på $1" - }, - "viewOnEtherscan": { - "message": "Se på Etherscan" - }, - "viewinExplorer": { - "message": "Vis i stifinder" - }, "visitWebSite": { "message": "Besøg vores webside" }, diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index d6e52d78b..2165ab0da 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -1087,15 +1087,6 @@ "viewContact": { "message": "Kontakt anzeigen" }, - "viewOnCustomBlockExplorer": { - "message": "Für $1 ansehen" - }, - "viewOnEtherscan": { - "message": "Auf Etherscan ansehen" - }, - "viewinExplorer": { - "message": "Im Explorer anzeigen" - }, "visitWebSite": { "message": "Gehe zu unserer Webseite" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index e7239b9ae..91d8915e4 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -1121,15 +1121,6 @@ "viewContact": { "message": "Εμφάνιση Επαφής" }, - "viewOnCustomBlockExplorer": { - "message": "Προβολή σε $1" - }, - "viewOnEtherscan": { - "message": "Προβολή στο Etherscan" - }, - "viewinExplorer": { - "message": "Προβολή στον Εξερευνητή" - }, "visitWebSite": { "message": "Επισκεφθείτε τον ιστότοπό μας" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 69f5cd019..f919903dc 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -259,6 +259,22 @@ "betaWelcome": { "message": "Welcome to MetaMask Beta" }, + "blockExplorerAccountAction": { + "message": "Account", + "description": "This is used with viewOnEtherscan and viewInExplorer e.g View Account in Explorer" + }, + "blockExplorerAssetAction": { + "message": "Asset", + "description": "This is used with viewOnEtherscan and viewInExplorer e.g View Asset in Explorer" + }, + "blockExplorerSwapAction": { + "message": "Swap", + "description": "This is used with viewOnEtherscan e.g View Swap on Etherscan" + }, + "blockExplorerTransactionAction": { + "message": "Transaction", + "description": "This is used with viewOnCustomBlockExplorer and viewOnEtherscan e.g View Transaction on Etherscan" + }, "blockExplorerUrl": { "message": "Block Explorer URL" }, @@ -2781,13 +2797,16 @@ "message": "View More" }, "viewOnCustomBlockExplorer": { - "message": "View at $1" + "message": "View $1 at $2", + "description": "$1 is the action type. e.g (Account, Transaction, Swap) and $2 is the Custom Block Exporer URL" }, "viewOnEtherscan": { - "message": "View on Etherscan" + "message": "View $1 on Etherscan", + "description": "$1 is the action type. e.g (Account, Transaction, Swap)" }, "viewinExplorer": { - "message": "View in Explorer" + "message": "View $1 in Explorer", + "description": "$1 is the action type. e.g (Account, Transaction, Swap)" }, "visitWebSite": { "message": "Visit our web site" diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index b799d2d59..61253b8af 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "Ver más" }, - "viewOnCustomBlockExplorer": { - "message": "Ver en $1" - }, - "viewOnEtherscan": { - "message": "Ver en Etherscan" - }, - "viewinExplorer": { - "message": "Ver en el explorador" - }, "visitWebSite": { "message": "Visite nuestro sitio web" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index b799d2d59..61253b8af 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "Ver más" }, - "viewOnCustomBlockExplorer": { - "message": "Ver en $1" - }, - "viewOnEtherscan": { - "message": "Ver en Etherscan" - }, - "viewinExplorer": { - "message": "Ver en el explorador" - }, "visitWebSite": { "message": "Visite nuestro sitio web" }, diff --git a/app/_locales/et/messages.json b/app/_locales/et/messages.json index f44cca3d0..56ace12ae 100644 --- a/app/_locales/et/messages.json +++ b/app/_locales/et/messages.json @@ -1117,15 +1117,6 @@ "viewContact": { "message": "Kuva kontakt" }, - "viewOnCustomBlockExplorer": { - "message": "Vaata $1" - }, - "viewOnEtherscan": { - "message": "Kuva Etherscanil" - }, - "viewinExplorer": { - "message": "Kuva Exploreris" - }, "visitWebSite": { "message": "Külastage meie veebilehte" }, diff --git a/app/_locales/fa/messages.json b/app/_locales/fa/messages.json index 96b9ece48..b4eb1580c 100644 --- a/app/_locales/fa/messages.json +++ b/app/_locales/fa/messages.json @@ -1127,15 +1127,6 @@ "viewContact": { "message": "مشاهده تماس" }, - "viewOnCustomBlockExplorer": { - "message": "مشاهده در 1$1" - }, - "viewOnEtherscan": { - "message": "مشاهده در ایترسکن" - }, - "viewinExplorer": { - "message": "مشاهده در براوزر" - }, "visitWebSite": { "message": "از وب سایت ما دیدن نمایید" }, diff --git a/app/_locales/fi/messages.json b/app/_locales/fi/messages.json index 2baae1b63..a7eb15365 100644 --- a/app/_locales/fi/messages.json +++ b/app/_locales/fi/messages.json @@ -1124,15 +1124,6 @@ "viewContact": { "message": "Näytä yhteyshenkilö" }, - "viewOnCustomBlockExplorer": { - "message": "Tarkastele kohdassa $1" - }, - "viewOnEtherscan": { - "message": "Näytä Etherscanissa" - }, - "viewinExplorer": { - "message": "Tarkastele Explorerissa" - }, "visitWebSite": { "message": "Vieraile verkkosivustollamme" }, diff --git a/app/_locales/fil/messages.json b/app/_locales/fil/messages.json index a472c8bd0..235694a2f 100644 --- a/app/_locales/fil/messages.json +++ b/app/_locales/fil/messages.json @@ -1021,15 +1021,6 @@ "viewContact": { "message": "Tingnan ang Contact" }, - "viewOnCustomBlockExplorer": { - "message": "Tingnan sa $1" - }, - "viewOnEtherscan": { - "message": "Tingnan sa Etherscan" - }, - "viewinExplorer": { - "message": "Tingnan sa Explorer" - }, "visitWebSite": { "message": "Bisitahin ang aming web site" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index f43a8f73f..6421c9c9e 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -1103,15 +1103,6 @@ "viewContact": { "message": "Voir contact" }, - "viewOnCustomBlockExplorer": { - "message": "Afficher sur $1" - }, - "viewOnEtherscan": { - "message": "Voir sur Etherscan" - }, - "viewinExplorer": { - "message": "Afficher dans Explorer" - }, "visitWebSite": { "message": "Visitez notre site web" }, diff --git a/app/_locales/he/messages.json b/app/_locales/he/messages.json index 3ddc4e4fb..0fca79788 100644 --- a/app/_locales/he/messages.json +++ b/app/_locales/he/messages.json @@ -1121,15 +1121,6 @@ "viewContact": { "message": "הצג איש קשר" }, - "viewOnCustomBlockExplorer": { - "message": "הצג ב- $1" - }, - "viewOnEtherscan": { - "message": "הצג ב-Etherscan" - }, - "viewinExplorer": { - "message": "הצג באקספלורר" - }, "visitWebSite": { "message": "בקר/י באתר שלנו" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index de8052516..938b2d6fa 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "और देखें" }, - "viewOnCustomBlockExplorer": { - "message": "$1 पर देखें" - }, - "viewOnEtherscan": { - "message": "Etherscan पर देखें" - }, - "viewinExplorer": { - "message": "एक्सप्लोरर में देखें" - }, "visitWebSite": { "message": "हमारी वेबसाइट पर जाएँ" }, diff --git a/app/_locales/hr/messages.json b/app/_locales/hr/messages.json index 656fd84f9..bf117d2ba 100644 --- a/app/_locales/hr/messages.json +++ b/app/_locales/hr/messages.json @@ -1117,15 +1117,6 @@ "viewContact": { "message": "Prikaži kontakt" }, - "viewOnCustomBlockExplorer": { - "message": "Prikaži u $1" - }, - "viewOnEtherscan": { - "message": "Prikaži na Etherscanu" - }, - "viewinExplorer": { - "message": "Prikaži u Exploreru" - }, "visitWebSite": { "message": "Posjetite naše mrežno mjesto" }, diff --git a/app/_locales/ht/messages.json b/app/_locales/ht/messages.json index 6cab69c61..0b11ad742 100644 --- a/app/_locales/ht/messages.json +++ b/app/_locales/ht/messages.json @@ -688,9 +688,6 @@ "viewAccount": { "message": "Wè Kont" }, - "viewOnEtherscan": { - "message": "Wè sou Etherscan" - }, "visitWebSite": { "message": "Vizite sit entènèt nou an" }, diff --git a/app/_locales/hu/messages.json b/app/_locales/hu/messages.json index 7e8cec14b..77ead06f9 100644 --- a/app/_locales/hu/messages.json +++ b/app/_locales/hu/messages.json @@ -1117,15 +1117,6 @@ "viewContact": { "message": "Névjegy megtekintése" }, - "viewOnCustomBlockExplorer": { - "message": "Megtekintés $1-kor" - }, - "viewOnEtherscan": { - "message": "Nézze meg Etherscanen" - }, - "viewinExplorer": { - "message": "Megtekintés Explorerben" - }, "visitWebSite": { "message": "Látogass el weboldalunkra" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 80f539ad7..7df93469d 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "Lihat Selengkapnya" }, - "viewOnCustomBlockExplorer": { - "message": "Lihat di $1" - }, - "viewOnEtherscan": { - "message": "Lihat di Etherscan" - }, - "viewinExplorer": { - "message": "Lihat di Explorer" - }, "visitWebSite": { "message": "Kunjungi situs web kami" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index 57122608d..7752a1a4e 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -1947,15 +1947,6 @@ "viewContact": { "message": "Visualizza contatto" }, - "viewOnCustomBlockExplorer": { - "message": "Vedi su $1" - }, - "viewOnEtherscan": { - "message": "Vedi su Etherscan" - }, - "viewinExplorer": { - "message": "Vista in Explorer" - }, "visitWebSite": { "message": "Visita il nostro sito web" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index e6f295cc6..c7f368b3e 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "詳細を表示" }, - "viewOnCustomBlockExplorer": { - "message": "$1 に表示" - }, - "viewOnEtherscan": { - "message": "Etherscan で表示" - }, - "viewinExplorer": { - "message": "Explorer で表示" - }, "visitWebSite": { "message": "当社の Web サイトにアクセス" }, diff --git a/app/_locales/kn/messages.json b/app/_locales/kn/messages.json index 7aad7aed4..33566d0e1 100644 --- a/app/_locales/kn/messages.json +++ b/app/_locales/kn/messages.json @@ -1127,15 +1127,6 @@ "viewContact": { "message": "ಸಂಪರ್ಕವನ್ನು ವೀಕ್ಷಿಸಿ" }, - "viewOnCustomBlockExplorer": { - "message": "$1 ನಲ್ಲಿ ವೀಕ್ಷಿಸಿ" - }, - "viewOnEtherscan": { - "message": "ಎಥೆರ್‌ಸ್ಕ್ಯಾನ್‌ನಲ್ಲಿ ವೀಕ್ಷಿಸಿ" - }, - "viewinExplorer": { - "message": "ಎಕ್ಸ್‌ಪ್ಲೋರರ್‌ನಲ್ಲಿ ವೀಕ್ಷಿಸಿ" - }, "visitWebSite": { "message": "ನಮ್ಮ ವೆಬ್ ಸೈಟ್ ಅನ್ನು ಭೇಟಿ ಮಾಡಿ" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index d62801f6a..d3346651a 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "더 보기" }, - "viewOnCustomBlockExplorer": { - "message": "$1에서 보기" - }, - "viewOnEtherscan": { - "message": "Etherscan에서 보기" - }, - "viewinExplorer": { - "message": "탐색기에서 보기" - }, "visitWebSite": { "message": "당사 웹사이트 방문하기" }, diff --git a/app/_locales/lt/messages.json b/app/_locales/lt/messages.json index f315161d8..d0e00c629 100644 --- a/app/_locales/lt/messages.json +++ b/app/_locales/lt/messages.json @@ -1127,15 +1127,6 @@ "viewContact": { "message": "Peržiūrėti kontaktą" }, - "viewOnCustomBlockExplorer": { - "message": "Peržiūrėti $1" - }, - "viewOnEtherscan": { - "message": "Peržiūrėti „Etherscan“" - }, - "viewinExplorer": { - "message": "Peržiūrėti naršyklėje" - }, "visitWebSite": { "message": "Apsilankykite mūsų svetainėje" }, diff --git a/app/_locales/lv/messages.json b/app/_locales/lv/messages.json index 3fdcc90a0..95ca3aac9 100644 --- a/app/_locales/lv/messages.json +++ b/app/_locales/lv/messages.json @@ -1123,15 +1123,6 @@ "viewContact": { "message": "Skatīt līgumu" }, - "viewOnCustomBlockExplorer": { - "message": "Skatīt $1" - }, - "viewOnEtherscan": { - "message": "Skatīt Etherscan" - }, - "viewinExplorer": { - "message": "Skatīt Explorer" - }, "visitWebSite": { "message": "Apmeklējiet mūsu tīmekļa vietni" }, diff --git a/app/_locales/ms/messages.json b/app/_locales/ms/messages.json index 38f440b04..aca80b0f5 100644 --- a/app/_locales/ms/messages.json +++ b/app/_locales/ms/messages.json @@ -1101,15 +1101,6 @@ "viewContact": { "message": "Lihat Kenalan" }, - "viewOnCustomBlockExplorer": { - "message": "Lihat pada $1" - }, - "viewOnEtherscan": { - "message": "Lihat di Etherscan" - }, - "viewinExplorer": { - "message": "Lihat di Explorer" - }, "visitWebSite": { "message": "Kunjungi laman web kami" }, diff --git a/app/_locales/no/messages.json b/app/_locales/no/messages.json index c63a23962..d23287630 100644 --- a/app/_locales/no/messages.json +++ b/app/_locales/no/messages.json @@ -1102,15 +1102,6 @@ "viewContact": { "message": "Se kontrakt" }, - "viewOnCustomBlockExplorer": { - "message": "Vis ved $1 " - }, - "viewOnEtherscan": { - "message": "Vis på Etherscan " - }, - "viewinExplorer": { - "message": "Se i Explorer" - }, "visitWebSite": { "message": "Besøk nettsiden vår " }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index b4c123481..9e9a3842c 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "Tumingin Pa" }, - "viewOnCustomBlockExplorer": { - "message": "Tingnan sa $1" - }, - "viewOnEtherscan": { - "message": "Tingnan sa Etherscan" - }, - "viewinExplorer": { - "message": "Tingnan sa Explorer" - }, "visitWebSite": { "message": "Bisitahin ang aming website" }, diff --git a/app/_locales/pl/messages.json b/app/_locales/pl/messages.json index 4c7b7383d..d014eaf77 100644 --- a/app/_locales/pl/messages.json +++ b/app/_locales/pl/messages.json @@ -1115,15 +1115,6 @@ "viewContact": { "message": "Wyświetl kontakt" }, - "viewOnCustomBlockExplorer": { - "message": "Wyświetl w $1" - }, - "viewOnEtherscan": { - "message": "Zobacz na Etherscan" - }, - "viewinExplorer": { - "message": "Wyświetl w przeglądarce" - }, "visitWebSite": { "message": "Odwiedź naszą stronę" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index 79879c23f..23fa47567 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "Exibir Mais" }, - "viewOnCustomBlockExplorer": { - "message": "Exibir em $1" - }, - "viewOnEtherscan": { - "message": "Exibir no Etherscan" - }, - "viewinExplorer": { - "message": "Exibir no Explorer" - }, "visitWebSite": { "message": "Visite nosso website" }, diff --git a/app/_locales/ro/messages.json b/app/_locales/ro/messages.json index 9e934ab69..390abc7f0 100644 --- a/app/_locales/ro/messages.json +++ b/app/_locales/ro/messages.json @@ -1108,15 +1108,6 @@ "viewContact": { "message": "Vizualizare contact" }, - "viewOnCustomBlockExplorer": { - "message": "Vizualizați la $1" - }, - "viewOnEtherscan": { - "message": "Vizualizați pe Etherscan" - }, - "viewinExplorer": { - "message": "Vizualizare în Explorator" - }, "visitWebSite": { "message": "Accesați site-ul nostru" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 4d7457124..af81d4be3 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "Посмотреть больше" }, - "viewOnCustomBlockExplorer": { - "message": "Посмотреть на $1" - }, - "viewOnEtherscan": { - "message": "Посмотреть на Etherscan" - }, - "viewinExplorer": { - "message": "Проводник в проводнике" - }, "visitWebSite": { "message": "Посетите наш веб-сайт" }, diff --git a/app/_locales/sk/messages.json b/app/_locales/sk/messages.json index 0a5af86c0..3fca411cd 100644 --- a/app/_locales/sk/messages.json +++ b/app/_locales/sk/messages.json @@ -1084,15 +1084,6 @@ "viewContact": { "message": "Zobraziť kontakt" }, - "viewOnCustomBlockExplorer": { - "message": "Zobraziť na $1" - }, - "viewOnEtherscan": { - "message": "Zobraziť na Etherscan" - }, - "viewinExplorer": { - "message": "Zobraziť v Exploreri" - }, "visitWebSite": { "message": "Navštivte naši stránku" }, diff --git a/app/_locales/sl/messages.json b/app/_locales/sl/messages.json index 2aa7c40d3..be803fe10 100644 --- a/app/_locales/sl/messages.json +++ b/app/_locales/sl/messages.json @@ -1112,15 +1112,6 @@ "viewContact": { "message": "Ogled stika" }, - "viewOnCustomBlockExplorer": { - "message": "Ogled na $1 " - }, - "viewOnEtherscan": { - "message": "Poglej na Etherscan" - }, - "viewinExplorer": { - "message": "Ogled v Explorerju" - }, "visitWebSite": { "message": "Obiščite našo spletno stran" }, diff --git a/app/_locales/sr/messages.json b/app/_locales/sr/messages.json index 5a21f3df1..4190db660 100644 --- a/app/_locales/sr/messages.json +++ b/app/_locales/sr/messages.json @@ -1112,15 +1112,6 @@ "viewContact": { "message": "Pogledaj kontakt" }, - "viewOnCustomBlockExplorer": { - "message": "Pogledaj na $1" - }, - "viewOnEtherscan": { - "message": "Pogledaj na Etherscan-u" - }, - "viewinExplorer": { - "message": "Pogledati u Explorer-u" - }, "visitWebSite": { "message": "Posetite našu veb lokaciju" }, diff --git a/app/_locales/sv/messages.json b/app/_locales/sv/messages.json index 790027eda..0a42affa6 100644 --- a/app/_locales/sv/messages.json +++ b/app/_locales/sv/messages.json @@ -1102,15 +1102,6 @@ "viewContact": { "message": "Visa kontakt" }, - "viewOnCustomBlockExplorer": { - "message": "Visa vid $1" - }, - "viewOnEtherscan": { - "message": "Visa på Etherscan" - }, - "viewinExplorer": { - "message": "Visa i Utforskaren" - }, "visitWebSite": { "message": "Besök vår hemsida" }, diff --git a/app/_locales/sw/messages.json b/app/_locales/sw/messages.json index 79c583c7b..5c3aed3c9 100644 --- a/app/_locales/sw/messages.json +++ b/app/_locales/sw/messages.json @@ -1105,15 +1105,6 @@ "viewContact": { "message": "Tazama Mawasiliano" }, - "viewOnCustomBlockExplorer": { - "message": "Tazama kwenye $1" - }, - "viewOnEtherscan": { - "message": "Tazama kwenye Etherscan" - }, - "viewinExplorer": { - "message": "Tazama kwenye Explorer" - }, "visitWebSite": { "message": "Tembelea Tovuti yetu" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index c65591572..fa48e14f6 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -1900,15 +1900,6 @@ "viewContact": { "message": "Tingnan ang Contact" }, - "viewOnCustomBlockExplorer": { - "message": "Tingnan sa $1" - }, - "viewOnEtherscan": { - "message": "Tingnan sa Etherscan" - }, - "viewinExplorer": { - "message": "Tingnan sa Explorer" - }, "visitWebSite": { "message": "Bisitahin ang aming website" }, diff --git a/app/_locales/uk/messages.json b/app/_locales/uk/messages.json index a9d372722..49509ac46 100644 --- a/app/_locales/uk/messages.json +++ b/app/_locales/uk/messages.json @@ -1127,15 +1127,6 @@ "viewContact": { "message": "Переглянути контакт" }, - "viewOnCustomBlockExplorer": { - "message": "Дивитись на $1" - }, - "viewOnEtherscan": { - "message": "Дивитись на Etherscan" - }, - "viewinExplorer": { - "message": "Дивитись в Explorer" - }, "visitWebSite": { "message": "Відвідайте наш веб-сайт" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 1553f11ee..5426ec6e5 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -2386,15 +2386,6 @@ "viewMore": { "message": "Xem thêm" }, - "viewOnCustomBlockExplorer": { - "message": "Xem tại $1" - }, - "viewOnEtherscan": { - "message": "Xem trên Etherscan" - }, - "viewinExplorer": { - "message": "Xem trên trình khám phá" - }, "visitWebSite": { "message": "Truy cập trang web của chúng tôi" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 1a83650d4..cbc14db78 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -1924,15 +1924,6 @@ "viewContact": { "message": "查看联系人" }, - "viewOnCustomBlockExplorer": { - "message": "在 $1 查看" - }, - "viewOnEtherscan": { - "message": "在 Etherscan(以太坊浏览器)上查看" - }, - "viewinExplorer": { - "message": "在浏览器中查看" - }, "visitWebSite": { "message": "访问我们的网站" }, diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json index 045826588..86263d617 100644 --- a/app/_locales/zh_TW/messages.json +++ b/app/_locales/zh_TW/messages.json @@ -1115,15 +1115,6 @@ "viewContact": { "message": "觀看聯絡資訊" }, - "viewOnCustomBlockExplorer": { - "message": "在 $1 瀏覽" - }, - "viewOnEtherscan": { - "message": "在 Etherscan 上瀏覽" - }, - "viewinExplorer": { - "message": "在 Explorer 上瀏覽" - }, "visitWebSite": { "message": "造訪我們的網站" }, diff --git a/ui/components/app/menu-bar/account-options-menu.js b/ui/components/app/menu-bar/account-options-menu.js index ca9b0bfab..dfcdf2bfe 100644 --- a/ui/components/app/menu-bar/account-options-menu.js +++ b/ui/components/app/menu-bar/account-options-menu.js @@ -117,7 +117,9 @@ export default function AccountOptionsMenu({ anchorElement, onClose }) { } iconClassName="fas fa-external-link-alt" > - {rpcPrefs.blockExplorerUrl ? t('viewinExplorer') : t('viewOnEtherscan')} + {rpcPrefs.blockExplorerUrl + ? t('viewinExplorer', [t('blockExplorerAccountAction')]) + : t('viewOnEtherscan', [t('blockExplorerAccountAction')])} {exportPrivateKeyFeatureEnabled ? ( diff --git a/ui/components/app/transaction-list-item-details/transaction-list-item-details.component.js b/ui/components/app/transaction-list-item-details/transaction-list-item-details.component.js index 1e0266573..75f637e4d 100644 --- a/ui/components/app/transaction-list-item-details/transaction-list-item-details.component.js +++ b/ui/components/app/transaction-list-item-details/transaction-list-item-details.component.js @@ -181,8 +181,13 @@ export default class TransactionListItemDetails extends PureComponent { containerClassName="transaction-list-item-details__header-button-tooltip-container" title={ blockExplorerUrl - ? t('viewOnCustomBlockExplorer', [blockExplorerUrl]) - : t('viewOnEtherscan') + ? t('viewOnCustomBlockExplorer', [ + t('blockExplorerTransactionAction'), + blockExplorerUrl, + ]) + : t('viewOnEtherscan', [ + t('blockExplorerTransactionAction'), + ]) } > - {' or '} + {isMainnet && ( + <> + + {t('or')} + + )} ); } + +ImportTokenLink.propTypes = { + isMainnet: PropTypes.bool, +}; diff --git a/ui/components/app/import-token-link/index.scss b/ui/components/app/import-token-link/index.scss index 83586363a..a0d2a7ea7 100644 --- a/ui/components/app/import-token-link/index.scss +++ b/ui/components/app/import-token-link/index.scss @@ -3,6 +3,6 @@ @include H6; display: inline; - padding: 0 0 16px; + padding: 0 5px 16px; } } From 506fa2d74454ae841268ecbd39fc8161bae572ad Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 27 Sep 2021 19:05:35 -0230 Subject: [PATCH 12/90] Fix Buffer warnings during build (#10495) The warnings about use of the unsafe Buffer constructor have been addressed by package updates and patches. The updates were: * `gulp-sourcemaps` was updated from v2 to v3, and was patched to replace remaining uses of the `Buffer` constructor * Upstream PR: https://github.com/gulp-sourcemaps/gulp-sourcemaps/pull/388 * The transitive dependency `yazl` was updated from v2.4.3 to v2.5.1 in the lockfile. * The abandoned packages `combine-source-map` and `inline-source-map` were patched. --- lavamoat/node/policy.json | 29 ++--- package.json | 2 +- ...source-map++convert-source-map+1.1.3.patch | 22 ++++ patches/gulp-sourcemaps+3.0.0.patch | 44 ++++++++ patches/inline-source-map+0.6.2.patch | 13 +++ yarn.lock | 105 ++++++++++-------- 6 files changed, 146 insertions(+), 69 deletions(-) create mode 100644 patches/combine-source-map++convert-source-map+1.1.3.patch create mode 100644 patches/gulp-sourcemaps+3.0.0.patch create mode 100644 patches/inline-source-map+0.6.2.patch diff --git a/lavamoat/node/policy.json b/lavamoat/node/policy.json index 0cdbcf152..7497e459b 100644 --- a/lavamoat/node/policy.json +++ b/lavamoat/node/policy.json @@ -824,8 +824,8 @@ "@gulp-sourcemaps/identity-map": { "packages": { "acorn": true, - "css": true, "normalize-path": true, + "postcss": true, "source-map": true, "through2": true } @@ -962,15 +962,6 @@ "uri-js": true } }, - "amdefine": { - "builtin": { - "path.dirname": true - }, - "globals": { - "__filename": true, - "process.nextTick": true - } - }, "ansi-colors": { "packages": { "ansi-wrap": true @@ -1492,7 +1483,7 @@ "path.resolve": true }, "globals": { - "Buffer": true + "Buffer.from": true }, "packages": { "safe-buffer": true @@ -1551,13 +1542,13 @@ "css": { "builtin": { "fs.readFileSync": true, - "path.dirname": true + "path.dirname": true, + "path.sep": true }, "packages": { "inherits": true, "source-map": true, - "source-map-resolve": true, - "urix": true + "source-map-resolve": true } }, "d": { @@ -2496,7 +2487,8 @@ "path.sep": true }, "globals": { - "Buffer": true + "Buffer.concat": true, + "Buffer.from": true }, "packages": { "@gulp-sourcemaps/identity-map": true, @@ -2665,7 +2657,7 @@ }, "inline-source-map": { "globals": { - "Buffer": true + "Buffer.from": true }, "packages": { "source-map": true @@ -4011,16 +4003,15 @@ "console.time": true, "console.timeEnd": true, "fetch": true - }, - "packages": { - "amdefine": true } }, "source-map-resolve": { "builtin": { + "path.sep": true, "url.resolve": true }, "globals": { + "TextDecoder": true, "setImmediate": true }, "packages": { diff --git a/package.json b/package.json index ce8c9bc02..3096ec6fd 100644 --- a/package.json +++ b/package.json @@ -279,7 +279,7 @@ "gulp-livereload": "4.0.0", "gulp-rename": "^2.0.0", "gulp-rtlcss": "^1.4.0", - "gulp-sourcemaps": "^2.6.0", + "gulp-sourcemaps": "^3.0.0", "gulp-stylelint": "^13.0.0", "gulp-watch": "^5.0.1", "gulp-zip": "^4.0.0", diff --git a/patches/combine-source-map++convert-source-map+1.1.3.patch b/patches/combine-source-map++convert-source-map+1.1.3.patch new file mode 100644 index 000000000..c24f12817 --- /dev/null +++ b/patches/combine-source-map++convert-source-map+1.1.3.patch @@ -0,0 +1,22 @@ +diff --git a/node_modules/combine-source-map/node_modules/convert-source-map/index.js b/node_modules/combine-source-map/node_modules/convert-source-map/index.js +index bfe92d1..bee1ffe 100644 +--- a/node_modules/combine-source-map/node_modules/convert-source-map/index.js ++++ b/node_modules/combine-source-map/node_modules/convert-source-map/index.js +@@ -9,7 +9,7 @@ var mapFileCommentRx = + /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg + + function decodeBase64(base64) { +- return new Buffer(base64, 'base64').toString(); ++ return Buffer.from(base64, 'base64').toString(); + } + + function stripComment(sm) { +@@ -60,7 +60,7 @@ Converter.prototype.toJSON = function (space) { + + Converter.prototype.toBase64 = function () { + var json = this.toJSON(); +- return new Buffer(json).toString('base64'); ++ return Buffer.from(json).toString('base64'); + }; + + Converter.prototype.toComment = function (options) { diff --git a/patches/gulp-sourcemaps+3.0.0.patch b/patches/gulp-sourcemaps+3.0.0.patch new file mode 100644 index 000000000..056bcb8e2 --- /dev/null +++ b/patches/gulp-sourcemaps+3.0.0.patch @@ -0,0 +1,44 @@ +diff --git a/node_modules/gulp-sourcemaps/src/init/index.internals.js b/node_modules/gulp-sourcemaps/src/init/index.internals.js +index 7104555..7dfe218 100644 +--- a/node_modules/gulp-sourcemaps/src/init/index.internals.js ++++ b/node_modules/gulp-sourcemaps/src/init/index.internals.js +@@ -72,7 +72,7 @@ module.exports = function(options, file, fileContent) { + + }); + // remove source map comment from source +- file.contents = new Buffer(sources.content, 'utf8'); ++ file.contents = Buffer.from(sources.content, 'utf8'); + } + + } +diff --git a/node_modules/gulp-sourcemaps/src/write/index.internals.js b/node_modules/gulp-sourcemaps/src/write/index.internals.js +index 89cee60..adfe8d1 100644 +--- a/node_modules/gulp-sourcemaps/src/write/index.internals.js ++++ b/node_modules/gulp-sourcemaps/src/write/index.internals.js +@@ -99,7 +99,7 @@ module.exports = function(destPath, options) { + + if (destPath === undefined || destPath === null) { + // encode source map into comment +- var base64Map = new Buffer(JSON.stringify(sourceMap)).toString('base64'); ++ var base64Map = Buffer.from(JSON.stringify(sourceMap)).toString('base64'); + comment = commentFormatter('data:application/json;charset=' + options.charset + ';base64,' + base64Map); + } else { + var mapFile = path.join(destPath, file.relative) + '.map'; +@@ -130,7 +130,7 @@ module.exports = function(destPath, options) { + + var sourceMapFile = file.clone(options.clone || { deep: false, contents: false }); + sourceMapFile.path = sourceMapPath; +- sourceMapFile.contents = new Buffer(JSON.stringify(sourceMap)); ++ sourceMapFile.contents = Buffer.from(JSON.stringify(sourceMap)); + sourceMapFile.stat = { + isFile: function() { return true; }, + isDirectory: function() { return false; }, +@@ -164,7 +164,7 @@ module.exports = function(destPath, options) { + + // append source map comment + if (options.addComment) { +- file.contents = Buffer.concat([file.contents, new Buffer(comment)]); ++ file.contents = Buffer.concat([file.contents, Buffer.from(comment)]); + } + } + diff --git a/patches/inline-source-map+0.6.2.patch b/patches/inline-source-map+0.6.2.patch new file mode 100644 index 000000000..5e5ae09a0 --- /dev/null +++ b/patches/inline-source-map+0.6.2.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/inline-source-map/index.js b/node_modules/inline-source-map/index.js +index df74d61..7641aad 100644 +--- a/node_modules/inline-source-map/index.js ++++ b/node_modules/inline-source-map/index.js +@@ -91,7 +91,7 @@ Generator.prototype.addSourceContent = function (sourceFile, sourcesContent) { + */ + Generator.prototype.base64Encode = function () { + var map = this.toString(); +- return new Buffer(map).toString('base64'); ++ return Buffer.from(map).toString('base64'); + }; + + /** diff --git a/yarn.lock b/yarn.lock index dcdf5a466..ed807e29c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2129,18 +2129,18 @@ resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.13.0.tgz#fcb113d1aca4b471b709e8c9c168674fbd6e06d9" integrity sha512-xKOeQEl5O47GPZYIMToj6uuA2syyFlq9EMSl2ui0uytjY9xbe8XS0pexNWmxrdcCyNGyDmLyYw5FtKsalBUeOg== -"@gulp-sourcemaps/identity-map@1.X": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/identity-map/-/identity-map-1.0.1.tgz#cfa23bc5840f9104ce32a65e74db7e7a974bbee1" - integrity sha1-z6I7xYQPkQTOMqZedNt+epdLvuE= +"@gulp-sourcemaps/identity-map@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/identity-map/-/identity-map-2.0.1.tgz#a6e8b1abec8f790ec6be2b8c500e6e68037c0019" + integrity sha512-Tb+nSISZku+eQ4X1lAkevcQa+jknn/OVUgZ3XCxEKIsLsqYuPoJwJOPQeaOk75X3WPftb29GWY1eqE7GLsXb1Q== dependencies: - acorn "^5.0.3" - css "^2.2.1" - normalize-path "^2.1.1" - source-map "^0.5.6" - through2 "^2.0.3" + acorn "^6.4.1" + normalize-path "^3.0.0" + postcss "^7.0.16" + source-map "^0.6.0" + through2 "^3.0.1" -"@gulp-sourcemaps/map-sources@1.X": +"@gulp-sourcemaps/map-sources@^1.0.0": version "1.0.0" resolved "https://registry.yarnpkg.com/@gulp-sourcemaps/map-sources/-/map-sources-1.0.0.tgz#890ae7c5d8c877f6d384860215ace9d7ec945bda" integrity sha1-iQrnxdjId/bThIYCFazp1+yUW9o= @@ -4805,16 +4805,16 @@ acorn-walk@^7.1.1: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== -acorn@5.X, acorn@^5.0.3, acorn@^5.1.2, acorn@^5.2.1: - version "5.7.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" - integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== - acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= +acorn@^5.1.2, acorn@^5.2.1: + version "5.7.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" + integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== + acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.7, acorn@^6.4.1: version "6.4.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" @@ -8642,7 +8642,7 @@ continuable-cache@^0.3.1: resolved "https://registry.yarnpkg.com/continuable-cache/-/continuable-cache-0.3.1.tgz#bd727a7faed77e71ff3985ac93351a912733ad0f" integrity sha1-vXJ6f67XfnH/OYWskzUakSczrQ8= -convert-source-map@1.7.0, convert-source-map@1.X, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.6.0, convert-source-map@^1.7.0: +convert-source-map@1.7.0, convert-source-map@^1.4.0, convert-source-map@^1.5.0, convert-source-map@^1.5.1, convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== @@ -8654,6 +8654,13 @@ convert-source-map@^0.3.3: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190" integrity sha1-8dgClQr33SYxof6+BZZVDIarMZA= +convert-source-map@^1.0.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" + integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== + dependencies: + safe-buffer "~5.1.1" + convert-source-map@~1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" @@ -9058,7 +9065,7 @@ css.escape@^1.5.1: resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb" integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s= -css@2.X, css@^2.0.0, css@^2.2.1: +css@^2.0.0: version "2.2.3" resolved "https://registry.yarnpkg.com/css/-/css-2.2.3.tgz#f861f4ba61e79bedc962aa548e5780fd95cbc6be" integrity sha512-0W171WccAjQGGTKLhw4m2nnl0zPHUlTO/I8td4XzJgIB8Hg3ZZx71qT4G4eX8OVsSiaAKiUMy73E3nsbPlg2DQ== @@ -9255,10 +9262,10 @@ debounce@^1.0.0: resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.1.0.tgz#6a1a4ee2a9dc4b7c24bb012558dbcdb05b37f408" integrity sha512-ZQVKfRVlwRfD150ndzEK8M90ABT+Y/JQKs4Y7U4MXdpuoUkkrr4DwKbVux3YjylA5bUMUj0Nc3pMxPJX6N2QQQ== -debug-fabulous@1.X: - version "1.0.0" - resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-1.0.0.tgz#57f6648646097b1b0849dcda0017362c1ec00f8b" - integrity sha512-dsd50qQ1atDeurcxL7XOjPp4nZCGZzWIONDujDXzl1atSyC3hMbZD+v6440etw+Vt0Pr8ce4TQzHfX3KZM05Mw== +debug-fabulous@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/debug-fabulous/-/debug-fabulous-1.1.0.tgz#af8a08632465224ef4174a9f06308c3c2a1ebc8e" + integrity sha512-GZqvGIgKNlUnHUPQhepnUZFIMoi3dgZKQBzKDeL2g7oJF9SNAji/AAu36dusFUas0O+pae74lNeoIPHqXWDkLg== dependencies: debug "3.X" memoizee "0.4.X" @@ -9671,7 +9678,7 @@ detect-libc@^1.0.2: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= -detect-newline@2.X: +detect-newline@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= @@ -13764,7 +13771,7 @@ got@^7.1.0: url-parse-lax "^1.0.0" url-to-options "^1.0.1" -graceful-fs@4.X, graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.3: +graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.3: version "4.2.4" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== @@ -13874,22 +13881,22 @@ gulp-rtlcss@^1.4.0: through2 "^2.0.5" vinyl-sourcemaps-apply "^0.2.1" -gulp-sourcemaps@^2.6.0: - version "2.6.3" - resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-2.6.3.tgz#11b033f759f909e0a5f15b7bdf47ac29cc54efa4" - integrity sha1-EbAz91n5CeCl8Vt730esKcxU76Q= - dependencies: - "@gulp-sourcemaps/identity-map" "1.X" - "@gulp-sourcemaps/map-sources" "1.X" - acorn "5.X" - convert-source-map "1.X" - css "2.X" - debug-fabulous "1.X" - detect-newline "2.X" - graceful-fs "4.X" - source-map "0.X" - strip-bom-string "1.X" - through2 "2.X" +gulp-sourcemaps@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-3.0.0.tgz#2e154e1a2efed033c0e48013969e6f30337b2743" + integrity sha512-RqvUckJkuYqy4VaIH60RMal4ZtG0IbQ6PXMNkNsshEGJ9cldUPRb/YCgboYae+CLAs1HQNb4ADTKCx65HInquQ== + dependencies: + "@gulp-sourcemaps/identity-map" "^2.0.1" + "@gulp-sourcemaps/map-sources" "^1.0.0" + acorn "^6.4.1" + convert-source-map "^1.0.0" + css "^3.0.0" + debug-fabulous "^1.0.0" + detect-newline "^2.0.0" + graceful-fs "^4.0.0" + source-map "^0.6.0" + strip-bom-string "^1.0.0" + through2 "^2.0.0" gulp-stylelint@^13.0.0: version "13.0.0" @@ -25270,11 +25277,6 @@ source-map@0.6.1, source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, sourc resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@0.X, source-map@^0.7.2, source-map@^0.7.3, source-map@~0.7.2: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - source-map@^0.1.38: version "0.1.43" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" @@ -25287,6 +25289,11 @@ source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.6, source-map@^0.5.7, sour resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= +source-map@^0.7.2, source-map@^0.7.3, source-map@~0.7.2: + version "0.7.3" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" + integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== + sourcemap-codec@^1.4.1, sourcemap-codec@^1.4.4: version "1.4.8" resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" @@ -25861,7 +25868,7 @@ strip-bom-stream@^2.0.0: first-chunk-stream "^2.0.0" strip-bom "^2.0.0" -strip-bom-string@1.X: +strip-bom-string@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-bom-string/-/strip-bom-string-1.0.0.tgz#e5211e9224369fbb81d633a2f00044dc8cedad92" integrity sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI= @@ -26444,7 +26451,7 @@ through2-filter@^2.0.0: through2 "~2.0.0" xtend "~4.0.0" -through2@2.X, through2@^2.0.0, through2@^2.0.1, through2@^2.0.3, through2@^2.0.5, through2@~2.0.0, through2@~2.0.3: +through2@^2.0.0, through2@^2.0.1, through2@^2.0.3, through2@^2.0.5, through2@~2.0.0, through2@~2.0.3: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== @@ -28872,9 +28879,9 @@ yauzl@2.10.0, yauzl@^2.10.0: fd-slicer "~1.1.0" yazl@^2.1.0: - version "2.4.3" - resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.4.3.tgz#ec26e5cc87d5601b9df8432dbdd3cd2e5173a071" - integrity sha1-7CblzIfVYBud+EMtvdPNLlFzoHE= + version "2.5.1" + resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.5.1.tgz#a3d65d3dd659a5b0937850e8609f22fffa2b5c35" + integrity sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw== dependencies: buffer-crc32 "~0.2.3" From d3f7464333ae6aaa50901dc5b9b809e4bd34fa65 Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 27 Sep 2021 12:39:31 -1000 Subject: [PATCH 13/90] Ci test config improvement (#12223) * ci - use same resource class for chrome and ff e2e tests * e2e:chrome - enable logging by default * lint fix --- .circleci/config.yml | 2 +- test/e2e/webdriver/chrome.js | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 973ee001a..a2ab03bfc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -391,7 +391,7 @@ jobs: destination: test-artifacts test-e2e-firefox: - executor: node-browsers + executor: node-browsers-medium-plus steps: - checkout - run: diff --git a/test/e2e/webdriver/chrome.js b/test/e2e/webdriver/chrome.js index bf3c2d023..9a1e1294b 100644 --- a/test/e2e/webdriver/chrome.js +++ b/test/e2e/webdriver/chrome.js @@ -16,13 +16,10 @@ class ChromeDriver { .setChromeOptions(options); const service = new chrome.ServiceBuilder(); - // Enables Chrome logging. + // Enables Chrome logging. Default: enabled // Especially useful for discovering why Chrome has crashed, but can also // be useful for revealing console errors (from the page or background). - if ( - process.env.ENABLE_CHROME_LOGGING && - process.env.ENABLE_CHROME_LOGGING !== 'false' - ) { + if (process.env.ENABLE_CHROME_LOGGING !== 'false') { service.setStdio('inherit').enableChromeLogging(); } if (port) { From 2e2bd0fce5ca48f5b2646409c727f524c0d35dc6 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Mon, 27 Sep 2021 17:40:05 -0500 Subject: [PATCH 14/90] Prevent fox mesh JSON warning (#12200) * Prevent fox mesh JSON warning * Update ui/helpers/utils/build-types.js Co-authored-by: Mark Stacey * Fix lint Co-authored-by: Mark Stacey --- ui/helpers/utils/build-types.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/helpers/utils/build-types.js b/ui/helpers/utils/build-types.js index d6ec658f8..37b4c139d 100644 --- a/ui/helpers/utils/build-types.js +++ b/ui/helpers/utils/build-types.js @@ -20,7 +20,10 @@ export function isBeta() { // the current metamask version (i.e. main, beta, etc.) export function getBuildSpecificAsset(assetName) { const buildType = process.env.METAMASK_BUILD_TYPE; - if (!assetList[buildType]?.[assetName]) { + if ( + !assetList[buildType] || + !Object.keys(assetList[buildType]).includes(assetName) + ) { console.warn( `Cannot find asset for build ${buildType}: ${assetName}, returning main build asset`, ); From 180ead81751b9bd92f3da62d44aed1ddea7b69b8 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Tue, 28 Sep 2021 11:20:21 +0530 Subject: [PATCH 15/90] Adding slider component (#12219) Adding slider component --- ui/components/ui/slider/index.js | 3 + ui/components/ui/slider/index.scss | 48 +++++++ ui/components/ui/slider/slider.component.js | 135 ++++++++++++++++++ .../ui/slider/slider.component.test.js | 58 ++++++++ ui/components/ui/slider/slider.stories.js | 33 +++++ ui/components/ui/ui-components.scss | 1 + ui/helpers/constants/design-system.js | 2 +- 7 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 ui/components/ui/slider/index.js create mode 100644 ui/components/ui/slider/index.scss create mode 100644 ui/components/ui/slider/slider.component.js create mode 100644 ui/components/ui/slider/slider.component.test.js create mode 100644 ui/components/ui/slider/slider.stories.js diff --git a/ui/components/ui/slider/index.js b/ui/components/ui/slider/index.js new file mode 100644 index 000000000..52e836261 --- /dev/null +++ b/ui/components/ui/slider/index.js @@ -0,0 +1,3 @@ +import Slider from './slider.component'; + +export default Slider; diff --git a/ui/components/ui/slider/index.scss b/ui/components/ui/slider/index.scss new file mode 100644 index 000000000..00ff33766 --- /dev/null +++ b/ui/components/ui/slider/index.scss @@ -0,0 +1,48 @@ +.slider { + display: inline-block; + width: 100%; + + &__heading, + &__footer { + display: flex; + justify-content: space-between; + } + + &__heading-title { + display: flex; + align-items: center; + + > p { + margin-left: 10px; + font-size: 14px; + } + } + + &__heading-detail > p { + font-size: 14px; + } + + &__footer-info { + display: flex; + align-items: center; + + > p { + font-size: 12px; + } + } + + &__footer-edit > button { + border: none; + background: none; + font-size: 12px; + color: $Blue-500; + + &:focus { + outline: none; + } + } + + h6 { + margin-inline-end: 6px; + } +} diff --git a/ui/components/ui/slider/slider.component.js b/ui/components/ui/slider/slider.component.js new file mode 100644 index 000000000..9bdb7309b --- /dev/null +++ b/ui/components/ui/slider/slider.component.js @@ -0,0 +1,135 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import MaterialSlider from '@material-ui/core/Slider'; +import { withStyles } from '@material-ui/core/styles'; + +import { + COLORS, + FONT_WEIGHT, + TYPOGRAPHY, +} from '../../../helpers/constants/design-system'; + +import InfoTooltip from '../info-tooltip/info-tooltip'; +import Typography from '../typography/typography'; + +const styles = { + root: { + height: 6, + padding: '6px 0', + }, + rail: { + borderRadius: 50, + background: '#D6D9DC', + height: 6, + }, + track: { + borderRadius: 50, + background: '#037DD6', + height: 6, + }, + thumb: { + 'height': 20, + 'width': 20, + 'marginTop': -7, + 'marginLeft': -7, + 'backgroundColor': '#037DD6', + 'border': '1px solid #EAF6FF', + 'boxSizing': 'border-box', + 'boxShadow': '0px 0px 14px 0px rgba(0, 0, 0, 0.18)', + '&:focus, &$active': { + height: 20, + width: 20, + marginTop: -7, + marginLeft: -7, + boxShadow: '0px 0px 14px 0px rgba(0, 0, 0, 0.18)', + }, + '&:hover': { + height: 22, + width: 22, + marginTop: -8, + marginLeft: -8, + border: 'none', + boxShadow: '0px 0px 14px 0px rgba(0, 0, 0, 0.18)', + }, + }, +}; + +const Slider = ({ + editText, + infoText, + onEdit, + titleDetail, + titleText, + tooltipText, + valueText, + ...rest +}) => ( +
+
+
+ {titleText && ( + + {titleText} + + )} + {tooltipText && ( + + )} + {valueText && ( + + {valueText} + + )} +
+ {titleDetail && ( +
+ + {titleDetail} + +
+ )} +
+ +
+
+ {infoText && ( + + {infoText} + + )} +
+
+ {onEdit && ( + + )} +
+
+
+); + +Slider.defaultProps = { + editText: 'Edit', +}; + +Slider.propTypes = { + editText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + infoText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + titleDetail: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + titleText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + tooltipText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + valueText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), + max: PropTypes.number, + min: PropTypes.number, + onChange: PropTypes.func, + onEdit: PropTypes.func, + step: PropTypes.number, + value: PropTypes.number, +}; + +export default withStyles(styles)(Slider); diff --git a/ui/components/ui/slider/slider.component.test.js b/ui/components/ui/slider/slider.component.test.js new file mode 100644 index 000000000..d28e2adca --- /dev/null +++ b/ui/components/ui/slider/slider.component.test.js @@ -0,0 +1,58 @@ +import React from 'react'; +import { fireEvent, render } from '@testing-library/react'; + +import Slider from './slider.component'; + +describe('Slider Component', () => { + describe('rendering', () => { + it('should render properly', () => { + expect(() => { + render(); + }).not.toThrow(); + }); + + it('should contain passed header props', () => { + const wrapper = render( + , + ); + + expect(wrapper.getAllByText('Slider Title Text')).toBeDefined(); + expect(wrapper.getAllByText('$ 00.00')).toBeDefined(); + expect(wrapper.getAllByText('100 GWEI')).toBeDefined(); + }); + + it('should contain passed footer props', () => { + const wrapper = render( + { + console.log('on edit click'); + }} + />, + ); + + expect(wrapper.getAllByText('Footer Info Text')).toBeDefined(); + expect( + wrapper.getByRole('button', { name: 'edit as numeric input' }), + ).toBeDefined(); + expect(wrapper.getAllByText('Edit GWEI')).toBeDefined(); + }); + + it('should call onEdit callback when edit button is clicked', () => { + const mockEditFn = jest.fn(); + const wrapper = render( + , + ); + + const editButton = wrapper.getByRole('button'); + fireEvent.click(editButton); + expect(mockEditFn).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/ui/components/ui/slider/slider.stories.js b/ui/components/ui/slider/slider.stories.js new file mode 100644 index 000000000..316ae3929 --- /dev/null +++ b/ui/components/ui/slider/slider.stories.js @@ -0,0 +1,33 @@ +import React from 'react'; +import Slider from '.'; + +export default { + title: 'Slider', + id: __filename, +}; + +export const slider = () => ; + +export const sliderWithSteps = () => ; + +export const sliderWithHeader = () => ( + +); + +export const sliderWithFooter = () => ( + { + console.log('on edit click'); + }} + /> +); diff --git a/ui/components/ui/ui-components.scss b/ui/components/ui/ui-components.scss index f585f9052..75cddcb90 100644 --- a/ui/components/ui/ui-components.scss +++ b/ui/components/ui/ui-components.scss @@ -45,6 +45,7 @@ @import 'readonly-input/index'; @import 'sender-to-recipient/index'; @import 'snackbar/index'; +@import 'slider/index'; @import 'tabs/index'; @import 'toggle-button/index'; @import 'token-balance/index'; diff --git a/ui/helpers/constants/design-system.js b/ui/helpers/constants/design-system.js index 9716b5567..7edcbc0b2 100644 --- a/ui/helpers/constants/design-system.js +++ b/ui/helpers/constants/design-system.js @@ -45,7 +45,7 @@ export const TYPOGRAPHY = { H7: 'h7', H8: 'h8', H9: 'h9', - Paragraph: 'paragraph', + Paragraph: 'p', }; const NONE = 'none'; From 92b075581ce344d2b4bd37921b206d0e8ab85baf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Sep 2021 13:38:31 -0230 Subject: [PATCH 16/90] Bump @metamask/contract-metadata from 1.29.0 to 1.30.0 (#12207) Bumps [@metamask/contract-metadata](https://github.com/MetaMask/contract-metadata) from 1.29.0 to 1.30.0. - [Release notes](https://github.com/MetaMask/contract-metadata/releases) - [Commits](https://github.com/MetaMask/contract-metadata/compare/v1.29.0...v1.30.0) --- updated-dependencies: - dependency-name: "@metamask/contract-metadata" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ed807e29c..6aaf4069e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2731,9 +2731,9 @@ yargs "^17.0.1" "@metamask/contract-metadata@^1.19.0", "@metamask/contract-metadata@^1.28.0", "@metamask/contract-metadata@^1.29.0": - version "1.29.0" - resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.29.0.tgz#4ca86a2f03d4dad4350d09216a7fe92f9dd21c8e" - integrity sha512-wxsC0ZCyhPKqThvmsL8+2zVWGWPqofSo8HNtOuOnQM9oGbXX9294imJ3T+A/Lov8fkX4jAWZOeNV0uR80zkNtA== + version "1.30.0" + resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.30.0.tgz#fa8e1b0c3e7aaa963986088f691fb553ffbe3904" + integrity sha512-b2usYW/ptQYnE6zhUmr4T+nvOAQJK5ABcpKudyQANpy4K099elpv4aN0WcrcOcwV99NHOdMzFP3ZuG0HoAyOBQ== "@metamask/controllers@^16.0.0": version "16.0.0" From 3f577700c6339c5d4fe55d21ade11e0a42e40be3 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Tue, 28 Sep 2021 13:43:26 -0230 Subject: [PATCH 17/90] Replace `isBeta` with `buildType` (#12231) This is a refactor to replace the `isBeta` boolean with `buildType` throughout the build system. This will allow us to modify the behaviour of each step of the build process for Flask as well. This should result in no functional changes. --- development/build/etc.js | 8 ++++++-- development/build/index.js | 10 ++++------ development/build/manifest.js | 5 +++-- development/build/static.js | 6 ++++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/development/build/etc.js b/development/build/etc.js index c30bbe9b8..8d2b75956 100644 --- a/development/build/etc.js +++ b/development/build/etc.js @@ -7,13 +7,14 @@ const pump = pify(require('pump')); const { version } = require('../../package.json'); const { createTask, composeParallel } = require('./task'); +const { BuildTypes } = require('./utils'); module.exports = createEtcTasks; function createEtcTasks({ betaVersionsMap, browserPlatforms, - isBeta, + buildType, livereload, }) { const clean = createTask('clean', async function clean() { @@ -34,7 +35,10 @@ function createEtcTasks({ 'zip', composeParallel( ...browserPlatforms.map((platform) => - createZipTask(platform, isBeta ? betaVersionsMap[platform] : undefined), + createZipTask( + platform, + buildType === BuildTypes.beta ? betaVersionsMap[platform] : undefined, + ), ), ), ); diff --git a/development/build/index.js b/development/build/index.js index 01c9b50da..d3e2ecc8d 100755 --- a/development/build/index.js +++ b/development/build/index.js @@ -37,7 +37,6 @@ function defineAndRunBuildTasks() { betaVersion, buildType, entryTask, - isBeta, isLavaMoat, shouldIncludeLockdown, shouldLintFenceFiles, @@ -47,7 +46,7 @@ function defineAndRunBuildTasks() { const browserPlatforms = ['firefox', 'chrome', 'brave', 'opera']; let betaVersionsMap; - if (isBeta) { + if (buildType === BuildTypes.beta) { betaVersionsMap = getNextBetaVersionMap( version, betaVersion, @@ -59,13 +58,13 @@ function defineAndRunBuildTasks() { livereload, browserPlatforms, shouldIncludeLockdown, - isBeta, + buildType, }); const manifestTasks = createManifestTasks({ browserPlatforms, betaVersionsMap, - isBeta, + buildType, }); const styleTasks = createStyleTasks({ livereload }); @@ -82,7 +81,7 @@ function defineAndRunBuildTasks() { livereload, browserPlatforms, betaVersionsMap, - isBeta, + buildType, }); // build for development (livereload) @@ -201,7 +200,6 @@ function parseArgv() { betaVersion: String(betaVersion), buildType, entryTask, - isBeta: argv[NamedArgs.BuildType] === BuildTypes.beta, isLavaMoat: process.argv[0].includes('lavamoat'), shouldIncludeLockdown: argv[NamedArgs.OmitLockdown], shouldLintFenceFiles, diff --git a/development/build/manifest.js b/development/build/manifest.js index 3e80ea5b5..6f8b9e8fe 100644 --- a/development/build/manifest.js +++ b/development/build/manifest.js @@ -7,10 +7,11 @@ const { version } = require('../../package.json'); const betaManifestModifications = require('../../app/manifest/_beta_modifications.json'); const { createTask, composeSeries } = require('./task'); +const { BuildTypes } = require('./utils'); module.exports = createManifestTasks; -function createManifestTasks({ betaVersionsMap, browserPlatforms, isBeta }) { +function createManifestTasks({ betaVersionsMap, browserPlatforms, buildType }) { // merge base manifest with per-platform manifests const prepPlatforms = async () => { return Promise.all( @@ -28,7 +29,7 @@ function createManifestTasks({ betaVersionsMap, browserPlatforms, isBeta }) { const result = merge( cloneDeep(baseManifest), platformModifications, - isBeta + buildType === BuildTypes.beta ? getBetaModifications(platform, betaVersionsMap) : { version }, ); diff --git a/development/build/static.js b/development/build/static.js index 341b7d56b..c92ca709a 100644 --- a/development/build/static.js +++ b/development/build/static.js @@ -6,6 +6,7 @@ const glob = require('fast-glob'); const locales = require('../../app/_locales/index.json'); const { createTask, composeSeries } = require('./task'); +const { BuildTypes } = require('./utils'); const EMPTY_JS_FILE = './development/empty.js'; @@ -13,7 +14,7 @@ module.exports = function createStaticAssetTasks({ livereload, browserPlatforms, shouldIncludeLockdown = true, - isBeta, + buildType, }) { const [copyTargetsProd, copyTargetsDev] = getCopyTargets( shouldIncludeLockdown, @@ -27,7 +28,8 @@ module.exports = function createStaticAssetTasks({ }, ]; - const targets = isBeta ? copyTargetsBeta : copyTargetsProd; + const targets = + buildType === BuildTypes.beta ? copyTargetsBeta : copyTargetsProd; const prod = createTask( 'static:prod', From f52dac290b680e7dfd459113ff095706f895ddf9 Mon Sep 17 00:00:00 2001 From: ryanml Date: Tue, 28 Sep 2021 12:21:19 -0700 Subject: [PATCH 18/90] Using parsed seed phrase for restore vault input validation (#12229) Fixes MetaMask/metamask-extension#12225 --- ui/pages/keychains/restore-vault.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/pages/keychains/restore-vault.js b/ui/pages/keychains/restore-vault.js index 625b9c71c..a8ba320ca 100644 --- a/ui/pages/keychains/restore-vault.js +++ b/ui/pages/keychains/restore-vault.js @@ -44,13 +44,14 @@ class RestoreVaultPage extends Component { const { t } = this.context; let seedPhraseError = null; - const wordCount = this.parseSeedPhrase(seedPhrase).split(/\s/u).length; + const parseSeedPhrase = this.parseSeedPhrase(seedPhrase); + const wordCount = parseSeedPhrase.split(/\s/u).length; if ( - seedPhrase && + parseSeedPhrase && (wordCount % 3 !== 0 || wordCount < 12 || wordCount > 24) ) { seedPhraseError = t('seedPhraseReq'); - } else if (!isValidMnemonic(seedPhrase)) { + } else if (!isValidMnemonic(parseSeedPhrase)) { seedPhraseError = t('invalidSeedPhrase'); } From d929ccdfa86104445b25926b941a9f7793b18b0a Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 28 Sep 2021 09:32:05 -1000 Subject: [PATCH 19/90] Update helpers.js (#12236) --- test/e2e/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js index dca25366a..5eb5ad8fb 100644 --- a/test/e2e/helpers.js +++ b/test/e2e/helpers.js @@ -130,7 +130,7 @@ async function withFixtures(options, testSuite) { if (webDriver) { await webDriver.quit(); } - if (dappServer) { + if (dappServer && dappServer.listening) { await new Promise((resolve, reject) => { dappServer.close((error) => { if (error) { From 4c38d12c5f02ba2d3a610884a768f1b9cde0b97b Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Tue, 28 Sep 2021 19:15:00 -0230 Subject: [PATCH 20/90] Fix assets for beta dev build (#12233) The MetaMask logo used for beta development builds was wrong. The lock screen (and any other place using the `@metamask/logo` logo) showed the correct logo, but all of our static assets used the "regular" logo. Now the beta logo should be used everywhere for beta development builds. --- development/build/static.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/development/build/static.js b/development/build/static.js index c92ca709a..5e5425a58 100644 --- a/development/build/static.js +++ b/development/build/static.js @@ -20,21 +20,24 @@ module.exports = function createStaticAssetTasks({ shouldIncludeLockdown, ); - const copyTargetsBeta = [ - ...copyTargetsProd, - { - src: './app/build-types/beta/', - dest: `images`, - }, - ]; - - const targets = - buildType === BuildTypes.beta ? copyTargetsBeta : copyTargetsProd; + const additionalBuildTargets = { + [BuildTypes.beta]: [ + { + src: './app/build-types/beta/', + dest: `images`, + }, + ], + }; + + if (Object.keys(additionalBuildTargets).includes(buildType)) { + copyTargetsProd.push(...additionalBuildTargets[buildType]); + copyTargetsDev.push(...additionalBuildTargets[buildType]); + } const prod = createTask( 'static:prod', composeSeries( - ...targets.map((target) => { + ...copyTargetsProd.map((target) => { return async function copyStaticAssets() { await performCopy(target); }; From 20eb35be4ee4c3665e3d9c5d722eb0a109f7d903 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 28 Sep 2021 12:40:07 -1000 Subject: [PATCH 21/90] test/e2e/driver/switchToWindowWithTitle - refresh window handles on each retry loop (#12237) --- test/e2e/webdriver/driver.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index d7a742399..ad8430794 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -277,13 +277,13 @@ class Driver { async switchToWindowWithTitle( title, - windowHandles, + initialWindowHandles, delayStep = 1000, timeout = 5000, ) { + let windowHandles = + initialWindowHandles || (await this.driver.getAllWindowHandles()); let timeElapsed = 0; - // eslint-disable-next-line no-param-reassign - windowHandles = windowHandles || (await this.driver.getAllWindowHandles()); while (timeElapsed <= timeout) { for (const handle of windowHandles) { await this.driver.switchTo().window(handle); @@ -294,6 +294,8 @@ class Driver { } await this.delay(delayStep); timeElapsed += delayStep; + // refresh the window handles + windowHandles = await this.driver.getAllWindowHandles(); } throw new Error(`No window with title: ${title}`); From d9d20160d6ef382768f417392f74879e125b71d0 Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 28 Sep 2021 20:56:08 -1000 Subject: [PATCH 22/90] LavaMoat Node update and various small enhancements (#12239) * lavamoat - update lavamoat-node and relevant policy + two handy patches * test/e2e - add timeout known to be flaky * lavamoat-viz - rename npm script --- .circleci/scripts/create-lavamoat-viz.sh | 2 +- lavamoat/node/policy.json | 201 ------------------- package.json | 4 +- patches/abort-controller+3.0.0.patch | 18 ++ patches/regenerator-runtime+0.13.7.patch | 11 +- test/e2e/tests/contract-interactions.spec.js | 3 +- yarn.lock | 30 ++- 7 files changed, 58 insertions(+), 211 deletions(-) create mode 100644 patches/abort-controller+3.0.0.patch diff --git a/.circleci/scripts/create-lavamoat-viz.sh b/.circleci/scripts/create-lavamoat-viz.sh index 53e520f27..db1dc3979 100755 --- a/.circleci/scripts/create-lavamoat-viz.sh +++ b/.circleci/scripts/create-lavamoat-viz.sh @@ -11,7 +11,7 @@ BUILD_DEST="./build-artifacts/build-viz/" mkdir -p "${BUILD_DEST}" # generate lavamoat debug config -yarn lavamoat:debug +yarn lavamoat:debug:build # generate viz npx lavamoat-viz --dest "${BUILD_DEST}" \ No newline at end of file diff --git a/lavamoat/node/policy.json b/lavamoat/node/policy.json index 7497e459b..c3acbd59d 100644 --- a/lavamoat/node/policy.json +++ b/lavamoat/node/policy.json @@ -1008,16 +1008,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, @@ -1377,7 +1367,6 @@ "anymatch": true, "async-each": true, "braces": true, - "fsevents": true, "glob-parent": true, "inherits": true, "is-binary-path": true, @@ -1629,16 +1618,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, @@ -2175,45 +2154,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 @@ -2575,16 +2515,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, @@ -2738,11 +2668,6 @@ "is-plain-object": true } }, - "is-fullwidth-code-point": { - "packages": { - "number-is-nan": true - } - }, "is-glob": { "packages": { "is-extglob": true @@ -3138,56 +3063,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-path": { "packages": { "remove-trailing-separator": true @@ -3203,22 +3078,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, @@ -3285,54 +3144,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 - } - }, "parent-module": { "packages": { "callsites": true @@ -3915,12 +3726,6 @@ "process": true } }, - "set-blocking": { - "globals": { - "process.stderr": true, - "process.stdout": true - } - }, "set-value": { "packages": { "extend-shallow": true, @@ -4122,7 +3927,6 @@ }, "string-width": { "packages": { - "code-point-at": true, "emoji-regex": true, "is-fullwidth-code-point": true, "strip-ansi": true @@ -4699,11 +4503,6 @@ "isexe": true } }, - "wide-align": { - "packages": { - "string-width": true - } - }, "write": { "builtin": { "fs.createWriteStream": true, diff --git a/package.json b/package.json index 3096ec6fd..bfb493184 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "update-changelog": "auto-changelog update", "generate:migration": "./development/generate-migration.sh", "lavamoat:auto": "lavamoat ./development/build/index.js --writeAutoPolicy", - "lavamoat:debug": "lavamoat ./development/build/index.js --writeAutoPolicyDebug" + "lavamoat:debug:build": "lavamoat ./development/build/index.js --writeAutoPolicyDebug" }, "resolutions": { "**/regenerator-runtime": "^0.13.7", @@ -287,7 +287,7 @@ "jest": "^26.6.3", "jsdom": "^11.2.0", "koa": "^2.7.0", - "lavamoat": "^5.3.1", + "lavamoat": "^5.3.4", "lavamoat-viz": "^6.0.9", "lockfile-lint": "^4.0.0", "loose-envify": "^1.4.0", diff --git a/patches/abort-controller+3.0.0.patch b/patches/abort-controller+3.0.0.patch new file mode 100644 index 000000000..2210446d2 --- /dev/null +++ b/patches/abort-controller+3.0.0.patch @@ -0,0 +1,18 @@ +diff --git a/node_modules/abort-controller/browser.js b/node_modules/abort-controller/browser.js +index b0c5ec3..c8c8018 100644 +--- a/node_modules/abort-controller/browser.js ++++ b/node_modules/abort-controller/browser.js +@@ -2,12 +2,7 @@ + "use strict" + + /*eslint-disable @mysticatea/prettier */ +-const { AbortController, AbortSignal } = +- typeof self !== "undefined" ? self : +- typeof window !== "undefined" ? window : +- /* otherwise */ undefined ++const { AbortController } = globalThis; + /*eslint-enable @mysticatea/prettier */ + + module.exports = AbortController +-module.exports.AbortSignal = AbortSignal +-module.exports.default = AbortController diff --git a/patches/regenerator-runtime+0.13.7.patch b/patches/regenerator-runtime+0.13.7.patch index 1710d779a..778bc62ca 100644 --- a/patches/regenerator-runtime+0.13.7.patch +++ b/patches/regenerator-runtime+0.13.7.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/regenerator-runtime/runtime.js b/node_modules/regenerator-runtime/runtime.js -index 547b8c6..c53a471 100644 +index 547b8c6..885626e 100644 --- a/node_modules/regenerator-runtime/runtime.js +++ b/node_modules/regenerator-runtime/runtime.js @@ -5,7 +5,7 @@ @@ -65,3 +65,12 @@ index 547b8c6..c53a471 100644 function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; +@@ -733,7 +734,7 @@ var runtime = (function (exports) { + )); + + try { +- regeneratorRuntime = runtime; ++ globalThis.regeneratorRuntime = runtime; + } catch (accidentalStrictMode) { + // This module should not be running in strict mode, so the above + // assignment should always work unless something is misconfigured. Just diff --git a/test/e2e/tests/contract-interactions.spec.js b/test/e2e/tests/contract-interactions.spec.js index e94c18f0a..c4e0537c5 100644 --- a/test/e2e/tests/contract-interactions.spec.js +++ b/test/e2e/tests/contract-interactions.spec.js @@ -1,5 +1,5 @@ const { strict: assert } = require('assert'); -const { withFixtures } = require('../helpers'); +const { withFixtures, regularDelayMs } = require('../helpers'); describe('Deploy contract and call contract methods', function () { let windowHandles; @@ -91,6 +91,7 @@ describe('Deploy contract and call contract methods', function () { 'MetaMask Notification', windowHandles, ); + await driver.delay(regularDelayMs); await driver.clickElement({ text: 'Confirm', tag: 'button' }); await driver.waitUntilXWindowHandles(2); await driver.switchToWindow(extension); diff --git a/yarn.lock b/yarn.lock index 6aaf4069e..3828c4441 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17418,6 +17418,17 @@ lavamoat-core@^10.0.1: merge-deep "^3.0.2" resolve "^1.15.1" +lavamoat-core@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/lavamoat-core/-/lavamoat-core-11.0.0.tgz#d1decbabae0429149fb7bbeb7f8a74fa054dbdf9" + integrity sha512-D/ULw8cbQ+0Rr/2IT38XedH8CWZsfIy0WThJHLjPbxwdPuHasFw9GHs88vjYv7a6UJ1uac8x5mhyOlbGoOJcIw== + dependencies: + fromentries "^1.2.0" + json-stable-stringify "^1.0.1" + lavamoat-tofu "^6.0.0" + merge-deep "^3.0.2" + resolve "^1.15.1" + lavamoat-tofu@^5.1.3: version "5.1.3" resolved "https://registry.yarnpkg.com/lavamoat-tofu/-/lavamoat-tofu-5.1.3.tgz#8e89a7ac206f3b2dc9c8ea52ecfd4f92f90285ae" @@ -17426,6 +17437,14 @@ lavamoat-tofu@^5.1.3: "@babel/parser" "^7.10.1" "@babel/traverse" "^7.10.1" +lavamoat-tofu@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lavamoat-tofu/-/lavamoat-tofu-6.0.0.tgz#26d37c14864eb98df247195c5419a3a762ef650b" + integrity sha512-tgXf+/lplow/Ao2cOsbQ4ZqTuKBLwNnSSjPFIiGAHAM6xs+c+jEr60UAqOflyBg94VOE47G6o8zYZOAylZpUrw== + dependencies: + "@babel/parser" "^7.10.1" + "@babel/traverse" "^7.10.1" + lavamoat-viz@^6.0.9: version "6.0.9" resolved "https://registry.yarnpkg.com/lavamoat-viz/-/lavamoat-viz-6.0.9.tgz#ddec64becdf62448f7d0ea57c5258246ee14304c" @@ -17438,16 +17457,17 @@ lavamoat-viz@^6.0.9: serve-handler "^6.1.3" yargs "^16.0.0" -lavamoat@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/lavamoat/-/lavamoat-5.3.1.tgz#66f140210f406c69ec58f18ebcd827b52e3a3276" - integrity sha512-XXMDX7dV2lKEymlC3+rAAWp7/j1Qe+j2lgyRMvg1xI2Vux24iW837grHDIyx1qs7LOhu5F98Z772z7jmGjBjfg== +lavamoat@^5.3.4: + version "5.3.4" + resolved "https://registry.yarnpkg.com/lavamoat/-/lavamoat-5.3.4.tgz#cf0778a5fc8b2bc14bce79d46dc730df3d8c21ad" + integrity sha512-0p7B8+6Hs/WGlkBaVQl6RGdAlYd0pL6eFTh6/Oc3kdyi4wVc2Fz5vFOJqrZi8XkvjMuCLln7udYbiCapr74yZQ== dependencies: "@babel/code-frame" "^7.10.4" + "@babel/highlight" "^7.10.4" bindings "^1.5.0" htmlescape "^1.1.1" json-stable-stringify "^1.0.1" - lavamoat-core "^10.0.1" + lavamoat-core "^11.0.0" lavamoat-tofu "^5.1.3" node-gyp-build "^4.2.3" object.fromentries "^2.0.2" From 53f2c84209a66680ff04dfeea63f2877ddf2774b Mon Sep 17 00:00:00 2001 From: Matthew Epps Date: Wed, 29 Sep 2021 08:11:19 -0500 Subject: [PATCH 23/90] Add client id to GasFeeController (#12221) * chore: Add client id to GasFeeController * chore: change EXTENSION_CLIENT_ID to SWAPS_CLIENT_ID in constants file --- app/scripts/metamask-controller.js | 2 ++ package.json | 2 +- shared/constants/swaps.js | 2 ++ ui/pages/swaps/swaps.util.js | 3 ++- yarn.lock | 8 ++++---- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index ae05d10d8..3608732fc 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -32,6 +32,7 @@ import { TRANSACTION_STATUSES } from '../../shared/constants/transaction'; import { GAS_API_BASE_URL, GAS_DEV_API_BASE_URL, + SWAPS_CLIENT_ID, } from '../../shared/constants/swaps'; import { MAINNET_CHAIN_ID } from '../../shared/constants/network'; import { KEYRING_TYPES } from '../../shared/constants/hardware-wallets'; @@ -201,6 +202,7 @@ export default class MetamaskController extends EventEmitter { this.gasFeeController = new GasFeeController({ interval: 10000, messenger: gasFeeMessenger, + clientId: SWAPS_CLIENT_ID, getProvider: () => this.networkController.getProviderAndBlockTracker().provider, onNetworkStateChange: this.networkController.on.bind( diff --git a/package.json b/package.json index bfb493184..bcb036048 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "@fortawesome/fontawesome-free": "^5.13.0", "@material-ui/core": "^4.11.0", "@metamask/contract-metadata": "^1.28.0", - "@metamask/controllers": "^16.0.0", + "@metamask/controllers": "^17.0.0", "@metamask/eth-ledger-bridge-keyring": "^0.7.0", "@metamask/eth-token-tracker": "^3.0.1", "@metamask/etherscan-link": "^2.1.0", diff --git a/shared/constants/swaps.js b/shared/constants/swaps.js index 5da0d08d8..7f9262d1e 100644 --- a/shared/constants/swaps.js +++ b/shared/constants/swaps.js @@ -177,3 +177,5 @@ export const ETHEREUM = 'ethereum'; export const POLYGON = 'polygon'; export const BSC = 'bsc'; export const RINKEBY = 'rinkeby'; + +export const SWAPS_CLIENT_ID = 'extension'; diff --git a/ui/pages/swaps/swaps.util.js b/ui/pages/swaps/swaps.util.js index aee102070..74203b411 100644 --- a/ui/pages/swaps/swaps.util.js +++ b/ui/pages/swaps/swaps.util.js @@ -14,6 +14,7 @@ import { SWAPS_DEV_API_V2_BASE_URL, GAS_API_BASE_URL, GAS_DEV_API_BASE_URL, + SWAPS_CLIENT_ID, } from '../../../shared/constants/swaps'; import { TRANSACTION_ENVELOPE_TYPES } from '../../../shared/constants/transaction'; import { @@ -53,7 +54,7 @@ const TOKEN_TRANSFER_LOG_TOPIC_HASH = const CACHE_REFRESH_FIVE_MINUTES = 300000; -const clientIdHeader = { 'X-Client-Id': 'extension' }; +const clientIdHeader = { 'X-Client-Id': SWAPS_CLIENT_ID }; /** * @param {string} type Type of an API call, e.g. "tokens" diff --git a/yarn.lock b/yarn.lock index 3828c4441..9133ce6ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2735,10 +2735,10 @@ resolved "https://registry.yarnpkg.com/@metamask/contract-metadata/-/contract-metadata-1.30.0.tgz#fa8e1b0c3e7aaa963986088f691fb553ffbe3904" integrity sha512-b2usYW/ptQYnE6zhUmr4T+nvOAQJK5ABcpKudyQANpy4K099elpv4aN0WcrcOcwV99NHOdMzFP3ZuG0HoAyOBQ== -"@metamask/controllers@^16.0.0": - version "16.0.0" - resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-16.0.0.tgz#2c13550a5c7d47a0061a3f3de25e6becdc8531ad" - integrity sha512-zqByf/KXlSK+WdCh5AvFIbmiqpdMGfXxZAVHruKRqxsW9QFOXaIHpshiBZlSH+QLCJuli0sjyheRMFufeTuqkQ== +"@metamask/controllers@^17.0.0": + version "17.0.0" + resolved "https://registry.yarnpkg.com/@metamask/controllers/-/controllers-17.0.0.tgz#7ef00b4f7583d8075115e8a2f074d7b66646bbe8" + integrity sha512-myPlAk8SpNm5SwHHKGgm2XDLP4bxNR2UsKoQlYtV7bJq3l8FV1agSFwHBwDhg61/52Xvqdqy+1YDVdV3kOwPgg== dependencies: "@ethereumjs/common" "^2.3.1" "@ethereumjs/tx" "^3.2.1" From acce73c9437855886ca9ff16e61ef7a7cff1a844 Mon Sep 17 00:00:00 2001 From: Daniel <80175477+dan437@users.noreply.github.com> Date: Wed, 29 Sep 2021 18:13:34 +0200 Subject: [PATCH 24/90] Fix form prefilling in Swaps on the Build Quote page (#12244) * Fix form prefilling in Swaps on the Build Quote page * Fix UTs * Clean up tokens when resetting swaps state, in case a user is changing a network --- app/scripts/controllers/swaps.js | 25 ++++++++++++++++++++++++- app/scripts/controllers/swaps.test.js | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/scripts/controllers/swaps.js b/app/scripts/controllers/swaps.js index 150b4fece..5f3ec9851 100644 --- a/app/scripts/controllers/swaps.js +++ b/app/scripts/controllers/swaps.js @@ -79,6 +79,7 @@ const initialState = { routeState: '', swapsFeatureIsLive: true, useNewSwapsApi: false, + isFetchingQuotes: false, swapsQuoteRefreshTime: FALLBACK_QUOTE_REFRESH_TIME, swapsQuotePrefetchingRefreshTime: FALLBACK_QUOTE_REFRESH_TIME, }, @@ -229,6 +230,8 @@ export default class SwapsController { const indexOfCurrentCall = this.indexOfNewestCallInFlight + 1; this.indexOfNewestCallInFlight = indexOfCurrentCall; + this.setIsFetchingQuotes(true); + let [newQuotes] = await Promise.all([ this._fetchTradesInfo(fetchParams, { ...fetchParamsMetaData, @@ -237,6 +240,20 @@ export default class SwapsController { this._setSwapsRefreshRates(), ]); + const { + swapsState: { isFetchingQuotes }, + } = this.store.getState(); + + // If isFetchingQuotes is false, it means a user left Swaps (we cleaned the state) + // and we don't want to set any API response with quotes into state. + if (!isFetchingQuotes) { + return [ + {}, // quotes + null, // selectedAggId + ]; + } + this.setIsFetchingQuotes(false); + newQuotes = mapValues(newQuotes, (quote) => ({ ...quote, sourceTokenInfo: fetchParamsMetaData.sourceTokenInfo, @@ -540,6 +557,13 @@ export default class SwapsController { this.store.updateState({ swapsState: { ...swapsState, routeState } }); } + setIsFetchingQuotes(status) { + const { swapsState } = this.store.getState(); + this.store.updateState({ + swapsState: { ...swapsState, isFetchingQuotes: status }, + }); + } + setSwapsLiveness(swapsLiveness) { const { swapsState } = this.store.getState(); const { swapsFeatureIsLive, useNewSwapsApi } = swapsLiveness; @@ -570,7 +594,6 @@ export default class SwapsController { this.store.updateState({ swapsState: { ...initialState.swapsState, - tokens: swapsState.tokens, swapsQuoteRefreshTime: swapsState.swapsQuoteRefreshTime, swapsQuotePrefetchingRefreshTime: swapsState.swapsQuotePrefetchingRefreshTime, diff --git a/app/scripts/controllers/swaps.test.js b/app/scripts/controllers/swaps.test.js index d6127c6db..978c705a8 100644 --- a/app/scripts/controllers/swaps.test.js +++ b/app/scripts/controllers/swaps.test.js @@ -135,6 +135,7 @@ const EMPTY_INIT_STATE = { swapsQuoteRefreshTime: 60000, swapsQuotePrefetchingRefreshTime: 60000, swapsUserFeeLevel: '', + isFetchingQuotes: false, }, }; From b5103bf317ddfe41d823d184b69203f7de949e33 Mon Sep 17 00:00:00 2001 From: Etienne Dusseault Date: Wed, 29 Sep 2021 15:42:38 -0300 Subject: [PATCH 25/90] Add select-hardware component to Storybook (#12227) --- .../select-hardware.stories.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ui/pages/create-account/connect-hardware/select-hardware.stories.js diff --git a/ui/pages/create-account/connect-hardware/select-hardware.stories.js b/ui/pages/create-account/connect-hardware/select-hardware.stories.js new file mode 100644 index 000000000..2748c87ad --- /dev/null +++ b/ui/pages/create-account/connect-hardware/select-hardware.stories.js @@ -0,0 +1,29 @@ +import React from 'react'; +import { action } from '@storybook/addon-actions'; +import SelectHardware from './select-hardware'; + +export default { + title: 'Connect Hardware Wallet', + id: __filename, +}; + +export const SelectHardwareComponent = () => { + return ( + + action(`Continue connect to ${selectedDevice}`)() + } + useLedgerLive + /> + ); +}; +export const BrowserNotSupported = () => { + return ( + undefined} + useLedgerLive + /> + ); +}; From c2bbbdd19ccddaae949f6226bb82b89abc7b10ee Mon Sep 17 00:00:00 2001 From: Etienne Dusseault Date: Wed, 29 Sep 2021 15:42:49 -0300 Subject: [PATCH 26/90] Add account-list component to Storybook (#12228) --- .storybook/test-data.js | 15 ++++ .../connect-hardware/account-list.stories.js | 68 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 ui/pages/create-account/connect-hardware/account-list.stories.js diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 376182e34..80608dadc 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -37,6 +37,21 @@ const state = { swapsFeatureIsLive: false, swapsQuoteRefreshTime: 60000, }, + accountArray: [ + { + name: 'This is a Really Long Account Name', + address: '0x64a845a5b02460acf8a3d84503b0d68d028b4bb4', + index: 0, + balance: '0x176e5b6f173ebe66', + }, + { + name: 'Account 2', + address: '0xb19ac54efa18cc3a14a5b821bfec73d284bf0c5e', + index: 1, + balance: '0x2d3142f5000', + }, + ], + connectedAccounts: ['0x64a845a5b02460acf8a3d84503b0d68d028b4bb4'], isInitialized: true, isUnlocked: true, isAccountMenuOpen: false, diff --git a/ui/pages/create-account/connect-hardware/account-list.stories.js b/ui/pages/create-account/connect-hardware/account-list.stories.js new file mode 100644 index 000000000..4efa39166 --- /dev/null +++ b/ui/pages/create-account/connect-hardware/account-list.stories.js @@ -0,0 +1,68 @@ +import React, { useState } from 'react'; +import { Provider } from 'react-redux'; +import { action } from '@storybook/addon-actions'; +import configureStore from '../../../store/store'; +import testData from '../../../../.storybook/test-data'; + +import AccountList from './account-list'; + +const store = configureStore(testData); + +export default { + title: 'Account List', + id: __filename, + decorators: [(story) => {story()}], +}; +global.platform = { + openTab: () => action('Open Tab')(), +}; + +export const AccountListComponent = () => { + const [selectedAccounts, setSelectedAccounts] = useState([ + { + name: 'This is a Really Long Account Name', + address: '0x64a845a5b02460acf8a3d84503b0d68d028b4bb4', + index: 0, + balance: '0x176e5b6f173ebe66', + }, + ]); + const { metamask } = store.getState(); + const { accountArray, connectedAccounts } = metamask; + const LEDGER_LIVE_PATH = `m/44'/60'/0'/0/0`; + const MEW_PATH = `m/44'/60'/0'`; + const BIP44_PATH = `m/44'/60'/0'/0`; + + const HD_PATHS = [ + { name: 'Ledger Live', value: LEDGER_LIVE_PATH }, + { name: 'Legacy (MEW / MyCrypto)', value: MEW_PATH }, + { name: `BIP44 Standard (e.g. MetaMask, Trezor)`, value: BIP44_PATH }, + ]; + + const onAccountChange = (account) => { + let accounts = []; + if (selectedAccounts.includes(account)) { + accounts = selectedAccounts.filter((acc) => account !== acc); + } else { + accounts.push(account); + } + setSelectedAccounts(accounts); + }; + + return ( + undefined} + selectedPath="/" + device="null" + accounts={accountArray} + connectedAccounts={connectedAccounts} + onAccountChange={onAccountChange} + onForgetDevice={() => action('On Forget Device')()} + getPage={() => action('Get Page')()} + selectedAccounts={selectedAccounts} + hdPaths={HD_PATHS} + onCancel={() => action('On Cancel')()} + onUnlockAccounts={() => action('On Unlock Accounts')()} + onAccountRestriction={() => action('On Account Restriction')()} + /> + ); +}; From bf89226ca1489090943a9dcd3ad193f0f6c67bfb Mon Sep 17 00:00:00 2001 From: Etienne Dusseault Date: Wed, 29 Sep 2021 15:43:18 -0300 Subject: [PATCH 27/90] Add send-header to Storybook (#12084) --- .storybook/actions/sb-send-action.js | 9 ++++ .storybook/reducers/sb-history-reducer.js | 9 ++++ .storybook/reducers/sb-send-reducer.js | 19 +++++++ .storybook/test-data.js | 10 ++++ .../send/send-header/send-header.stories.js | 54 +++++++++++++++++++ 5 files changed, 101 insertions(+) create mode 100644 .storybook/actions/sb-send-action.js create mode 100644 .storybook/reducers/sb-history-reducer.js create mode 100644 .storybook/reducers/sb-send-reducer.js create mode 100644 ui/pages/send/send-header/send-header.stories.js diff --git a/.storybook/actions/sb-send-action.js b/.storybook/actions/sb-send-action.js new file mode 100644 index 000000000..c1e66e41c --- /dev/null +++ b/.storybook/actions/sb-send-action.js @@ -0,0 +1,9 @@ +export const updateSendAsset = (type) => ({ + type: 'send/updateSendAsset', + payload: type, +}); + +export const updateSendStage = (stage) => ({ + type: 'send/updateSendStage', + payload: stage, +}); diff --git a/.storybook/reducers/sb-history-reducer.js b/.storybook/reducers/sb-history-reducer.js new file mode 100644 index 000000000..a3d282a27 --- /dev/null +++ b/.storybook/reducers/sb-history-reducer.js @@ -0,0 +1,9 @@ +import testData from '../test-data'; + +const initialState = { ...testData.history }; +export default function historySBReducer(state = initialState, action) { + switch (action.type) { + default: + return state; + } +} diff --git a/.storybook/reducers/sb-send-reducer.js b/.storybook/reducers/sb-send-reducer.js new file mode 100644 index 000000000..c53cd1bb7 --- /dev/null +++ b/.storybook/reducers/sb-send-reducer.js @@ -0,0 +1,19 @@ +import testData from '../test-data'; + +const initialState = { ...testData.send }; +export default function sendSBReducer(state = initialState, action) { + switch (action.type) { + case 'send/updateSendStage': + return { + ...state, + stage: action.payload, + }; + case 'send/updateSendAsset': + return { + ...state, + asset: { ...state.asset, type: action.payload }, + }; + default: + return state; + } +} diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 80608dadc..1aac5c8ba 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -379,6 +379,15 @@ const state = { value: '0x9c2686', }, ], + [ + { + note: 'txStateManager: setting status to confirmed', + op: 'replace', + path: '/status', + timestamp: 1629582721178, + value: 'confirmed', + }, + ], [ { note: 'txStateManager: setting status to confirmed', @@ -1178,6 +1187,7 @@ const state = { balance: '0x0', details: null, }, + stage: 'ADD_RECIPIENT', amount: '3782dace9d900000', gas: { price: null, diff --git a/ui/pages/send/send-header/send-header.stories.js b/ui/pages/send/send-header/send-header.stories.js new file mode 100644 index 000000000..034623bb3 --- /dev/null +++ b/ui/pages/send/send-header/send-header.stories.js @@ -0,0 +1,54 @@ +import React, { useEffect } from 'react'; +import { combineReducers, createStore } from 'redux'; +import { Provider } from 'react-redux'; + +import { select } from '@storybook/addon-knobs'; +import { + updateSendStage, + updateSendAsset, +} from '../../../../.storybook/actions/sb-send-action'; + +import sendSBReducer from '../../../../.storybook/reducers/sb-send-reducer'; +import historySBReducer from '../../../../.storybook/reducers/sb-history-reducer'; + +import { ASSET_TYPES, SEND_STAGES } from '../../../ducks/send'; +import SendHeader from './send-header.component'; + +export default { + title: 'SendHeader', + id: __filename, +}; + +export const SendHeaderComponent = () => { + const store = createStore( + combineReducers({ send: sendSBReducer, history: historySBReducer }), + ); + const state = store.getState(); + const { send } = state; + const asset = + select('Asset', [ASSET_TYPES.NATIVE, ASSET_TYPES.TOKEN]) || send.asset; + + const stage = + select('Stage', [ + SEND_STAGES.ADD_RECIPIENT, + SEND_STAGES.DRAFT, + SEND_STAGES.EDIT, + SEND_STAGES.INACTIVE, + ]) || send.stage; + + useEffect(() => { + store.dispatch(updateSendAsset(asset)); + }, [store, asset]); + + useEffect(() => { + store.dispatch(updateSendStage(stage)); + }, [store, stage]); + + return ( + +
+ +
+
+ ); +}; From e238cbc568c2ab3461f2596ae2cf9e0a78274679 Mon Sep 17 00:00:00 2001 From: Niranjana Binoy <43930900+NiranjanaBinoy@users.noreply.github.com> Date: Wed, 29 Sep 2021 14:53:56 -0400 Subject: [PATCH 28/90] Turning OFF token detection for test nets (#12232) --- app/scripts/controllers/detect-tokens.js | 9 ++++++++- app/scripts/controllers/detect-tokens.test.js | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/scripts/controllers/detect-tokens.js b/app/scripts/controllers/detect-tokens.js index 246114657..ea647b59f 100644 --- a/app/scripts/controllers/detect-tokens.js +++ b/app/scripts/controllers/detect-tokens.js @@ -4,6 +4,7 @@ import SINGLE_CALL_BALANCES_ABI from 'single-call-balance-checker-abi'; import { SINGLE_CALL_BALANCES_ADDRESS } from '../constants/contracts'; import { MINUTE } from '../../../shared/constants/time'; import { isEqualCaseInsensitive } from '../../../ui/helpers/utils/util'; +import { MAINNET_CHAIN_ID } from '../../../shared/constants/network'; // By default, poll every 3 minutes const DEFAULT_INTERVAL = MINUTE * 3; @@ -79,7 +80,13 @@ export default class DetectTokensController { } const { tokenList } = this._tokenList.state; - if (Object.keys(tokenList).length === 0) { + // since the token detection is currently enabled only on Mainnet + // we can use the chainId check to ensure token detection is not triggered for any other network + // but once the balance check contract for other networks are deploayed and ready to use, we need to update this check. + if ( + this._network.store.getState().provider.chainId !== MAINNET_CHAIN_ID || + Object.keys(tokenList).length === 0 + ) { return; } diff --git a/app/scripts/controllers/detect-tokens.test.js b/app/scripts/controllers/detect-tokens.test.js index 4a739aff1..4fd5605b0 100644 --- a/app/scripts/controllers/detect-tokens.test.js +++ b/app/scripts/controllers/detect-tokens.test.js @@ -42,6 +42,7 @@ describe('DetectTokensController', function () { '0x7e57e2', '0xbc86727e770de68b1060c91f6bb6945c73e10388', ]); + preferences.setUseTokenDetection(true); sandbox .stub(network, 'getLatestBlock') .callsFake(() => Promise.resolve({})); From 6187ab9b01ea757366a42d22b7292413c0f2b119 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Thu, 30 Sep 2021 17:27:59 +0530 Subject: [PATCH 29/90] Fix gas control flicker on send screen when switching between EIP-1559 networks (#12230) Fix gas control flicker on send screen when switching between EIP-1559 networks --- test/data/mock-state.json | 5 ++ ui/ducks/metamask/metamask.js | 10 ++++ ui/ducks/metamask/metamask.test.js | 36 +++++++++++ .../send-content/send-content.component.js | 6 +- .../send-content/send-content.container.js | 6 +- ui/selectors/selectors.js | 16 +++++ ui/selectors/selectors.test.js | 59 +++++++++++++++++++ 7 files changed, 133 insertions(+), 5 deletions(-) diff --git a/test/data/mock-state.json b/test/data/mock-state.json index 8b6171339..e8c979fd1 100644 --- a/test/data/mock-state.json +++ b/test/data/mock-state.json @@ -31,6 +31,11 @@ "name": "Test Account 2" } }, + "networkDetails": { + "EIPS": { + "1559": true + } + }, "cachedBalances": {}, "incomingTransactions": {}, "unapprovedTxs": { diff --git a/ui/ducks/metamask/metamask.js b/ui/ducks/metamask/metamask.js index d78726a6a..b5867a1ff 100644 --- a/ui/ducks/metamask/metamask.js +++ b/ui/ducks/metamask/metamask.js @@ -279,6 +279,16 @@ export function getUnapprovedTxs(state) { return state.metamask.unapprovedTxs; } +/** + * Function returns true if network details are fetched and it is found to not support EIP-1559 + */ +export function isNotEIP1559Network(state) { + return state.metamask.networkDetails?.EIPS[1559] === false; +} + +/** + * Function returns true if network details are fetched and it is found to support EIP-1559 + */ export function isEIP1559Network(state) { return state.metamask.networkDetails?.EIPS[1559] === true; } diff --git a/ui/ducks/metamask/metamask.test.js b/ui/ducks/metamask/metamask.test.js index 51c88033d..0c75e7f47 100644 --- a/ui/ducks/metamask/metamask.test.js +++ b/ui/ducks/metamask/metamask.test.js @@ -7,6 +7,7 @@ import reduceMetamask, { getSendHexDataFeatureFlagState, getSendToAccounts, getUnapprovedTxs, + isNotEIP1559Network, } from './metamask'; describe('MetaMask Reducers', () => { @@ -99,6 +100,9 @@ describe('MetaMask Reducers', () => { gasPrice: '4a817c800', }, }, + networkDetails: { + EIPS: { 1559: true }, + }, }, {}, ), @@ -378,4 +382,36 @@ describe('MetaMask Reducers', () => { }); }); }); + + describe('isNotEIP1559Network()', () => { + it('should return true if network does not supports EIP-1559', () => { + expect( + isNotEIP1559Network({ + ...mockState, + metamask: { + ...mockState.metamask, + networkDetails: { + EIPS: { 1559: false }, + }, + }, + }), + ).toStrictEqual(true); + }); + + it('should return false if networkDetails.EIPS.1559 is not false', () => { + expect(isNotEIP1559Network(mockState)).toStrictEqual(false); + + expect( + isNotEIP1559Network({ + ...mockState, + metamask: { + ...mockState.metamask, + networkDetails: { + EIPS: { 1559: undefined }, + }, + }, + }), + ).toStrictEqual(false); + }); + }); }); diff --git a/ui/pages/send/send-content/send-content.component.js b/ui/pages/send/send-content/send-content.component.js index 9ae57736d..0e80abbc0 100644 --- a/ui/pages/send/send-content/send-content.component.js +++ b/ui/pages/send/send-content/send-content.component.js @@ -29,7 +29,7 @@ export default class SendContent extends Component { gasIsExcessive: PropTypes.bool.isRequired, isEthGasPrice: PropTypes.bool, noGasPrice: PropTypes.bool, - networkAndAccountSupports1559: PropTypes.bool, + networkOrAccountNotSupports1559: PropTypes.bool, }; render() { @@ -40,7 +40,7 @@ export default class SendContent extends Component { isEthGasPrice, noGasPrice, isAssetSendable, - networkAndAccountSupports1559, + networkOrAccountNotSupports1559, } = this.props; let gasError; @@ -59,7 +59,7 @@ export default class SendContent extends Component { {this.maybeRenderAddContact()} - {!networkAndAccountSupports1559 && } + {networkOrAccountNotSupports1559 && } {this.props.showHexData && } diff --git a/ui/pages/send/send-content/send-content.container.js b/ui/pages/send/send-content/send-content.container.js index a1f4daf46..83b38dfeb 100644 --- a/ui/pages/send/send-content/send-content.container.js +++ b/ui/pages/send/send-content/send-content.container.js @@ -4,7 +4,7 @@ import { getAddressBookEntry, getIsEthGasPriceFetched, getNoGasPriceFetched, - checkNetworkAndAccountSupports1559, + checkNetworkOrAccountNotSupports1559, } from '../../../selectors'; import { getIsAssetSendable, getSendTo } from '../../../ducks/send'; @@ -25,7 +25,9 @@ function mapStateToProps(state) { isEthGasPrice: getIsEthGasPriceFetched(state), noGasPrice: getNoGasPriceFetched(state), to, - networkAndAccountSupports1559: checkNetworkAndAccountSupports1559(state), + networkOrAccountNotSupports1559: checkNetworkOrAccountNotSupports1559( + state, + ), }; } diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 124e39bc4..eae899294 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -32,6 +32,7 @@ import { DAY } from '../../shared/constants/time'; import { getNativeCurrency, getConversionRate, + isNotEIP1559Network, isEIP1559Network, } from '../ducks/metamask/metamask'; @@ -92,6 +93,10 @@ export function isEIP1559Account(state) { return currentKeyring && currentKeyring.type !== KEYRING_TYPES.TREZOR; } +/** + * The function returns true if network and account details are fetched and + * both of them support EIP-1559. + */ export function checkNetworkAndAccountSupports1559(state) { const networkSupports1559 = isEIP1559Network(state); const accountSupports1559 = isEIP1559Account(state); @@ -99,6 +104,17 @@ export function checkNetworkAndAccountSupports1559(state) { return networkSupports1559 && accountSupports1559; } +/** + * The function returns true if network and account details are fetched and + * either of them do not support EIP-1559. + */ +export function checkNetworkOrAccountNotSupports1559(state) { + const networkNotSupports1559 = isNotEIP1559Network(state); + const accountSupports1559 = isEIP1559Account(state); + + return networkNotSupports1559 || accountSupports1559 === false; +} + /** * Checks if the current wallet is a hardware wallet. * @param {Object} state diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index 75a43ea49..edc572f26 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -78,6 +78,65 @@ describe('Selectors', () => { }); }); + describe('#checkNetworkOrAccountNotSupports1559', () => { + it('returns false if network and account supports EIP-1559', () => { + const not1559Network = selectors.checkNetworkOrAccountNotSupports1559({ + ...mockState, + metamask: { + ...mockState.metamask, + keyrings: [ + { + type: 'Ledger Hardware', + accounts: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'], + }, + ], + }, + }); + expect(not1559Network).toStrictEqual(false); + }); + + it('returns true if network does not support EIP-1559', () => { + let not1559Network = selectors.checkNetworkOrAccountNotSupports1559({ + ...mockState, + metamask: { + ...mockState.metamask, + networkDetails: { + EIPS: { 1559: undefined }, + }, + }, + }); + expect(not1559Network).toStrictEqual(true); + not1559Network = selectors.checkNetworkOrAccountNotSupports1559({ + ...mockState, + metamask: { + ...mockState.metamask, + networkDetails: { + EIPS: { 1559: false }, + }, + }, + }); + expect(not1559Network).toStrictEqual(true); + }); + + it('returns true if account does not support EIP-1559', () => { + const networkOrAccountNotSupports1559 = selectors.checkNetworkOrAccountNotSupports1559( + { + ...mockState, + metamask: { + ...mockState.metamask, + keyrings: [ + { + type: 'Trezor Hardware', + accounts: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'], + }, + ], + }, + }, + ); + expect(networkOrAccountNotSupports1559).toStrictEqual(true); + }); + }); + describe('#getAddressBook', () => { it('should return the address book', () => { expect(selectors.getAddressBook(mockState)).toStrictEqual([ From 1c5489e046ab557634184007dcd5498c57272c77 Mon Sep 17 00:00:00 2001 From: Bogdan A Date: Thu, 30 Sep 2021 19:04:57 +0300 Subject: [PATCH 30/90] Locale en message fix- "not connected this site" (#12186) --- app/_locales/en/messages.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 1d27a4d5d..9d2aa6aad 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -421,7 +421,7 @@ "message": "You have 1 account connected to this site." }, "connectedAccountsEmptyDescription": { - "message": "MetaMask is not connected this site. To connect to a web3 site, find the connect button on their site." + "message": "MetaMask is not connected to this site. To connect to a web3 site, find and click the connect button." }, "connectedSites": { "message": "Connected sites" From 730605353a88ab41e29a6cf3c6a609211af510e1 Mon Sep 17 00:00:00 2001 From: ryanml Date: Thu, 30 Sep 2021 09:14:20 -0700 Subject: [PATCH 31/90] Using URL util to parse hostname for block explorer link (#12241) --- .../account-details-modal/account-details-modal.component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/components/app/modals/account-details-modal/account-details-modal.component.js b/ui/components/app/modals/account-details-modal/account-details-modal.component.js index 5943cdca5..72767f310 100644 --- a/ui/components/app/modals/account-details-modal/account-details-modal.component.js +++ b/ui/components/app/modals/account-details-modal/account-details-modal.component.js @@ -81,7 +81,7 @@ export default class AccountDetailsModal extends Component { > {rpcPrefs.blockExplorerUrl ? this.context.t('blockExplorerView', [ - rpcPrefs.blockExplorerUrl.match(/^https?:\/\/(.+)/u)[1], + getURLHostName(rpcPrefs.blockExplorerUrl), ]) : this.context.t('viewOnEtherscan', [ this.context.t('blockExplorerAccountAction'), From 9355fb21c70948443372992c07ae8174e829bd7d Mon Sep 17 00:00:00 2001 From: Alex Donesky Date: Thu, 30 Sep 2021 16:34:11 -0500 Subject: [PATCH 32/90] Establish onboarding-flow wrapper/router base and feature flag env variable (#12247) * establish onboarding-flow wrapper/router base and feature flag env variable * small cleanup * addressing feedback --- development/build/scripts.js | 2 + ui/ducks/metamask/metamask.js | 15 +++ ui/helpers/constants/routes.js | 28 +++++ .../authenticated/authenticated.component.js | 22 +++- .../initialized/initialized.component.js | 10 +- ui/pages/onboarding-flow/index.scss | 18 +++ .../onboarding-flow-switch.js | 41 +++++++ ui/pages/onboarding-flow/onboarding-flow.js | 109 ++++++++++++++++++ ui/pages/pages.scss | 1 + ui/pages/routes/routes.component.js | 8 +- ui/selectors/first-time-flow.js | 10 +- 11 files changed, 255 insertions(+), 9 deletions(-) create mode 100644 ui/pages/onboarding-flow/index.scss create mode 100644 ui/pages/onboarding-flow/onboarding-flow-switch/onboarding-flow-switch.js create mode 100644 ui/pages/onboarding-flow/onboarding-flow.js diff --git a/development/build/scripts.js b/development/build/scripts.js index da7e73e26..618485ad7 100644 --- a/development/build/scripts.js +++ b/development/build/scripts.js @@ -27,6 +27,7 @@ const bifyModuleGroups = require('bify-module-groups'); const metamaskrc = require('rc')('metamask', { INFURA_PROJECT_ID: process.env.INFURA_PROJECT_ID, + ONBOARDING_V2: process.env.ONBOARDING_V2, SEGMENT_HOST: process.env.SEGMENT_HOST, SEGMENT_WRITE_KEY: process.env.SEGMENT_WRITE_KEY, SEGMENT_LEGACY_WRITE_KEY: process.env.SEGMENT_LEGACY_WRITE_KEY, @@ -612,6 +613,7 @@ function getEnvironmentVariables({ buildType, devMode, testing }) { ? process.env.SEGMENT_PROD_LEGACY_WRITE_KEY : metamaskrc.SEGMENT_LEGACY_WRITE_KEY, SWAPS_USE_DEV_APIS: process.env.SWAPS_USE_DEV_APIS === '1', + ONBOARDING_V2: metamaskrc.ONBOARDING_V2 === '1', }; } diff --git a/ui/ducks/metamask/metamask.js b/ui/ducks/metamask/metamask.js index b5867a1ff..e1314d5c2 100644 --- a/ui/ducks/metamask/metamask.js +++ b/ui/ducks/metamask/metamask.js @@ -325,3 +325,18 @@ export function getIsGasEstimatesLoading(state) { return isGasEstimatesLoading; } + +export function getCompletedOnboarding(state) { + return state.metamask.completedOnboarding; +} +export function getIsInitialized(state) { + return state.metamask.isInitialized; +} + +export function getIsUnlocked(state) { + return state.metamask.isUnlocked; +} + +export function getSeedPhraseBackedUp(state) { + return state.metamask.seedPhraseBackedUp; +} diff --git a/ui/helpers/constants/routes.js b/ui/helpers/constants/routes.js index 800a4badb..1ae2ef494 100644 --- a/ui/helpers/constants/routes.js +++ b/ui/helpers/constants/routes.js @@ -52,6 +52,21 @@ const INITIALIZE_END_OF_FLOW_ROUTE = '/initialize/end-of-flow'; const INITIALIZE_CONFIRM_SEED_PHRASE_ROUTE = '/initialize/seed-phrase/confirm'; const INITIALIZE_METAMETRICS_OPT_IN_ROUTE = '/initialize/metametrics-opt-in'; +const ONBOARDING_ROUTE = '/onboarding'; +const ONBOARDING_REVIEW_SRP_ROUTE = '/onboarding/review-srp'; +const ONBOARDING_CONFIRM_SRP_ROUTE = '/onboarding/confirm-srp'; +const ONBOARDING_CREATE_PASSWORD_ROUTE = '/onboarding/create-password'; +const ONBOARDING_COMPLETION_ROUTE = '/onboarding/completion'; +const ONBOARDING_UNLOCK_ROUTE = '/onboarding/unlock'; +const ONBOARDING_GET_STARTED_ROUTE = '/onboarding/get-started'; +const ONBOARDING_HELP_US_IMPROVE_ROUTE = '/onboarding/help-us-improve'; +const ONBOARDING_IMPORT_WITH_SRP_ROUTE = + '/onboarding/create-password/import-with-sre'; +const ONBOARDING_IMPORT_MOBILE_ROUTE = '/onboarding/create-password'; +const ONBOARDING_SECURE_YOUR_WALLET_ROUTE = '/onboarding/secure-your-wallet'; +const ONBOARDING_PRIVACY_SETTINGS_ROUTE = '/onboarding/privacy-settings'; +const ONBOARDING_PIN_EXTENSION_ROUTE = '/onboarding/pin-extension'; + const CONFIRM_TRANSACTION_ROUTE = '/confirm-transaction'; const CONFIRM_SEND_ETHER_PATH = '/send-ether'; const CONFIRM_SEND_TOKEN_PATH = '/send-token'; @@ -199,4 +214,17 @@ export { AWAITING_SIGNATURES_ROUTE, SWAPS_ERROR_ROUTE, SWAPS_MAINTENANCE_ROUTE, + ONBOARDING_ROUTE, + ONBOARDING_GET_STARTED_ROUTE, + ONBOARDING_HELP_US_IMPROVE_ROUTE, + ONBOARDING_CREATE_PASSWORD_ROUTE, + ONBOARDING_IMPORT_WITH_SRP_ROUTE, + ONBOARDING_IMPORT_MOBILE_ROUTE, + ONBOARDING_SECURE_YOUR_WALLET_ROUTE, + ONBOARDING_REVIEW_SRP_ROUTE, + ONBOARDING_CONFIRM_SRP_ROUTE, + ONBOARDING_PRIVACY_SETTINGS_ROUTE, + ONBOARDING_COMPLETION_ROUTE, + ONBOARDING_UNLOCK_ROUTE, + ONBOARDING_PIN_EXTENSION_ROUTE, }; diff --git a/ui/helpers/higher-order-components/authenticated/authenticated.component.js b/ui/helpers/higher-order-components/authenticated/authenticated.component.js index 2feebfdb0..1fe151047 100644 --- a/ui/helpers/higher-order-components/authenticated/authenticated.component.js +++ b/ui/helpers/higher-order-components/authenticated/authenticated.component.js @@ -1,16 +1,32 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Redirect, Route } from 'react-router-dom'; -import { UNLOCK_ROUTE, INITIALIZE_ROUTE } from '../../constants/routes'; +import { + UNLOCK_ROUTE, + INITIALIZE_ROUTE, + ONBOARDING_ROUTE, +} from '../../constants/routes'; export default function Authenticated(props) { const { isUnlocked, completedOnboarding } = props; - switch (true) { + // For ONBOARDING_V2 dev purposes, + // Remove when ONBOARDING_V2 dev complete + case process.env.ONBOARDING_V2 === true: + return ; + case isUnlocked && completedOnboarding: return ; case !completedOnboarding: - return ; + return ( + + ); default: return ; } diff --git a/ui/helpers/higher-order-components/initialized/initialized.component.js b/ui/helpers/higher-order-components/initialized/initialized.component.js index a953403fd..5773d605a 100644 --- a/ui/helpers/higher-order-components/initialized/initialized.component.js +++ b/ui/helpers/higher-order-components/initialized/initialized.component.js @@ -1,13 +1,19 @@ import React from 'react'; import PropTypes from 'prop-types'; import { Redirect, Route } from 'react-router-dom'; -import { INITIALIZE_ROUTE } from '../../constants/routes'; +import { INITIALIZE_ROUTE, ONBOARDING_ROUTE } from '../../constants/routes'; export default function Initialized(props) { return props.completedOnboarding ? ( ) : ( - + ); } diff --git a/ui/pages/onboarding-flow/index.scss b/ui/pages/onboarding-flow/index.scss new file mode 100644 index 000000000..aebae2fbd --- /dev/null +++ b/ui/pages/onboarding-flow/index.scss @@ -0,0 +1,18 @@ +@import 'recovery-phrase/index'; +@import 'new-account/index'; + +.onboarding-flow { + width: 100%; + background-color: $white; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + + &__wrapper { + margin-top: 40px; + padding: 32px; + border: 1px solid $Grey-100; + border-radius: 20px; + } +} diff --git a/ui/pages/onboarding-flow/onboarding-flow-switch/onboarding-flow-switch.js b/ui/pages/onboarding-flow/onboarding-flow-switch/onboarding-flow-switch.js new file mode 100644 index 000000000..3512f6f2f --- /dev/null +++ b/ui/pages/onboarding-flow/onboarding-flow-switch/onboarding-flow-switch.js @@ -0,0 +1,41 @@ +import React from 'react'; +import { useSelector } from 'react-redux'; +import { Redirect } from 'react-router-dom'; +import { + DEFAULT_ROUTE, + ONBOARDING_COMPLETION_ROUTE, + ONBOARDING_GET_STARTED_ROUTE, + ONBOARDING_UNLOCK_ROUTE, + LOCK_ROUTE, +} from '../../../helpers/constants/routes'; +import { + getCompletedOnboarding, + getIsInitialized, + getIsUnlocked, + getSeedPhraseBackedUp, +} from '../../../ducks/metamask/metamask'; + +export default function OnboardingFlowSwitch() { + const completedOnboarding = useSelector(getCompletedOnboarding); + const isInitialized = useSelector(getIsInitialized); + const seedPhraseBackedUp = useSelector(getSeedPhraseBackedUp); + const isUnlocked = useSelector(getIsUnlocked); + + if (completedOnboarding) { + return ; + } + + if (seedPhraseBackedUp !== null) { + return ; + } + + if (isUnlocked) { + return ; + } + + if (!isInitialized) { + return ; + } + + return ; +} diff --git a/ui/pages/onboarding-flow/onboarding-flow.js b/ui/pages/onboarding-flow/onboarding-flow.js new file mode 100644 index 000000000..fed13cbad --- /dev/null +++ b/ui/pages/onboarding-flow/onboarding-flow.js @@ -0,0 +1,109 @@ +import React, { useEffect, useState } from 'react'; +import { Switch, Route, useHistory } from 'react-router-dom'; +import { useDispatch, useSelector } from 'react-redux'; +import Unlock from '../unlock-page'; +import { + ONBOARDING_CREATE_PASSWORD_ROUTE, + ONBOARDING_REVIEW_SRP_ROUTE, + ONBOARDING_CONFIRM_SRP_ROUTE, + ONBOARDING_UNLOCK_ROUTE, + DEFAULT_ROUTE, +} from '../../helpers/constants/routes'; +import { + getCompletedOnboarding, + getIsInitialized, + getIsUnlocked, + getSeedPhraseBackedUp, +} from '../../ducks/metamask/metamask'; +import { + createNewVaultAndGetSeedPhrase, + unlockAndGetSeedPhrase, +} from '../../store/actions'; +import { getFirstTimeFlowTypeRoute } from '../../selectors'; +import OnboardingFlowSwitch from './onboarding-flow-switch/onboarding-flow-switch'; +import NewAccount from './new-account/new-account'; +import ReviewRecoveryPhrase from './recovery-phrase/review-recovery-phrase'; +import ConfirmRecoveryPhrase from './recovery-phrase/confirm-recovery-phrase'; + +export default function OnboardingFlow() { + const [seedPhrase, setSeedPhrase] = useState(''); + const dispatch = useDispatch(); + const history = useHistory(); + const isInitialized = useSelector(getIsInitialized); + const isUnlocked = useSelector(getIsUnlocked); + const completedOnboarding = useSelector(getCompletedOnboarding); + const seedPhraseBackedUp = useSelector(getSeedPhraseBackedUp); + const nextRoute = useSelector(getFirstTimeFlowTypeRoute); + + useEffect(() => { + // For ONBOARDING_V2 dev purposes, + // Remove when ONBOARDING_V2 dev complete + if (process.env.ONBOARDING_V2) { + history.push(ONBOARDING_CREATE_PASSWORD_ROUTE); + return; + } + + if (completedOnboarding && seedPhraseBackedUp) { + history.push(DEFAULT_ROUTE); + return; + } + + if (isInitialized && !isUnlocked) { + history.push(ONBOARDING_UNLOCK_ROUTE); + } + }, [ + history, + completedOnboarding, + isInitialized, + isUnlocked, + seedPhraseBackedUp, + ]); + + const handleCreateNewAccount = async (password) => { + const newSeedPhrase = await dispatch( + createNewVaultAndGetSeedPhrase(password), + ); + setSeedPhrase(newSeedPhrase); + }; + + const handleUnlock = async (password) => { + const retreivedSeedPhrase = await dispatch( + unlockAndGetSeedPhrase(password), + ); + setSeedPhrase(retreivedSeedPhrase); + history.push(nextRoute); + }; + + return ( +
+
+ + ( + + )} + /> + } + /> + } + /> + ( + + )} + /> + + +
+
+ ); +} diff --git a/ui/pages/pages.scss b/ui/pages/pages.scss index 5cbc7932e..300bdcf4a 100644 --- a/ui/pages/pages.scss +++ b/ui/pages/pages.scss @@ -19,3 +19,4 @@ @import 'settings/index'; @import 'swaps/index'; @import 'unlock-page/index'; +@import 'onboarding-flow/index'; diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index 4b631c302..4c37ca5bb 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -53,6 +53,7 @@ import { BUILD_QUOTE_ROUTE, CONFIRMATION_V_NEXT_ROUTE, CONFIRM_IMPORT_TOKEN_ROUTE, + ONBOARDING_ROUTE, } from '../../helpers/constants/routes'; import { @@ -62,6 +63,7 @@ import { import { getEnvironmentType } from '../../../app/scripts/lib/util'; import { isBeta } from '../../helpers/utils/build-types'; import ConfirmationPage from '../confirmation'; +import OnboardingFlow from '../onboarding-flow/onboarding-flow'; export default class Routes extends Component { static propTypes = { @@ -114,9 +116,11 @@ export default class Routes extends Component { renderRoutes() { const { autoLockTimeLimit, setLastActiveTime } = this.props; - const routes = ( + {process.env.ONBOARDING_V2 && ( + + )} @@ -225,7 +229,7 @@ export default class Routes extends Component { const isInitializing = Boolean( matchPath(location.pathname, { - path: INITIALIZE_ROUTE, + path: process.env.ONBOARDING_V2 ? ONBOARDING_ROUTE : INITIALIZE_ROUTE, exact: false, }), ); diff --git a/ui/selectors/first-time-flow.js b/ui/selectors/first-time-flow.js index b56bdc861..bbebfbd3a 100644 --- a/ui/selectors/first-time-flow.js +++ b/ui/selectors/first-time-flow.js @@ -2,6 +2,8 @@ import { INITIALIZE_CREATE_PASSWORD_ROUTE, INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE, DEFAULT_ROUTE, + ONBOARDING_CREATE_PASSWORD_ROUTE, + ONBOARDING_IMPORT_WITH_SRP_ROUTE, } from '../helpers/constants/routes'; export function getFirstTimeFlowTypeRoute(state) { @@ -9,9 +11,13 @@ export function getFirstTimeFlowTypeRoute(state) { let nextRoute; if (firstTimeFlowType === 'create') { - nextRoute = INITIALIZE_CREATE_PASSWORD_ROUTE; + nextRoute = process.env.ONBOARDING_V2 + ? ONBOARDING_CREATE_PASSWORD_ROUTE + : INITIALIZE_CREATE_PASSWORD_ROUTE; } else if (firstTimeFlowType === 'import') { - nextRoute = INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE; + nextRoute = process.env.ONBOARDING_V2 + ? ONBOARDING_IMPORT_WITH_SRP_ROUTE + : INITIALIZE_IMPORT_WITH_SEED_PHRASE_ROUTE; } else { nextRoute = DEFAULT_ROUTE; } From c14f46eb929b4ff5322f84446bfed0c4b1480871 Mon Sep 17 00:00:00 2001 From: ryanml Date: Fri, 1 Oct 2021 09:07:29 -0700 Subject: [PATCH 33/90] Fixing confirm-add-suggested-token storybook entry (#12261) --- .../approval-screens/add-suggested-token.js | 130 ++++++++++-------- .storybook/test-data.js | 2 +- .../confirm-add-suggested-token.stories.js | 22 ++- 3 files changed, 84 insertions(+), 70 deletions(-) diff --git a/.storybook/initial-states/approval-screens/add-suggested-token.js b/.storybook/initial-states/approval-screens/add-suggested-token.js index 0b623e3f7..5cd10451c 100644 --- a/.storybook/initial-states/approval-screens/add-suggested-token.js +++ b/.storybook/initial-states/approval-screens/add-suggested-token.js @@ -1,65 +1,83 @@ -export const suggestedTokens = { - "0x6b175474e89094c44da98b954eedeac495271d0f": { - "address": "0x6b175474e89094c44da98b954eedeac495271d0f", - "symbol": "META", - "decimals": 18, - "image": "metamark.svg", - "unlisted": false +export const suggestedAssets = [ + { + asset: { + address: '0x6b175474e89094c44da98b954eedeac495271d0f', + symbol: 'META', + decimals: 18, + image: 'metamark.svg', + unlisted: false }, - "0xB8c77482e45F1F44dE1745F52C74426C631bDD52": { - "address": "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", - "symbol": "0X", - "decimals": 18, - "image": "0x.svg", - "unlisted": false + }, + { + asset: { + 'address': '0xB8c77482e45F1F44dE1745F52C74426C631bDD52', + 'symbol': '0X', + 'decimals': 18, + 'image': '0x.svg', + 'unlisted': false }, - "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984": { - "address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - "symbol": "AST", - "decimals": 18, - "image": "ast.png", - "unlisted": false + }, + { + asset: { + 'address': '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', + 'symbol': 'AST', + 'decimals': 18, + 'image': 'ast.png', + 'unlisted': false }, - "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2": { - "address": "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2", - "symbol": "BAT", - "decimals": 18, - "image": "BAT_icon.svg", - "unlisted": false + }, + { + asset: { + 'address': '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', + 'symbol': 'BAT', + 'decimals': 18, + 'image': 'BAT_icon.svg', + 'unlisted': false }, - "0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1": { - "address": "0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1", - "symbol": "CVL", - "decimals": 18, - "image": "CVL_token.svg", - "unlisted": false + }, + { + asset: { + 'address': '0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1', + 'symbol': 'CVL', + 'decimals': 18, + 'image': 'CVL_token.svg', + 'unlisted': false }, - "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e": { - "address": "0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e", - "symbol": "GLA", - "decimals": 18, - "image": "gladius.svg", - "unlisted": false + }, + { + asset: { + 'address': '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', + 'symbol': 'GLA', + 'decimals': 18, + 'image': 'gladius.svg', + 'unlisted': false }, - "0x467Bccd9d29f223BcE8043b84E8C8B282827790F": { - "address": "0x467Bccd9d29f223BcE8043b84E8C8B282827790F", - "symbol": "GNO", - "decimals": 18, - "image": "gnosis.svg", - "unlisted": false + }, + { + asset: { + 'address': '0x467Bccd9d29f223BcE8043b84E8C8B282827790F', + 'symbol': 'GNO', + 'decimals': 18, + 'image': 'gnosis.svg', + 'unlisted': false }, - "0xff20817765cb7f73d4bde2e66e067e58d11095c2": { - "address": "0xff20817765cb7f73d4bde2e66e067e58d11095c2", - "symbol": "OMG", - "decimals": 18, - "image": "omg.jpg", - "unlisted": false + }, + { + asset: { + 'address': '0xff20817765cb7f73d4bde2e66e067e58d11095c2', + 'symbol': 'OMG', + 'decimals': 18, + 'image': 'omg.jpg', + 'unlisted': false }, - "0x8e870d67f660d95d5be530380d0ec0bd388289e1": { - "address": "0x8e870d67f660d95d5be530380d0ec0bd388289e1", - "symbol": "WED", - "decimals": 18, - "image": "wed.png", - "unlisted": false + }, + { + asset: { + 'address': '0x8e870d67f660d95d5be530380d0ec0bd388289e1', + 'symbol': 'WED', + 'decimals': 18, + 'image': 'wed.png', + 'unlisted': false }, - } \ No newline at end of file + }, +] diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 1aac5c8ba..045aa298c 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -816,7 +816,7 @@ const state = { '0xaD6D458402F60fD3Bd25163575031ACDce07538D': './sai.svg', }, hiddenTokens: [], - suggestedTokens: {}, + suggestedAssets: {}, useNonceField: false, usePhishDetect: true, lostIdentities: {}, diff --git a/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.stories.js b/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.stories.js index cdd525aa5..bad912176 100644 --- a/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.stories.js +++ b/ui/pages/confirm-add-suggested-token/confirm-add-suggested-token.stories.js @@ -2,7 +2,7 @@ import React, { useEffect } from 'react'; import { text } from '@storybook/addon-knobs'; import { store, getNewState } from '../../../.storybook/preview'; -import { suggestedTokens } from '../../../.storybook/initial-states/approval-screens/add-suggested-token'; +import { suggestedAssets } from '../../../.storybook/initial-states/approval-screens/add-suggested-token'; import { updateMetamaskState } from '../../store/actions'; import ConfirmAddSuggestedToken from '.'; @@ -16,32 +16,28 @@ const PageSet = ({ children }) => { const image = text('Icon URL', 'metamark.svg'); const state = store.getState(); - const suggestedTokensState = state.metamask.suggestedTokens; + const suggestedAssetsState = state.metamask.suggestedAssets; useEffect(() => { - suggestedTokensState[ - '0x6b175474e89094c44da98b954eedeac495271d0f' - ].symbol = symbol; + suggestedAssetsState[0].symbol = symbol; store.dispatch( updateMetamaskState( getNewState(state.metamask, { - suggestedTokens: suggestedTokensState, + suggestedAssets: suggestedAssetsState, }), ), ); - }, [symbol, suggestedTokensState, state.metamask]); + }, [symbol, suggestedAssetsState, state.metamask]); useEffect(() => { - suggestedTokensState[ - '0x6b175474e89094c44da98b954eedeac495271d0f' - ].image = image; + suggestedAssetsState[0].image = image; store.dispatch( updateMetamaskState( getNewState(state.metamask, { - suggestedTokens: suggestedTokensState, + suggestedAssets: suggestedAssetsState, }), ), ); - }, [image, suggestedTokensState, state.metamask]); + }, [image, suggestedAssetsState, state.metamask]); return children; }; @@ -51,7 +47,7 @@ export const AddSuggestedToken = () => { store.dispatch( updateMetamaskState( getNewState(state.metamask, { - suggestedTokens, + suggestedAssets, }), ), ); From f9ea9e4b432176d940001365938aa88253d54024 Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 1 Oct 2021 08:53:12 -1000 Subject: [PATCH 34/90] lockdown - breakout making globalThis properties non-writable (#12258) * lockdown - breakout making globalThis properties non-writable into lockdown-more.js * Update app/scripts/lockdown-more.js Co-authored-by: David Walsh * Update app/scripts/lockdown-more.js Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com> Co-authored-by: David Walsh Co-authored-by: Erik Marks <25517051+rekmarks@users.noreply.github.com> --- .eslintrc.js | 2 + app/background.html | 1 + app/home.html | 1 + app/manifest/_base.json | 1 + app/notification.html | 1 + app/phishing.html | 1 + app/popup.html | 1 + app/scripts/lockdown-more.js | 91 ++++++++++++++++++++ app/scripts/lockdown-run.js | 92 --------------------- development/build/static.js | 6 ++ test/unit-global/protect-intrinsics.test.js | 1 + 11 files changed, 106 insertions(+), 92 deletions(-) create mode 100644 app/scripts/lockdown-more.js diff --git a/.eslintrc.js b/.eslintrc.js index ca9fe4677..7f8d6695e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -183,6 +183,7 @@ module.exports = { 'nyc.config.js', 'stylelint.config.js', 'app/scripts/lockdown-run.js', + 'app/scripts/lockdown-more.js', 'development/**/*.js', 'test/e2e/**/*.js', 'test/lib/wait-until-called.js', @@ -197,6 +198,7 @@ module.exports = { { files: [ 'app/scripts/lockdown-run.js', + 'app/scripts/lockdown-more.js', 'test/unit-global/protect-intrinsics.test.js', ], globals: { diff --git a/app/background.html b/app/background.html index 2faa31411..4f80b2d7f 100644 --- a/app/background.html +++ b/app/background.html @@ -8,6 +8,7 @@ + {{@each(it.jsBundles) => val}} diff --git a/app/home.html b/app/home.html index 5350b31dd..c55a6446f 100644 --- a/app/home.html +++ b/app/home.html @@ -14,6 +14,7 @@ + {{@each(it.jsBundles) => val}} diff --git a/app/manifest/_base.json b/app/manifest/_base.json index 6c328d0c6..e4f55da26 100644 --- a/app/manifest/_base.json +++ b/app/manifest/_base.json @@ -35,6 +35,7 @@ "globalthis.js", "lockdown-install.js", "lockdown-run.js", + "lockdown-more.js", "contentscript.js" ], "run_at": "document_start", diff --git a/app/notification.html b/app/notification.html index 55b98c960..7ff5d73cc 100644 --- a/app/notification.html +++ b/app/notification.html @@ -37,6 +37,7 @@ + {{@each(it.jsBundles) => val}} diff --git a/app/phishing.html b/app/phishing.html index dd180fb77..30accb9bf 100644 --- a/app/phishing.html +++ b/app/phishing.html @@ -5,6 +5,7 @@ + diff --git a/app/popup.html b/app/popup.html index c94b82df8..378efbfb4 100644 --- a/app/popup.html +++ b/app/popup.html @@ -14,6 +14,7 @@ + {{@each(it.jsBundles) => val}} diff --git a/app/scripts/lockdown-more.js b/app/scripts/lockdown-more.js new file mode 100644 index 000000000..7db50e43f --- /dev/null +++ b/app/scripts/lockdown-more.js @@ -0,0 +1,91 @@ +// Make all "object" and "function" own properties of globalThis +// non-configurable and non-writable, when possible. +// We call a property that is non-configurable and non-writable, +// "non-modifiable". +try { + /** + * `lockdown` only hardens the properties enumerated by the + * universalPropertyNames constant specified in 'ses/src/whitelist'. This + * function makes all function and object properties on the start compartment + * global non-configurable and non-writable, unless they are already + * non-configurable. + * + * It is critical that this function runs at the right time during + * initialization, which should always be immediately after `lockdown` has been + * called. At the time of writing, the modifications this function makes to the + * runtime environment appear to be non-breaking, but that could change with + * the addition of dependencies, or the order of our scripts in our HTML files. + * Exercise caution. + * + * See inline comments for implementation details. + * + * We write this function in IIFE format to avoid polluting global scope. + */ + (function protectIntrinsics() { + const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis); + + // These named intrinsics are not automatically hardened by `lockdown` + const shouldHardenManually = new Set(['eval', 'Function']); + + const globalProperties = new Set([ + // universalPropertyNames is a constant added by lockdown to global scope + // at the time of writing, it is initialized in 'ses/src/whitelist'. + // These properties tend to be non-enumerable. + ...namedIntrinsics, + + // TODO: Also include the named platform globals + // This grabs every enumerable property on globalThis. + // ...Object.keys(globalThis), + ]); + + globalProperties.forEach((propertyName) => { + const descriptor = Reflect.getOwnPropertyDescriptor( + globalThis, + propertyName, + ); + + if (descriptor) { + if (descriptor.configurable) { + // If the property on globalThis is configurable, make it + // non-configurable. If it has no accessor properties, also make it + // non-writable. + if (hasAccessor(descriptor)) { + Object.defineProperty(globalThis, propertyName, { + configurable: false, + }); + } else { + Object.defineProperty(globalThis, propertyName, { + configurable: false, + writable: false, + }); + } + } + + if (shouldHardenManually.has(propertyName)) { + harden(globalThis[propertyName]); + } + } + }); + + /** + * Checks whether the given propertyName descriptor has any accessors, i.e. the + * properties `get` or `set`. + * + * We want to make globals non-writable, and we can't set the `writable` + * property and accessor properties at the same time. + * + * @param {Object} descriptor - The propertyName descriptor to check. + * @returns {boolean} Whether the propertyName descriptor has any accessors. + */ + function hasAccessor(descriptor) { + return 'set' in descriptor || 'get' in descriptor; + } + })(); +} catch (error) { + console.error('Protecting intrinsics failed:', error); + if (globalThis?.sentry.captureException) { + globalThis.sentry.captureException( + new Error(`Protecting intrinsics failed: ${error.message}`), + ); + } +} diff --git a/app/scripts/lockdown-run.js b/app/scripts/lockdown-run.js index 3c7276fdf..0d869cc7f 100644 --- a/app/scripts/lockdown-run.js +++ b/app/scripts/lockdown-run.js @@ -20,95 +20,3 @@ try { ); } } - -// Make all "object" and "function" own properties of globalThis -// non-configurable and non-writable, when possible. -// We call the a property that is non-configurable and non-writable, -// "non-modifiable". -try { - /** - * `lockdown` only hardens the properties enumerated by the - * universalPropertyNames constant specified in 'ses/src/whitelist'. This - * function makes all function and object properties on the start compartment - * global non-configurable and non-writable, unless they are already - * non-configurable. - * - * It is critical that this function runs at the right time during - * initialization, which should always be immediately after `lockdown` has been - * called. At the time of writing, the modifications this function makes to the - * runtime environment appear to be non-breaking, but that could change with - * the addition of dependencies, or the order of our scripts in our HTML files. - * Exercise caution. - * - * See inline comments for implementation details. - * - * We write this function in IIFE format to avoid polluting global scope. - */ - (function protectIntrinsics() { - const namedIntrinsics = Reflect.ownKeys(new Compartment().globalThis); - - // These named intrinsics are not automatically hardened by `lockdown` - const shouldHardenManually = new Set(['eval', 'Function']); - - const globalProperties = new Set([ - // universalPropertyNames is a constant added by lockdown to global scope - // at the time of writing, it is initialized in 'ses/src/whitelist'. - // These properties tend to be non-enumerable. - ...namedIntrinsics, - - // TODO: Also include the named platform globals - // This grabs every enumerable property on globalThis. - // ...Object.keys(globalThis), - ]); - - globalProperties.forEach((propertyName) => { - const descriptor = Reflect.getOwnPropertyDescriptor( - globalThis, - propertyName, - ); - - if (descriptor) { - if (descriptor.configurable) { - // If the property on globalThis is configurable, make it - // non-configurable. If it has no accessor properties, also make it - // non-writable. - if (hasAccessor(descriptor)) { - Object.defineProperty(globalThis, propertyName, { - configurable: false, - }); - } else { - Object.defineProperty(globalThis, propertyName, { - configurable: false, - writable: false, - }); - } - } - - if (shouldHardenManually.has(propertyName)) { - harden(globalThis[propertyName]); - } - } - }); - - /** - * Checks whether the given propertyName descriptor has any accessors, i.e. the - * properties `get` or `set`. - * - * We want to make globals non-writable, and we can't set the `writable` - * property and accessor properties at the same time. - * - * @param {Object} descriptor - The propertyName descriptor to check. - * @returns {boolean} Whether the propertyName descriptor has any accessors. - */ - function hasAccessor(descriptor) { - return 'set' in descriptor || 'get' in descriptor; - } - })(); -} catch (error) { - console.error('Protecting intrinsics failed:', error); - if (globalThis.sentry && globalThis.sentry.captureException) { - globalThis.sentry.captureException( - new Error(`Protecting intrinsics failed: ${error.message}`), - ); - } -} diff --git a/development/build/static.js b/development/build/static.js index 5e5425a58..3926cefb0 100644 --- a/development/build/static.js +++ b/development/build/static.js @@ -148,6 +148,12 @@ function getCopyTargets(shouldIncludeLockdown) { : EMPTY_JS_FILE, dest: `lockdown-run.js`, }, + { + src: shouldIncludeLockdown + ? `./app/scripts/lockdown-more.js` + : EMPTY_JS_FILE, + dest: `lockdown-more.js`, + }, { // eslint-disable-next-line node/no-extraneous-require src: require.resolve('@lavamoat/lavapack/src/runtime-cjs.js'), diff --git a/test/unit-global/protect-intrinsics.test.js b/test/unit-global/protect-intrinsics.test.js index 5075080f9..3958d7762 100644 --- a/test/unit-global/protect-intrinsics.test.js +++ b/test/unit-global/protect-intrinsics.test.js @@ -1,5 +1,6 @@ import 'ses/lockdown'; import '../../app/scripts/lockdown-run'; +import '../../app/scripts/lockdown-more'; import { strict as assert } from 'assert'; // These are Agoric inventions, and we don't care about them. From a174d50ba5c578f279c57343d5e10ebd3a69053b Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 1 Oct 2021 09:39:28 -1000 Subject: [PATCH 35/90] ci - improve lavamoat validation debug info (#12259) * ci - improve lavamoat validation debug info * Update validate-allow-scripts.sh * Update validate-lavamoat-policy.sh --- .circleci/scripts/validate-allow-scripts.sh | 2 +- .circleci/scripts/validate-lavamoat-policy.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/scripts/validate-allow-scripts.sh b/.circleci/scripts/validate-allow-scripts.sh index e466f039c..de45520ad 100755 --- a/.circleci/scripts/validate-allow-scripts.sh +++ b/.circleci/scripts/validate-allow-scripts.sh @@ -6,7 +6,7 @@ set -o pipefail yarn allow-scripts auto -if git diff --exit-code --quiet +if git diff --exit-code then echo "allow-scripts configuration is up-to-date" else diff --git a/.circleci/scripts/validate-lavamoat-policy.sh b/.circleci/scripts/validate-lavamoat-policy.sh index 4eab30b75..d674cd3f0 100755 --- a/.circleci/scripts/validate-lavamoat-policy.sh +++ b/.circleci/scripts/validate-lavamoat-policy.sh @@ -6,7 +6,7 @@ set -o pipefail yarn lavamoat:auto -if git diff --exit-code --quiet +if git diff --exit-code then echo "LavaMoat policy is up-to-date" else From 7c4bd78f2e48a208fe635019ab9bbb83ac9c7854 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Fri, 1 Oct 2021 16:23:54 -0600 Subject: [PATCH 36/90] Suppress prop types warning in RadioGroupComponent (#12249) When editing the gas fee for a transaction, the following warning is being output to the console: Warning: Failed prop type: Connector: prop type `isFirst` is invalid; it must be a function, usually from the `prop-types` package, but received `undefined`. This commit fixes this issue. --- ui/components/ui/radio-group/radio-group.component.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/components/ui/radio-group/radio-group.component.js b/ui/components/ui/radio-group/radio-group.component.js index 7bc0dae6b..90c136fb9 100644 --- a/ui/components/ui/radio-group/radio-group.component.js +++ b/ui/components/ui/radio-group/radio-group.component.js @@ -24,8 +24,8 @@ function Connector({ isFirst, isLast }) { } Connector.propTypes = { - isFirst: PropTypes.boolean, - isLast: PropTypes.boolean, + isFirst: PropTypes.bool, + isLast: PropTypes.bool, }; export default function RadioGroup({ options, name, selectedValue, onChange }) { From f741712255b60462321ec99882fcb2cf8efcf723 Mon Sep 17 00:00:00 2001 From: ryanml Date: Mon, 4 Oct 2021 06:46:18 -0700 Subject: [PATCH 37/90] Fixing confirmation screen storybook views (#12271) --- .storybook/test-data.js | 65 +++++++++++++++++++ .../confirm-import-token.stories.js | 22 +++++-- 2 files changed, 83 insertions(+), 4 deletions(-) diff --git a/.storybook/test-data.js b/.storybook/test-data.js index 045aa298c..a725361a0 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -14,6 +14,71 @@ const state = { url: 'https://metamask.github.io/test-dapp/', }, metamask: { + tokenList: { + '0x6b175474e89094c44da98b954eedeac495271d0f': { + address: '0x6b175474e89094c44da98b954eedeac495271d0f', + symbol: 'META', + decimals: 18, + image: 'metamark.svg', + unlisted: false + }, + '0xB8c77482e45F1F44dE1745F52C74426C631bDD52': { + address: '0xB8c77482e45F1F44dE1745F52C74426C631bDD52', + symbol: '0X', + decimals: 18, + image: '0x.svg', + unlisted: false + }, + '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984': { + address: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', + symbol: 'AST', + decimals: 18, + image: 'ast.png', + unlisted: false + }, + '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2': { + address: '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2', + symbol: 'BAT', + decimals: 18, + image: 'BAT_icon.svg', + unlisted: false + }, + '0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1': { + address: '0xe83cccfabd4ed148903bf36d4283ee7c8b3494d1', + symbol: 'CVL', + decimals: 18, + image: 'CVL_token.svg', + unlisted: false + }, + '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e': { + address: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e', + symbol: 'GLA', + decimals: 18, + image: 'gladius.svg', + unlisted: false + }, + '0x467Bccd9d29f223BcE8043b84E8C8B282827790F': { + address: '0x467Bccd9d29f223BcE8043b84E8C8B282827790F', + symbol: 'GNO', + decimals: 18, + image: 'gnosis.svg', + unlisted: false + }, + '0xff20817765cb7f73d4bde2e66e067e58d11095c2': { + address: '0xff20817765cb7f73d4bde2e66e067e58d11095c2', + symbol: 'OMG', + decimals: 18, + image: 'omg.jpg', + unlisted: false + }, + '0x8e870d67f660d95d5be530380d0ec0bd388289e1': { + address: '0x8e870d67f660d95d5be530380d0ec0bd388289e1', + symbol: 'WED', + decimals: 18, + image: 'wed.png', + unlisted: false + }, + }, networkDetails: { EIPS: { 1559: true, diff --git a/ui/pages/confirm-import-token/confirm-import-token.stories.js b/ui/pages/confirm-import-token/confirm-import-token.stories.js index 87acd2f59..dcc1d1fcc 100644 --- a/ui/pages/confirm-import-token/confirm-import-token.stories.js +++ b/ui/pages/confirm-import-token/confirm-import-token.stories.js @@ -3,7 +3,7 @@ import React, { useEffect } from 'react'; import { createBrowserHistory } from 'history'; import { text } from '@storybook/addon-knobs'; -import { store } from '../../../.storybook/preview'; +import { store, getNewState } from '../../../.storybook/preview'; import { tokens } from '../../../.storybook/initial-states/approval-screens/add-token'; import { updateMetamaskState } from '../../store/actions'; import ConfirmAddToken from '.'; @@ -23,14 +23,28 @@ const PageSet = ({ children }) => { useEffect(() => { const pendingTokens = { ...pendingTokensState }; pendingTokens['0x33f90dee07c6e8b9682dd20f73e6c358b2ed0f03'].symbol = symbol; - store.dispatch(updateMetamaskState({ pendingTokens })); - }, [symbol, pendingTokensState]); + store.dispatch( + updateMetamaskState( + getNewState(state.metamask, { + pendingTokens, + }), + ), + ); + }, [symbol, pendingTokensState, state.metamask]); return children; }; export const AddToken = () => { - store.dispatch(updateMetamaskState({ pendingTokens: tokens })); + const { metamask: state } = store.getState(); + store.dispatch( + updateMetamaskState( + getNewState(state, { + pendingTokens: tokens, + }), + ), + ); + return ( From 9de632e9d142c3c99a556bd88d6b41623f59aeab Mon Sep 17 00:00:00 2001 From: Etienne Dusseault Date: Tue, 5 Oct 2021 11:13:07 -0300 Subject: [PATCH 38/90] Fix contact-list Storybook (#12262) --- .storybook/test-data.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.storybook/test-data.js b/.storybook/test-data.js index a725361a0..1e1e0e397 100644 --- a/.storybook/test-data.js +++ b/.storybook/test-data.js @@ -199,6 +199,18 @@ const state = { }, }, }, + addresses: [ + { + address: '0x39a4e4Af7cCB654dB9500F258c64781c8FbD39F0', + name: 'DAI', + isEns: false, + }, + { + address: '1x39a4e4Af7cCB654dB9500F258c64781c8FbD39F0', + name: 'ETH', + isEns: true, + }, + ], contractExchangeRates: { '0xaD6D458402F60fD3Bd25163575031ACDce07538D': 0, }, From 68d7ff73c54c029cbf1f864b3bb1b45d63e935bb Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Tue, 5 Oct 2021 21:46:08 +0530 Subject: [PATCH 39/90] Remove autofocus from gas limit input on advance gas popup (#12279) --- .../app/advanced-gas-controls/advanced-gas-controls.component.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js b/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js index 93f3e5ee3..d6676f93e 100644 --- a/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js +++ b/ui/components/app/advanced-gas-controls/advanced-gas-controls.component.js @@ -54,7 +54,6 @@ export default function AdvancedGasControls({ value={gasLimit} allowDecimals={false} numeric - autoFocus /> {showFeeMarketFields ? ( <> From 68259ee3e261986f24261bff37b1fb298ac7aea9 Mon Sep 17 00:00:00 2001 From: Niranjana Binoy <43930900+NiranjanaBinoy@users.noreply.github.com> Date: Tue, 5 Oct 2021 15:20:42 -0400 Subject: [PATCH 40/90] UX Papercuts Epic: Create a consistent representation of the Buttons (#12096) --- test/e2e/metamask-ui.spec.js | 2 +- test/e2e/tests/custom-rpc-history.spec.js | 6 +++--- test/e2e/tests/from-import-ui.spec.js | 2 +- test/e2e/tests/incremental-security.spec.js | 2 +- .../app/account-menu/account-menu.component.js | 5 +++-- ui/components/app/account-menu/account-menu.test.js | 3 ++- ui/components/app/account-menu/index.scss | 6 +++--- .../invalid-custom-network-alert.scss | 1 - .../unconnected-account-alert.js | 1 - .../unconnected-account-alert.scss | 1 - ui/components/app/app-components.scss | 1 + ui/components/app/cancel-button/cancel-button.js | 5 ++--- .../confirm-page-container-content.component.js | 1 - .../confirm-page-container.component.js | 1 - ui/components/app/home-notification/index.scss | 2 -- ui/components/app/loading-network-screen/index.scss | 6 ++++++ .../loading-network-screen.component.js | 2 +- .../metamask-template-renderer.stories.js | 2 -- ui/components/app/modal/modal.component.js | 9 ++------- ui/components/app/modal/modal.component.test.js | 10 +++++----- .../cancel-transaction/cancel-transaction.component.js | 1 - .../confirm-delete-network.component.js | 2 +- .../confirm-delete-network.test.js | 4 ++-- .../confirm-remove-account.component.js | 1 - .../confirm-remove-account.test.js | 4 ++-- .../confirm-reset-account.component.js | 2 +- .../confirm-reset-account.test.js | 6 ++++-- .../customize-nonce/customize-nonce.component.js | 3 --- .../edit-approval-permission.component.js | 1 - .../export-private-key-modal.component.js | 6 +++--- .../hide-token-confirmation-modal.js | 4 ++-- .../metametrics-opt-in-modal.component.js | 1 - .../metametrics-opt-in-modal.test.js | 4 +++- .../app/modals/qr-scanner/qr-scanner.component.js | 1 - .../reject-transactions.component.js | 1 - .../reject-transactions/reject-transactions.test.js | 4 ++-- .../transaction-confirmed.test.js | 4 +--- .../permission-page-container.component.js | 1 - .../recovery-phrase-reminder.js | 2 +- .../signature-request-original.component.js | 4 ++-- .../signature-request-footer/index.scss | 1 - .../signature-request-footer.component.js | 2 +- .../signature-request.container.test.js | 2 +- .../app/transaction-list-item-details/index.scss | 7 ++++++- .../transaction-list-item-details.component.js | 4 ++-- .../transaction-list-item.component.js | 3 +-- .../app/transaction-list/transaction-list.component.js | 1 - ui/components/app/whats-new-popup/whats-new-popup.js | 1 - ui/components/ui/button/button.component.js | 6 +++--- .../page-container-footer.component.js | 4 ++-- .../page-container-footer.component.test.js | 2 +- .../ui/page-container/page-container.component.js | 1 - .../truncated-definition-list.js | 1 - ui/css/itcss/components/send.scss | 3 ++- .../confirm-add-suggested-token.component.js | 4 ++-- .../confirm-decrypt-message.component.js | 4 ++-- .../confirm-encryption-public-key.component.js | 4 ++-- .../confirm-import-token.component.js | 4 ++-- .../confirmation-footer/confirmation-footer.js | 4 ++-- .../create-account/connect-hardware/account-list.js | 2 +- ui/pages/create-account/import-account/json.js | 4 ++-- ui/pages/create-account/import-account/private-key.js | 4 ++-- ui/pages/create-account/new-account.component.js | 4 ++-- .../metametrics-opt-in/metametrics-opt-in.component.js | 1 - .../metametrics-opt-in/metametrics-opt-in.test.js | 2 +- ui/pages/keychains/index.scss | 5 +++++ ui/pages/keychains/restore-vault.js | 2 +- ui/pages/keychains/reveal-seed.js | 8 ++++---- ui/pages/mobile-sync/mobile-sync.component.js | 8 ++++---- ui/pages/onboarding-flow/new-account/new-account.js | 1 - .../recovery-phrase/confirm-recovery-phrase.js | 1 - .../recovery-phrase/review-recovery-phrase.js | 2 -- .../choose-account/choose-account.component.js | 2 +- ui/pages/permissions-connect/choose-account/index.scss | 2 +- .../permissions-connect/permissions-connect.stories.js | 1 - .../add-contact/add-contact.component.js | 1 - .../contact-list-tab/contact-list-tab.component.js | 1 - .../edit-contact/edit-contact.component.js | 1 - ui/pages/settings/contact-list-tab/index.scss | 1 - ui/pages/settings/networks-tab/index.scss | 4 ++-- .../network-form/network-form.component.js | 4 ++-- .../settings/networks-tab/networks-tab.component.js | 2 +- ui/pages/swaps/import-token/import-token.js | 4 +--- .../item-list/item-list.component.js | 2 +- ui/pages/swaps/select-quote-popover/index.scss | 1 - .../swaps/select-quote-popover/select-quote-popover.js | 4 ++-- .../__snapshots__/swaps-footer.test.js.snap | 4 ++-- ui/pages/swaps/swaps-footer/swaps-footer.js | 1 - ui/pages/unlock-page/index.scss | 1 + ui/pages/unlock-page/unlock-page.component.js | 4 ++-- 90 files changed, 122 insertions(+), 144 deletions(-) create mode 100644 ui/components/app/loading-network-screen/index.scss diff --git a/test/e2e/metamask-ui.spec.js b/test/e2e/metamask-ui.spec.js index 74ea431f2..3f57d00ae 100644 --- a/test/e2e/metamask-ui.spec.js +++ b/test/e2e/metamask-ui.spec.js @@ -100,7 +100,7 @@ describe('MetaMask', function () { }); it('clicks the "No thanks" option on the metametrics opt-in screen', async function () { - await driver.clickElement('.btn-default'); + await driver.clickElement('.btn-secondary'); await driver.delay(largeDelayMs); }); diff --git a/test/e2e/tests/custom-rpc-history.spec.js b/test/e2e/tests/custom-rpc-history.spec.js index 08a2bdd31..078cb124f 100644 --- a/test/e2e/tests/custom-rpc-history.spec.js +++ b/test/e2e/tests/custom-rpc-history.spec.js @@ -48,7 +48,7 @@ describe('Stores custom RPC history', function () { await chainIdInput.clear(); await chainIdInput.sendKeys(chainId.toString()); - await driver.clickElement('.network-form__footer .btn-secondary'); + await driver.clickElement('.network-form__footer .btn-primary'); await driver.findElement({ text: networkName, tag: 'span' }); }, ); @@ -192,7 +192,7 @@ describe('Stores custom RPC history', function () { await driver.clickElement({ text: 'Custom RPC', tag: 'span' }); // cancel new custom rpc - await driver.clickElement('.network-form__footer button.btn-default'); + await driver.clickElement('.network-form__footer button.btn-secondary'); const networkListItems = await driver.findClickableElements( '.networks-tab__networks-list-name', @@ -209,7 +209,7 @@ describe('Stores custom RPC history', function () { ); await driver.clickElement( - '.button.btn-danger.modal-container__footer-button', + '.button.btn-danger-primary.modal-container__footer-button', ); // wait for confirm delete modal to be removed from DOM. diff --git a/test/e2e/tests/from-import-ui.spec.js b/test/e2e/tests/from-import-ui.spec.js index 176b51e48..a7fba5982 100644 --- a/test/e2e/tests/from-import-ui.spec.js +++ b/test/e2e/tests/from-import-ui.spec.js @@ -38,7 +38,7 @@ describe('Metamask Import UI', function () { await driver.clickElement({ text: 'Import wallet', tag: 'button' }); // clicks the "No thanks" option on the metametrics opt-in screen - await driver.clickElement('.btn-default'); + await driver.clickElement('.btn-secondary'); // Import Secret Recovery Phrase await driver.fill( diff --git a/test/e2e/tests/incremental-security.spec.js b/test/e2e/tests/incremental-security.spec.js index 185a0d8c0..f6e5e5066 100644 --- a/test/e2e/tests/incremental-security.spec.js +++ b/test/e2e/tests/incremental-security.spec.js @@ -42,7 +42,7 @@ describe('Incremental Security', function () { await driver.clickElement({ text: 'Create a Wallet', tag: 'button' }); // clicks the "No thanks" option on the metametrics opt-in screen - await driver.clickElement('.btn-default'); + await driver.clickElement('.btn-secondary'); // accepts a secure password await driver.fill( diff --git a/ui/components/app/account-menu/account-menu.component.js b/ui/components/app/account-menu/account-menu.component.js index 41c809be8..c391a08aa 100644 --- a/ui/components/app/account-menu/account-menu.component.js +++ b/ui/components/app/account-menu/account-menu.component.js @@ -19,6 +19,7 @@ import { } from '../../../helpers/constants/routes'; import TextField from '../../ui/text-field'; import SearchIcon from '../../ui/search-icon'; +import Button from '../../ui/button'; import { isBeta } from '../../../helpers/utils/build-types'; @@ -324,7 +325,7 @@ export default class AccountMenu extends Component {
{t('myAccounts')} - +
diff --git a/ui/components/app/account-menu/account-menu.test.js b/ui/components/app/account-menu/account-menu.test.js index fc715ead1..501c187dd 100644 --- a/ui/components/app/account-menu/account-menu.test.js +++ b/ui/components/app/account-menu/account-menu.test.js @@ -3,6 +3,7 @@ import sinon from 'sinon'; import configureMockStore from 'redux-mock-store'; import { Provider } from 'react-redux'; import { mountWithRouter } from '../../../../test/lib/render-helpers'; +import Button from '../../ui/button'; import AccountMenu from '.'; describe('Account Menu', () => { @@ -103,7 +104,7 @@ describe('Account Menu', () => { let logout; it('logout', () => { - logout = wrapper.find('.account-menu__lock-button'); + logout = wrapper.find(Button); expect(logout).toHaveLength(1); }); diff --git a/ui/components/app/account-menu/index.scss b/ui/components/app/account-menu/index.scss index 8f1f5c8c8..18059a7e8 100644 --- a/ui/components/app/account-menu/index.scss +++ b/ui/components/app/account-menu/index.scss @@ -97,14 +97,14 @@ align-items: center; } - &__lock-button { + & &__lock-button { @include H7; - border: 1px solid $dusty-gray; + border: 1px solid $ui-white; background-color: transparent; color: $white; - border-radius: 4px; padding: 3.5px 24px; + width: 59px; } &__item-icon { diff --git a/ui/components/app/alerts/invalid-custom-network-alert/invalid-custom-network-alert.scss b/ui/components/app/alerts/invalid-custom-network-alert/invalid-custom-network-alert.scss index de7010883..a1a170466 100644 --- a/ui/components/app/alerts/invalid-custom-network-alert/invalid-custom-network-alert.scss +++ b/ui/components/app/alerts/invalid-custom-network-alert/invalid-custom-network-alert.scss @@ -37,7 +37,6 @@ & &-button { height: 40px; width: 50%; - border-radius: 100px; margin-right: 24px; &:last-of-type { diff --git a/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.js b/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.js index 1b887bba4..cbcac50eb 100644 --- a/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.js +++ b/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.js @@ -76,7 +76,6 @@ const UnconnectedAccountAlert = () => { disabled={alertState === LOADING} onClick={onClose} type="primary" - rounded className="unconnected-account-alert__dismiss-button" > {t('dismiss')} diff --git a/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.scss b/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.scss index 11c12f420..cedd14617 100644 --- a/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.scss +++ b/ui/components/app/alerts/unconnected-account-alert/unconnected-account-alert.scss @@ -22,7 +22,6 @@ height: 40px; width: 100px; border: 0; - border-radius: 100px; } &__error { diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index aabadf245..d76c2998f 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -46,3 +46,4 @@ @import 'transaction-total-banner/index'; @import 'wallet-overview/index'; @import 'whats-new-popup/index'; +@import 'loading-network-screen/index' diff --git a/ui/components/app/cancel-button/cancel-button.js b/ui/components/app/cancel-button/cancel-button.js index bef23f98c..0efce2212 100644 --- a/ui/components/app/cancel-button/cancel-button.js +++ b/ui/components/app/cancel-button/cancel-button.js @@ -33,11 +33,10 @@ export default function CancelButton({ const btn = (
diff --git a/ui/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.test.js b/ui/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.test.js index 7b90b24ff..ff6650652 100644 --- a/ui/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.test.js +++ b/ui/components/app/modals/metametrics-opt-in-modal/metametrics-opt-in-modal.test.js @@ -28,7 +28,9 @@ describe('MetaMetrics Opt In', () => { }); it('passes false to setParticipateInMetaMetrics and hides modal', async () => { - const noThanks = wrapper.find('.btn-default.page-container__footer-button'); + const noThanks = wrapper.find( + '.btn-secondary.page-container__footer-button', + ); noThanks.simulate('click'); expect(await props.setParticipateInMetaMetrics.calledOnce).toStrictEqual( diff --git a/ui/components/app/modals/qr-scanner/qr-scanner.component.js b/ui/components/app/modals/qr-scanner/qr-scanner.component.js index fac593717..610c2631b 100644 --- a/ui/components/app/modals/qr-scanner/qr-scanner.component.js +++ b/ui/components/app/modals/qr-scanner/qr-scanner.component.js @@ -221,7 +221,6 @@ export default class QrScanner extends Component { onSubmit={this.tryAgain} cancelText={t('cancel')} submitText={t('tryAgain')} - submitButtonType="confirm" /> ); diff --git a/ui/components/app/modals/reject-transactions/reject-transactions.component.js b/ui/components/app/modals/reject-transactions/reject-transactions.component.js index 3bb4cd9d9..6ef0daa91 100644 --- a/ui/components/app/modals/reject-transactions/reject-transactions.component.js +++ b/ui/components/app/modals/reject-transactions/reject-transactions.component.js @@ -32,7 +32,6 @@ export default class RejectTransactionsModal extends PureComponent { onCancel={hideModal} submitText={t('rejectAll')} cancelText={t('cancel')} - submitType="secondary" >
diff --git a/ui/components/app/modals/reject-transactions/reject-transactions.test.js b/ui/components/app/modals/reject-transactions/reject-transactions.test.js index 043f9bab7..e8ec7a7b5 100644 --- a/ui/components/app/modals/reject-transactions/reject-transactions.test.js +++ b/ui/components/app/modals/reject-transactions/reject-transactions.test.js @@ -26,7 +26,7 @@ describe('Reject Transactions Model', () => { it('hides modal when cancel button is clicked', () => { const cancelButton = wrapper.find( - '.btn-default.modal-container__footer-button', + '.btn-secondary.modal-container__footer-button', ); cancelButton.simulate('click'); @@ -35,7 +35,7 @@ describe('Reject Transactions Model', () => { it('onSubmit is called and hides modal when reject all clicked', async () => { const rejectAllButton = wrapper.find( - '.btn-secondary.modal-container__footer-button', + '.btn-primary.modal-container__footer-button', ); rejectAllButton.simulate('click'); diff --git a/ui/components/app/modals/transaction-confirmed/transaction-confirmed.test.js b/ui/components/app/modals/transaction-confirmed/transaction-confirmed.test.js index 84111a9ee..0e1658242 100644 --- a/ui/components/app/modals/transaction-confirmed/transaction-confirmed.test.js +++ b/ui/components/app/modals/transaction-confirmed/transaction-confirmed.test.js @@ -17,9 +17,7 @@ describe('Transaction Confirmed', () => { }, }, ); - const submit = wrapper.find( - '.btn-secondary.modal-container__footer-button', - ); + const submit = wrapper.find('.btn-primary.modal-container__footer-button'); submit.simulate('click'); expect(props.onSubmit.calledOnce).toStrictEqual(true); diff --git a/ui/components/app/permission-page-container/permission-page-container.component.js b/ui/components/app/permission-page-container/permission-page-container.component.js index a8378f746..2a8daa2f6 100644 --- a/ui/components/app/permission-page-container/permission-page-container.component.js +++ b/ui/components/app/permission-page-container/permission-page-container.component.js @@ -141,7 +141,6 @@ export default class PermissionPageContainer extends Component { cancelText={this.context.t('cancel')} onSubmit={() => this.onSubmit()} submitText={this.context.t('connect')} - submitButtonType="confirm" buttonSizeLarge={false} />
diff --git a/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js b/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js index 1b8b66ba3..23dd36442 100644 --- a/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js +++ b/ui/components/app/recovery-phrase-reminder/recovery-phrase-reminder.js @@ -75,7 +75,7 @@ export default function RecoveryPhraseReminder({ onConfirm, hasBackedUp }) { - diff --git a/ui/components/app/signature-request-original/signature-request-original.component.js b/ui/components/app/signature-request-original/signature-request-original.component.js index c999cf282..41312296c 100644 --- a/ui/components/app/signature-request-original/signature-request-original.component.js +++ b/ui/components/app/signature-request-original/signature-request-original.component.js @@ -290,7 +290,7 @@ export default class SignatureRequestOriginal extends Component { return (
diff --git a/ui/components/app/transaction-list-item/transaction-list-item.component.js b/ui/components/app/transaction-list-item/transaction-list-item.component.js index 4f7210d16..88227e7d0 100644 --- a/ui/components/app/transaction-list-item/transaction-list-item.component.js +++ b/ui/components/app/transaction-list-item/transaction-list-item.component.js @@ -122,8 +122,7 @@ export default function TransactionListItem({ } return (
diff --git a/ui/components/ui/truncated-definition-list/truncated-definition-list.js b/ui/components/ui/truncated-definition-list/truncated-definition-list.js index 2382b045b..f7354cffd 100644 --- a/ui/components/ui/truncated-definition-list/truncated-definition-list.js +++ b/ui/components/ui/truncated-definition-list/truncated-definition-list.js @@ -49,7 +49,6 @@ export default function TruncatedDefinitionList({ -
diff --git a/ui/pages/create-account/connect-hardware/account-list.js b/ui/pages/create-account/connect-hardware/account-list.js index 96a31bd05..29922fcd2 100644 --- a/ui/pages/create-account/connect-hardware/account-list.js +++ b/ui/pages/create-account/connect-hardware/account-list.js @@ -194,7 +194,7 @@ class AccountList extends Component { return (
diff --git a/ui/pages/onboarding-flow/recovery-phrase/confirm-recovery-phrase.js b/ui/pages/onboarding-flow/recovery-phrase/confirm-recovery-phrase.js index 52d3926e1..2828b5fd7 100644 --- a/ui/pages/onboarding-flow/recovery-phrase/confirm-recovery-phrase.js +++ b/ui/pages/onboarding-flow/recovery-phrase/confirm-recovery-phrase.js @@ -80,7 +80,6 @@ export default function ConfirmRecoveryPhrase({ seedPhrase = '' }) { />
) : ( diff --git a/ui/pages/permissions-connect/choose-account/index.scss b/ui/pages/permissions-connect/choose-account/index.scss index d02f5136b..4fcd11e70 100644 --- a/ui/pages/permissions-connect/choose-account/index.scss +++ b/ui/pages/permissions-connect/choose-account/index.scss @@ -179,7 +179,7 @@ width: 124px; } - .btn-default { + .btn-secondary { background: white; margin-left: 16px; } diff --git a/ui/pages/permissions-connect/permissions-connect.stories.js b/ui/pages/permissions-connect/permissions-connect.stories.js index 6eff21540..87af63ee2 100644 --- a/ui/pages/permissions-connect/permissions-connect.stories.js +++ b/ui/pages/permissions-connect/permissions-connect.stories.js @@ -74,7 +74,6 @@ export const PermissionPageContainerComponent = () => { cancelButtonType="default" onSubmit={action('Account(s) Connected')} submitText="connect" - submitButtonType="confirm" buttonSizeLarge={false} />
diff --git a/ui/pages/settings/contact-list-tab/add-contact/add-contact.component.js b/ui/pages/settings/contact-list-tab/add-contact/add-contact.component.js index 6ce7f06f0..3ed6296d6 100644 --- a/ui/pages/settings/contact-list-tab/add-contact/add-contact.component.js +++ b/ui/pages/settings/contact-list-tab/add-contact/add-contact.component.js @@ -153,7 +153,6 @@ export default class AddContact extends PureComponent { history.push(CONTACT_LIST_ROUTE); }} submitText={this.context.t('save')} - submitButtonType="confirm" />
); diff --git a/ui/pages/settings/contact-list-tab/contact-list-tab.component.js b/ui/pages/settings/contact-list-tab/contact-list-tab.component.js index 2f4b135f0..0f315517f 100644 --- a/ui/pages/settings/contact-list-tab/contact-list-tab.component.js +++ b/ui/pages/settings/contact-list-tab/contact-list-tab.component.js @@ -80,7 +80,6 @@ export default class ContactListTab extends Component { viewingContact || editingContact, })} type="secondary" - rounded onClick={() => { history.push(CONTACT_ADD_ROUTE); }} diff --git a/ui/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js b/ui/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js index 51419b302..0f64dfa15 100644 --- a/ui/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js +++ b/ui/pages/settings/contact-list-tab/edit-contact/edit-contact.component.js @@ -177,7 +177,6 @@ export default class EditContact extends PureComponent { history.push(`${viewRoute}/${address}`); }} submitText={this.context.t('save')} - submitButtonType="confirm" /> ); diff --git a/ui/pages/settings/contact-list-tab/index.scss b/ui/pages/settings/contact-list-tab/index.scss index 4084afa0f..8f00641b6 100644 --- a/ui/pages/settings/contact-list-tab/index.scss +++ b/ui/pages/settings/contact-list-tab/index.scss @@ -257,7 +257,6 @@ top: 85px; right: 16px; width: auto; - border-radius: 100px; @media screen and (max-width: $break-small) { top: 16px; diff --git a/ui/pages/settings/networks-tab/index.scss b/ui/pages/settings/networks-tab/index.scss index 40a182264..d8da8cf79 100644 --- a/ui/pages/settings/networks-tab/index.scss +++ b/ui/pages/settings/networks-tab/index.scss @@ -232,11 +232,11 @@ width: 93%; } - .btn-default { + .btn-secondary { margin-right: 0.375rem; } - .btn-secondary { + .btn-primary { margin-left: 0.375rem; } diff --git a/ui/pages/settings/networks-tab/network-form/network-form.component.js b/ui/pages/settings/networks-tab/network-form/network-form.component.js index e2968001d..2e722031e 100644 --- a/ui/pages/settings/networks-tab/network-form/network-form.component.js +++ b/ui/pages/settings/networks-tab/network-form/network-form.component.js @@ -629,14 +629,14 @@ export default class NetworkForm extends PureComponent { )} diff --git a/ui/pages/swaps/searchable-item-list/item-list/item-list.component.js b/ui/pages/swaps/searchable-item-list/item-list/item-list.component.js index 13ee5afa8..d74b50460 100644 --- a/ui/pages/swaps/searchable-item-list/item-list/item-list.component.js +++ b/ui/pages/swaps/searchable-item-list/item-list/item-list.component.js @@ -139,7 +139,7 @@ export default function ItemList({ )} {result.notImported && ( - )} diff --git a/ui/pages/swaps/select-quote-popover/index.scss b/ui/pages/swaps/select-quote-popover/index.scss index ad305a3f8..e2a3a2cc7 100644 --- a/ui/pages/swaps/select-quote-popover/index.scss +++ b/ui/pages/swaps/select-quote-popover/index.scss @@ -2,7 +2,6 @@ .select-quote-popover { &__button { - border-radius: 100px; height: 39px; width: 140px; } diff --git a/ui/pages/swaps/select-quote-popover/select-quote-popover.js b/ui/pages/swaps/select-quote-popover/select-quote-popover.js index c3efcba48..c4f9e8977 100644 --- a/ui/pages/swaps/select-quote-popover/select-quote-popover.js +++ b/ui/pages/swaps/select-quote-popover/select-quote-popover.js @@ -57,7 +57,7 @@ const SelectQuotePopover = ({ const footer = ( <>