From 6a54e8269ee309b611064fc06c6f98f926c4a5b6 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Thu, 27 Jun 2024 17:26:28 +0530 Subject: [PATCH 1/5] Add support of blockaid validations to new networks --- shared/constants/network.ts | 7 +++++++ shared/constants/security-provider.ts | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 452f0584ffaa..4aff59658264 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -158,6 +158,8 @@ export const CHAIN_IDS = { CHZ: '0x15b38', NUMBERS: '0x290b', SEI: '0x531', + BERACHAIN: '0x138d5', + METACHAIN_ONE: '0x1b6e6', } as const; export const CHAINLIST_CHAIN_IDS_MAP = { @@ -259,6 +261,8 @@ export const MOONRIVER_DISPLAY_NAME = 'Moonriver'; export const SCROLL_DISPLAY_NAME = 'Scroll'; export const SCROLL_SEPOLIA_DISPLAY_NAME = 'Scroll Sepolia'; export const OP_BNB_DISPLAY_NAME = 'opBNB'; +export const BERACHAIN_DISPLAY_NAME = 'Berachain Artio'; +export const METACHAIN_ONE_DISPLAY_NAME = 'Metachain One Mainnet'; export const infuraProjectId = process.env.INFURA_PROJECT_ID; export const getRpcUrl = ({ @@ -549,6 +553,9 @@ export const NETWORK_TO_NAME_MAP = { [CHAIN_IDS.SCROLL_SEPOLIA]: SCROLL_SEPOLIA_DISPLAY_NAME, [CHAIN_IDS.SEPOLIA]: SEPOLIA_DISPLAY_NAME, [CHAIN_IDS.OPBNB]: OP_BNB_DISPLAY_NAME, + [CHAIN_IDS.ZKSYNC_ERA]: ZK_SYNC_ERA_DISPLAY_NAME, + [CHAIN_IDS.BERACHAIN]: BERACHAIN_DISPLAY_NAME, + [CHAIN_IDS.METACHAIN_ONE]: METACHAIN_ONE_DISPLAY_NAME, } as const; export const CHAIN_ID_TO_CURRENCY_SYMBOL_MAP = { diff --git a/shared/constants/security-provider.ts b/shared/constants/security-provider.ts index 1c8dd6433fac..a53dd7caba78 100644 --- a/shared/constants/security-provider.ts +++ b/shared/constants/security-provider.ts @@ -100,6 +100,10 @@ export const SECURITY_PROVIDER_SUPPORTED_CHAIN_IDS: Hex[] = [ CHAIN_IDS.OPTIMISM, CHAIN_IDS.POLYGON, CHAIN_IDS.SEPOLIA, + CHAIN_IDS.ZKSYNC_ERA, + CHAIN_IDS.SCROLL, + CHAIN_IDS.BERACHAIN, + CHAIN_IDS.METACHAIN_ONE, ]; export const SECURITY_PROVIDER_EXCLUDED_TRANSACTION_TYPES = [ From 319126101fb229e7afa37b826f7b5e23d2c6d4c9 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Fri, 28 Jun 2024 21:29:55 +0530 Subject: [PATCH 2/5] Update --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1afbb70c1e20..e0344ab28e7d 100644 --- a/package.json +++ b/package.json @@ -325,7 +325,7 @@ "@metamask/permission-log-controller": "^2.0.1", "@metamask/phishing-controller": "^9.0.3", "@metamask/post-message-stream": "^8.0.0", - "@metamask/ppom-validator": "^0.31.0", + "@metamask/ppom-validator": "^0.32.0", "@metamask/providers": "^14.0.2", "@metamask/queued-request-controller": "^2.0.0", "@metamask/rate-limit-controller": "^5.0.1", diff --git a/yarn.lock b/yarn.lock index c9fac8508f47..72730523ba0b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6160,9 +6160,9 @@ __metadata: languageName: node linkType: hard -"@metamask/ppom-validator@npm:^0.31.0": - version: 0.31.0 - resolution: "@metamask/ppom-validator@npm:0.31.0" +"@metamask/ppom-validator@npm:^0.32.0": + version: 0.32.0 + resolution: "@metamask/ppom-validator@npm:0.32.0" dependencies: "@metamask/base-controller": "npm:^3.0.0" "@metamask/controller-utils": "npm:^8.0.1" @@ -6173,7 +6173,7 @@ __metadata: elliptic: "npm:^6.5.4" eslint-plugin-n: "npm:^16.6.2" json-rpc-random-id: "npm:^1.0.1" - checksum: 10/ed7b02384dddea8733a61672cd983f416b3842a597d4694b22c2b4fc9836400909e58c4c3a98901c78593d2c053e54ba8477deb7d0a8a0a67a61ce22faebd3e8 + checksum: 10/6b88fc9b5dc4ddcff88c15aed96994f93a95c350ae522115415d44aa38da981bdbdee56c7889cb44992a08eff4bcaf6198516961d3a69ec3d7a83c8014748496 languageName: node linkType: hard @@ -25496,7 +25496,7 @@ __metadata: "@metamask/phishing-controller": "npm:^9.0.3" "@metamask/phishing-warning": "npm:^3.0.3" "@metamask/post-message-stream": "npm:^8.0.0" - "@metamask/ppom-validator": "npm:^0.31.0" + "@metamask/ppom-validator": "npm:^0.32.0" "@metamask/providers": "npm:^14.0.2" "@metamask/queued-request-controller": "npm:^2.0.0" "@metamask/rate-limit-controller": "npm:^5.0.1" From 9ac14db9ccc7fa3844934a5d303a7d886081bc83 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Tue, 2 Jul 2024 17:59:45 +0530 Subject: [PATCH 3/5] Update --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index c1bccfbd0e70..2a9d1a9dc278 100644 --- a/package.json +++ b/package.json @@ -259,7 +259,7 @@ }, "dependencies": { "@babel/runtime": "patch:@babel/runtime@npm%3A7.24.0#~/.yarn/patches/@babel-runtime-npm-7.24.0-7eb1dd11a2.patch", - "@blockaid/ppom_release": "^1.4.8", + "@blockaid/ppom_release": "^1.4.9", "@contentful/rich-text-html-renderer": "^16.3.5", "@ensdomains/content-hash": "^2.5.7", "@ethereumjs/tx": "^4.1.1", diff --git a/yarn.lock b/yarn.lock index 0f23fcb86b02..a320753cd6c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1710,10 +1710,10 @@ __metadata: languageName: node linkType: hard -"@blockaid/ppom_release@npm:^1.4.8": - version: 1.4.8 - resolution: "@blockaid/ppom_release@npm:1.4.8" - checksum: 10/a8b7e94e54fdfd4a0fdde096f9302c7bbba18eec7b02e1f1163ec3848d25f12b3a7ff41be3f949ef7b77317c611aaec680d15c50f51b1f03244e3b1c2b9c4aed +"@blockaid/ppom_release@npm:^1.4.9": + version: 1.4.9 + resolution: "@blockaid/ppom_release@npm:1.4.9" + checksum: 10/5aff4d0397632eb875a96e5bf1d13ebb17b11a457a4fe5f1b9a6a80d4612be233d0c328ecf36fff4d126326b0ea555590e8112515c3df7703f79b376288d5559 languageName: node linkType: hard @@ -25135,7 +25135,7 @@ __metadata: "@babel/preset-typescript": "npm:^7.23.2" "@babel/register": "npm:^7.22.15" "@babel/runtime": "patch:@babel/runtime@npm%3A7.24.0#~/.yarn/patches/@babel-runtime-npm-7.24.0-7eb1dd11a2.patch" - "@blockaid/ppom_release": "npm:^1.4.8" + "@blockaid/ppom_release": "npm:^1.4.9" "@contentful/rich-text-html-renderer": "npm:^16.3.5" "@ensdomains/content-hash": "npm:^2.5.7" "@ethereumjs/tx": "npm:^4.1.1" From 91c7d6a3c544a01bff4b5f4f1862236c8c322c7c Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Tue, 2 Jul 2024 18:03:23 +0530 Subject: [PATCH 4/5] Update --- .../blockaid-banner-alert.test.js.snap | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap b/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap index 50b8d01883c8..4291fd98efbe 100644 --- a/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap +++ b/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap @@ -50,18 +50,18 @@ exports[`Blockaid Banner Alert should render 'danger' UI when securityAlertRespo class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

@@ -79,8 +79,8 @@ exports[`Blockaid Banner Alert should render 'danger' UI when securityAlertRespo style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

@@ -147,18 +147,18 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

@@ -176,8 +176,8 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

@@ -244,18 +244,18 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

@@ -273,8 +273,8 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

@@ -342,18 +342,18 @@ exports[`Blockaid Banner Alert should render details section even when features class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

@@ -371,8 +371,8 @@ exports[`Blockaid Banner Alert should render details section even when features style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

@@ -441,11 +441,11 @@ exports[`Blockaid Banner Alert should render details when provided 1`] = ` class="mm-box mm-text mm-text--body-md mm-text--overflow-wrap-break-word mm-box--color-text-default" >
  • - • + • Operator is an EOA
  • - • + • Operator is untrusted according to previous activity
  • @@ -453,18 +453,18 @@ exports[`Blockaid Banner Alert should render details when provided 1`] = ` class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -482,8 +482,8 @@ exports[`Blockaid Banner Alert should render details when provided 1`] = ` style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

    @@ -552,18 +552,18 @@ exports[`Blockaid Banner Alert should render link to report url 1`] = ` class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -581,8 +581,8 @@ exports[`Blockaid Banner Alert should render link to report url 1`] = ` style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

    From 0bae4fbbd67d46b1553da16392d762bf319d9d42 Mon Sep 17 00:00:00 2001 From: Jyoti Puri Date: Tue, 2 Jul 2024 18:59:01 +0530 Subject: [PATCH 5/5] update --- .../blockaid-banner-alert.test.js.snap | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap b/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap index 4291fd98efbe..539af8a50295 100644 --- a/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap +++ b/ui/pages/confirmations/components/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap @@ -50,8 +50,8 @@ exports[`Blockaid Banner Alert should render 'danger' UI when securityAlertRespo class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -79,8 +79,8 @@ exports[`Blockaid Banner Alert should render 'danger' UI when securityAlertRespo style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

    @@ -147,8 +147,8 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -176,8 +176,8 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

    @@ -244,8 +244,8 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -273,8 +273,8 @@ exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResp style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

    @@ -342,8 +342,8 @@ exports[`Blockaid Banner Alert should render details section even when features class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -371,8 +371,8 @@ exports[`Blockaid Banner Alert should render details section even when features style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

    @@ -441,11 +441,11 @@ exports[`Blockaid Banner Alert should render details when provided 1`] = ` class="mm-box mm-text mm-text--body-md mm-text--overflow-wrap-break-word mm-box--color-text-default" >
  • - • + • Operator is an EOA
  • - • + • Operator is untrusted according to previous activity
  • @@ -453,8 +453,8 @@ exports[`Blockaid Banner Alert should render details when provided 1`] = ` class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -482,8 +482,8 @@ exports[`Blockaid Banner Alert should render details when provided 1`] = ` style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +

    @@ -552,8 +552,8 @@ exports[`Blockaid Banner Alert should render link to report url 1`] = ` class="mm-box mm-text mm-text--body-md mm-box--margin-top-3 mm-box--display-flex mm-box--color-text-default" > - - Something doesn't look right? + + Something doesn't look right? Report an issue - - + +

    @@ -581,8 +581,8 @@ exports[`Blockaid Banner Alert should render link to report url 1`] = ` style="mask-image: url('./images/icons/security-tick.svg');" /> - - Powered by + + Powered by Blockaid - - + +