From 646aac44b40c27c2d3184d9026a818957052850b Mon Sep 17 00:00:00 2001 From: seaona <54408225+seaona@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:38:17 +0200 Subject: [PATCH 01/13] fix: flaky test `'Import NFT should continue to display an imported NFT after importing, adding a new account, and switching back` (#27006) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** In this test, we are importing an NFT and right after, we try to switch accounts. Sometimes, when we try to click into the Account, we get an error that another element is obscuring it. To fix it, when we click confirm, for importing the NFT, we'll wait until the element disappears, after proceeding to clicking the Account. `ElementClickInterceptedError: Element
-
- T -
-
-
- -
-
+ T

-
-

- @metamask/snap-test -

-
-
- T -
-
-
- -
-
+ T

-
-

- @metamask/snap-test -

-
-
- ? -
-
-
- -
-
+ ?

-
-

-

- + {t('connectionRequest')} diff --git a/ui/pages/snap-account-redirect/__snapshots__/create-snap-redirect.test.tsx.snap b/ui/pages/snap-account-redirect/__snapshots__/create-snap-redirect.test.tsx.snap index 440f05d43033..a971dd30faba 100644 --- a/ui/pages/snap-account-redirect/__snapshots__/create-snap-redirect.test.tsx.snap +++ b/ui/pages/snap-account-redirect/__snapshots__/create-snap-redirect.test.tsx.snap @@ -6,37 +6,21 @@ exports[` renders the url and message when provided and i class="mm-box create-snap-account-page mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full mm-box--height-full mm-box--border-style-none" >
-
- m -
-
-
- -
-
+ m

renders the url and message when provided and i @metamask/snap-simple-keyring

-
-

- @metamask/snap-simple-keyring -

-
+ ); diff --git a/ui/pages/snaps/snap-view/snap-view.js b/ui/pages/snaps/snap-view/snap-view.js index a913a1387527..5ef406fe9123 100644 --- a/ui/pages/snaps/snap-view/snap-view.js +++ b/ui/pages/snaps/snap-view/snap-view.js @@ -92,7 +92,12 @@ function SnapView() { }; return ( -
+
Date: Tue, 10 Sep 2024 14:16:21 +0000 Subject: [PATCH 05/13] Update LavaMoat policies --- lavamoat/browserify/beta/policy.json | 40 +-------------------------- lavamoat/browserify/flask/policy.json | 40 +-------------------------- lavamoat/browserify/main/policy.json | 40 +-------------------------- lavamoat/browserify/mmi/policy.json | 40 +-------------------------- 4 files changed, 4 insertions(+), 156 deletions(-) diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 69e5c441536a..048b607d8f0b 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -1688,10 +1688,10 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>@metamask/eth-block-tracker": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, "@metamask/rpc-errors": true, @@ -1741,44 +1741,6 @@ "semver": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": { - "globals": { - "URL": true, - "console.error": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-json-rpc-middleware>klona": true, - "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, - "@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "pify": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": { - "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "@metamask/safe-event-emitter": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/rpc-errors": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 69e5c441536a..048b607d8f0b 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -1688,10 +1688,10 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>@metamask/eth-block-tracker": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, "@metamask/rpc-errors": true, @@ -1741,44 +1741,6 @@ "semver": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": { - "globals": { - "URL": true, - "console.error": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-json-rpc-middleware>klona": true, - "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, - "@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "pify": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": { - "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "@metamask/safe-event-emitter": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/rpc-errors": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 69e5c441536a..048b607d8f0b 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -1688,10 +1688,10 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>@metamask/eth-block-tracker": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, "@metamask/rpc-errors": true, @@ -1741,44 +1741,6 @@ "semver": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": { - "globals": { - "URL": true, - "console.error": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-json-rpc-middleware>klona": true, - "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, - "@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "pify": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": { - "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "@metamask/safe-event-emitter": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/rpc-errors": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 489d0a279690..b1a4d5813ef3 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1780,10 +1780,10 @@ "packages": { "@metamask/base-controller": true, "@metamask/controller-utils": true, + "@metamask/eth-json-rpc-middleware": true, "@metamask/eth-query": true, "@metamask/eth-token-tracker>@metamask/eth-block-tracker": true, "@metamask/network-controller>@metamask/eth-json-rpc-infura": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": true, "@metamask/network-controller>@metamask/eth-json-rpc-provider": true, "@metamask/network-controller>@metamask/swappable-obj-proxy": true, "@metamask/rpc-errors": true, @@ -1833,44 +1833,6 @@ "semver": true } }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware": { - "globals": { - "URL": true, - "console.error": true, - "setTimeout": true - }, - "packages": { - "@metamask/eth-json-rpc-middleware>klona": true, - "@metamask/eth-json-rpc-middleware>safe-stable-stringify": true, - "@metamask/eth-sig-util": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": true, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "pify": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/json-rpc-engine": { - "packages": { - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": true, - "@metamask/rpc-errors": true, - "@metamask/safe-event-emitter": true - } - }, - "@metamask/network-controller>@metamask/eth-json-rpc-middleware>@metamask/utils": { - "globals": { - "TextDecoder": true, - "TextEncoder": true - }, - "packages": { - "@metamask/utils>@metamask/superstruct": true, - "@metamask/utils>@scure/base": true, - "@metamask/utils>pony-cause": true, - "@noble/hashes": true, - "browserify>buffer": true, - "nock>debug": true, - "semver": true - } - }, "@metamask/network-controller>@metamask/eth-json-rpc-provider": { "packages": { "@metamask/rpc-errors": true, From 9405bc1dbccd4c51cff60b32a0386ff3ed55b4b2 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 10 Sep 2024 12:00:31 -0230 Subject: [PATCH 06/13] fix: Ignore yarn audit warning for GHSA-9wv6-86v2-598j (#27024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This addresses the following `yarn audit` failure: ``` └─ path-to-regexp ├─ ID: 1099496 ├─ Issue: path-to-regexp outputs backtracking regular expressions ├─ URL: https://github.com/advisories/GHSA-9wv6-86v2-598j ├─ Severity: high ├─ Vulnerable Versions: >=0.2.0 <8.0.0 │ ├─ Tree Versions │ └─ 1.7.0 │ └─ Dependents └─ react-router@npm:5.1.2 [12b72] ``` path-to-Regexp is used in two files within react-router v5.1.2: `generatePath.js` and `matchPath.js`. In both cases, `path` and `options` variables are passed to a `compilePath` function. Those are then passed to `pathtoRegexp`. The variables passed to `pathtoRegexp` are dependent on props or parameters passed to react-router components and/or methods explictly from the metamask code. So this vulnerability cannot be exploited by an external actor. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27024?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .yarnrc.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.yarnrc.yml b/.yarnrc.yml index 252333917781..1522080c0561 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -43,6 +43,16 @@ npmAuditIgnoreAdvisories: # not appear to be used. - 1092461 + # Issue: path-to-regexp outputs backtracking regular expressions + # URL: https://github.com/advisories/GHSA-9wv6-86v2-598j + # path-to-regexp is used in react-router v5.1.2, which we use. However, the + # vulnerability in path-to-regexp could only be exploited within react-router + # if malicious properties were passed to react-router components or methods + # explicitly from our code. As such, this vulneratibility cannot be exploited + # by an external / malicious actor. Meanwhile, once we update to v6+, + # path-to-regexp will no longer be used. + - 1099499 + # Temp fix for https://github.com/MetaMask/metamask-extension/pull/16920 for the sake of 11.7.1 hotfix # This will be removed in this ticket https://github.com/MetaMask/metamask-extension/issues/22299 - 'ts-custom-error (deprecation)' From 8bab1ad1f311ea8561fa29c1d5dd75eb004758a2 Mon Sep 17 00:00:00 2001 From: David Murdoch <187813+davidmurdoch@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:10:15 -0400 Subject: [PATCH 07/13] fix(AssetPrice): change `stroke-linecap` and `stroke-linejoin` properties to valid JS syntax (#26488) I noticed a react warning about the `stroke-linecap` and `stroke-linejoin` properties not being valid (they are supposed to be `strokeLinecap` and `strokeLinejoin`). I've updated them in this PR. It doesn't change anything except for the warning, as React was passing the hyphenated values to the DOM anyway (now it just won't complain). So this PR just serves to get rid of the warning. --- ui/pages/asset/components/asset-price.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/pages/asset/components/asset-price.tsx b/ui/pages/asset/components/asset-price.tsx index 17bb48d429ac..36daf353508d 100644 --- a/ui/pages/asset/components/asset-price.tsx +++ b/ui/pages/asset/components/asset-price.tsx @@ -25,13 +25,13 @@ const chartUp = ( > ); @@ -46,13 +46,13 @@ const chartDown = ( > ); From 218d61032aa3d0069550a26babd2b0b9bb34f83e Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:18:59 -0700 Subject: [PATCH 08/13] chore: Create Storybook story for ImportSRP component (#27000) This PR adds a Storybook story for the AddNetworkModal component. The story showcases different states and configurations of the component, improving its testability and documentation. 1. Reason for the change: To enhance the component's visibility in Storybook and facilitate easier testing and development. 2. Improvement/solution: Created a new story file with multiple variations of the AddNetworkModal component. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27000?quickstart=1) ## **Related issues** N/A ## **Manual testing steps** 1. Go to the latest build of storybook in this PR 2. Navigate to the AddNetworkModal component in the Pages/Onboarding folder. ## **Screenshots/Recordings** https://files.devinusercontent.com/attachments/5a13b9e8-2468-4532-beea-9545056bb6b0/e3cdc221-da44-45c1-9c05-fcf91c8ff12b.png ## **Pre-merge author checklist** - [X] I've followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I've included tests if applicable - [X] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. [This Devin run](https://preview.devin.ai/devin/bfec9966b74f4487830943b93eee3eac) was requested by George. --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: georgewrmarshall --- .../import-srp/import-srp.stories.tsx | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 ui/pages/onboarding-flow/import-srp/import-srp.stories.tsx diff --git a/ui/pages/onboarding-flow/import-srp/import-srp.stories.tsx b/ui/pages/onboarding-flow/import-srp/import-srp.stories.tsx new file mode 100644 index 000000000000..536b87520ee2 --- /dev/null +++ b/ui/pages/onboarding-flow/import-srp/import-srp.stories.tsx @@ -0,0 +1,83 @@ +import React from 'react'; +import { MemoryRouter } from 'react-router-dom'; +import { Provider } from 'react-redux'; +import { configureStore } from '@reduxjs/toolkit'; +import type { Meta, StoryObj } from '@storybook/react'; +import ImportSRP from './import-srp'; +import { MetaMetricsContext } from '../../../contexts/metametrics'; +import type { UITrackEventMethod } from '../../../contexts/metametrics'; + +const mockStore = configureStore({ + reducer: { + metamask: (state = { + internalAccounts: { + selectedAccount: '0x0000000000000000000000000000000000000001', + accounts: { + '0x0000000000000000000000000000000000000001': { + address: '0x0000000000000000000000000000000000000001', + metadata: { + keyring: { + type: 'HD Key Tree', + accounts: ['0x0000000000000000000000000000000000000001'], + }, + }, + }, + }, + }, + keyrings: [ + { + type: 'HD Key Tree', + accounts: ['0x0000000000000000000000000000000000000001'], + }, + ], + }) => state, + }, +}); + +const mockTrackEvent: UITrackEventMethod = (event, properties) => { + console.log('Mock track event:', { event, properties }); + return Promise.resolve(); +}; + +const Wrapper = ({ children }) => ( + + + + {children} + + + +); + +const meta: Meta = { + title: 'Pages/OnboardingFlow/ImportSRP', + component: ImportSRP, + decorators: [ + (Story) => ( + + + + ), + ], + parameters: { + docs: { + description: { + component: 'ImportSRP component allows users to input and submit their Secret Recovery Phrase.', + }, + }, + }, + argTypes: { + submitSecretRecoveryPhrase: { action: 'submitSecretRecoveryPhrase' }, + }, +}; + +export default meta; +type Story = StoryObj; + +export const DefaultStory: Story = { + args: { + submitSecretRecoveryPhrase: () => console.log('Secret Recovery Phrase submitted'), + }, +}; + +DefaultStory.storyName = 'Default'; From ddc0d588218cfe2abc481c5d271e7d6fced421e8 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:20:30 -0700 Subject: [PATCH 09/13] chore: Create a story for AddNetworkModal component (#27003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds a Storybook story for the AddNetworkModal component. The story showcases different states and configurations of the component, improving its testability and documentation. 1. Reason for the change: To enhance the component's visibility in Storybook and facilitate easier testing and development. 2. Improvement/solution: Created a new story file with multiple variations of the AddNetworkModal component. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27003?quickstart=1) ## **Related issues** N/A ## **Manual testing steps** 1. Go to the latest build of storybook in this PR 2. Navigate to the AddNetworkModal component in the Pages/Onboarding folder. ## **Screenshots/Recordings** Screenshot 2024-09-09 at 4 24 18 PM ## **Pre-merge author checklist** - [X] I've followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I've included tests if applicable - [X] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. [This Devin run](https://preview.devin.ai/devin/bfec9966b74f4487830943b93eee3eac) was requested by George. If you have any feedback, you can leave comments in the PR and I'll address them in the app! Co-authored-by: georgewrmarshall --- .../add-network-modal.stories.tsx | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 ui/pages/onboarding-flow/add-network-modal/add-network-modal.stories.tsx diff --git a/ui/pages/onboarding-flow/add-network-modal/add-network-modal.stories.tsx b/ui/pages/onboarding-flow/add-network-modal/add-network-modal.stories.tsx new file mode 100644 index 000000000000..5153ccb2ca56 --- /dev/null +++ b/ui/pages/onboarding-flow/add-network-modal/add-network-modal.stories.tsx @@ -0,0 +1,40 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import AddNetworkModal from './index'; + +const meta: Meta = { + title: 'Pages/OnboardingFlow/AddNetworkModal', + component: AddNetworkModal, + argTypes: { + showHeader: { control: 'boolean' }, + addNewNetwork: { control: 'boolean' }, + onEditNetwork: { action: 'onEditNetwork' }, + networkToEdit: { control: 'object' }, + onRpcUrlAdd: { action: 'onRpcUrlAdd' }, + prevActionMode: { control: 'text' }, + networkFormInformation: { control: 'object' }, + setNetworkFormInformation: { action: 'setNetworkFormInformation' }, + }, + args: { + showHeader: false, + addNewNetwork: true, + onEditNetwork: undefined, + networkToEdit: undefined, + prevActionMode: undefined, + networkFormInformation: {}, + setNetworkFormInformation: () => null, + onRpcUrlAdd: () => {}, + }, +}; + +export default meta; +type Story = StoryObj; + +export const Default: Story = { + args: {}, +}; + +export const ShowHeader: Story = { + args: { + showHeader: true, + }, +}; From ad9f0f16f5ad96c1aa56d1a19b57dfb02f90edee Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 10 Sep 2024 14:22:45 -0230 Subject: [PATCH 10/13] fix: Add a second id to ignore for the GHSA-9wv6-86v2-598j (#27041) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Follow up to https://github.com/MetaMask/metamask-extension/pull/27024. Since that was merged, an update was made to https://github.com/MetaMask/metamask-extension/pull/27024, and so the yarn audit warning now has a new id, which we need to include in the `npmAuditIgnoreAdvisories` config. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27041?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .yarnrc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.yarnrc.yml b/.yarnrc.yml index 1522080c0561..63b9539cbfba 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -52,6 +52,7 @@ npmAuditIgnoreAdvisories: # by an external / malicious actor. Meanwhile, once we update to v6+, # path-to-regexp will no longer be used. - 1099499 + - 1099514 # Temp fix for https://github.com/MetaMask/metamask-extension/pull/16920 for the sake of 11.7.1 hotfix # This will be removed in this ticket https://github.com/MetaMask/metamask-extension/issues/22299 From 7dc6362a70a3e7ab1de406bfdcbae7ad4d2c68be Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 10 Sep 2024 15:32:12 -0230 Subject: [PATCH 11/13] fix: Update id for ignoring path-to-regexp advisory (#27044) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** Follow up to https://github.com/MetaMask/metamask-extension/pull/27024 and https://github.com/MetaMask/metamask-extension/pull/27041 The id has changed again, so we are going to try updating one more time. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27044?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .yarnrc.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.yarnrc.yml b/.yarnrc.yml index 63b9539cbfba..5d4aa7cd4e73 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -51,8 +51,7 @@ npmAuditIgnoreAdvisories: # explicitly from our code. As such, this vulneratibility cannot be exploited # by an external / malicious actor. Meanwhile, once we update to v6+, # path-to-regexp will no longer be used. - - 1099499 - - 1099514 + - 1099518 # Temp fix for https://github.com/MetaMask/metamask-extension/pull/16920 for the sake of 11.7.1 hotfix # This will be removed in this ticket https://github.com/MetaMask/metamask-extension/issues/22299 From 54c85e87f0e0c569ca5fff1f1b0e3a7e2c6e000d Mon Sep 17 00:00:00 2001 From: Vinicius Stevam <45455812+vinistevam@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:03:17 +0100 Subject: [PATCH 12/13] fix: update `network is busy` threshold 0.9 (#26983) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This PR aims to update the threshold for the `network is busy` warning. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26983?quickstart=1) ## **Related issues** Fixes: https://github.com/MetaMask/MetaMask-planning/issues/2752 ## **Manual testing steps** 1. Go to this test Dapp or start a simple send ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> --- shared/constants/gas.ts | 2 +- ui/ducks/metamask/metamask.test.js | 6 +++--- .../status-slider/status-slider.test.js | 8 ++++---- .../components/gas-details-item/gas-details-item.test.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/shared/constants/gas.ts b/shared/constants/gas.ts index 5748ee00d9f3..010ff6ffe66f 100644 --- a/shared/constants/gas.ts +++ b/shared/constants/gas.ts @@ -82,7 +82,7 @@ export enum EditGasModes { export enum NetworkCongestionThresholds { notBusy = 0, stable = 0.33, - busy = 0.66, + busy = 0.9, } export type TxGasFees = { diff --git a/ui/ducks/metamask/metamask.test.js b/ui/ducks/metamask/metamask.test.js index d36dac4f87bb..5f3021297c96 100644 --- a/ui/ducks/metamask/metamask.test.js +++ b/ui/ducks/metamask/metamask.test.js @@ -509,7 +509,7 @@ describe('MetaMask Reducers', () => { metamask: { gasFeeEstimatesByChainId: { '0x1': { - gasFeeEstimates: { networkCongestion: 0.67 }, + gasFeeEstimates: { networkCongestion: 0.91 }, }, }, }, @@ -526,7 +526,7 @@ describe('MetaMask Reducers', () => { metamask: { gasFeeEstimatesByChainId: { '0x1': { - gasFeeEstimates: { networkCongestion: 0.66 }, + gasFeeEstimates: { networkCongestion: 0.9 }, }, }, }, @@ -543,7 +543,7 @@ describe('MetaMask Reducers', () => { metamask: { gasFeeEstimatesByChainId: { '0x1': { - gasFeeEstimates: { networkCongestion: 0.65 }, + gasFeeEstimates: { networkCongestion: 0.89 }, }, }, }, diff --git a/ui/pages/confirmations/components/edit-gas-fee-popover/network-statistics/status-slider/status-slider.test.js b/ui/pages/confirmations/components/edit-gas-fee-popover/network-statistics/status-slider/status-slider.test.js index abeee19e720e..4811469a667b 100644 --- a/ui/pages/confirmations/components/edit-gas-fee-popover/network-statistics/status-slider/status-slider.test.js +++ b/ui/pages/confirmations/components/edit-gas-fee-popover/network-statistics/status-slider/status-slider.test.js @@ -34,13 +34,13 @@ describe('StatusSlider', () => { expect(getByText('Stable')).toBeInTheDocument(); }); - it('should show "Busy" when networkCongestion is 0.66', () => { - const { getByText } = renderComponent({ networkCongestion: 0.66 }); + it('should show "Busy" when networkCongestion is 0.9', () => { + const { getByText } = renderComponent({ networkCongestion: 0.9 }); expect(getByText('Busy')).toBeInTheDocument(); }); - it('should show "Busy" when networkCongestion is greater than 0.66', () => { - const { getByText } = renderComponent({ networkCongestion: 0.67 }); + it('should show "Busy" when networkCongestion is greater than 0.9', () => { + const { getByText } = renderComponent({ networkCongestion: 0.91 }); expect(getByText('Busy')).toBeInTheDocument(); }); diff --git a/ui/pages/confirmations/components/gas-details-item/gas-details-item.test.js b/ui/pages/confirmations/components/gas-details-item/gas-details-item.test.js index 16ba3c892877..ca85dd9abae9 100644 --- a/ui/pages/confirmations/components/gas-details-item/gas-details-item.test.js +++ b/ui/pages/confirmations/components/gas-details-item/gas-details-item.test.js @@ -270,7 +270,7 @@ describe('GasDetailsItem', () => { high: { suggestedMaxPriorityFeePerGas: '1', }, - networkCongestion: 0.7, + networkCongestion: 0.91, }, }, }, From b960add20dda2bfb2721f190b897be1103815622 Mon Sep 17 00:00:00 2001 From: Matteo Scurati Date: Wed, 11 Sep 2024 11:08:26 +0200 Subject: [PATCH 13/13] fix: check if the notifications started flow is running (#27038) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This PR adds a check to the modal for enabling notifications. If the enabling process is in progress, closing the modal does not trigger the “dismissed” event. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27038?quickstart=1) ## **Related issues** N/A ## **Manual testing steps** N/A ## **Screenshots/Recordings** N/A ### **Before** N/A ### **After** N/A ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../turn-on-metamask-notifications.tsx | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/ui/components/app/modals/turn-on-metamask-notifications/turn-on-metamask-notifications.tsx b/ui/components/app/modals/turn-on-metamask-notifications/turn-on-metamask-notifications.tsx index e63e0a019b2f..de3da35fa841 100644 --- a/ui/components/app/modals/turn-on-metamask-notifications/turn-on-metamask-notifications.tsx +++ b/ui/components/app/modals/turn-on-metamask-notifications/turn-on-metamask-notifications.tsx @@ -51,14 +51,14 @@ export default function TurnOnMetamaskNotifications() { ); const isProfileSyncingEnabled = useSelector(selectIsProfileSyncingEnabled); - const [buttonState, setButtonState] = useState( + const [isLoading, setIsLoading] = useState( isUpdatingMetamaskNotifications, ); const { createNotifications, error } = useCreateNotifications(); const handleTurnOnNotifications = async () => { - setButtonState(true); + setIsLoading(true); await createNotifications(); trackEvent({ category: MetaMetricsEventCategory.NotificationsActivationFlow, @@ -72,13 +72,18 @@ export default function TurnOnMetamaskNotifications() { const handleHideModal = () => { hideModal(); - trackEvent({ - category: MetaMetricsEventCategory.NotificationsActivationFlow, - event: MetaMetricsEventName.NotificationsActivated, - properties: { - is_profile_syncing_enabled: isProfileSyncingEnabled, - action_type: 'dismissed', - }, + setIsLoading((prevLoadingState) => { + if (!prevLoadingState) { + trackEvent({ + category: MetaMetricsEventCategory.NotificationsActivationFlow, + event: MetaMetricsEventName.NotificationsActivated, + properties: { + is_profile_syncing_enabled: isProfileSyncingEnabled, + action_type: 'dismissed', + }, + }); + } + return prevLoadingState; }); }; @@ -149,8 +154,8 @@ export default function TurnOnMetamaskNotifications() { }} submitButtonProps={{ children: t('turnOnMetamaskNotificationsButton'), - loading: buttonState, - disabled: buttonState, + loading: isLoading, + disabled: isLoading, 'data-testid': 'turn-on-notifications-button', }} />