From 1c8b4bb27ad6c06f38f54a3f03585c203c97aba8 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Fri, 30 Jun 2023 12:40:58 -0230 Subject: [PATCH 01/56] Version v10.34.0 --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dc5fce18eea..ca6587539e95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [10.34.0] + ## [10.33.0] ### Added - UI Upgrade ([#18903](https://github.com/MetaMask/metamask-extension/pull/18903)) @@ -3825,7 +3827,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Uncategorized - Added the ability to restore accounts from seed words. -[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.33.0...HEAD +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.34.0...HEAD +[10.33.0]: https://github.com/MetaMask/metamask-extension/compare/v10.33.0...v10.34.0 [10.33.0]: https://github.com/MetaMask/metamask-extension/compare/v10.32.0...v10.33.0 [10.32.0]: https://github.com/MetaMask/metamask-extension/compare/v10.31.1...v10.32.0 [10.31.1]: https://github.com/MetaMask/metamask-extension/compare/v10.31.0...v10.31.1 diff --git a/package.json b/package.json index 123d68999fa5..5b7fd1fdd8e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metamask-crx", - "version": "10.33.0", + "version": "10.34.0", "private": true, "repository": { "type": "git", From 96f2ab4dae3746e3c5cecb3291b310997dd6a215 Mon Sep 17 00:00:00 2001 From: George Weiler Date: Fri, 7 Jul 2023 03:29:35 -0600 Subject: [PATCH 02/56] feat: adds linea mainnet buyable support in anticipation of July 11 launch (#19854) * feat: adds linea mainnet support in anticipation of July 11 launch * chore: fixes linting issue * chore: adds comma for linting --------- Co-authored-by: Pedro Pablo Aste Kompen Co-authored-by: Dan J Miller --- shared/constants/network.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared/constants/network.ts b/shared/constants/network.ts index b25353dbe424..6d5058aac68a 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -549,7 +549,6 @@ export const BUYABLE_CHAINS_MAP: { | typeof CHAIN_IDS.FANTOM_TESTNET | typeof CHAIN_IDS.MOONBEAM_TESTNET | typeof CHAIN_IDS.LINEA_GOERLI - | typeof CHAIN_IDS.LINEA_MAINNET | typeof CHAIN_IDS.GOERLI >]: BuyableChainSettings; } = { @@ -613,6 +612,10 @@ export const BUYABLE_CHAINS_MAP: { nativeCurrency: CURRENCY_SYMBOLS.PALM, network: 'palm', }, + [CHAIN_IDS.LINEA_MAINNET]: { + nativeCurrency: CURRENCY_SYMBOLS.ETH, + network: 'linea', + }, }; export const FEATURED_RPCS: RPCDefinition[] = [ From ec7c64d4fc06aa08f2d2f267989fde2602705ef6 Mon Sep 17 00:00:00 2001 From: Matthew Walsh Date: Fri, 7 Jul 2023 09:05:58 +0100 Subject: [PATCH 03/56] Provide missing history property (#19896) --- ui/pages/confirm-signature-request/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/pages/confirm-signature-request/index.js b/ui/pages/confirm-signature-request/index.js index ef1a43a49f5f..b86b23a6ee06 100644 --- a/ui/pages/confirm-signature-request/index.js +++ b/ui/pages/confirm-signature-request/index.js @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { withRouter } from 'react-router-dom'; +import { useHistory, withRouter } from 'react-router-dom'; import log from 'loglevel'; import { cloneDeep } from 'lodash'; import * as actions from '../../store/actions'; @@ -69,6 +69,7 @@ const ConfirmTxScreen = ({ match }) => { ///: END:ONLY_INCLUDE_IN const [prevValue, setPrevValues] = useState(); + const history = useHistory(); useEffect(() => { const unconfTxList = txHelper( @@ -174,6 +175,7 @@ const ConfirmTxScreen = ({ match }) => { return ( Date: Wed, 5 Jul 2023 20:54:46 +0800 Subject: [PATCH 04/56] fix: fetch for snap registry (#19866) --- app/scripts/controllers/preferences.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js index 052f218a3928..9be792c49437 100644 --- a/app/scripts/controllers/preferences.js +++ b/app/scripts/controllers/preferences.js @@ -526,7 +526,8 @@ export default class PreferencesController { async updateSnapRegistry() { let snapRegistry; try { - snapRegistry = await fetch(KEYRING_SNAPS_REGISTRY_URL); + const response = await fetch(KEYRING_SNAPS_REGISTRY_URL); + snapRegistry = await response.json(); } catch (error) { console.error(`Failed to fetch registry: `, error); snapRegistry = {}; From f145331665aacb17d32febe66487d5aedb9ee46f Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Thu, 13 Jul 2023 12:23:10 -0230 Subject: [PATCH 05/56] Fix memory based performance problem caused by use of lodash memoize in box component (#19993) --- ui/components/component-library/box/box.tsx | 2 +- ui/components/ui/box/box.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/components/component-library/box/box.tsx b/ui/components/component-library/box/box.tsx index 409b0b640d7c..d09d0a6d6bed 100644 --- a/ui/components/component-library/box/box.tsx +++ b/ui/components/component-library/box/box.tsx @@ -130,7 +130,7 @@ const generateClassNames = memoize( } return classNamesObject; }, - (styleDeclaration, value) => [styleDeclaration, value], + (styleDeclaration, value) => `${styleDeclaration}${value}`, ); export const Box: BoxComponent = React.forwardRef( diff --git a/ui/components/ui/box/box.js b/ui/components/ui/box/box.js index 869413663df3..679dfb95cb11 100644 --- a/ui/components/ui/box/box.js +++ b/ui/components/ui/box/box.js @@ -184,7 +184,7 @@ const generateClassNames = memoize( } return classesObject; }, - (type, value) => [type, value], + (type, value) => `${type}${value}`, ); /** From 88c433cd09e2bd9ded15453538f7a5a023a86e98 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Wed, 12 Jul 2023 20:05:27 -0230 Subject: [PATCH 06/56] Prevent controller events from crashing (#19963) * Prevent controller events from crashing The package `@metamask/base-controller` has been updated to v3.1, which includes a change to how event subscriber errors are handled. Errors thrown in event subscribers will no longer interrupt event publishing. Subscriber errors are caught and thrown in a timeout handler, ensuring that they are logged and captured by Sentry. We can find any subscriber errors by looking at the background console, or at the Sentry dashboard. Fixes #19801 * Update LavaMoat policies --------- Co-authored-by: MetaMask Bot --- lavamoat/browserify/beta/policy.json | 3 +++ lavamoat/browserify/desktop/policy.json | 3 +++ lavamoat/browserify/flask/policy.json | 3 +++ lavamoat/browserify/main/policy.json | 3 +++ lavamoat/browserify/mmi/policy.json | 3 +++ package.json | 2 +- yarn.lock | 10 +++++----- 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index f3373a420170..4990fb1b99fc 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -855,6 +855,9 @@ } }, "@metamask/base-controller": { + "globals": { + "setTimeout": true + }, "packages": { "immer": true } diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index aa3b955d2ff7..6cd8068ff101 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -855,6 +855,9 @@ } }, "@metamask/base-controller": { + "globals": { + "setTimeout": true + }, "packages": { "immer": true } diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index aa3b955d2ff7..6cd8068ff101 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -855,6 +855,9 @@ } }, "@metamask/base-controller": { + "globals": { + "setTimeout": true + }, "packages": { "immer": true } diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index f3373a420170..4990fb1b99fc 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -855,6 +855,9 @@ } }, "@metamask/base-controller": { + "globals": { + "setTimeout": true + }, "packages": { "immer": true } diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index a097c6d553d0..79411ecd1dd8 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1076,6 +1076,9 @@ } }, "@metamask/base-controller": { + "globals": { + "setTimeout": true + }, "packages": { "immer": true } diff --git a/package.json b/package.json index 8c04eefe889a..fee7bf4ed237 100644 --- a/package.json +++ b/package.json @@ -227,7 +227,7 @@ "@metamask/announcement-controller": "^4.0.0", "@metamask/approval-controller": "^3.3.0", "@metamask/assets-controllers": "^9.2.0", - "@metamask/base-controller": "^3.0.0", + "@metamask/base-controller": "^3.1.0", "@metamask/browser-passworder": "^4.1.0", "@metamask/contract-metadata": "^2.3.1", "@metamask/controller-utils": "^4.0.1", diff --git a/yarn.lock b/yarn.lock index a28073e73243..c88669224d02 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3940,13 +3940,13 @@ __metadata: languageName: node linkType: hard -"@metamask/base-controller@npm:^3.0.0": - version: 3.0.0 - resolution: "@metamask/base-controller@npm:3.0.0" +"@metamask/base-controller@npm:^3.0.0, @metamask/base-controller@npm:^3.1.0": + version: 3.1.0 + resolution: "@metamask/base-controller@npm:3.1.0" dependencies: "@metamask/utils": ^5.0.2 immer: ^9.0.6 - checksum: a0853d90b024466c4108531cbf4459bd2f66fa6e0b912e42bd27cdf54262411a5601117649b6061424475ffa6b9714c5199d686c21e4d07c3b7b1ee0b4c17caa + checksum: fc1597a099e6d28bd089df936ca349d6c38c2e1b0f0737385cba30c34a5239241519eb172d77c70f8db2604f4dc5724f6893affe42bdd104cef98f9cfd6f1db8 languageName: node linkType: hard @@ -24504,7 +24504,7 @@ __metadata: "@metamask/approval-controller": ^3.3.0 "@metamask/assets-controllers": ^9.2.0 "@metamask/auto-changelog": ^2.1.0 - "@metamask/base-controller": ^3.0.0 + "@metamask/base-controller": ^3.1.0 "@metamask/browser-passworder": ^4.1.0 "@metamask/contract-metadata": ^2.3.1 "@metamask/controller-utils": ^4.0.1 From fac889c1116a2ab3c54b8243c6cf562f23d093f3 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Wed, 12 Jul 2023 11:05:41 -0500 Subject: [PATCH 07/56] Fix #19548 - Increase address copy to clipboard time (#19948) --- .../multichain/address-copy-button/address-copy-button.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/components/multichain/address-copy-button/address-copy-button.js b/ui/components/multichain/address-copy-button/address-copy-button.js index 953bff31a68f..a46affac01a3 100644 --- a/ui/components/multichain/address-copy-button/address-copy-button.js +++ b/ui/components/multichain/address-copy-button/address-copy-button.js @@ -14,6 +14,7 @@ import { useCopyToClipboard } from '../../../hooks/useCopyToClipboard'; import { shortenAddress } from '../../../helpers/utils/util'; import Tooltip from '../../ui/tooltip/tooltip'; import { useI18nContext } from '../../../hooks/useI18nContext'; +import { MINUTE } from '../../../../shared/constants/time'; export const AddressCopyButton = ({ address, @@ -22,7 +23,7 @@ export const AddressCopyButton = ({ onClick, }) => { const displayAddress = shorten ? shortenAddress(address) : address; - const [copied, handleCopy] = useCopyToClipboard(); + const [copied, handleCopy] = useCopyToClipboard(MINUTE); const t = useI18nContext(); return ( From 3c981d78d55107b68897a6effeec5bde228efbb2 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Thu, 13 Jul 2023 15:15:53 -0230 Subject: [PATCH 08/56] Update changelog for v10.34.0 (#20002) --- CHANGELOG.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 208946bb346e..00d3852f01b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [10.34.0] +### Added +- Add a security quiz to the SRP reveal ([#19283](https://github.com/MetaMask/metamask-extension/pull/19283)) +- [FLASK] Add Snaps keyring and new snap accounts related pages ([#19710](https://github.com/MetaMask/metamask-extension/pull/19710)) + + +### Changed +- Decrease boldness of text in some labels ([#19731](https://github.com/MetaMask/metamask-extension/pull/19731)) + +### Fixed +- Fix design inconsistencies in the connect flow ([#19800](https://github.com/MetaMask/metamask-extension/pull/19800)) +- Fix connection issues on some dapps, and ensure that `eth_requestAccount` returns accounts when opening multiple tabs for the same dapp ([#19727](https://github.com/MetaMask/metamask-extension/pull/19727)) +- Fix UI bugs in contacts page ([#19646](https://github.com/MetaMask/metamask-extension/pull/19646)) +- Ensure correct logo shown on Linea ([#19717](https://github.com/MetaMask/metamask-extension/pull/19717)) +- Fix the autolock field in settings on firefox ([#19653](https://github.com/MetaMask/metamask-extension/pull/19653)) +- Prevent duplicate account names that only differ by letter casing ([#19616](https://github.com/MetaMask/metamask-extension/pull/19616)) +- Ensure token details stay within asset dropdown border ([#19626](https://github.com/MetaMask/metamask-extension/pull/19626)) +- Prevent rounded corners in account menu ([#19615](https://github.com/MetaMask/metamask-extension/pull/19615)) +- Ensure network changes before the user accepts a wallet_watchAsset request add the NFT to pre-change chain ID and address ([#19629](https://github.com/MetaMask/metamask-extension/pull/19629)) +- Fix performance degradations noticable on Firefox builds ([#19993](https://github.com/MetaMask/metamask-extension/pull/19993)) +- Fix copy to clipboard of public address, so that it is only cleared from the clipboard after 60 seconds ([#19948](https://github.com/MetaMask/metamask-extension/pull/19948)) +- Fix overlapping text, in some language, in home screen buttons ([#19920](https://github.com/MetaMask/metamask-extension/pull/19920)) + + ## [10.33.1] ### Fixed - Fix to bug causing users to see an infinite spinner when signing typed messages. ([#19894](https://github.com/MetaMask/metamask-extension/pull/19894)) @@ -3831,8 +3854,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added the ability to restore accounts from seed words. [Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.34.0...HEAD -[10.33.0]: https://github.com/MetaMask/metamask-extension/compare/v10.33.0...v10.34.0 -[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.33.1...HEAD +[10.34.0]: https://github.com/MetaMask/metamask-extension/compare/v10.33.1...v10.34.0 [10.33.1]: https://github.com/MetaMask/metamask-extension/compare/v10.33.0...v10.33.1 [10.33.0]: https://github.com/MetaMask/metamask-extension/compare/v10.32.0...v10.33.0 [10.32.0]: https://github.com/MetaMask/metamask-extension/compare/v10.31.1...v10.32.0 From 710101991c1495a9036070650a6bf4301d4a108c Mon Sep 17 00:00:00 2001 From: Nidhi Kumari Date: Thu, 13 Jul 2023 23:31:10 +0530 Subject: [PATCH 09/56] fixed button in wallet-overview (#19920) * fixed button in wallet-overview * lint fix * updated selector css with class --- ui/components/ui/icon-button/icon-button.js | 26 ++++++++++++++----- ui/components/ui/icon-button/icon-button.scss | 4 +++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ui/components/ui/icon-button/icon-button.js b/ui/components/ui/icon-button/icon-button.js index c6eb9062a181..cc95d8343cf1 100644 --- a/ui/components/ui/icon-button/icon-button.js +++ b/ui/components/ui/icon-button/icon-button.js @@ -28,13 +28,25 @@ export default function IconButton({ {renderWrapper( <>
{Icon}
- - {label.length > 12 ? ( - {label} - ) : ( - label - )} - + {label.length > 9 ? ( + + + {label} + + + ) : ( + + {label} + + )} , )} diff --git a/ui/components/ui/icon-button/icon-button.scss b/ui/components/ui/icon-button/icon-button.scss index 14c0a9eaf44d..e80854307fc7 100644 --- a/ui/components/ui/icon-button/icon-button.scss +++ b/ui/components/ui/icon-button/icon-button.scss @@ -29,4 +29,8 @@ opacity: 0.3; cursor: auto; } + + &__label { + width: 60px; //for ellipsis keeping the width same as icon-button used here + } } From 6c04d765022e55341148132228301b35688ac30b Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 13 Jul 2023 13:29:53 -0500 Subject: [PATCH 10/56] Fix #19941 - Correctly show network name and selection when chainIds collide (#19947) --- test/data/mock-state.json | 13 +++++- test/e2e/fixture-builder.js | 3 ++ test/e2e/tests/custom-rpc-history.spec.js | 10 +++-- .../__snapshots__/nft-details.test.js.snap | 2 +- .../app/nft-details/nft-details.test.js | 18 ++++++++- .../__snapshots__/app-header.test.js.snap | 4 +- .../network-list-menu/network-list-menu.js | 6 ++- ui/selectors/selectors.js | 13 +++++- ui/selectors/selectors.test.js | 40 +++++++++++++++++++ ui/store/actions.ts | 3 -- 10 files changed, 95 insertions(+), 17 deletions(-) diff --git a/test/data/mock-state.json b/test/data/mock-state.json index 07153cf85cfd..77d17841f66b 100644 --- a/test/data/mock-state.json +++ b/test/data/mock-state.json @@ -115,13 +115,22 @@ "type": "rpc", "chainId": "0x5", "ticker": "ETH", - "id": "testNetworkConfigurationId" + "id": "chain5" }, "networkConfigurations": { "testNetworkConfigurationId": { "rpcUrl": "https://testrpc.com", "chainId": "0x1", - "nickname": "Custom Mainnet RPC" + "nickname": "Custom Mainnet RPC", + "type": "rpc", + "id": "testNetworkConfigurationId" + }, + "chain5": { + "type": "rpc", + "chainId": "0x5", + "ticker": "ETH", + "nickname": "Chain 5", + "id": "chain5" } }, "keyrings": [ diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index 884c9b94e8e0..bbbcd49cf42b 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -215,6 +215,7 @@ function defaultFixture() { rpcUrl: 'http://localhost:8545', ticker: 'ETH', type: 'rpc', + id: 'networkConfigurationId', }, networkConfigurations: { networkConfigurationId: { @@ -346,6 +347,7 @@ function onboardingFixture() { rpcUrl: 'http://localhost:8545', chainId: CHAIN_IDS.LOCALHOST, nickname: 'Localhost 8545', + id: 'networkConfigurationId', }, networkConfigurations: { networkConfigurationId: { @@ -355,6 +357,7 @@ function onboardingFixture() { rpcUrl: 'http://localhost:8545', ticker: 'ETH', networkConfigurationId: 'networkConfigurationId', + type: 'rpc', }, }, }, diff --git a/test/e2e/tests/custom-rpc-history.spec.js b/test/e2e/tests/custom-rpc-history.spec.js index 8b43ab712218..fd8e8314ba8e 100644 --- a/test/e2e/tests/custom-rpc-history.spec.js +++ b/test/e2e/tests/custom-rpc-history.spec.js @@ -196,19 +196,21 @@ describe('Stores custom RPC history', function () { fixtures: new FixtureBuilder() .withNetworkController({ networkConfigurations: { - networkConfigurationId: { + networkConfigurationIdOne: { rpcUrl: 'http://127.0.0.1:8545/1', chainId: '0x539', ticker: 'ETH', nickname: 'http://127.0.0.1:8545/1', rpcPrefs: {}, + type: 'rpc', }, - networkConfigurationId2: { + networkConfigurationIdTwo: { rpcUrl: 'http://127.0.0.1:8545/2', chainId: '0x539', ticker: 'ETH', nickname: 'http://127.0.0.1:8545/2', rpcPrefs: {}, + type: 'rpc', }, }, }) @@ -248,14 +250,14 @@ describe('Stores custom RPC history', function () { fixtures: new FixtureBuilder() .withNetworkController({ networkConfigurations: { - networkConfigurationId: { + networkConfigurationIdOne: { rpcUrl: 'http://127.0.0.1:8545/1', chainId: '0x539', ticker: 'ETH', nickname: 'http://127.0.0.1:8545/1', rpcPrefs: {}, }, - networkConfigurationId2: { + networkConfigurationIdTwo: { rpcUrl: 'http://127.0.0.1:8545/2', chainId: '0x539', ticker: 'ETH', diff --git a/ui/components/app/nft-details/__snapshots__/nft-details.test.js.snap b/ui/components/app/nft-details/__snapshots__/nft-details.test.js.snap index 152b24ab711d..30bdc26668a0 100644 --- a/ui/components/app/nft-details/__snapshots__/nft-details.test.js.snap +++ b/ui/components/app/nft-details/__snapshots__/nft-details.test.js.snap @@ -66,7 +66,7 @@ exports[`NFT Details should match minimal props and state snapshot 1`] = ` class="box mm-text mm-avatar-base mm-avatar-base--size-sm mm-avatar-network nft-item__network-badge mm-text--body-sm mm-text--text-transform-uppercase box--display-flex box--flex-direction-row box--justify-content-center box--align-items-center box--color-text-default box--background-color-background-alternative box--rounded-full box--border-color-background-default box--border-width-2 box--border-style-solid" data-testid="nft-network-badge" > - G + C diff --git a/ui/components/app/nft-details/nft-details.test.js b/ui/components/app/nft-details/nft-details.test.js index 3909406b2458..aab54bd60e06 100644 --- a/ui/components/app/nft-details/nft-details.test.js +++ b/ui/components/app/nft-details/nft-details.test.js @@ -13,6 +13,12 @@ import { removeAndIgnoreNft, setRemoveNftMessage, } from '../../../store/actions'; +import { + CHAIN_IDS, + CURRENCY_SYMBOLS, + MAINNET_DISPLAY_NAME, + NETWORK_TYPES, +} from '../../../../shared/constants/network'; import NftDetails from './nft-details'; jest.mock('copy-to-clipboard'); @@ -172,7 +178,10 @@ describe('NFT Details', () => { metamask: { ...mockState.metamask, providerConfig: { - chainId: '0x1', + chainId: CHAIN_IDS.MAINNET, + type: NETWORK_TYPES.MAINNET, + ticker: CURRENCY_SYMBOLS.ETH, + nickname: MAINNET_DISPLAY_NAME, }, }, }; @@ -203,12 +212,16 @@ describe('NFT Details', () => { ...mockState.metamask, providerConfig: { chainId: '0x89', + type: 'rpc', + id: 'custom-mainnet', }, networkConfigurations: { testNetworkConfigurationId: { rpcUrl: 'https://testrpc.com', chainId: '0x89', nickname: 'Custom Mainnet RPC', + type: 'rpc', + id: 'custom-mainnet', }, }, }, @@ -239,7 +252,8 @@ describe('NFT Details', () => { metamask: { ...mockState.metamask, providerConfig: { - chainId: '0xaa36a7', + chainId: CHAIN_IDS.SEPOLIA, + type: NETWORK_TYPES.SEPOLIA, }, }, }; diff --git a/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap b/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap index bb44e6a6f488..3a4e81f7e002 100644 --- a/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap +++ b/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap @@ -214,12 +214,12 @@ exports[`App Header should match snapshot 1`] = `
- G + C

- Goerli + Chain 5

{ const networks = useSelector(getAllEnabledNetworks); const showTestNetworks = useSelector(getShowTestNetworks); const currentChainId = useSelector(getCurrentChainId); + + const currentNetwork = useSelector(getCurrentNetwork); + const dispatch = useDispatch(); const history = useHistory(); const trackEvent = useContext(MetaMetricsContext); @@ -91,7 +95,7 @@ export const NetworkListMenu = ({ onClose }) => { ) { return null; } - const isCurrentNetwork = currentChainId === network.chainId; + const isCurrentNetwork = currentNetwork.id === network.id; const canDeleteNetwork = !isCurrentNetwork && !UNREMOVABLE_CHAIN_IDS.includes(network.chainId); diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 04517c7e0474..a07c737881c7 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -1170,9 +1170,13 @@ export function getNetworkConfigurations(state) { export function getCurrentNetwork(state) { const allNetworks = getAllNetworks(state); - const currentChainId = getCurrentChainId(state); + const providerConfig = getProviderConfig(state); - return allNetworks.find((network) => network.chainId === currentChainId); + const filter = + providerConfig.type === 'rpc' + ? (network) => network.id === providerConfig.id + : (network) => network.id === providerConfig.type; + return allNetworks.find(filter); } export function getAllEnabledNetworks(state) { @@ -1200,6 +1204,7 @@ export function getAllNetworks(state) { }, providerType: NETWORK_TYPES.MAINNET, ticker: CURRENCY_SYMBOLS.ETH, + id: NETWORK_TYPES.MAINNET, }, { chainId: CHAIN_IDS.LINEA_MAINNET, @@ -1210,6 +1215,7 @@ export function getAllNetworks(state) { }, providerType: NETWORK_TYPES.LINEA_MAINNET, ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_MAINNET], + id: NETWORK_TYPES.LINEA_MAINNET, }, // Custom networks added by the user ...Object.values(networkConfigurations).filter( @@ -1222,6 +1228,7 @@ export function getAllNetworks(state) { rpcUrl: CHAIN_ID_TO_RPC_URL_MAP[CHAIN_IDS.GOERLI], providerType: NETWORK_TYPES.GOERLI, ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.GOERLI], + id: NETWORK_TYPES.GOERLI, }, { chainId: CHAIN_IDS.SEPOLIA, @@ -1229,6 +1236,7 @@ export function getAllNetworks(state) { rpcUrl: CHAIN_ID_TO_RPC_URL_MAP[CHAIN_IDS.SEPOLIA], providerType: NETWORK_TYPES.SEPOLIA, ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.SEPOLIA], + id: NETWORK_TYPES.SEPOLIA, }, { chainId: CHAIN_IDS.LINEA_GOERLI, @@ -1239,6 +1247,7 @@ export function getAllNetworks(state) { }, providerType: NETWORK_TYPES.LINEA_GOERLI, ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_GOERLI], + id: NETWORK_TYPES.LINEA_GOERLI, }, // Localhosts ...Object.values(networkConfigurations).filter( diff --git a/ui/selectors/selectors.test.js b/ui/selectors/selectors.test.js index 8819a9769cde..1c2b1b5dec2a 100644 --- a/ui/selectors/selectors.test.js +++ b/ui/selectors/selectors.test.js @@ -316,6 +316,46 @@ describe('Selectors', () => { }); }); + describe('#getCurrentNetwork', () => { + it('returns the correct custom network when there is a chainId collision', () => { + const modifiedMockState = { + ...mockState, + metamask: { + ...mockState.metamask, + providerConfig: { + ...mockState.metamask.networkConfigurations + .testNetworkConfigurationId, + // 0x1 would collide with Ethereum Mainnet + chainId: '0x1', + // type of "rpc" signals custom network + type: 'rpc', + }, + }, + }; + + const currentNetwork = selectors.getCurrentNetwork(modifiedMockState); + expect(currentNetwork.nickname).toBe('Custom Mainnet RPC'); + expect(currentNetwork.chainId).toBe('0x1'); + }); + + it('returns the correct mainnet network when there is a chainId collision', () => { + const modifiedMockState = { + ...mockState, + metamask: { + ...mockState.metamask, + providerConfig: { + ...mockState.metamask.providerConfig, + chainId: '0x1', + // Changing type to 'mainnet' represents Ethereum Mainnet + type: 'mainnet', + }, + }, + }; + const currentNetwork = selectors.getCurrentNetwork(modifiedMockState); + expect(currentNetwork.nickname).toBe('Ethereum Mainnet'); + }); + }); + describe('#getAllEnabledNetworks', () => { it('returns only MainNet with showTestNetworks off', () => { const networks = selectors.getAllEnabledNetworks({ diff --git a/ui/store/actions.ts b/ui/store/actions.ts index 5e12c3ae7197..509127bf6585 100644 --- a/ui/store/actions.ts +++ b/ui/store/actions.ts @@ -19,12 +19,9 @@ import { PayloadAction } from '@reduxjs/toolkit'; import { GasFeeController } from '@metamask/gas-fee-controller'; import { PermissionsRequest } from '@metamask/permission-controller'; import { NonEmptyArray } from '@metamask/controller-utils'; -<<<<<<< HEAD ///: BEGIN:ONLY_INCLUDE_IN(keyring-snaps) import { HandlerType } from '@metamask/snaps-utils'; ///: END:ONLY_INCLUDE_IN -======= ->>>>>>> master import { getMethodDataAsync } from '../helpers/utils/transactions.util'; import switchDirection from '../../shared/lib/switch-direction'; import { From c9d2e61400ce41d070ecf3e7456ad44815a7b3ef Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Fri, 7 Jul 2023 11:14:18 -0700 Subject: [PATCH 11/56] Bump @metamask/network-controller to 10.3.0 (#19903) In the new version of NetworkController, it will now precreate network clients for built-in and custom networks and expose those network clients for consumers. This furthers the multichain UX project by making it possible for MetaMask to interface with multiple networks simultaneously. This commit also upgrades `@metamask/gas-fee-controller` to prevent a peer dependency warning from showing up as well as `@metamask/controller-utils` in order to reduce the dependency tree. There are no user-facing changes to either package. --- .iyarc | 4 +--- package.json | 8 +++---- yarn.lock | 63 +++++++++++++++++----------------------------------- 3 files changed, 25 insertions(+), 50 deletions(-) diff --git a/.iyarc b/.iyarc index 0bb3e981ffae..cea1e59ebc4a 100644 --- a/.iyarc +++ b/.iyarc @@ -3,6 +3,4 @@ GHSA-257v-vj4p-3w2h # request library is subject to SSRF. # addressed by temporary patch in .yarn/patches/request-npm-2.88.2-f4a57c72c4.patch -# NOTE: Disabled for now since this library seems to have been removed from the -# dependency tree — we can re-enable this line later if it appears again -#GHSA-p8p7-x288-28g6 +GHSA-p8p7-x288-28g6 diff --git a/package.json b/package.json index fee7bf4ed237..c067fb97d396 100644 --- a/package.json +++ b/package.json @@ -230,8 +230,8 @@ "@metamask/base-controller": "^3.1.0", "@metamask/browser-passworder": "^4.1.0", "@metamask/contract-metadata": "^2.3.1", - "@metamask/controller-utils": "^4.0.1", - "@metamask/design-tokens": "^1.9.0", + "@metamask/controller-utils": "^4.1.0", + "@metamask/design-tokens": "^1.12.0", "@metamask/desktop": "^0.3.0", "@metamask/eth-json-rpc-middleware": "^11.0.0", "@metamask/eth-keyring-controller": "^10.0.1", @@ -240,13 +240,13 @@ "@metamask/eth-token-tracker": "^4.0.0", "@metamask/eth-trezor-keyring": "^1.0.0", "@metamask/etherscan-link": "^2.2.0", - "@metamask/gas-fee-controller": "^6.0.0", + "@metamask/gas-fee-controller": "^6.0.1", "@metamask/jazzicon": "^2.0.0", "@metamask/key-tree": "^7.0.0", "@metamask/logo": "^3.1.1", "@metamask/message-manager": "^7.0.2", "@metamask/metamask-eth-abis": "^3.0.0", - "@metamask/network-controller": "^10.1.0", + "@metamask/network-controller": "^10.3.0", "@metamask/notification-controller": "^3.0.0", "@metamask/obs-store": "^8.1.0", "@metamask/permission-controller": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index c88669224d02..64cb5026dfb4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4024,10 +4024,10 @@ __metadata: languageName: node linkType: hard -"@metamask/design-tokens@npm:^1.6.0, @metamask/design-tokens@npm:^1.9.0": - version: 1.11.1 - resolution: "@metamask/design-tokens@npm:1.11.1" - checksum: 38677f66167861826c35f7b0e6efc3c69269178e3dad5de41a9c9a7925dfb1f560f673e02a51acd7f7983762546130132f83dcaefe8ab47e16301775cff0b968 +"@metamask/design-tokens@npm:^1.12.0, @metamask/design-tokens@npm:^1.6.0": + version: 1.12.0 + resolution: "@metamask/design-tokens@npm:1.12.0" + checksum: 9b6c5485c846171aa7fcef03cbe93b4d94ffaa76faf953aa27a689fd3d494438cd657de6ea1aa5a40cc2af15dcf10f8dd860fd3d90f5e9806807e37020bdccd9 languageName: node linkType: hard @@ -4285,13 +4285,13 @@ __metadata: languageName: node linkType: hard -"@metamask/gas-fee-controller@npm:^6.0.0": - version: 6.0.0 - resolution: "@metamask/gas-fee-controller@npm:6.0.0" +"@metamask/gas-fee-controller@npm:^6.0.1": + version: 6.0.1 + resolution: "@metamask/gas-fee-controller@npm:6.0.1" dependencies: "@metamask/base-controller": ^3.0.0 - "@metamask/controller-utils": ^4.0.0 - "@metamask/network-controller": ^9.0.0 + "@metamask/controller-utils": ^4.1.0 + "@metamask/network-controller": ^10.3.0 "@metamask/utils": ^5.0.2 "@types/uuid": ^8.3.0 babel-runtime: ^6.26.0 @@ -4301,8 +4301,8 @@ __metadata: immer: ^9.0.6 uuid: ^8.3.2 peerDependencies: - "@metamask/network-controller": ^9.0.0 - checksum: e7f15b0d3043e228f85cfa462c800d7332845b8d13211b1688c68a3b4b09b921aaa9b3304688dd0b7e4d9abd59f96dab0f50259a90f35c4b50321e2805c65bfb + "@metamask/network-controller": ^10.3.0 + checksum: 4a9243ee6aad355b4f2ef1a1065f1444f823721a02af2e8a8f35683f60f020a280f33be15bce95b24c4aff698408aaa263070bec020019b8bef561d55bdc949c languageName: node linkType: hard @@ -4378,12 +4378,12 @@ __metadata: languageName: node linkType: hard -"@metamask/network-controller@npm:^10.1.0, @metamask/network-controller@npm:^10.2.0": - version: 10.2.0 - resolution: "@metamask/network-controller@npm:10.2.0" +"@metamask/network-controller@npm:^10.2.0, @metamask/network-controller@npm:^10.3.0": + version: 10.3.0 + resolution: "@metamask/network-controller@npm:10.3.0" dependencies: "@metamask/base-controller": ^3.0.0 - "@metamask/controller-utils": ^4.0.1 + "@metamask/controller-utils": ^4.1.0 "@metamask/eth-json-rpc-infura": ^8.0.0 "@metamask/eth-json-rpc-middleware": ^11.0.0 "@metamask/eth-json-rpc-provider": ^1.0.0 @@ -4397,7 +4397,7 @@ __metadata: immer: ^9.0.6 json-rpc-engine: ^6.1.0 uuid: ^8.3.2 - checksum: 6474125845d838564ef60105b5914369aa650a6769df5f3f2a471839f351d798984faa5e3184054a5bfb4ec738e2a50c6fbf31f9eceb9cea4c227651105295dc + checksum: 0c48625af9c18be3ed2a433209db770bab02e667e251be1ef4c1f61a62c25907536ff740712bdfd799ac923a4a6bb9df5430ead8d4215507bbf30dcc7a40d53c languageName: node linkType: hard @@ -4417,29 +4417,6 @@ __metadata: languageName: node linkType: hard -"@metamask/network-controller@npm:^9.0.0": - version: 9.0.0 - resolution: "@metamask/network-controller@npm:9.0.0" - dependencies: - "@metamask/base-controller": ^3.0.0 - "@metamask/controller-utils": ^4.0.0 - "@metamask/eth-json-rpc-infura": ^8.0.0 - "@metamask/eth-json-rpc-middleware": ^11.0.0 - "@metamask/eth-json-rpc-provider": ^1.0.0 - "@metamask/swappable-obj-proxy": ^2.1.0 - "@metamask/utils": ^5.0.2 - async-mutex: ^0.2.6 - babel-runtime: ^6.26.0 - eth-block-tracker: ^7.0.1 - eth-query: ^2.1.2 - eth-rpc-errors: ^4.0.2 - immer: ^9.0.6 - json-rpc-engine: ^6.1.0 - uuid: ^8.3.2 - checksum: 7548fe82990ff62d36a6c42a49442422fe3634933b6fc85b86a3bbb2788a755c73f3fa70a70ae48ddf09a70e3e33d375723980aec76e89cdf21b76b96a069b07 - languageName: node - linkType: hard - "@metamask/notification-controller@npm:^3.0.0": version: 3.0.0 resolution: "@metamask/notification-controller@npm:3.0.0" @@ -24507,8 +24484,8 @@ __metadata: "@metamask/base-controller": ^3.1.0 "@metamask/browser-passworder": ^4.1.0 "@metamask/contract-metadata": ^2.3.1 - "@metamask/controller-utils": ^4.0.1 - "@metamask/design-tokens": ^1.9.0 + "@metamask/controller-utils": ^4.1.0 + "@metamask/design-tokens": ^1.12.0 "@metamask/desktop": ^0.3.0 "@metamask/eslint-config": ^9.0.0 "@metamask/eslint-config-jest": ^9.0.0 @@ -24523,13 +24500,13 @@ __metadata: "@metamask/eth-trezor-keyring": ^1.0.0 "@metamask/etherscan-link": ^2.2.0 "@metamask/forwarder": ^1.1.0 - "@metamask/gas-fee-controller": ^6.0.0 + "@metamask/gas-fee-controller": ^6.0.1 "@metamask/jazzicon": ^2.0.0 "@metamask/key-tree": ^7.0.0 "@metamask/logo": ^3.1.1 "@metamask/message-manager": ^7.0.2 "@metamask/metamask-eth-abis": ^3.0.0 - "@metamask/network-controller": ^10.1.0 + "@metamask/network-controller": ^10.3.0 "@metamask/notification-controller": ^3.0.0 "@metamask/obs-store": ^8.1.0 "@metamask/permission-controller": ^4.0.0 From ccc4cf1bb97e7ae7f3f9b0ba50b7d3feac5846d9 Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 10 Jul 2023 12:56:34 -0230 Subject: [PATCH 12/56] Resolve two new security advisories (#19940) Two new security advisories have been resolved. These advisories are causing CI to fail on `develop`. Neither presents any risk to us, as they are prototype pollution issues that are prevented by lockdown. The first advisory isn't easy for us to patch. It's caused by an outdated version of `protobufjs` used by `@trezor/transport`. It has been ignored for now, until Trezor updates that package. For the second advisory (related to `tough-cookie`), it was resolved by updating that dependency in our lockfile. --- .iyarc | 5 +++++ yarn.lock | 42 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/.iyarc b/.iyarc index cea1e59ebc4a..9e16de044ef3 100644 --- a/.iyarc +++ b/.iyarc @@ -4,3 +4,8 @@ GHSA-257v-vj4p-3w2h # request library is subject to SSRF. # addressed by temporary patch in .yarn/patches/request-npm-2.88.2-f4a57c72c4.patch GHSA-p8p7-x288-28g6 + +# Prototype pollution +# Not easily patched +# Minimal risk to us because we're using lockdown which also prevents this case of prototype pollution +GHSA-h755-8qp9-cq85 diff --git a/yarn.lock b/yarn.lock index 64cb5026dfb4..bccbec8fec60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28818,6 +28818,13 @@ __metadata: languageName: node linkType: hard +"querystringify@npm:^2.1.1": + version: 2.2.0 + resolution: "querystringify@npm:2.2.0" + checksum: 5641ea231bad7ef6d64d9998faca95611ed4b11c2591a8cae741e178a974f6a8e0ebde008475259abe1621cb15e692404e6b6626e927f7b849d5c09392604b15 + languageName: node + linkType: hard + "queue-microtask@npm:^1.2.3": version: 1.2.3 resolution: "queue-microtask@npm:1.2.3" @@ -30320,6 +30327,13 @@ __metadata: languageName: node linkType: hard +"requires-port@npm:^1.0.0": + version: 1.0.0 + resolution: "requires-port@npm:1.0.0" + checksum: eee0e303adffb69be55d1a214e415cf42b7441ae858c76dfc5353148644f6fd6e698926fc4643f510d5c126d12a705e7c8ed7e38061113bdf37547ab356797ff + languageName: node + linkType: hard + "reselect@npm:^3.0.1": version: 3.0.1 resolution: "reselect@npm:3.0.1" @@ -33418,13 +33432,14 @@ __metadata: linkType: hard "tough-cookie@npm:>=2.3.3, tough-cookie@npm:^4.0.0": - version: 4.0.0 - resolution: "tough-cookie@npm:4.0.0" + version: 4.1.3 + resolution: "tough-cookie@npm:4.1.3" dependencies: psl: ^1.1.33 punycode: ^2.1.1 - universalify: ^0.1.2 - checksum: 0891b37eb7d17faa3479d47f0dce2e3007f2583094ad272f2670d120fbcc3df3b0b0a631ba96ecad49f9e2297d93ff8995ce0d3292d08dd7eabe162f5b224d69 + universalify: ^0.2.0 + url-parse: ^1.5.3 + checksum: c9226afff36492a52118432611af083d1d8493a53ff41ec4ea48e5b583aec744b989e4280bcf476c910ec1525a89a4a0f1cae81c08b18fb2ec3a9b3a72b91dcc languageName: node linkType: hard @@ -34316,13 +34331,20 @@ __metadata: languageName: node linkType: hard -"universalify@npm:^0.1.0, universalify@npm:^0.1.2": +"universalify@npm:^0.1.0": version: 0.1.2 resolution: "universalify@npm:0.1.2" checksum: 40cdc60f6e61070fe658ca36016a8f4ec216b29bf04a55dce14e3710cc84c7448538ef4dad3728d0bfe29975ccd7bfb5f414c45e7b78883567fb31b246f02dff languageName: node linkType: hard +"universalify@npm:^0.2.0": + version: 0.2.0 + resolution: "universalify@npm:0.2.0" + checksum: e86134cb12919d177c2353196a4cc09981524ee87abf621f7bc8d249dbbbebaec5e7d1314b96061497981350df786e4c5128dbf442eba104d6e765bc260678b5 + languageName: node + linkType: hard + "universalify@npm:^2.0.0": version: 2.0.0 resolution: "universalify@npm:2.0.0" @@ -34478,6 +34500,16 @@ __metadata: languageName: node linkType: hard +"url-parse@npm:^1.5.3": + version: 1.5.10 + resolution: "url-parse@npm:1.5.10" + dependencies: + querystringify: ^2.1.1 + requires-port: ^1.0.0 + checksum: fbdba6b1d83336aca2216bbdc38ba658d9cfb8fc7f665eb8b17852de638ff7d1a162c198a8e4ed66001ddbf6c9888d41e4798912c62b4fd777a31657989f7bdf + languageName: node + linkType: hard + "url@npm:~0.11.0": version: 0.11.0 resolution: "url@npm:0.11.0" From 65946c47c434fd9493b0f9e29a83198ffab70ed5 Mon Sep 17 00:00:00 2001 From: Elliot Winkler Date: Thu, 13 Jul 2023 16:57:31 -0600 Subject: [PATCH 13/56] Restore support for Linea networks (#20011) When the NetworkController in this repo was replaced with `@metamask/network-controller`, support for Linea networks was lost as it did not support it at that time. `@metamask/network-controller` has since been updated, so this commit bumps that package to restore support. --- .iyarc | 4 ++ lavamoat/browserify/beta/policy.json | 22 +------- lavamoat/browserify/desktop/policy.json | 22 +------- lavamoat/browserify/flask/policy.json | 22 +------- lavamoat/browserify/main/policy.json | 22 +------- lavamoat/browserify/mmi/policy.json | 22 +------- package.json | 4 +- yarn.lock | 71 +++++++++++-------------- 8 files changed, 43 insertions(+), 146 deletions(-) diff --git a/.iyarc b/.iyarc index 9e16de044ef3..2b0adcf36b12 100644 --- a/.iyarc +++ b/.iyarc @@ -9,3 +9,7 @@ GHSA-p8p7-x288-28g6 # Not easily patched # Minimal risk to us because we're using lockdown which also prevents this case of prototype pollution GHSA-h755-8qp9-cq85 + +# tough-cookie +# this will go away soon when we get rid of web3-provider-engine +GHSA-72xf-g2v4-qvf3 diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 4990fb1b99fc..8231a9ec8987 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -1621,7 +1621,7 @@ }, "packages": { "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "eth-rpc-errors": true, "json-rpc-engine": true, "node-fetch": true @@ -1639,26 +1639,6 @@ "superstruct": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": { - "globals": { - "URL": true, - "btoa": true, - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware>pify": true, - "@metamask/safe-event-emitter": true, - "browserify>browser-resolve": true, - "eth-rpc-errors": true, - "json-rpc-engine": true, - "lavamoat>json-stable-stringify": true, - "vinyl>clone": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/safe-event-emitter": true, diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index 6cd8068ff101..7428fea81baf 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -1747,7 +1747,7 @@ }, "packages": { "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "eth-rpc-errors": true, "json-rpc-engine": true, "node-fetch": true @@ -1765,26 +1765,6 @@ "superstruct": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": { - "globals": { - "URL": true, - "btoa": true, - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware>pify": true, - "@metamask/safe-event-emitter": true, - "browserify>browser-resolve": true, - "eth-rpc-errors": true, - "json-rpc-engine": true, - "lavamoat>json-stable-stringify": true, - "vinyl>clone": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/safe-event-emitter": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 6cd8068ff101..7428fea81baf 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -1747,7 +1747,7 @@ }, "packages": { "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "eth-rpc-errors": true, "json-rpc-engine": true, "node-fetch": true @@ -1765,26 +1765,6 @@ "superstruct": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": { - "globals": { - "URL": true, - "btoa": true, - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware>pify": true, - "@metamask/safe-event-emitter": true, - "browserify>browser-resolve": true, - "eth-rpc-errors": true, - "json-rpc-engine": true, - "lavamoat>json-stable-stringify": true, - "vinyl>clone": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/safe-event-emitter": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 4990fb1b99fc..8231a9ec8987 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -1621,7 +1621,7 @@ }, "packages": { "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "eth-rpc-errors": true, "json-rpc-engine": true, "node-fetch": true @@ -1639,26 +1639,6 @@ "superstruct": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": { - "globals": { - "URL": true, - "btoa": true, - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware>pify": true, - "@metamask/safe-event-emitter": true, - "browserify>browser-resolve": true, - "eth-rpc-errors": true, - "json-rpc-engine": true, - "lavamoat>json-stable-stringify": true, - "vinyl>clone": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/safe-event-emitter": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 79411ecd1dd8..9dabc001b835 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1842,7 +1842,7 @@ }, "packages": { "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": true, + "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "eth-rpc-errors": true, "json-rpc-engine": true, "node-fetch": true @@ -1860,26 +1860,6 @@ "superstruct": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware": { - "globals": { - "URL": true, - "btoa": true, - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-snap-keyring>@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>@metamask/utils": true, - "@metamask/network-controller>@metamask/eth-json-rpc-infura>eth-json-rpc-middleware>pify": true, - "@metamask/safe-event-emitter": true, - "browserify>browser-resolve": true, - "eth-rpc-errors": true, - "json-rpc-engine": true, - "lavamoat>json-stable-stringify": true, - "vinyl>clone": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/safe-event-emitter": true, diff --git a/package.json b/package.json index c067fb97d396..a830bca0c843 100644 --- a/package.json +++ b/package.json @@ -230,7 +230,7 @@ "@metamask/base-controller": "^3.1.0", "@metamask/browser-passworder": "^4.1.0", "@metamask/contract-metadata": "^2.3.1", - "@metamask/controller-utils": "^4.1.0", + "@metamask/controller-utils": "^4.2.0", "@metamask/design-tokens": "^1.12.0", "@metamask/desktop": "^0.3.0", "@metamask/eth-json-rpc-middleware": "^11.0.0", @@ -246,7 +246,7 @@ "@metamask/logo": "^3.1.1", "@metamask/message-manager": "^7.0.2", "@metamask/metamask-eth-abis": "^3.0.0", - "@metamask/network-controller": "^10.3.0", + "@metamask/network-controller": "^10.3.1", "@metamask/notification-controller": "^3.0.0", "@metamask/obs-store": "^8.1.0", "@metamask/permission-controller": "^4.0.0", diff --git a/yarn.lock b/yarn.lock index bccbec8fec60..a47b620aa744 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4007,9 +4007,9 @@ __metadata: languageName: node linkType: hard -"@metamask/controller-utils@npm:^4.0.0, @metamask/controller-utils@npm:^4.0.1, @metamask/controller-utils@npm:^4.1.0": - version: 4.1.0 - resolution: "@metamask/controller-utils@npm:4.1.0" +"@metamask/controller-utils@npm:^4.0.0, @metamask/controller-utils@npm:^4.0.1, @metamask/controller-utils@npm:^4.1.0, @metamask/controller-utils@npm:^4.2.0": + version: 4.2.0 + resolution: "@metamask/controller-utils@npm:4.2.0" dependencies: "@metamask/utils": ^5.0.2 "@spruceid/siwe-parser": 1.1.3 @@ -4020,7 +4020,7 @@ __metadata: ethereumjs-util: ^7.0.10 ethjs-unit: ^0.1.6 fast-deep-equal: ^3.1.3 - checksum: b4975e6ca860b691931254aa749e8c4faddd04279609cf197155b38150e55da0e966bf9b2d61ee1cd070f79d16e0305d5a0ff1747e0b4ab2e1c3ab46ca84e4d7 + checksum: e71779577c37038e6e605a43ef6b9c1af82e0b3887a72c01f48ae1e4e2005116fc9d09c8b690139478c04dd2929e227642c5fd80cfbc81814d667c415c714228 languageName: node linkType: hard @@ -4121,16 +4121,16 @@ __metadata: languageName: node linkType: hard -"@metamask/eth-json-rpc-infura@npm:^8.0.0": - version: 8.1.0 - resolution: "@metamask/eth-json-rpc-infura@npm:8.1.0" +"@metamask/eth-json-rpc-infura@npm:^8.1.0": + version: 8.1.1 + resolution: "@metamask/eth-json-rpc-infura@npm:8.1.1" dependencies: - "@metamask/utils": ^3.0.1 - eth-json-rpc-middleware: ^9.0.0 + "@metamask/eth-json-rpc-provider": ^1.0.0 + "@metamask/utils": ^4.0.0 eth-rpc-errors: ^4.0.3 json-rpc-engine: ^6.1.0 node-fetch: ^2.6.7 - checksum: fd09383e2b3c16187b8889b53bfc431fc7ea4f6483acc23ddf77f2fd771ad0fbff41d6a62d4b05833e7cda66adafe0cb3730d7c0e9575b89683b71a82ab1ee1f + checksum: ab4ce53fcc1586344824d58aed4d71412b015466f697758b4849e186038ae1730c9765935dfaf1a9131ff1a8f0f36dcb66fd50355ed95ac7a4bf0bc18c4c2696 languageName: node linkType: hard @@ -4378,13 +4378,13 @@ __metadata: languageName: node linkType: hard -"@metamask/network-controller@npm:^10.2.0, @metamask/network-controller@npm:^10.3.0": - version: 10.3.0 - resolution: "@metamask/network-controller@npm:10.3.0" +"@metamask/network-controller@npm:^10.2.0, @metamask/network-controller@npm:^10.3.0, @metamask/network-controller@npm:^10.3.1": + version: 10.3.1 + resolution: "@metamask/network-controller@npm:10.3.1" dependencies: - "@metamask/base-controller": ^3.0.0 - "@metamask/controller-utils": ^4.1.0 - "@metamask/eth-json-rpc-infura": ^8.0.0 + "@metamask/base-controller": ^3.1.0 + "@metamask/controller-utils": ^4.2.0 + "@metamask/eth-json-rpc-infura": ^8.1.0 "@metamask/eth-json-rpc-middleware": ^11.0.0 "@metamask/eth-json-rpc-provider": ^1.0.0 "@metamask/swappable-obj-proxy": ^2.1.0 @@ -4397,7 +4397,7 @@ __metadata: immer: ^9.0.6 json-rpc-engine: ^6.1.0 uuid: ^8.3.2 - checksum: 0c48625af9c18be3ed2a433209db770bab02e667e251be1ef4c1f61a62c25907536ff740712bdfd799ac923a4a6bb9df5430ead8d4215507bbf30dcc7a40d53c + checksum: 62adb90b02eae1236f9c1c3ceb70c9de0f4e390c3b68ced0c81b0b867dced7814d5d805cdfb6e0ccc9e62b82fac762f70c204f08feb3f3ee5647610d079cbdd7 languageName: node linkType: hard @@ -4968,7 +4968,7 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^3.0.1, @metamask/utils@npm:^3.0.3, @metamask/utils@npm:^3.4.1": +"@metamask/utils@npm:^3.0.3, @metamask/utils@npm:^3.4.1": version: 3.6.0 resolution: "@metamask/utils@npm:3.6.0" dependencies: @@ -4980,6 +4980,18 @@ __metadata: languageName: node linkType: hard +"@metamask/utils@npm:^4.0.0": + version: 4.0.0 + resolution: "@metamask/utils@npm:4.0.0" + dependencies: + "@types/debug": ^4.1.7 + debug: ^4.3.4 + semver: ^7.3.8 + superstruct: ^1.0.3 + checksum: 6d4edca78fe1f66504ed5e5ca021a67f4b4e0893e86484c746b87039c2161c39d3b8bd8e4b9235ddfd023b2d76dd54210af94ec5550e27bc4ad9c0d7d5f3f231 + languageName: node + linkType: hard + "@metamask/utils@npm:^5.0.0, @metamask/utils@npm:^5.0.1, @metamask/utils@npm:^5.0.2": version: 5.0.2 resolution: "@metamask/utils@npm:5.0.2" @@ -15997,25 +16009,6 @@ __metadata: languageName: node linkType: hard -"eth-json-rpc-middleware@npm:^9.0.0": - version: 9.0.1 - resolution: "eth-json-rpc-middleware@npm:9.0.1" - dependencies: - "@metamask/eth-sig-util": ^5.0.0 - "@metamask/safe-event-emitter": ^2.0.0 - "@metamask/utils": ^3.0.3 - btoa: ^1.2.1 - clone: ^2.1.1 - eth-block-tracker: ^5.0.1 - eth-rpc-errors: ^4.0.3 - json-rpc-engine: ^6.1.0 - json-stable-stringify: ^1.0.1 - node-fetch: ^2.6.7 - pify: ^3.0.0 - checksum: 9512829a6958df6ef739b891a0c0804b51a140407fd2e3ddaaa6b18d975796646cfcf7f7305a18beb7903db09e0c7a91b06dc5434b6bd2d6cdb85d992d9fd3ab - languageName: node - linkType: hard - "eth-lattice-keyring@npm:^0.12.4": version: 0.12.4 resolution: "eth-lattice-keyring@npm:0.12.4" @@ -24484,7 +24477,7 @@ __metadata: "@metamask/base-controller": ^3.1.0 "@metamask/browser-passworder": ^4.1.0 "@metamask/contract-metadata": ^2.3.1 - "@metamask/controller-utils": ^4.1.0 + "@metamask/controller-utils": ^4.2.0 "@metamask/design-tokens": ^1.12.0 "@metamask/desktop": ^0.3.0 "@metamask/eslint-config": ^9.0.0 @@ -24506,7 +24499,7 @@ __metadata: "@metamask/logo": ^3.1.1 "@metamask/message-manager": ^7.0.2 "@metamask/metamask-eth-abis": ^3.0.0 - "@metamask/network-controller": ^10.3.0 + "@metamask/network-controller": ^10.3.1 "@metamask/notification-controller": ^3.0.0 "@metamask/obs-store": ^8.1.0 "@metamask/permission-controller": ^4.0.0 From c25d47952ee01536021738b862bbfe5238fea84b Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Fri, 14 Jul 2023 09:35:05 -0230 Subject: [PATCH 14/56] Remove failing audit exclusion for GHSA-h755-8qp9-cq85 --- .iyarc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.iyarc b/.iyarc index 2b0adcf36b12..9e16de044ef3 100644 --- a/.iyarc +++ b/.iyarc @@ -9,7 +9,3 @@ GHSA-p8p7-x288-28g6 # Not easily patched # Minimal risk to us because we're using lockdown which also prevents this case of prototype pollution GHSA-h755-8qp9-cq85 - -# tough-cookie -# this will go away soon when we get rid of web3-provider-engine -GHSA-72xf-g2v4-qvf3 From 19d5cdb014e948adc117bee6714ecb65a49c8617 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Tue, 18 Jul 2023 08:31:02 -0500 Subject: [PATCH 15/56] UX: Remove unwanted async callback (#20065) --- ui/components/multichain/network-list-menu/network-list-menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/components/multichain/network-list-menu/network-list-menu.js b/ui/components/multichain/network-list-menu/network-list-menu.js index dd9278bc1238..ab3ad899c6d6 100644 --- a/ui/components/multichain/network-list-menu/network-list-menu.js +++ b/ui/components/multichain/network-list-menu/network-list-menu.js @@ -95,7 +95,7 @@ export const NetworkListMenu = ({ onClose }) => { iconSrc={network?.rpcPrefs?.imageUrl} key={`${network.id || network.chainId}-${index}`} selected={isCurrentNetwork} - onClick={async () => { + onClick={() => { dispatch(toggleNetworkMenu()); if (network.providerType) { dispatch(setProviderType(network.providerType)); From e105a6030efc7d541cd2f3b3f6ca6087ff0b8d2c Mon Sep 17 00:00:00 2001 From: Nidhi Kumari Date: Tue, 18 Jul 2023 19:02:00 +0530 Subject: [PATCH 16/56] added background color of testnet to activity screen (#20068) --- .../transaction-list-item/transaction-list-item.component.js | 3 +++ 1 file changed, 3 insertions(+) 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 a8b6045fd838..ec8f1ed1a220 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 @@ -51,6 +51,7 @@ import { import { checkNetworkAndAccountSupports1559, getCurrentNetwork, + getTestNetworkBackgroundColor, } from '../../../selectors'; import { isLegacyTransaction } from '../../../helpers/utils/transactions.util'; import { formatDateWithYearContext } from '../../../helpers/utils/util'; @@ -77,6 +78,7 @@ function TransactionListItemInner({ const [showRetryEditGasPopover, setShowRetryEditGasPopover] = useState(false); const { supportsEIP1559 } = useGasFeeContext(); const { openModal } = useTransactionModalContext(); + const testNetworkBackgroundColor = useSelector(getTestNetworkBackgroundColor); const { initialTransaction: { id }, @@ -276,6 +278,7 @@ function TransactionListItemInner({ src={currentChain?.rpcPrefs?.imageUrl} borderWidth={1} borderColor={BackgroundColor.backgroundDefault} + backgroundColor={testNetworkBackgroundColor} /> } > From f8bfb6cff5fd92d30cfadc85c6b42ba4627c0014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Regadas?= Date: Tue, 18 Jul 2023 14:55:37 +0100 Subject: [PATCH 17/56] [MMI] adds segment events to Metametrics constants (#19468) * adds metametrics enums * prettier * adds necessary code fence * edits events names and title cases them * edits events names * updates events according to segment-schema --- shared/constants/metametrics.ts | 17 +++++++++---- .../signature-request.component.js | 11 ++++++--- .../app/wallet-overview/eth-overview.js | 8 +++---- .../custody-confirm-link-modal.js | 2 +- .../interactive-replacement-token-modal.js | 8 +++++-- .../account-list-menu/account-list-menu.js | 2 +- .../multichain/global-menu/global-menu.js | 2 +- .../confirm-add-custodian-token.js | 16 ++++++++----- .../confirm-add-institutional-feature.js | 8 +++++-- ui/pages/institutional/custody/custody.js | 24 +++++++++++-------- 10 files changed, 64 insertions(+), 34 deletions(-) diff --git a/shared/constants/metametrics.ts b/shared/constants/metametrics.ts index 453ba97ea0c7..f69a091691b5 100644 --- a/shared/constants/metametrics.ts +++ b/shared/constants/metametrics.ts @@ -583,10 +583,19 @@ export enum MetaMetricsEventName { WalletSetupFailed = 'Wallet Setup Failed', WalletCreated = 'Wallet Created', ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) - UserClickedDeepLink = 'User Clicked Deeplink', - UserClickedConnectCustodialAccount = 'Clicked Connect Custodial Account', - UserClickedPortfolioButton = 'Clicked Portfolio Button', - UserClickedCompliance = 'Clicked Compliance', + DeeplinkClicked = 'Deeplink Clicked', + ConnectCustodialAccountClicked = 'Connect Custodial Account Clicked', + MMIPortfolioButtonClicked = 'MMI Portfolio Button Clicked', + StakeButtonClicked = 'Stake Button Clicked', + ComplianceButtonClicked = 'Compliance Button Clicked', + RefreshTokenListClicked = 'Refresh Token List Clicked', + SignatureDeeplinkDisplayed = 'Signature Deeplink Displayed', + InstitutionalFeatureConnected = 'Institutional Feature Connected', + CustodianSelected = 'Custodian Selected', + CustodianConnected = 'Custodian Connected', + CustodianConnectionCanceled = 'Custodian Connection Canceled', + CustodianConnectionFailed = 'Custodian Connection Failed', + CustodialAccountsConnected = 'Custodial Accounts Connected', ///: END:ONLY_INCLUDE_IN AccountDetailMenuOpened = 'Account Details Menu Opened', BlockExplorerLinkClicked = 'Block Explorer Clicked', diff --git a/ui/components/app/signature-request/signature-request.component.js b/ui/components/app/signature-request/signature-request.component.js index 601d73e3507c..f5eda00e9c00 100644 --- a/ui/components/app/signature-request/signature-request.component.js +++ b/ui/components/app/signature-request/signature-request.component.js @@ -11,7 +11,12 @@ import { shortenAddress, ///: END:ONLY_INCLUDE_IN } from '../../../helpers/utils/util'; -import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics'; +import { + MetaMetricsEventCategory, + ///: BEGIN:ONLY_INCLUDE_IN(build-mmi) + MetaMetricsEventName, + ///: END:ONLY_INCLUDE_IN +} from '../../../../shared/constants/metametrics'; import SiteOrigin from '../../ui/site-origin'; import Button from '../../ui/button'; import ContractDetailsModal from '../modals/contract-details-modal/contract-details-modal'; @@ -121,8 +126,8 @@ export default class SignatureRequest extends PureComponent { onDeepLinkFetched: () => undefined, onDeepLinkShown: () => { this.context.trackEvent({ - category: 'MMI', - event: 'Show deeplink for signature', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.SignatureDeeplinkDisplayed, }); }, }); diff --git a/ui/components/app/wallet-overview/eth-overview.js b/ui/components/app/wallet-overview/eth-overview.js index 4cafa05149d2..30133118227b 100644 --- a/ui/components/app/wallet-overview/eth-overview.js +++ b/ui/components/app/wallet-overview/eth-overview.js @@ -73,15 +73,15 @@ const EthOverview = ({ className, showAddress }) => { const portfolioEvent = () => { trackEvent({ - category: 'Navigation', - event: 'Clicked Portfolio Button', + category: MetaMetricsEventCategory.Navigation, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); }; const stakingEvent = () => { trackEvent({ - category: 'Navigation', - event: 'Clicked Stake Button', + category: MetaMetricsEventCategory.Navigation, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); }; diff --git a/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js b/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js index e7d0c4d5bc90..f4c15c41266e 100644 --- a/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js +++ b/ui/components/institutional/custody-confirm-link-modal/custody-confirm-link-modal.js @@ -70,7 +70,7 @@ const CustodyConfirmLink = ({ hideModal }) => { trackEvent({ category: MetaMetricsEventCategory.MMI, - event: MetaMetricsEventName.UserClickedDeepLink, + event: MetaMetricsEventName.DeeplinkClicked, }); dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(false)); dispatch(hideModal()); diff --git a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js index 232f4817f5f8..eae1529f2add 100644 --- a/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js +++ b/ui/components/institutional/interactive-replacement-token-modal/interactive-replacement-token-modal.js @@ -26,6 +26,10 @@ import { TextAlign, AlignItems, } from '../../../helpers/constants/design-system'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; const InteractiveReplacementTokenModal = () => { const t = useI18nContext(); @@ -55,8 +59,8 @@ const InteractiveReplacementTokenModal = () => { }); trackEvent({ - category: 'MMI', - event: 'User clicked refresh token link', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.ComplianceButtonClicked, }); }; diff --git a/ui/components/multichain/account-list-menu/account-list-menu.js b/ui/components/multichain/account-list-menu/account-list-menu.js index 80c1b91f4927..6f3935e4dfe8 100644 --- a/ui/components/multichain/account-list-menu/account-list-menu.js +++ b/ui/components/multichain/account-list-menu/account-list-menu.js @@ -298,7 +298,7 @@ export const AccountListMenu = ({ onClose }) => { trackEvent({ category: MetaMetricsEventCategory.Navigation, event: - MetaMetricsEventName.UserClickedConnectCustodialAccount, + MetaMetricsEventName.ConnectCustodialAccountClicked, }); if (getEnvironmentType() === ENVIRONMENT_TYPE_POPUP) { global.platform.openExtensionInBrowser( diff --git a/ui/components/multichain/global-menu/global-menu.js b/ui/components/multichain/global-menu/global-menu.js index 350f159471cd..1de3222acc1b 100644 --- a/ui/components/multichain/global-menu/global-menu.js +++ b/ui/components/multichain/global-menu/global-menu.js @@ -113,7 +113,7 @@ export const GlobalMenu = ({ closeMenu, anchorElement }) => { onClick={() => { trackEvent({ category: MetaMetricsEventCategory.Navigation, - event: MetaMetricsEventName.UserClickedPortfolioButton, + event: MetaMetricsEventName.MMIPortfolioButtonClicked, }); window.open(mmiPortfolioUrl, '_blank'); closeMenu(); diff --git a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js index 4f0257e77bdc..f49144ac4cdb 100644 --- a/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js +++ b/ui/pages/institutional/confirm-add-custodian-token/confirm-add-custodian-token.js @@ -26,6 +26,10 @@ import { Box, } from '../../../components/component-library'; import { Text } from '../../../components/component-library/text/deprecated'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; import { complianceActivated, getInstitutionalConnectRequests, @@ -59,8 +63,8 @@ const ConfirmAddCustodianToken = () => { } trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC request', custodian: connectRequest.custodian, @@ -184,8 +188,8 @@ const ConfirmAddCustodianToken = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC cancel', custodian: connectRequest.custodian, @@ -238,8 +242,8 @@ const ConfirmAddCustodianToken = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodian onboarding', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.TokenAdded, properties: { actions: 'Custodian RPC confirm', custodian: connectRequest.custodian, diff --git a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js index 627f7acb3275..bc528a094fca 100644 --- a/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js +++ b/ui/pages/institutional/confirm-add-institutional-feature/confirm-add-institutional-feature.js @@ -21,6 +21,10 @@ import { } from '../../../helpers/constants/design-system'; import Box from '../../../components/ui/box'; import { mmiActionsFactory } from '../../../store/institutional/institution-background'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; export default function ConfirmAddInstitutionalFeature({ history }) { const t = useI18nContext(); @@ -52,8 +56,8 @@ export default function ConfirmAddInstitutionalFeature({ history }) { const sendEvent = ({ actions, service }) => { trackEvent({ - category: 'MMI', - event: 'Institutional feature connection', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.InstitutionalFeatureConnected, properties: { actions, service, diff --git a/ui/pages/institutional/custody/custody.js b/ui/pages/institutional/custody/custody.js index d9825ead94ef..f5e5734542e1 100644 --- a/ui/pages/institutional/custody/custody.js +++ b/ui/pages/institutional/custody/custody.js @@ -44,6 +44,10 @@ import { getCurrentChainId, getSelectedAddress } from '../../../selectors'; import { getMMIConfiguration } from '../../../selectors/institutional/selectors'; import CustodyAccountList from '../connect-custody/account-list'; import JwtUrlForm from '../../../components/institutional/jwt-url-form'; +import { + MetaMetricsEventCategory, + MetaMetricsEventName, +} from '../../../../shared/constants/metametrics'; import PulseLoader from '../../../components/ui/pulse-loader/pulse-loader'; const CustodyPage = () => { @@ -141,8 +145,8 @@ const CustodyPage = () => { setCurrentJwt(jwtListValue[0] || ''); setJwtList(jwtListValue); trackEvent({ - category: 'MMI', - event: 'Custodian Selected', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianSelected, properties: { custodian: custodian.name, }, @@ -192,8 +196,8 @@ const CustodyPage = () => { `Something went wrong connecting your custodian account. Error details: ${errorMessage}`, ); trackEvent({ - category: 'MMI', - event: 'Connect to custodian error', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnectionFailed, properties: { custodian: selectedCustodianName, }, @@ -225,8 +229,8 @@ const CustodyPage = () => { setAccounts(accountsValue); trackEvent({ - category: 'MMI', - event: 'Connect to custodian', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnected, properties: { custodian: selectedCustodianName, apiUrl, @@ -553,8 +557,8 @@ const CustodyPage = () => { ); trackEvent({ - category: 'MMI', - event: 'Custodial accounts connected', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodialAccountsConnected, properties: { custodian: selectedCustodianName, numberOfAccounts: Object.keys(selectedAccounts).length, @@ -588,8 +592,8 @@ const CustodyPage = () => { } trackEvent({ - category: 'MMI', - event: 'Connect to custodian cancel', + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.CustodianConnectionCanceled, properties: { custodian: selectedCustodianName, numberOfAccounts: Object.keys(selectedAccounts).length, From a8716db6943cfe5e594085b1771d0f87e766fbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Oliv=C3=A9?= Date: Tue, 18 Jul 2023 15:58:33 +0200 Subject: [PATCH 18/56] [MMI] Fix wrong custody logo location (#20072) * Added missing styles * updated snapshots * fixed snapshot * updated snapshot --- .../__snapshots__/app-header.test.js.snap | 2 +- .../multichain/app-header/app-header.scss | 14 ++++++++++++++ .../metafox-logo.component.test.js.snap | 6 +++--- .../ui/metafox-logo/metafox-logo.component.js | 2 +- .../onboarding-app-header.test.js.snap | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap b/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap index 0687107d4427..fc0fc5c4bde4 100644 --- a/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap +++ b/ui/components/multichain/app-header/__snapshots__/app-header.test.js.snap @@ -7,7 +7,7 @@ exports[`App Header should match snapshot 1`] = ` data-testid="app-header-logo" >

[complianceBlurb0]

[complianceBlurb1]

[complianceBlurpStep0]

diff --git a/ui/components/institutional/compliance-modal/compliance-modal.js b/ui/components/institutional/compliance-modal/compliance-modal.js index 5c3805c56fd1..629cf330f6ba 100644 --- a/ui/components/institutional/compliance-modal/compliance-modal.js +++ b/ui/components/institutional/compliance-modal/compliance-modal.js @@ -3,14 +3,20 @@ import { useDispatch } from 'react-redux'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { hideModal } from '../../../store/actions'; import Modal from '../../app/modal'; -import Box from '../../ui/box'; -import { ButtonIcon, IconSize, IconName } from '../../component-library'; -import { Text } from '../../component-library/text/deprecated'; + +import { + ButtonIcon, + IconSize, + IconName, + Text, + Box, +} from '../../component-library'; + import { AlignItems, JustifyContent, TextColor, - DISPLAY, + Display, } from '../../../helpers/constants/design-system'; const ComplianceModal = () => { @@ -35,11 +41,11 @@ const ComplianceModal = () => { diff --git a/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap b/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap index 52b06d34b23b..ff4e3a70ca67 100644 --- a/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap +++ b/ui/components/institutional/compliance-settings/__snapshots__/compliance-settings.test.js.snap @@ -3,15 +3,15 @@ exports[`Compliance Settings shows disconnect when Compliance is activated 1`] = `
Change your settings or view reports by opening up Codefi Compliance or disconnect below.