From 0cb53f74f2cee22bbfbb866891f0d9987e8c40b2 Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Thu, 6 Apr 2023 15:14:11 +0000 Subject: [PATCH 1/9] Version v10.28.2 --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e2ed30bb..5ad912f33 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.28.2] + ## [10.28.1] ### Changed - Fix release automation ([#18427](https://github.com/MetaMask/metamask-extension/pull/18427)) @@ -3643,7 +3645,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.28.1...HEAD +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.28.2...HEAD +[10.28.2]: https://github.com/MetaMask/metamask-extension/compare/v10.28.1...v10.28.2 [10.28.1]: https://github.com/MetaMask/metamask-extension/compare/v10.28.0...v10.28.1 [10.28.0]: https://github.com/MetaMask/metamask-extension/compare/v10.27.0...v10.28.0 [10.27.0]: https://github.com/MetaMask/metamask-extension/compare/v10.26.2...v10.27.0 diff --git a/package.json b/package.json index c0a26aa2b..787b6d747 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metamask-crx", - "version": "10.28.1", + "version": "10.28.2", "private": true, "repository": { "type": "git", From 43d5bf152c213b8d0033c1cde1c4c311883e8ccd Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Thu, 6 Apr 2023 08:07:34 -0700 Subject: [PATCH 2/9] =?UTF-8?q?Fix=20switch-ethereum-chain=20handler=20by?= =?UTF-8?q?=20passing=20configuration=20id=20to=20setA=E2=80=A6=20(#18483)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix switch-ethereum-chain handler by passing configuration id to setActiveNetwork * fix e2e test * Fix e2e tests * Update test/e2e/tests/switch-custom-network.spec.js Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> * Revert "Update test/e2e/tests/switch-custom-network.spec.js" This reverts commit be533ff7f25e1fd42e951d9b817b8438035ae256. --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> --- .../handlers/switch-ethereum-chain.js | 2 +- test/e2e/tests/switch-custom-network.spec.js | 102 ++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 test/e2e/tests/switch-custom-network.spec.js diff --git a/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js b/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js index 935b9ec60..81c6887e0 100644 --- a/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js +++ b/app/scripts/lib/rpc-method-middleware/handlers/switch-ethereum-chain.js @@ -115,7 +115,7 @@ async function switchEthereumChainHandler( ) { setProviderType(approvedRequestData.type); } else { - await setActiveNetwork(approvedRequestData); + await setActiveNetwork(approvedRequestData.id); } res.result = null; } catch (error) { diff --git a/test/e2e/tests/switch-custom-network.spec.js b/test/e2e/tests/switch-custom-network.spec.js new file mode 100644 index 000000000..9da4eedc1 --- /dev/null +++ b/test/e2e/tests/switch-custom-network.spec.js @@ -0,0 +1,102 @@ +const { strict: assert } = require('assert'); +const FixtureBuilder = require('../fixture-builder'); +const { convertToHexValue, withFixtures } = require('../helpers'); + +describe('Swtich ethereum chain', function () { + const ganacheOptions = { + accounts: [ + { + secretKey: + '0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC', + balance: convertToHexValue(25000000000000000000), + }, + ], + concurrent: { port: 8546, chainId: 1338, ganacheOptions2: {} }, + }; + + it('should successfully change the network in response to wallet_switchEthereumChain', async function () { + await withFixtures( + { + dapp: true, + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), + ganacheOptions, + title: this.test.title, + failOnConsoleError: false, + }, + async ({ driver }) => { + await driver.navigate(); + await driver.fill('#password', 'correct horse battery staple'); + await driver.press('#password', driver.Key.ENTER); + + const windowHandles = await driver.getAllWindowHandles(); + const extension = windowHandles[0]; + + await driver.openNewPage('http://127.0.0.1:8080/'); + + await driver.clickElement({ + tag: 'button', + text: 'Add Localhost 8546', + }); + + await driver.waitUntilXWindowHandles(3); + + await driver.switchToWindowWithTitle( + 'MetaMask Notification', + windowHandles, + ); + + await driver.clickElement({ + tag: 'button', + text: 'Approve', + }); + + await driver.findElement({ + tag: 'h3', + text: 'Allow this site to switch the network?', + }); + + // Don't switch to network now, because we will click the 'Switch to Localhost 8546' button below + await driver.clickElement({ + tag: 'button', + text: 'Cancel', + }); + + await driver.waitUntilXWindowHandles(2); + + await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles); + await driver.clickElement({ + tag: 'button', + text: 'Switch to Localhost 8546', + }); + + await driver.waitUntilXWindowHandles(3); + + await driver.switchToWindowWithTitle( + 'MetaMask Notification', + windowHandles, + ); + + await driver.clickElement({ + tag: 'button', + text: 'Switch network', + }); + + await driver.waitUntilXWindowHandles(2); + + await driver.switchToWindow(extension); + + const currentNetworkName = await driver.findElement({ + tag: 'span', + text: 'Localhost 8546', + }); + + assert.ok( + Boolean(currentNetworkName), + 'Failed to switch to custom network', + ); + }, + ); + }); +}); From 227af24483fffc15c179f6ef79dcb4b9ccba409b Mon Sep 17 00:00:00 2001 From: vthomas13 <10986371+vthomas13@users.noreply.github.com> Date: Thu, 6 Apr 2023 11:08:11 -0400 Subject: [PATCH 3/9] Bumping notification id's to 18 & 19 (#18460) Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Dan J Miller --- app/_locales/de/messages.json | 6 --- app/_locales/el/messages.json | 6 --- app/_locales/en/messages.json | 21 ++++---- app/_locales/es/messages.json | 6 --- app/_locales/fr/messages.json | 6 --- app/_locales/hi/messages.json | 6 --- app/_locales/id/messages.json | 6 --- app/_locales/ja/messages.json | 6 --- app/_locales/ko/messages.json | 6 --- app/_locales/pt/messages.json | 6 --- app/_locales/ru/messages.json | 6 --- app/_locales/tl/messages.json | 6 --- app/_locales/tr/messages.json | 6 --- app/_locales/vi/messages.json | 6 --- app/_locales/zh_CN/messages.json | 6 --- shared/notifications/index.js | 48 +++++++++++-------- test/e2e/fixture-builder.js | 12 ++++- .../app/whats-new-popup/whats-new-popup.js | 12 +++-- ui/selectors/selectors.js | 6 ++- 19 files changed, 61 insertions(+), 122 deletions(-) diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 3e07daae6..6f4cf6e25 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Ethereum Merge ist da!" }, - "notifications17ActionText": { - "message": "Sicherheits- und Datenschutzeinstellungen anzeigen" - }, - "notifications17Title": { - "message": "Sicherheits- und Datenschutzeinstellungen" - }, "notifications1Description": { "message": "Mobile MetaMask-Anwender können jetzt Token in ihren mobilen Wallets swappen. Scannen Sie den QR-Code, um die mobile App zu erhalten und mit dem Swapping zu beginnen.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index e05037db0..50f603838 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Η συγχώνευση στο Ethereum είναι εδώ!" }, - "notifications17ActionText": { - "message": "Εμφάνιση ρυθμίσεων Ασφάλειας & Απορρήτου" - }, - "notifications17Title": { - "message": "Ρυθμίσεις Ασφάλειας & Απορρήτου" - }, "notifications1Description": { "message": "Οι χρήστες του MetaMask Mobile μπορούν τώρα να ανταλλάξουν tokens μέσα στο κινητό τους πορτοφόλι. Σαρώστε τον κωδικό QR για να πάρετε την εφαρμογή για κινητά και να αρχίσετε να ανταλλάζετε.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 0288955e6..9846fad1c 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -2366,40 +2366,37 @@ "notifications15Title": { "message": "The Ethereum Merge is here!" }, - "notifications16ActionText": { + "notifications18ActionText": { "message": "Enable security alerts" }, - "notifications16DescriptionOne": { + "notifications18DescriptionOne": { "message": "Get alerts from third parties when you may have received a malicious request.", "description": "Description of a notification in the 'See What's New' popup. Describes Opensea Security Provider feature." }, - "notifications16DescriptionThree": { + "notifications18DescriptionThree": { "message": "Always be sure to do your own due diligence before approving any requests.", "description": "Description of a notification in the 'See What's New' popup. Describes Opensea Security Provider feature." }, - "notifications16DescriptionTwo": { + "notifications18DescriptionTwo": { "message": "OpenSea is the first provider for this feature. More providers coming soon!", "description": "Description of a notification in the 'See What's New' popup. Describes Opensea Security Provider feature." }, - "notifications16Title": { - "message": "Stay safe with security alerts" - }, - "notifications17ActionText": { + "notifications19ActionText": { "message": "Enable NFT autodetection" }, - "notifications17DescriptionOne": { + "notifications19DescriptionOne": { "message": "Two ways you can get started:", "description": "Description of a notification in the 'See What's New' popup. Describes NFT autodetection feature." }, - "notifications17DescriptionThree": { + "notifications19DescriptionThree": { "message": "We only support ERC-721 at the moment.", "description": "Description of a notification in the 'See What's New' popup. Describes NFT autodetection feature." }, - "notifications17DescriptionTwo": { + "notifications19DescriptionTwo": { "message": "Manually add your NFTs, or turn on NFT autodetection in Settings > Experimental.", "description": "Description of a notification in the 'See What's New' popup. Describes NFT autodetection feature." }, - "notifications17Title": { + "notifications19Title": { "message": "See your NFTs like never before" }, "notifications1Description": { diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 9fa598d90..3ff6332bc 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "¡La Fusión de Ethereum está aquí!" }, - "notifications17ActionText": { - "message": "Mostrar configuración de seguridad y privacidad" - }, - "notifications17Title": { - "message": "Configuración de Seguridad y privacidad" - }, "notifications1Description": { "message": "Los usuarios de la aplicación móvil de MetaMask ahora pueden canjear tokens en su cartera móvil. Escanee el código QR para obtener la aplicación móvil y comience a canjear.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 904c3b7f1..90a701e7a 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "La fusion Ethereum est en marche !" }, - "notifications17ActionText": { - "message": "Afficher les paramètres de sécurité et de confidentialité" - }, - "notifications17Title": { - "message": "Paramètres de sécurité et de confidentialité" - }, "notifications1Description": { "message": "Les utilisateurs de MetaMask Mobile peuvent désormais échanger des jetons dans leur portefeuille mobile. Scannez le code QR pour obtenir l’application mobile et commencez à échanger.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index bb826f5ec..78cf97f61 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "इथेरियम मर्ज यहाँ है!" }, - "notifications17ActionText": { - "message": "सुरक्षा और गोपनीयता सेटिंग्स को दिखाएं" - }, - "notifications17Title": { - "message": "सुरक्षा और गोपनीयता सेटिंग्स" - }, "notifications1Description": { "message": "MetaMask Mobile उपयोगकर्ता अब अपने मोबाइल वॉलेट के अंदर टोकन स्वैप कर सकते हैं। मोबाइल ऐप प्राप्त करने के लिए QR कोड को स्कैन करें और स्वैप करना शुरू करें।", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 8df3e4908..9a6997cab 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Penggabungan Ethereum telah tiba!" }, - "notifications17ActionText": { - "message": "Tampilkan pengaturan Keamanan & Privasi" - }, - "notifications17Title": { - "message": "Pengaturan Keamanan & Privasi" - }, "notifications1Description": { "message": "Pengguna MetaMask Mobile kini bisa menukar token di dalam dompet seluler mereka. Pindai kode QR untuk mendapatkan aplikasi seluler dan mulai menukar.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 0eec323b6..41796f382 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Ethereum のマージ (Merge) が完了しました!" }, - "notifications17ActionText": { - "message": "セキュリティおよびプライバシー設定を表示" - }, - "notifications17Title": { - "message": "セキュリティおよびプライバシー設定" - }, "notifications1Description": { "message": "MetaMask Mobileのユーザーが、モバイルウォレット内でトークンを交換できるようになりました。QRコードをスキャンしてモバイルアプリを取得し、スワップを開始します。", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 0b0c9cf3d..f46b0ff36 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "이더리움 머지가 완료되었습니다!" }, - "notifications17ActionText": { - "message": "보안 및 개인정보 설정 표시" - }, - "notifications17Title": { - "message": "보안 및 개인정보 설정 표시" - }, "notifications1Description": { "message": "MetaMask 모바일 사용자는 이제 모바일 지갑에서 토큰을 스왑할 수 있습니다. QR 코드를 스캔하여 모바일 앱을 설치하고 스왑을 시작하세요.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 58c17c518..5b73c1ab8 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "A fusão do Ethereum chegou!" }, - "notifications17ActionText": { - "message": "Mostrar configurações de segurança e privacidade" - }, - "notifications17Title": { - "message": "Configurações de segurança e privacidade" - }, "notifications1Description": { "message": "Usuários da MetaMask Mobile agora podem trocar tokens dentro de sua carteira mobile. Leia o QR code para obter o aplicativo para dispositivos móveis e comece a trocar.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 6e1f9e794..37f138a27 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Ethereum Merge уже досутпно!" }, - "notifications17ActionText": { - "message": "Показать настройки безопасности и конфиденциальности" - }, - "notifications17Title": { - "message": "Настройки безопасности и конфиденциальности" - }, "notifications1Description": { "message": "Теперь пользователи MetaMask Mobile могут обменивать токены в своем мобильном кошельке. Отсканируйте QR-код, чтобы скачать мобильное приложение и начать обмен.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 477ba8b5c..a6394c2ed 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Narito na ang Ethereum Merge!" }, - "notifications17ActionText": { - "message": "Ipakita ang mga setting ng Seguridad at Pagkapribado" - }, - "notifications17Title": { - "message": "Mga Setting ng Seguridad at Pagkapribado" - }, "notifications1Description": { "message": "Ang mga user ng MetaMask Mobile ay maaari na ngayong mag-swap ng mga token sa loob ng kanilang mobile wallet. I-scan ang QR code para makuha ang mobile app at magsimulang mag-swap.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 5f1c5b4f9..17114accc 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Ethereum Birleşmesi başladı!" }, - "notifications17ActionText": { - "message": "Güvenlik ve Gizlilik ayarlarını göster" - }, - "notifications17Title": { - "message": "Güvenlik ve Gizlilik Ayarları" - }, "notifications1Description": { "message": "MetaMask Mobil kullanıcıları artık mobil cüzdanları içinde token takas edebilirler. Mobil uygulamayı edinmek ve takas yapmaya başlamak için QR kodunu tarayın.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index e72945347..a3acb4703 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "Hợp nhất Ethereum đã được triển khai!" }, - "notifications17ActionText": { - "message": "Hiển thị cài đặt Bảo mật và Quyền riêng tư" - }, - "notifications17Title": { - "message": "Cài đặt Bảo mật và Quyền riêng tư" - }, "notifications1Description": { "message": "Giờ đây, người dùng MetaMask trên điện thoại di động có thể hoán đổi token trong ví di động của họ. Quét mã QR để tải ứng dụng di động và bắt đầu hoán đổi.", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 63f207f8f..b6b057c41 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -2336,12 +2336,6 @@ "notifications15Title": { "message": "以太坊合并来了!" }, - "notifications17ActionText": { - "message": "显示安全和隐私设置" - }, - "notifications17Title": { - "message": "安全和隐私设置" - }, "notifications1Description": { "message": "MetaMask Mobile 用户现在可以在他们的移动钱包中交换代币。扫描二维码以获取移动应用程序并开始交换。", "description": "Description of a notification in the 'See What's New' popup. Describes the swapping on mobile feature." diff --git a/shared/notifications/index.js b/shared/notifications/index.js index f1a5ff738..10c24bbfe 100644 --- a/shared/notifications/index.js +++ b/shared/notifications/index.js @@ -81,13 +81,21 @@ export const UI_NOTIFICATIONS = { 16: { id: 16, date: null, + }, + 17: { + id: 17, + date: null, + }, + 18: { + id: 18, + date: null, image: { src: 'images/open-sea-security-provider.svg', width: '100%', }, }, - 17: { - id: 17, + 19: { + id: 19, date: null, image: { src: 'images/nfts.svg', @@ -240,34 +248,34 @@ export const getTranslatedUINotifications = (t, locale) => { ) : '', }, - 16: { - ...UI_NOTIFICATIONS[16], - title: t('notifications16Title'), + 18: { + ...UI_NOTIFICATIONS[18], + title: t('notifications18Title'), description: [ - t('notifications16DescriptionOne'), - t('notifications16DescriptionTwo'), - t('notifications16DescriptionThree'), + t('notifications18DescriptionOne'), + t('notifications18DescriptionTwo'), + t('notifications18DescriptionThree'), ], - actionText: t('notifications16ActionText'), - date: UI_NOTIFICATIONS[16].date + actionText: t('notifications18ActionText'), + date: UI_NOTIFICATIONS[18].date ? new Intl.DateTimeFormat(formattedLocale).format( - new Date(UI_NOTIFICATIONS[16].date), + new Date(UI_NOTIFICATIONS[18].date), ) : '', }, - 17: { - ...UI_NOTIFICATIONS[17], - title: t('notifications17Title'), + 19: { + ...UI_NOTIFICATIONS[19], + title: t('notifications19Title'), description: [ - t('notifications17DescriptionOne'), - t('notifications17DescriptionTwo'), - t('notifications17DescriptionThree'), + t('notifications19DescriptionOne'), + t('notifications19DescriptionTwo'), + t('notifications19DescriptionThree'), ], - actionText: t('notifications17ActionText'), - date: UI_NOTIFICATIONS[17].date + actionText: t('notifications19ActionText'), + date: UI_NOTIFICATIONS[19].date ? new Intl.DateTimeFormat(formattedLocale).format( - new Date(UI_NOTIFICATIONS[17].date), + new Date(UI_NOTIFICATIONS[19].date), ) : '', }, diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index 7661a726c..5771feb0c 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -114,11 +114,21 @@ function defaultFixture() { 16: { date: null, id: 16, - isShown: true, + isShown: false, }, 17: { date: null, id: 17, + isShown: false, + }, + 18: { + date: null, + id: 18, + isShown: true, + }, + 19: { + date: null, + id: 19, isShown: true, }, }, diff --git a/ui/components/app/whats-new-popup/whats-new-popup.js b/ui/components/app/whats-new-popup/whats-new-popup.js index 7d644a372..98c636e50 100644 --- a/ui/components/app/whats-new-popup/whats-new-popup.js +++ b/ui/components/app/whats-new-popup/whats-new-popup.js @@ -61,10 +61,16 @@ function getActionFunctionById(id, history) { }, 16: () => { updateViewedNotifications({ 16: true }); - history.push(`${EXPERIMENTAL_ROUTE}#transaction-security-check`); }, 17: () => { updateViewedNotifications({ 17: true }); + }, + 18: () => { + updateViewedNotifications({ 18: true }); + history.push(`${EXPERIMENTAL_ROUTE}#transaction-security-check`); + }, + 19: () => { + updateViewedNotifications({ 19: true }); history.push(`${EXPERIMENTAL_ROUTE}#autodetect-nfts`); }, }; @@ -266,8 +272,8 @@ export default function WhatsNewPopup({ onClose }) { const notification = getTranslatedUINotifications(t, locale)[id]; const isLast = index === notifications.length - 1; // Display the swaps notification with full image - // Displays the NFTs & OpenSea notifications 16,17 with full image - return index === 0 || id === 1 || id === 16 || id === 17 + // Displays the NFTs & OpenSea notifications 18,19 with full image + return index === 0 || id === 1 || id === 18 || id === 19 ? renderFirstNotification(notification, idRefMap, history, isLast) : renderSubsequentNotification( notification, diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index d3900e0a8..d374cd6e1 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -963,8 +963,10 @@ function getAllowedAnnouncementIds(state) { 13: false, 14: false, 15: false, - 16: true, - 17: true, + 16: false, + 17: false, + 18: true, + 19: true, }; } From d8e79188a55f4e7f118b752a8f0a57db33777600 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Thu, 6 Apr 2023 10:19:42 -0700 Subject: [PATCH 4/9] Fix locale file issues on chrome store (#18487) --- app/_locales/hi/messages.json | 4 ++-- app/_locales/ja/messages.json | 4 ++-- app/_locales/tr/messages.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 78cf97f61..500bc48fc 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -1604,11 +1604,11 @@ "description": "Is the bolded text in 'holdToRevealContent1'" }, "holdToRevealContent3": { - "message": "इसे किसी के साथ साझा न करें। $1$2", + "message": "इसे किसी के साथ साझा न करें। $1,$2", "description": "$1 is a message from 'holdToRevealContent4' and $2 is a text link with the message from 'holdToRevealContent5'" }, "holdToRevealContent4": { - "message": "MetaMask सपोर्ट इसका अनुरोध नहीं करेगा,", + "message": "MetaMask सपोर्ट इसका अनुरोध नहीं करेगा", "description": "Part of 'holdToRevealContent3'" }, "holdToRevealContent5": { diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 41796f382..6e1a716a9 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -1604,11 +1604,11 @@ "description": "Is the bolded text in 'holdToRevealContent1'" }, "holdToRevealContent3": { - "message": "これは誰にも教えないでください。$1$2", + "message": "これは誰にも教えないでください。$1、$2", "description": "$1 is a message from 'holdToRevealContent4' and $2 is a text link with the message from 'holdToRevealContent5'" }, "holdToRevealContent4": { - "message": "MetaMask サポートがこの情報を尋ねることはなく、", + "message": "MetaMask サポートがこの情報を尋ねることはなく", "description": "Part of 'holdToRevealContent3'" }, "holdToRevealContent5": { diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 17114accc..f8a4b63cd 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -1596,7 +1596,7 @@ "message": "GKİ'yi göstermek için basılı tut" }, "holdToRevealContent1": { - "message": "Gizli Kurtarma İfadeniz: $1$", + "message": "Gizli Kurtarma İfadeniz: $1", "description": "$1 is a bolded text with the message from 'holdToRevealContent2'" }, "holdToRevealContent2": { From afc7ec3a6a107c94268985d4b2b539ec257739e1 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Thu, 6 Apr 2023 15:18:17 -0230 Subject: [PATCH 5/9] Update change log --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad912f33..cdec2e759 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [10.28.2] +### Fixed +- Fix network switching prompted by dapps by fixing the `wallet_switchEthereumChain` handler. ([#18483](https://github.com/MetaMask/metamask-extension/pull/18483)) +- Fix to ensure all users see the NFT and transaction security notifications ([#18460](https://github.com/MetaMask/metamask-extension/pull/18460)) +- Fix issue blocking Hindi, Japanese and Turkish language users from installing from the Chrome store ([#18487](https://github.com/MetaMask/metamask-extension/pull/18487)) ## [10.28.1] ### Changed From 2cc41c9bb85559ea872b8eafd4d1774a2ff660de Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Tue, 11 Apr 2023 19:23:04 +0000 Subject: [PATCH 6/9] Version v10.28.3 --- CHANGELOG.md | 5 ++++- package.json | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdec2e759..a7423ec0a 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.28.3] + ## [10.28.2] ### Fixed - Fix network switching prompted by dapps by fixing the `wallet_switchEthereumChain` handler. ([#18483](https://github.com/MetaMask/metamask-extension/pull/18483)) @@ -3649,7 +3651,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.28.2...HEAD +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v10.28.3...HEAD +[10.28.3]: https://github.com/MetaMask/metamask-extension/compare/v10.28.2...v10.28.3 [10.28.2]: https://github.com/MetaMask/metamask-extension/compare/v10.28.1...v10.28.2 [10.28.1]: https://github.com/MetaMask/metamask-extension/compare/v10.28.0...v10.28.1 [10.28.0]: https://github.com/MetaMask/metamask-extension/compare/v10.27.0...v10.28.0 diff --git a/package.json b/package.json index 787b6d747..df2bfa370 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metamask-crx", - "version": "10.28.2", + "version": "10.28.3", "private": true, "repository": { "type": "git", From 6a14f12c760907e6329da66c7853a10c2295ccd8 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 11 Apr 2023 16:46:31 -0230 Subject: [PATCH 7/9] Ensure that all networkConfiguration object in networkController state have an id (#18513) * Ensure that all networkConfiguration object in networkController state have an id * Lint fix * Update app/scripts/migrations/084.ts Co-authored-by: Mark Stacey * Add unit tests for error cases * Simplify code * Remove unnecessary any typing * Fix network controller type checking * Lint fix * Improve typing --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Mark Stacey --- app/scripts/migrations/083.test.js | 254 +++++++++++++++++++++++++++++ app/scripts/migrations/083.ts | 58 +++++++ app/scripts/migrations/index.js | 2 + 3 files changed, 314 insertions(+) create mode 100644 app/scripts/migrations/083.test.js create mode 100644 app/scripts/migrations/083.ts diff --git a/app/scripts/migrations/083.test.js b/app/scripts/migrations/083.test.js new file mode 100644 index 000000000..c59951aef --- /dev/null +++ b/app/scripts/migrations/083.test.js @@ -0,0 +1,254 @@ +import { v4 } from 'uuid'; +import { migrate, version } from './083'; + +jest.mock('uuid', () => { + const actual = jest.requireActual('uuid'); + + return { + ...actual, + v4: jest.fn(), + }; +}); + +describe('migration #83', () => { + beforeEach(() => { + v4.mockImplementationOnce(() => 'network-configuration-id-1') + .mockImplementationOnce(() => 'network-configuration-id-2') + .mockImplementationOnce(() => 'network-configuration-id-3') + .mockImplementationOnce(() => 'network-configuration-id-4'); + }); + + afterEach(() => { + jest.resetAllMocks(); + }); + it('should update the version metadata', async () => { + const oldStorage = { + meta: { + version: 82, + }, + data: {}, + }; + + const newStorage = await migrate(oldStorage); + expect(newStorage.meta).toStrictEqual({ + version, + }); + }); + + it('should use the key of the networkConfigurations object to set the id of each network configuration', async () => { + const oldStorage = { + meta: { + version, + }, + data: { + NetworkController: { + networkConfigurations: { + 'network-configuration-id-1': { + chainId: '0x539', + nickname: 'Localhost 8545', + rpcPrefs: {}, + rpcUrl: 'http://localhost:8545', + ticker: 'ETH', + }, + 'network-configuration-id-2': { + chainId: '0xa4b1', + nickname: 'Arbitrum One', + rpcPrefs: { + blockExplorerUrl: 'https://explorer.arbitrum.io', + }, + rpcUrl: + 'https://arbitrum-mainnet.infura.io/v3/373266a93aab4acda48f89d4fe77c748', + ticker: 'ETH', + }, + 'network-configuration-id-3': { + chainId: '0x4e454152', + nickname: 'Aurora Mainnet', + rpcPrefs: { + blockExplorerUrl: 'https://aurorascan.dev/', + }, + rpcUrl: + 'https://aurora-mainnet.infura.io/v3/373266a93aab4acda48f89d4fe77c748', + ticker: 'Aurora ETH', + }, + 'network-configuration-id-4': { + chainId: '0x38', + nickname: + 'BNB Smart Chain (previously Binance Smart Chain Mainnet)', + rpcPrefs: { + blockExplorerUrl: 'https://bscscan.com/', + }, + rpcUrl: 'https://bsc-dataseed.binance.org/', + ticker: 'BNB', + }, + }, + }, + }, + }; + + const newStorage = await migrate(oldStorage); + + const expectedNewStorage = { + meta: { + version, + }, + data: { + NetworkController: { + networkConfigurations: { + 'network-configuration-id-1': { + chainId: '0x539', + nickname: 'Localhost 8545', + rpcPrefs: {}, + rpcUrl: 'http://localhost:8545', + ticker: 'ETH', + id: 'network-configuration-id-1', + }, + 'network-configuration-id-2': { + chainId: '0xa4b1', + nickname: 'Arbitrum One', + rpcPrefs: { + blockExplorerUrl: 'https://explorer.arbitrum.io', + }, + rpcUrl: + 'https://arbitrum-mainnet.infura.io/v3/373266a93aab4acda48f89d4fe77c748', + ticker: 'ETH', + id: 'network-configuration-id-2', + }, + 'network-configuration-id-3': { + chainId: '0x4e454152', + nickname: 'Aurora Mainnet', + rpcPrefs: { + blockExplorerUrl: 'https://aurorascan.dev/', + }, + rpcUrl: + 'https://aurora-mainnet.infura.io/v3/373266a93aab4acda48f89d4fe77c748', + ticker: 'Aurora ETH', + id: 'network-configuration-id-3', + }, + 'network-configuration-id-4': { + chainId: '0x38', + nickname: + 'BNB Smart Chain (previously Binance Smart Chain Mainnet)', + rpcPrefs: { + blockExplorerUrl: 'https://bscscan.com/', + }, + rpcUrl: 'https://bsc-dataseed.binance.org/', + ticker: 'BNB', + id: 'network-configuration-id-4', + }, + }, + }, + }, + }; + expect(newStorage).toStrictEqual(expectedNewStorage); + }); + + it('should not modify state if state.NetworkController is undefined', async () => { + const oldStorage = { + meta: { + version, + }, + data: { + testProperty: 'testValue', + }, + }; + + const newStorage = await migrate(oldStorage); + + const expectedNewStorage = { + meta: { + version, + }, + data: { + testProperty: 'testValue', + }, + }; + expect(newStorage).toStrictEqual(expectedNewStorage); + }); + + it('should not modify state if state.NetworkController is not an object', async () => { + const oldStorage = { + meta: { + version, + }, + data: { + NetworkController: false, + testProperty: 'testValue', + }, + }; + + const newStorage = await migrate(oldStorage); + + const expectedNewStorage = { + meta: { + version, + }, + data: { + NetworkController: false, + testProperty: 'testValue', + }, + }; + expect(newStorage).toStrictEqual(expectedNewStorage); + }); + + it('should not modify state if state.NetworkController.networkConfigurations is undefined', async () => { + const oldStorage = { + meta: { + version, + }, + data: { + NetworkController: { + testNetworkControllerProperty: 'testNetworkControllerValue', + networkConfigurations: undefined, + }, + testProperty: 'testValue', + }, + }; + + const newStorage = await migrate(oldStorage); + + const expectedNewStorage = { + meta: { + version, + }, + data: { + NetworkController: { + testNetworkControllerProperty: 'testNetworkControllerValue', + networkConfigurations: undefined, + }, + testProperty: 'testValue', + }, + }; + expect(newStorage).toStrictEqual(expectedNewStorage); + }); + + it('should not modify state if state.NetworkController.networkConfigurations is an empty object', async () => { + const oldStorage = { + meta: { + version, + }, + data: { + NetworkController: { + testNetworkControllerProperty: 'testNetworkControllerValue', + networkConfigurations: {}, + }, + testProperty: 'testValue', + }, + }; + + const newStorage = await migrate(oldStorage); + + const expectedNewStorage = { + meta: { + version, + }, + data: { + NetworkController: { + testNetworkControllerProperty: 'testNetworkControllerValue', + networkConfigurations: {}, + }, + testProperty: 'testValue', + }, + }; + expect(newStorage).toStrictEqual(expectedNewStorage); + }); +}); diff --git a/app/scripts/migrations/083.ts b/app/scripts/migrations/083.ts new file mode 100644 index 000000000..cc3e3b16b --- /dev/null +++ b/app/scripts/migrations/083.ts @@ -0,0 +1,58 @@ +import { cloneDeep } from 'lodash'; +import { isObject } from '@metamask/utils'; + +export const version = 83; + +/** + * Ensure that each networkConfigurations object in state.NetworkController.networkConfigurations has an + * `id` property which matches the key pointing that object + * + * @param originalVersionedData - Versioned MetaMask extension state, exactly what we persist to dist. + * @param originalVersionedData.meta - State metadata. + * @param originalVersionedData.meta.version - The current state version. + * @param originalVersionedData.data - The persisted MetaMask state, keyed by controller. + * @returns Updated versioned MetaMask extension state. + */ +export async function migrate(originalVersionedData: { + meta: { version: number }; + data: Record; +}) { + const versionedData = cloneDeep(originalVersionedData); + versionedData.meta.version = version; + versionedData.data = transformState(versionedData.data); + return versionedData; +} + +function transformState(state: Record) { + if (!isObject(state.NetworkController)) { + return state; + } + const { NetworkController } = state; + + if (!isObject(NetworkController.networkConfigurations)) { + return state; + } + + const { networkConfigurations } = NetworkController; + + const newNetworkConfigurations: Record> = {}; + + for (const networkConfigurationId of Object.keys(networkConfigurations)) { + const networkConfiguration = networkConfigurations[networkConfigurationId]; + if (!isObject(networkConfiguration)) { + return state; + } + newNetworkConfigurations[networkConfigurationId] = { + ...networkConfiguration, + id: networkConfigurationId, + }; + } + + return { + ...state, + NetworkController: { + ...NetworkController, + networkConfigurations: newNetworkConfigurations, + }, + }; +} diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index fdd29924c..c3f8e515f 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -86,6 +86,7 @@ import m079 from './079'; import m080 from './080'; import * as m081 from './081'; import * as m082 from './082'; +import * as m083 from './083'; const migrations = [ m002, @@ -169,6 +170,7 @@ const migrations = [ m080, m081, m082, + m083, ]; export default migrations; From 8220051390650845b934dcff98769102545042c0 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 11 Apr 2023 17:49:08 -0230 Subject: [PATCH 8/9] Fix changelog for v10.28.3 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7423ec0a..1be32abe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [10.28.3] +### Fixed +- Fix network switching prompted by dapps for users that added the network prior to v10.28.0. ([#18513](https://github.com/MetaMask/metamask-extension/pull/18513)) ## [10.28.2] ### Fixed From 0ef26802946de22456086a1902515399ff488f00 Mon Sep 17 00:00:00 2001 From: legobeat <109787230+legobeat@users.noreply.github.com> Date: Sun, 9 Apr 2023 10:42:45 +0900 Subject: [PATCH 9/9] deps/security: vm2@3.9.11->3.9.15 (#18512) Fixes CVE-2023-29017 / GHSA-7jxr-cg7f-gpgv --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index c770a116f..82cfd53d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -34506,14 +34506,14 @@ __metadata: linkType: hard "vm2@npm:^3.9.3": - version: 3.9.11 - resolution: "vm2@npm:3.9.11" + version: 3.9.15 + resolution: "vm2@npm:3.9.15" dependencies: acorn: ^8.7.0 acorn-walk: ^8.2.0 bin: vm2: bin/vm2 - checksum: aab39e6e4b59146d24abacd79f490e854a6e058a8b23d93d2be5aca7720778e2605d2cc028ccc4a5f50d3d91b0c38be9a6247a80d2da1a6de09425cc437770b4 + checksum: 1df70d5a88173651c0062901aba67e5edfeeb3f699fe6c305f5efb6a5a7391e5724cbf98a6516600b65016c6824dc07cc79947ea4222f8537ae1d9ce0b730ad7 languageName: node linkType: hard