From 3552941323a9ddb8818c27fd4c789db17b3fc7df Mon Sep 17 00:00:00 2001 From: Victorien Gauch <85494462+VGau@users.noreply.github.com> Date: Tue, 21 Mar 2023 17:28:38 +0100 Subject: [PATCH] feat: add the ConsenSys zkEVM (Linea) as a default network (#17875) * feat: add the consensys zkEVM as a default network * fix: change infuraNetworkStatus in navigate-txs file * fix: remove account tracker for zkEVM + remove zkEVM from infura list * fix: change consensys zkevm name to linea + change rpc url for linea network * fix: rebase conflicts * feat: add new colors for linea goerli network * feat: add new function inside network dropdown to render non infura networks * feat: add feature toggle for linea network * fix: add new unit test --------- Co-authored-by: Dan J Miller --- app/_locales/am/messages.json | 6 ++ app/_locales/ar/messages.json | 6 ++ app/_locales/bg/messages.json | 6 ++ app/_locales/ca/messages.json | 6 ++ app/_locales/da/messages.json | 6 ++ app/_locales/de/messages.json | 6 ++ app/_locales/el/messages.json | 6 ++ app/_locales/en/messages.json | 6 ++ app/_locales/es/messages.json | 6 ++ app/_locales/es_419/messages.json | 6 ++ app/_locales/et/messages.json | 6 ++ app/_locales/fa/messages.json | 6 ++ app/_locales/fi/messages.json | 6 ++ app/_locales/fil/messages.json | 3 + app/_locales/fr/messages.json | 6 ++ app/_locales/he/messages.json | 6 ++ app/_locales/hi/messages.json | 6 ++ app/_locales/hr/messages.json | 6 ++ app/_locales/hu/messages.json | 6 ++ app/_locales/id/messages.json | 6 ++ app/_locales/it/messages.json | 6 ++ app/_locales/ja/messages.json | 6 ++ app/_locales/kn/messages.json | 6 ++ app/_locales/ko/messages.json | 6 ++ app/_locales/lt/messages.json | 6 ++ app/_locales/lv/messages.json | 6 ++ app/_locales/ms/messages.json | 6 ++ app/_locales/no/messages.json | 3 + app/_locales/ph/messages.json | 6 ++ app/_locales/pl/messages.json | 6 ++ app/_locales/pt/messages.json | 6 ++ app/_locales/pt_BR/messages.json | 6 ++ app/_locales/ro/messages.json | 6 ++ app/_locales/ru/messages.json | 6 ++ app/_locales/sk/messages.json | 6 ++ app/_locales/sl/messages.json | 6 ++ app/_locales/sr/messages.json | 6 ++ app/_locales/sv/messages.json | 6 ++ app/_locales/sw/messages.json | 6 ++ app/_locales/tl/messages.json | 6 ++ app/_locales/tr/messages.json | 6 ++ app/_locales/uk/messages.json | 6 ++ app/_locales/vi/messages.json | 6 ++ app/_locales/zh_CN/messages.json | 6 ++ app/_locales/zh_TW/messages.json | 6 ++ .../handlers/switch-ethereum-chain.js | 3 +- development/states/navigate-txs.json | 3 +- shared/constants/network.ts | 27 +++++++ .../app/dropdowns/network-dropdown.js | 80 +++++++++++++++++-- .../app/dropdowns/network-dropdown.test.js | 19 ++++- .../loading-network-screen.component.js | 2 + .../signature-request-original.component.js | 2 + .../signature-request.component.js | 2 + ui/components/ui/typography/typography.js | 2 + ui/css/design-system/colors.scss | 2 + ui/css/itcss/components/network.scss | 4 + ui/css/utilities/colors.scss | 2 + ui/helpers/constants/design-system.ts | 8 ++ ui/helpers/constants/settings.js | 7 ++ ui/helpers/utils/settings-search.test.js | 2 +- ui/helpers/utils/util.js | 1 + ui/helpers/utils/util.test.js | 11 +++ ui/pages/routes/routes.component.js | 2 + .../networks-tab/networks-tab.constants.js | 10 +++ .../settings/networks-tab/networks-tab.js | 40 ++++++---- ui/store/actions.ts | 2 + 66 files changed, 469 insertions(+), 26 deletions(-) diff --git a/app/_locales/am/messages.json b/app/_locales/am/messages.json index 8d86237b5..155a3286c 100644 --- a/app/_locales/am/messages.json +++ b/app/_locales/am/messages.json @@ -172,6 +172,9 @@ "connectingToGoerli": { "message": "ከ Goerli የሙከራ አውታረ መረብ ጋር መገናኘት" }, + "connectingToLineaTestnet": { + "message": "ከ Linea Goerli የሙከራ አውታረ መረብ ጋር መገናኘት" + }, "connectingToMainnet": { "message": "ከዋናው የ Ethereum አውታረ መረብ ጋር መገናኘት" }, @@ -425,6 +428,9 @@ "likeToImportTokens": { "message": "እነዚህን ተለዋጭ ስሞች ለማከል ይፈልጋሉ?" }, + "lineatestnet": { + "message": "የ Linea Goerli የሙከራ አውታረ መረብ" + }, "links": { "message": "ማስፈንጠሪያዎች" }, diff --git a/app/_locales/ar/messages.json b/app/_locales/ar/messages.json index b1462ad75..50d252b1b 100644 --- a/app/_locales/ar/messages.json +++ b/app/_locales/ar/messages.json @@ -182,6 +182,9 @@ "connectingToGoerli": { "message": "الاتصال بشبكة اختبار Goerli" }, + "connectingToLineaTestnet": { + "message": "الاتصال بشبكة اختبار Linea Goerli" + }, "connectingToMainnet": { "message": "جارِ الاتصال بشبكة إيثيريوم الرئيسية" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "هل ترغب في إضافة هذه الرموز؟" }, + "lineatestnet": { + "message": "شبكة اختبار Linea Goerli" + }, "links": { "message": "الروابط" }, diff --git a/app/_locales/bg/messages.json b/app/_locales/bg/messages.json index 5eb731605..ea6d78ee6 100644 --- a/app/_locales/bg/messages.json +++ b/app/_locales/bg/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Свързване с тестова мрежа на Goerli" }, + "connectingToLineaTestnet": { + "message": "Свързване с тестова мрежа на Linea Goerli" + }, "connectingToMainnet": { "message": "Свързване с главната мрежа Ethereum" }, @@ -433,6 +436,9 @@ "likeToImportTokens": { "message": "Искате ли да добавите тези жетони?" }, + "lineatestnet": { + "message": "Тестова мрежа на Linea Goerli" + }, "links": { "message": "Връзки" }, diff --git a/app/_locales/ca/messages.json b/app/_locales/ca/messages.json index bae263733..b206f37dd 100644 --- a/app/_locales/ca/messages.json +++ b/app/_locales/ca/messages.json @@ -175,6 +175,9 @@ "connectingToGoerli": { "message": "Connectant a Xarxa de Prova Goerli" }, + "connectingToLineaTestnet": { + "message": "Connectant a Xarxa de Prova Linea Goerli" + }, "connectingToMainnet": { "message": "Connectant a Xarxa Principal Ethereum" }, @@ -424,6 +427,9 @@ "likeToImportTokens": { "message": "T'agradaria afegir aquestes fitxes?" }, + "lineatestnet": { + "message": "Xarxa de test Linea Goerli" + }, "links": { "message": "Enllaços" }, diff --git a/app/_locales/da/messages.json b/app/_locales/da/messages.json index f0d400c0e..4640d2957 100644 --- a/app/_locales/da/messages.json +++ b/app/_locales/da/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Opretter forbindelse til Goerli Testnetværk" }, + "connectingToLineaTestnet": { + "message": "Opretter forbindelse til Linea Goerli Testnetværk" + }, "connectingToMainnet": { "message": "Forbinder til dit Primære Ethereum Netværk" }, @@ -430,6 +433,9 @@ "likeToImportTokens": { "message": "Ønsker du at tilføje disse tokens?" }, + "lineatestnet": { + "message": "Linea-testnetværk" + }, "loadMore": { "message": "Indlæs Mere" }, diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index be6cb7785..7890f6927 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Verbindungsaufbau zum Goerli-Testnetzwerk" }, + "connectingToLineaTestnet": { + "message": "Verbindungsaufbau zum Linea-Testnetzwerk" + }, "connectingToMainnet": { "message": "Verbinde zum Ethereum Mainnet" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Möchtest du diese Token hinzufügen?" }, + "lineatestnet": { + "message": "Linea-Testnetzwerk" + }, "link": { "message": "Link" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index df76ccafa..0f487ff17 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Σύνδεση στο Δίκτυο Δοκιμής Goerli" }, + "connectingToLineaTestnet": { + "message": "Σύνδεση στο δίκτυο δοκιμών Linea Goerli" + }, "connectingToMainnet": { "message": "Σύνδεση στο Κύριο Δίκτυο Ethereum" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Θέλετε να προσθέσετε αυτά τα token;" }, + "lineatestnet": { + "message": "Δίκτυο δοκιμών Linea Goerli" + }, "link": { "message": "Σύνδεσμος" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 12a2abfef..49ad840b2 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -743,6 +743,9 @@ "connectingToGoerli": { "message": "Connecting to Goerli test network" }, + "connectingToLineaTestnet": { + "message": "Connecting to Linea Goerli test network" + }, "connectingToMainnet": { "message": "Connecting to Ethereum Mainnet" }, @@ -1836,6 +1839,9 @@ "likeToImportTokens": { "message": "Would you like to import these tokens?" }, + "lineatestnet": { + "message": "Linea Goerli test network" + }, "link": { "message": "Link" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 22d7489d6..aa1104a2d 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Estableciendo conexión a la red de prueba Goerli" }, + "connectingToLineaTestnet": { + "message": "Conectando a la red de prueba Linea Goerli" + }, "connectingToMainnet": { "message": "Estableciendo conexión a la red principal de Ethereum" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "¿Le gustaría agregar estos tokens?" }, + "lineatestnet": { + "message": "Red de prueba Linea Goerli" + }, "link": { "message": "Vínculo" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index 774f552c7..b8e429718 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -469,6 +469,9 @@ "connectingToGoerli": { "message": "Estableciendo conexión a la red de prueba Goerli" }, + "connectingToLineaTestnet": { + "message": "Estableciendo conexión a la red de prueba Linea Goerli" + }, "connectingToMainnet": { "message": "Estableciendo conexión a la red principal de Ethereum" }, @@ -1308,6 +1311,9 @@ "likeToImportTokens": { "message": "¿Quiere agregar estos tokens?" }, + "lineatestnet": { + "message": "Red de prueba Linea Goerli" + }, "link": { "message": "Enlace" }, diff --git a/app/_locales/et/messages.json b/app/_locales/et/messages.json index e6879d2d6..ba3c7b7ba 100644 --- a/app/_locales/et/messages.json +++ b/app/_locales/et/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Ühendamine Goerli testvõrguga" }, + "connectingToLineaTestnet": { + "message": "Ühendamine Linea Goerli testvõrguga" + }, "connectingToMainnet": { "message": "Ühenduse loomine peamise Etherumi võrguga" }, @@ -433,6 +436,9 @@ "likeToImportTokens": { "message": "Kas soovite need load lisada?" }, + "lineatestnet": { + "message": "Linea Goerli testvõrk" + }, "links": { "message": "Lingid" }, diff --git a/app/_locales/fa/messages.json b/app/_locales/fa/messages.json index 1b1a1ff53..084da8b5b 100644 --- a/app/_locales/fa/messages.json +++ b/app/_locales/fa/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "در حال اتصال به شبکه آزمایشی Goerli " }, + "connectingToLineaTestnet": { + "message": "در حال اتصال به شبکه آزمایشی Linea Goerli" + }, "connectingToMainnet": { "message": "در حال اتصال به شبکه اصلی ایتریم" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "آیا میخواهید این رمزیاب ها را اضافه نمایید؟" }, + "lineatestnet": { + "message": "شبکه آزمایشی Linea Goerli" + }, "links": { "message": "لینک ها" }, diff --git a/app/_locales/fi/messages.json b/app/_locales/fi/messages.json index 2cff7d700..46d6a0fac 100644 --- a/app/_locales/fi/messages.json +++ b/app/_locales/fi/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Yhdistetään Goerlin testiverkostoon" }, + "connectingToLineaTestnet": { + "message": "Yhdistetään Linea Goerli testiverkostoon" + }, "connectingToMainnet": { "message": "Yhdistetään Ethereumin pääverkkoon" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "Haluaisitko lisätä nämä poletit?" }, + "lineatestnet": { + "message": "Linea-testiverkko" + }, "links": { "message": "Linkit" }, diff --git a/app/_locales/fil/messages.json b/app/_locales/fil/messages.json index 8168dc729..5c4207eab 100644 --- a/app/_locales/fil/messages.json +++ b/app/_locales/fil/messages.json @@ -157,6 +157,9 @@ "connectingToGoerli": { "message": "Kumokonekta sa Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Kumokonekta sa Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Kumokonekta sa Ethereum Mainnet" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 909e07417..545919216 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Connexion au testnet Goerli" }, + "connectingToLineaTestnet": { + "message": "Connexion au réseau de test Linea Goerli" + }, "connectingToMainnet": { "message": "Connexion au réseau principal Ethereum" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Souhaitez-vous ajouter ces jetons ?" }, + "lineatestnet": { + "message": "Réseau de test Linea Goerli" + }, "link": { "message": "Associer" }, diff --git a/app/_locales/he/messages.json b/app/_locales/he/messages.json index 94543a14f..22cfe088b 100644 --- a/app/_locales/he/messages.json +++ b/app/_locales/he/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "מתחבר ל-Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "מתחבר ל-Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "מתחבר לרשת אתריום הראשית" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "האם ברצונך להוסיף טוקנים אלה?" }, + "lineatestnet": { + "message": "רשת בדיקה Linea Goerli" + }, "links": { "message": "קישורים" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 256e5b166..e232416af 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Goerli टेस्ट नेटवर्क से कनेक्ट हो रहा है" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli टेस्ट नेटवर्क से कनेक्ट हो रहा है" + }, "connectingToMainnet": { "message": "Ethereum Mainnet से कनेक्ट हो रहा है" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "क्या आप इन टोकन को इंपोर्ट करना चाहते हैं?" }, + "lineatestnet": { + "message": "Linea Goerli टेस्ट नेटवर्क" + }, "link": { "message": "लिंक" }, diff --git a/app/_locales/hr/messages.json b/app/_locales/hr/messages.json index d959ef76c..ac747094d 100644 --- a/app/_locales/hr/messages.json +++ b/app/_locales/hr/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Povezivanje na testnu mrežu Goerli" }, + "connectingToLineaTestnet": { + "message": "Povezivanje na testnu mrežu Linea Goerli" + }, "connectingToMainnet": { "message": "Povezivanje na glavnu mrežu Ethereum" }, @@ -433,6 +436,9 @@ "likeToImportTokens": { "message": "Želite li dodati ove tokene?" }, + "lineatestnet": { + "message": "Testna mreža Linea Goerli" + }, "links": { "message": "Poveznice" }, diff --git a/app/_locales/hu/messages.json b/app/_locales/hu/messages.json index 1c0a5c87f..040a7822e 100644 --- a/app/_locales/hu/messages.json +++ b/app/_locales/hu/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Csatlakozás a Goerli teszthálózathoz" }, + "connectingToLineaTestnet": { + "message": "Csatlakozás a Linea Goerli teszthálózathoz" + }, "connectingToMainnet": { "message": "Csatlakozás a fő Ethereum hálózathoz" }, @@ -433,6 +436,9 @@ "likeToImportTokens": { "message": "Hozzá szeretné adni ezeket az érméket?" }, + "lineatestnet": { + "message": "Linea Goerli teszthálózat" + }, "links": { "message": "Linkek" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 65d3d6969..077a53028 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Menghubungkan ke jaringan uji Goerli" }, + "connectingToLineaTestnet": { + "message": "Menghubungkan ke jaringan uji Linea Goerli" + }, "connectingToMainnet": { "message": "Menghubungkan ke Ethereum Mainnet" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Apakah Anda ingin menambahkan token ini?" }, + "lineatestnet": { + "message": "Jaringan uji Linea Goerli" + }, "link": { "message": "Tautan" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index ed5798e4d..8bb36f323 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -599,6 +599,9 @@ "connectingToGoerli": { "message": "Connessione alla Rete di Test Goerli" }, + "connectingToLineaTestnet": { + "message": "Connessione alla Rete di test Linea Goerli" + }, "connectingToMainnet": { "message": "Connessione alla Rete Ethereum Principale" }, @@ -1210,6 +1213,9 @@ "likeToImportTokens": { "message": "Vorresti aggiungere questi token?" }, + "lineatestnet": { + "message": "Rete di test Linea Goerli" + }, "links": { "message": "Collegamenti" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 797c53435..a78e13c19 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Goerliテストネットワークに接続中" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli テストネットワークに接続中" + }, "connectingToMainnet": { "message": "イーサリアムメインネットに接続中" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "これらのトークンを追加しますか?" }, + "lineatestnet": { + "message": "Linea Goerli テストネットワーク" + }, "link": { "message": "リンク" }, diff --git a/app/_locales/kn/messages.json b/app/_locales/kn/messages.json index 2c58b461f..f4b75091e 100644 --- a/app/_locales/kn/messages.json +++ b/app/_locales/kn/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Goerli ಪರೀಕ್ಷಾ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಸಂಪರ್ಕಿಸಲಾಗುತ್ತಿದೆ" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli ಪರೀಕ್ಷಾ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಸಂಪರ್ಕಿಸಲಾಗುತ್ತಿದೆ" + }, "connectingToMainnet": { "message": "ಮುಖ್ಯ ಎಥೆರಿಯಮ್ ನೆಟ್‌ವರ್ಕ್‌ಗೆ ಸಂಪರ್ಕಿಸಲಾಗುತ್ತಿದೆ" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "ನೀವು ಈ ಟೋಕನ್‌ಗಳನ್ನು ಸೇರಿಸಲು ಬಯಸುತ್ತೀರಾ?" }, + "lineatestnet": { + "message": "Linea Goerli ಪರೀಕ್ಷೆ ನೆಟ್‌ವರ್ಕ್" + }, "links": { "message": "ಲಿಂಕ್‌ಗಳು" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 9988fc17b..4fd899110 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Goerli 테스트 네트워크에 연결 중" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli 테스트 네트워크에 연결 중" + }, "connectingToMainnet": { "message": "이더리움 메인넷에 연결 중" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "이 토큰을 추가할까요?" }, + "lineatestnet": { + "message": "Linea Goerli 테스트 네트워크" + }, "link": { "message": "링크" }, diff --git a/app/_locales/lt/messages.json b/app/_locales/lt/messages.json index 76765856f..e5942963d 100644 --- a/app/_locales/lt/messages.json +++ b/app/_locales/lt/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Jungiamasi prie „Goerli“ bandomojo tinklo" }, + "connectingToLineaTestnet": { + "message": "Jungiamasi prie „Linea“ bandomojo tinklo" + }, "connectingToMainnet": { "message": "Jungiamasi prie pagrindinio „Ethereum“ tinklo" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "Ar norėtumėte pridėti šiuos žetonus?" }, + "lineatestnet": { + "message": "„Linea“ bandomasis tinklas" + }, "links": { "message": "Nuorodos" }, diff --git a/app/_locales/lv/messages.json b/app/_locales/lv/messages.json index 4a16847d0..906b990e7 100644 --- a/app/_locales/lv/messages.json +++ b/app/_locales/lv/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Pieslēdzas Goerli testa tīklam" }, + "connectingToLineaTestnet": { + "message": "Pieslēdzas Linea Goerli testa tīklam" + }, "connectingToMainnet": { "message": "Savienojas ar galveno Ethereum tīklu" }, @@ -433,6 +436,9 @@ "likeToImportTokens": { "message": "Vai vēlaties pievienot šos marķierus?" }, + "lineatestnet": { + "message": "Linea Goerli testa tīkls" + }, "links": { "message": "Saites" }, diff --git a/app/_locales/ms/messages.json b/app/_locales/ms/messages.json index 95865e4c2..86a29324f 100644 --- a/app/_locales/ms/messages.json +++ b/app/_locales/ms/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Menyambung kepada Rangkaian Ujian Goerli" }, + "connectingToLineaTestnet": { + "message": "Menyambung kepada Rangkaian Ujian Linea Goerli" + }, "connectingToMainnet": { "message": "Menyambung kepada Rangkaian Ethereum Utama" }, @@ -426,6 +429,9 @@ "likeToImportTokens": { "message": "Adakah anda ingin menambah token ini?" }, + "lineatestnet": { + "message": "Rangkaian Ujian Linea Goerli" + }, "links": { "message": "Pautan" }, diff --git a/app/_locales/no/messages.json b/app/_locales/no/messages.json index 46788f1c2..b8dfff373 100644 --- a/app/_locales/no/messages.json +++ b/app/_locales/no/messages.json @@ -175,6 +175,9 @@ "connectingToGoerli": { "message": "Oppretter forbindelse med Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Oppretter forbindelse med Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Forbinder med hoved-Ethereumnettverk " }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index c972807c7..5f89b000a 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -332,6 +332,9 @@ "connectingToGoerli": { "message": "Kumokonekta sa Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Kumokonekta sa Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Kumokonekta sa Ethereum Mainnet" }, @@ -840,6 +843,9 @@ "likeToImportTokens": { "message": "Gusto mo bang idagdag ang mga token na ito?" }, + "lineatestnet": { + "message": "Linea Goerli Test Network" + }, "links": { "message": "Mga Link" }, diff --git a/app/_locales/pl/messages.json b/app/_locales/pl/messages.json index a403f46de..424615fa4 100644 --- a/app/_locales/pl/messages.json +++ b/app/_locales/pl/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Łączenie z siecią testową Goerli" }, + "connectingToLineaTestnet": { + "message": "Łączenie z siecią testową Linea Goerli" + }, "connectingToMainnet": { "message": "Łączenie z główną siecią Ethereum" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "Czy chcesz dodać te tokeny?" }, + "lineatestnet": { + "message": "Sieć testowa Linea Goerli" + }, "links": { "message": "Łącza" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index bfe7febde..7f1f61efd 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Conectando à rede de testes Goerli" }, + "connectingToLineaTestnet": { + "message": "Conectando à rede de teste Linea Goerli" + }, "connectingToMainnet": { "message": "Conectando à mainnet do Ethereum" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Gostaria de adicionar estes tokens?" }, + "lineatestnet": { + "message": "Rede de teste Linea Goerli" + }, "link": { "message": "Link" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index ae06eebdc..e5d15ee42 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -469,6 +469,9 @@ "connectingToGoerli": { "message": "Conectando à rede de testes Goerli" }, + "connectingToLineaTestnet": { + "message": "Conectando à rede de testes Linea Goerli" + }, "connectingToMainnet": { "message": "Conectando à mainnet do Ethereum" }, @@ -1308,6 +1311,9 @@ "likeToImportTokens": { "message": "Você gostaria de importar esses tokens?" }, + "lineatestnet": { + "message": "Rede de testes Linea Goerli" + }, "link": { "message": "Link" }, diff --git a/app/_locales/ro/messages.json b/app/_locales/ro/messages.json index 44efbb0cc..3592f2faa 100644 --- a/app/_locales/ro/messages.json +++ b/app/_locales/ro/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Se conectează la rețeaua de test Goerli" }, + "connectingToLineaTestnet": { + "message": "Se conectează la rețeaua de test Linea Goerli" + }, "connectingToMainnet": { "message": "Se conectează la rețeaua Ethereum principală" }, @@ -427,6 +430,9 @@ "likeToImportTokens": { "message": "Adăugați aceste indicative?" }, + "lineatestnet": { + "message": "Rețea de test Linea Goerli" + }, "links": { "message": "Link-uri" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 2221e078b..efc0c1ec7 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Подключение к тестовой сети Goerli..." }, + "connectingToLineaTestnet": { + "message": "Подключение к тестовой сети Linea..." + }, "connectingToMainnet": { "message": "Подключение к сети Ethereum Mainnet..." }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Вы хотели бы импортировать эти токены?" }, + "lineatestnet": { + "message": "Тестовая сеть Linea Goerli" + }, "link": { "message": "Привязать" }, diff --git a/app/_locales/sk/messages.json b/app/_locales/sk/messages.json index b43ecd63f..29b29567c 100644 --- a/app/_locales/sk/messages.json +++ b/app/_locales/sk/messages.json @@ -172,6 +172,9 @@ "connectingToGoerli": { "message": "Pripája sa k testovacej sieti Goerli" }, + "connectingToLineaTestnet": { + "message": "Pripája sa k testovacej sieti Linea Goerli" + }, "connectingToMainnet": { "message": "Připojuji se k Ethereum Mainnet" }, @@ -424,6 +427,9 @@ "likeToImportTokens": { "message": "Chcete přidat tyto tokeny?" }, + "lineatestnet": { + "message": "Testovacia sieť Linea Goerli" + }, "links": { "message": "Odkazy" }, diff --git a/app/_locales/sl/messages.json b/app/_locales/sl/messages.json index fca992011..386e4e8a8 100644 --- a/app/_locales/sl/messages.json +++ b/app/_locales/sl/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Povezovanje na testno omrežje Goerli" }, + "connectingToLineaTestnet": { + "message": "Povezovanje na testno omrežje Linea Goerli" + }, "connectingToMainnet": { "message": "Povezovanje na glavno omrežje" }, @@ -431,6 +434,9 @@ "likeToImportTokens": { "message": "Želite dodati te žetone?" }, + "lineatestnet": { + "message": "Testno omrežje Linea Goerli" + }, "links": { "message": "Povezave" }, diff --git a/app/_locales/sr/messages.json b/app/_locales/sr/messages.json index 72e8eb829..5308a5653 100644 --- a/app/_locales/sr/messages.json +++ b/app/_locales/sr/messages.json @@ -175,6 +175,9 @@ "connectingToGoerli": { "message": "Povezuje se sa test mrežom Goerli " }, + "connectingToLineaTestnet": { + "message": "Povezuje se sa test mrežom Linea Goerli" + }, "connectingToMainnet": { "message": "Povezuje se na glavnu Ethereum mrežu" }, @@ -434,6 +437,9 @@ "likeToImportTokens": { "message": "Želite li da dodate ove tokene?" }, + "lineatestnet": { + "message": "Test mreža Linea Goerli" + }, "links": { "message": "Veze" }, diff --git a/app/_locales/sv/messages.json b/app/_locales/sv/messages.json index b73e7c7f5..a5b365916 100644 --- a/app/_locales/sv/messages.json +++ b/app/_locales/sv/messages.json @@ -172,6 +172,9 @@ "connectingToGoerli": { "message": "Ansluter till Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Ansluter till Linea Goerli Test Network" + }, "connectingToMainnet": { "message": "Koppla till Ethereums huvudnätverk" }, @@ -427,6 +430,9 @@ "likeToImportTokens": { "message": "Vill du lägga till dessa tokens?" }, + "lineatestnet": { + "message": "Linea Goerli testnätverk" + }, "links": { "message": "Länkar" }, diff --git a/app/_locales/sw/messages.json b/app/_locales/sw/messages.json index 59e28b5c7..4884f08c6 100644 --- a/app/_locales/sw/messages.json +++ b/app/_locales/sw/messages.json @@ -172,6 +172,9 @@ "connectingToGoerli": { "message": "Inaunganisha kwenye Mtandao wa Majaribio wa Goerli" }, + "connectingToLineaTestnet": { + "message": "Inaunganisha kwenye Mtandao wa Majaribio wa Linea Goerli" + }, "connectingToMainnet": { "message": "Inaunganisha kwenye Mtandao Mkuu wa Ethereum" }, @@ -424,6 +427,9 @@ "likeToImportTokens": { "message": "Je, ungependa kuongeza vianzio hivi?" }, + "lineatestnet": { + "message": "Mtandao wa Majaribio wa Linea Goerli" + }, "links": { "message": "Viungo" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index ef92e1c31..d49004713 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Kumokonekta sa Goerli Test Network" }, + "connectingToLineaTestnet": { + "message": "Kumokonekta sa Linea Goerli test network" + }, "connectingToMainnet": { "message": "Kumokonekta sa Ethereum Mainnet" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Gusto mo bang idagdag ang mga token na ito?" }, + "lineatestnet": { + "message": "Linea Goerli test network" + }, "link": { "message": "Link" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index bc120bb11..ffa5f6c6a 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Goerli Test Ağına Bağlanıyor" }, + "connectingToLineaTestnet": { + "message": "Linea Goerli test ağına bağlanılıyor" + }, "connectingToMainnet": { "message": "Ethereum Mainnet ağına bağlanıyor" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Bu tokenleri içe aktarmak ister misiniz?" }, + "lineatestnet": { + "message": "Linea Goerli test ağı" + }, "link": { "message": "Bağlantı" }, diff --git a/app/_locales/uk/messages.json b/app/_locales/uk/messages.json index 69fa453ba..3a1748a5d 100644 --- a/app/_locales/uk/messages.json +++ b/app/_locales/uk/messages.json @@ -178,6 +178,9 @@ "connectingToGoerli": { "message": "Підключення до тестової мережі Goerli" }, + "connectingToLineaTestnet": { + "message": "Підключення до тестової мережі Linea Goerli" + }, "connectingToMainnet": { "message": "З'єднуємось з Головною мережею Ethereum" }, @@ -437,6 +440,9 @@ "likeToImportTokens": { "message": "Ви б хотіли додати ці токени?" }, + "lineatestnet": { + "message": "Тестова мережа Linea Goerli" + }, "links": { "message": "Посилання" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index bc03a062d..0fbff37ab 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "Đang kết nối với mạng thử nghiệm Goerli" }, + "connectingToLineaTestnet": { + "message": "Đang kết nối với mạng thử nghiệm Linea Goerli" + }, "connectingToMainnet": { "message": "Đang kết nối với mạng chính thức của Ethereum" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "Bạn có muốn nhập những token này không?" }, + "lineatestnet": { + "message": "Mạng thử nghiệm Linea Goerli" + }, "link": { "message": "Liên kết" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index e7f16c271..986e750c1 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -736,6 +736,9 @@ "connectingToGoerli": { "message": "正在连接 Goerli 测试网络" }, + "connectingToLineaTestnet": { + "message": "正在连接Linea测试网络" + }, "connectingToMainnet": { "message": "正在连接到以太坊主网" }, @@ -1813,6 +1816,9 @@ "likeToImportTokens": { "message": "您想导入这些代币吗?" }, + "lineatestnet": { + "message": "Linea测试网络" + }, "link": { "message": "链接" }, diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json index 16b1843a4..6d56de0c3 100644 --- a/app/_locales/zh_TW/messages.json +++ b/app/_locales/zh_TW/messages.json @@ -331,6 +331,9 @@ "connectingToGoerli": { "message": "連線到 Goerli 測試網路" }, + "connectingToLineaTestnet": { + "message": "連線到 Linea Goerli 測試網路" + }, "connectingToMainnet": { "message": "連線到 Ethereum 主網路" }, @@ -854,6 +857,9 @@ "likeToImportTokens": { "message": "確定要加入代幣?" }, + "lineatestnet": { + "message": "Linea Goerli 測試網路" + }, "links": { "message": "連結" }, 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 7c5edc155..c3a0bbfe8 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 @@ -110,7 +110,8 @@ async function switchEthereumChainHandler( }); if ( chainId in CHAIN_ID_TO_TYPE_MAP && - approvedRequestData.type !== NETWORK_TYPES.LOCALHOST + approvedRequestData.type !== NETWORK_TYPES.LOCALHOST && + approvedRequestData.type !== NETWORK_TYPES.LINEA_TESTNET ) { setProviderType(approvedRequestData.type); } else { diff --git a/development/states/navigate-txs.json b/development/states/navigate-txs.json index 68d2535a2..6a4605e9a 100644 --- a/development/states/navigate-txs.json +++ b/development/states/navigate-txs.json @@ -304,7 +304,8 @@ "infuraNetworkStatus": { "mainnet": "ok", "goerli": "ok", - "sepolia": "ok" + "sepolia": "ok", + "lineatestnet": "ok" } }, "send": { diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 84314ac3d..a11db2b5e 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -165,6 +165,7 @@ export const NETWORK_TYPES = { MAINNET: 'mainnet', RPC: 'rpc', SEPOLIA: 'sepolia', + LINEA_TESTNET: 'lineatestnet', } as const; /** @@ -190,6 +191,7 @@ export const NETWORK_IDS = { GOERLI: '5', LOCALHOST: '1337', SEPOLIA: '11155111', + LINEA_TESTNET: '59140', } as const; /** @@ -211,6 +213,7 @@ export const CHAIN_IDS = { HARMONY: '0x63564c40', PALM: '0x2a15c308d', SEPOLIA: '0xaa36a7', + LINEA_TESTNET: '0xe704', AURORA: '0x4e454152', } as const; @@ -223,6 +226,7 @@ export const MAX_SAFE_CHAIN_ID = 4503599627370476; export const MAINNET_DISPLAY_NAME = 'Ethereum Mainnet'; export const GOERLI_DISPLAY_NAME = 'Goerli'; export const SEPOLIA_DISPLAY_NAME = 'Sepolia'; +export const LINEA_TESTNET_DISPLAY_NAME = 'Linea Goerli test network'; export const LOCALHOST_DISPLAY_NAME = 'Localhost 8545'; export const BSC_DISPLAY_NAME = 'Binance Smart Chain'; export const POLYGON_DISPLAY_NAME = 'Polygon'; @@ -252,6 +256,7 @@ export const MAINNET_RPC_URL = getRpcUrl({ }); export const GOERLI_RPC_URL = getRpcUrl({ network: NETWORK_TYPES.GOERLI }); export const SEPOLIA_RPC_URL = getRpcUrl({ network: NETWORK_TYPES.SEPOLIA }); +export const LINEA_TESTNET_RPC_URL = 'https://rpc.goerli.linea.build'; export const LOCALHOST_RPC_URL = 'http://localhost:8545'; /** @@ -428,6 +433,7 @@ export const INFURA_PROVIDER_TYPES = [ export const TEST_CHAINS = [ CHAIN_IDS.GOERLI, CHAIN_IDS.SEPOLIA, + CHAIN_IDS.LINEA_TESTNET, CHAIN_IDS.LOCALHOST, ]; @@ -446,6 +452,10 @@ export const TEST_NETWORK_TICKER_MAP: { [NETWORK_TYPES.SEPOLIA]: `${typedCapitalize(NETWORK_TYPES.SEPOLIA)}${ CURRENCY_SYMBOLS.ETH }`, + [NETWORK_TYPES.LINEA_TESTNET]: + `Linea${CURRENCY_SYMBOLS.ETH}` as `${Capitalize< + typeof NETWORK_TYPES.LINEA_TESTNET + >}${typeof CURRENCY_SYMBOLS.ETH}`, }; /** @@ -462,6 +472,12 @@ export const BUILT_IN_NETWORKS = { chainId: CHAIN_IDS.SEPOLIA, ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.SEPOLIA], }, + [NETWORK_TYPES.LINEA_TESTNET]: { + networkId: NETWORK_IDS.LINEA_TESTNET, + chainId: CHAIN_IDS.LINEA_TESTNET, + ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_TESTNET], + blockExplorerUrl: 'https://explorer.goerli.linea.build', + }, [NETWORK_TYPES.MAINNET]: { networkId: NETWORK_IDS.MAINNET, chainId: CHAIN_IDS.MAINNET, @@ -476,15 +492,18 @@ export const NETWORK_TO_NAME_MAP = { [NETWORK_TYPES.MAINNET]: MAINNET_DISPLAY_NAME, [NETWORK_TYPES.GOERLI]: GOERLI_DISPLAY_NAME, [NETWORK_TYPES.SEPOLIA]: SEPOLIA_DISPLAY_NAME, + [NETWORK_TYPES.LINEA_TESTNET]: LINEA_TESTNET_DISPLAY_NAME, [NETWORK_TYPES.LOCALHOST]: LOCALHOST_DISPLAY_NAME, [NETWORK_IDS.GOERLI]: GOERLI_DISPLAY_NAME, [NETWORK_IDS.SEPOLIA]: SEPOLIA_DISPLAY_NAME, + [NETWORK_IDS.LINEA_TESTNET]: LINEA_TESTNET_DISPLAY_NAME, [NETWORK_IDS.MAINNET]: MAINNET_DISPLAY_NAME, [NETWORK_IDS.LOCALHOST]: LOCALHOST_DISPLAY_NAME, [CHAIN_IDS.GOERLI]: GOERLI_DISPLAY_NAME, [CHAIN_IDS.SEPOLIA]: SEPOLIA_DISPLAY_NAME, + [CHAIN_IDS.LINEA_TESTNET]: LINEA_TESTNET_DISPLAY_NAME, [CHAIN_IDS.MAINNET]: MAINNET_DISPLAY_NAME, [CHAIN_IDS.LOCALHOST]: LOCALHOST_DISPLAY_NAME, } as const; @@ -493,12 +512,14 @@ export const CHAIN_ID_TO_TYPE_MAP = { [CHAIN_IDS.MAINNET]: NETWORK_TYPES.MAINNET, [CHAIN_IDS.GOERLI]: NETWORK_TYPES.GOERLI, [CHAIN_IDS.SEPOLIA]: NETWORK_TYPES.SEPOLIA, + [CHAIN_IDS.LINEA_TESTNET]: NETWORK_TYPES.LINEA_TESTNET, [CHAIN_IDS.LOCALHOST]: NETWORK_TYPES.LOCALHOST, } as const; export const CHAIN_ID_TO_RPC_URL_MAP = { [CHAIN_IDS.GOERLI]: GOERLI_RPC_URL, [CHAIN_IDS.SEPOLIA]: SEPOLIA_RPC_URL, + [CHAIN_IDS.LINEA_TESTNET]: LINEA_TESTNET_RPC_URL, [CHAIN_IDS.MAINNET]: MAINNET_RPC_URL, [CHAIN_IDS.LOCALHOST]: LOCALHOST_RPC_URL, } as const; @@ -520,6 +541,7 @@ export const CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP = { export const NETWORK_ID_TO_ETHERS_NETWORK_NAME_MAP = { [NETWORK_IDS.GOERLI]: NETWORK_TYPES.GOERLI, [NETWORK_IDS.SEPOLIA]: NETWORK_TYPES.SEPOLIA, + [NETWORK_IDS.LINEA_TESTNET]: NETWORK_TYPES.LINEA_TESTNET, [NETWORK_IDS.MAINNET]: NETWORK_NAMES.HOMESTEAD, } as const; @@ -527,6 +549,7 @@ export const CHAIN_ID_TO_NETWORK_ID_MAP = { [CHAIN_IDS.MAINNET]: NETWORK_IDS.MAINNET, [CHAIN_IDS.GOERLI]: NETWORK_IDS.GOERLI, [CHAIN_IDS.SEPOLIA]: NETWORK_IDS.SEPOLIA, + [CHAIN_IDS.LINEA_TESTNET]: NETWORK_IDS.LINEA_TESTNET, [CHAIN_IDS.LOCALHOST]: NETWORK_IDS.LOCALHOST, } as const; @@ -591,6 +614,7 @@ export const BUYABLE_CHAINS_MAP: { | typeof CHAIN_IDS.PALM | typeof CHAIN_IDS.HARMONY | typeof CHAIN_IDS.OPTIMISM_TESTNET + | typeof CHAIN_IDS.LINEA_TESTNET >]: BuyableChainSettings; } = { [CHAIN_IDS.MAINNET]: { @@ -982,3 +1006,6 @@ export const FEATURED_RPCS: RPCDefinition[] = [ }, }, ]; + +export const SHOULD_SHOW_LINEA_TESTNET_NETWORK = + new Date().getTime() > Date.UTC(2023, 2, 28); diff --git a/ui/components/app/dropdowns/network-dropdown.js b/ui/components/app/dropdowns/network-dropdown.js index f54c8ddce..0e1884441 100644 --- a/ui/components/app/dropdowns/network-dropdown.js +++ b/ui/components/app/dropdowns/network-dropdown.js @@ -7,8 +7,13 @@ import Button from '../../ui/button'; import * as actions from '../../../store/actions'; import { openAlert as displayInvalidCustomNetworkAlert } from '../../../ducks/alerts/invalid-custom-network'; import { + BUILT_IN_NETWORKS, + CHAIN_ID_TO_RPC_URL_MAP, + LINEA_TESTNET_RPC_URL, LOCALHOST_RPC_URL, + NETWORK_TO_NAME_MAP, NETWORK_TYPES, + SHOULD_SHOW_LINEA_TESTNET_NETWORK, } from '../../../../shared/constants/network'; import { isPrefixedFormattedHexString } from '../../../../shared/modules/network.utils'; @@ -57,8 +62,12 @@ function mapDispatchToProps(dispatch) { setProviderType: (type) => { dispatch(actions.setProviderType(type)); }, - setRpcTarget: (target, chainId, ticker, nickname) => { - dispatch(actions.setRpcTarget(target, chainId, ticker, nickname)); + setRpcTarget: (target, chainId, ticker, nickname, { blockExplorerUrl }) => { + dispatch( + actions.setRpcTarget(target, chainId, ticker, nickname, { + blockExplorerUrl, + }), + ); }, hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()), displayInvalidCustomNetworkAlert: (networkName) => { @@ -224,6 +233,8 @@ class NetworkDropdown extends Component { return t('goerli'); case NETWORK_TYPES.SEPOLIA: return t('sepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('lineatestnet'); case NETWORK_TYPES.LOCALHOST: return t('localhost'); default: @@ -268,6 +279,55 @@ class NetworkDropdown extends Component { ); } + renderNonInfuraDefaultNetwork(network) { + const { + provider: { type: providerType }, + setRpcTarget, + } = this.props; + + const isCurrentRpcTarget = providerType === NETWORK_TYPES.RPC; + return ( + { + const { chainId, ticker, blockExplorerUrl } = + BUILT_IN_NETWORKS[network]; + const networkName = NETWORK_TO_NAME_MAP[network]; + + const rpcUrl = CHAIN_ID_TO_RPC_URL_MAP[chainId]; + await setRpcTarget(rpcUrl, chainId, ticker, networkName, { + blockExplorerUrl, + }); + }} + style={DROP_DOWN_MENU_ITEM_STYLE} + > + {isCurrentRpcTarget ? ( + + ) : ( +
+ )} + + + {this.context.t(network)} + +
+ ); + } + render() { const { history, @@ -277,9 +337,12 @@ class NetworkDropdown extends Component { showTestnetMessageInDropdown, hideTestNetMessage, } = this.props; + const rpcListDetail = this.props.frequentRpcListDetail; - const rpcListDetailWithoutLocalHost = rpcListDetail.filter( - (rpc) => rpc.rpcUrl !== LOCALHOST_RPC_URL, + const rpcListDetailWithoutLocalHostAndLinea = rpcListDetail.filter( + (rpc) => + rpc.rpcUrl !== LOCALHOST_RPC_URL && + rpc.rpcUrl !== LINEA_TESTNET_RPC_URL, ); const rpcListDetailForLocalHost = rpcListDetail.filter( (rpc) => rpc.rpcUrl === LOCALHOST_RPC_URL, @@ -352,7 +415,7 @@ class NetworkDropdown extends Component { {this.renderNetworkEntry(NETWORK_TYPES.MAINNET)} {this.renderCustomRpcList( - rpcListDetailWithoutLocalHost, + rpcListDetailWithoutLocalHostAndLinea, this.props.provider, )} @@ -360,6 +423,13 @@ class NetworkDropdown extends Component { <> {this.renderNetworkEntry(NETWORK_TYPES.GOERLI)} {this.renderNetworkEntry(NETWORK_TYPES.SEPOLIA)} + {SHOULD_SHOW_LINEA_TESTNET_NETWORK && ( + <> + {this.renderNonInfuraDefaultNetwork( + NETWORK_TYPES.LINEA_TESTNET, + )} + + )} {this.renderCustomRpcList( rpcListDetailForLocalHost, this.props.provider, diff --git a/ui/components/app/dropdowns/network-dropdown.test.js b/ui/components/app/dropdowns/network-dropdown.test.js index 727b8fadc..e02804fa3 100644 --- a/ui/components/app/dropdowns/network-dropdown.test.js +++ b/ui/components/app/dropdowns/network-dropdown.test.js @@ -6,6 +6,15 @@ import { renderWithProvider } from '../../../../test/lib/render-helpers'; import { LOCALHOST_RPC_URL } from '../../../../shared/constants/network'; import NetworkDropdown from './network-dropdown'; +// Mock linea test network feature toggle +jest.mock('../../../../shared/constants/network', () => { + const constants = jest.requireActual('../../../../shared/constants/network'); + return { + ...constants, + SHOULD_SHOW_LINEA_TESTNET_NETWORK: true, + }; +}); + describe('Network Dropdown', () => { const createMockStore = configureMockStore([thunk]); @@ -97,6 +106,13 @@ describe('Network Dropdown', () => { expect(localhostColorIndicator).toBeInTheDocument(); }); + it('checks background color for seventh ColorIndicator', () => { + const lineaColorIndicator = screen.queryByTestId( + 'color-icon-lineatestnet', + ); + expect(lineaColorIndicator).toBeInTheDocument(); + }); + it('checks that Add Network button is rendered', () => { const addNetworkButton = screen.queryByText('Add network'); expect(addNetworkButton).toBeInTheDocument(); @@ -104,8 +120,7 @@ describe('Network Dropdown', () => { it('shows test networks in the dropdown', () => { const networkItems = screen.queryAllByTestId(/network-item/u); - - expect(networkItems).toHaveLength(6); + expect(networkItems).toHaveLength(7); }); }); diff --git a/ui/components/app/loading-network-screen/loading-network-screen.component.js b/ui/components/app/loading-network-screen/loading-network-screen.component.js index bf241cfce..9a258557d 100644 --- a/ui/components/app/loading-network-screen/loading-network-screen.component.js +++ b/ui/components/app/loading-network-screen/loading-network-screen.component.js @@ -49,6 +49,8 @@ export default class LoadingNetworkScreen extends PureComponent { return t('connectingToGoerli'); case NETWORK_TYPES.SEPOLIA: return t('connectingToSepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('connectingToLineaTestnet'); default: return t('connectingTo', [providerId]); } diff --git a/ui/components/app/signature-request-original/signature-request-original.component.js b/ui/components/app/signature-request-original/signature-request-original.component.js index 6e5fd5313..9c3039de4 100644 --- a/ui/components/app/signature-request-original/signature-request-original.component.js +++ b/ui/components/app/signature-request-original/signature-request-original.component.js @@ -72,6 +72,8 @@ export default class SignatureRequestOriginal extends Component { return t('goerli'); case NETWORK_TYPES.SEPOLIA: return t('sepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('lineatestnet'); case NETWORK_TYPES.LOCALHOST: return t('localhost'); default: diff --git a/ui/components/app/signature-request/signature-request.component.js b/ui/components/app/signature-request/signature-request.component.js index d9cf0f88c..86b631a64 100644 --- a/ui/components/app/signature-request/signature-request.component.js +++ b/ui/components/app/signature-request/signature-request.component.js @@ -113,6 +113,8 @@ export default class SignatureRequest extends PureComponent { return t('goerli'); case NETWORK_TYPES.SEPOLIA: return t('sepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('lineatestnet'); case NETWORK_TYPES.LOCALHOST: return t('localhost'); default: diff --git a/ui/components/ui/typography/typography.js b/ui/components/ui/typography/typography.js index 19cbabccb..5557c325b 100644 --- a/ui/components/ui/typography/typography.js +++ b/ui/components/ui/typography/typography.js @@ -32,6 +32,8 @@ export const ValidColors = [ Color.sepolia, Color.goerli, Color.sepoliaInverse, + Color.lineaTestnet, + Color.lineaTestnetInverse, ]; export const ValidTags = [ diff --git a/ui/css/design-system/colors.scss b/ui/css/design-system/colors.scss index 55c3a6811..0b3e330bf 100644 --- a/ui/css/design-system/colors.scss +++ b/ui/css/design-system/colors.scss @@ -41,6 +41,8 @@ $color-map: ( 'sepolia': --color-network-sepolia-default, 'goerli-inverse':--color-network-goerli-inverse, 'sepolia-inverse': --color-network-sepolia-inverse, + 'lineatestnet': --color-network-linea-testnet-default, + 'lineatestnet-inverse': --color-network-linea-testnet-inverse, 'localhost': --color-network-localhost-default, 'transparent': --transparent, 'flask-purple': --color-flask-default, diff --git a/ui/css/itcss/components/network.scss b/ui/css/itcss/components/network.scss index c89f93d55..f7baf1a07 100644 --- a/ui/css/itcss/components/network.scss +++ b/ui/css/itcss/components/network.scss @@ -25,6 +25,10 @@ background-color: rgba(207, 181, 240, 0.7) !important; } + &.linea-test-network .menu-icon-circle div { + background-color: rgba(0, 0, 0, 0.7) !important; + } + &.localhost-network .menu-icon-circle div { background-color: rgba(3, 135, 137, 0.7) !important; } diff --git a/ui/css/utilities/colors.scss b/ui/css/utilities/colors.scss index 221786dcf..7d2e8e7c8 100644 --- a/ui/css/utilities/colors.scss +++ b/ui/css/utilities/colors.scss @@ -4,6 +4,8 @@ --mainnet: #29b6af; --inherit: inherit; --transparent: transparent; + --color-network-linea-testnet-default: #000; + --color-network-linea-testnet-inverse: #fcfcfc; // DO NOT CHANGE // Required for the QR reader to work properly --qr-code-white-background: #fff; diff --git a/ui/helpers/constants/design-system.ts b/ui/helpers/constants/design-system.ts index a73831274..f2490be01 100644 --- a/ui/helpers/constants/design-system.ts +++ b/ui/helpers/constants/design-system.ts @@ -46,6 +46,8 @@ export enum Color { mainnet = 'mainnet', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', + lineaTestnetInverse = 'lineatestnet-inverse', transparent = 'transparent', localhost = 'localhost', inherit = 'inherit', @@ -75,6 +77,7 @@ export enum BackgroundColor { mainnet = 'mainnet', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', transparent = 'transparent', localhost = 'localhost', } @@ -100,6 +103,7 @@ export enum BorderColor { mainnet = 'mainnet', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', transparent = 'transparent', localhost = 'localhost', } @@ -121,6 +125,8 @@ export enum TextColor { inherit = 'inherit', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', + lineaTestnetInverse = 'lineatestnet-inverse', goerliInverse = 'goerli-inverse', sepoliaInverse = 'sepolia-inverse', } @@ -143,6 +149,8 @@ export enum IconColor { inherit = 'inherit', goerli = 'goerli', sepolia = 'sepolia', + lineaTestnet = 'lineatestnet', + lineaTestnetInverse = 'lineatestnet-inverse', goerliInverse = 'goerli-inverse', sepoliaInverse = 'sepolia-inverse', } diff --git a/ui/helpers/constants/settings.js b/ui/helpers/constants/settings.js index bbbfd5812..391bfd4c7 100644 --- a/ui/helpers/constants/settings.js +++ b/ui/helpers/constants/settings.js @@ -254,6 +254,13 @@ export const SETTINGS_CONSTANTS = [ route: `${NETWORKS_ROUTE}#networks-sepolia`, icon: 'fa fa-plug', }, + { + tabMessage: (t) => t('networks'), + sectionMessage: (t) => t('lineatestnet'), + descriptionMessage: (t) => t('lineatestnet'), + route: `${NETWORKS_ROUTE}#networks-lineatestnet`, + icon: 'fa fa-plug', + }, { tabMessage: (t) => t('networks'), sectionMessage: (t) => t('localhost'), diff --git a/ui/helpers/utils/settings-search.test.js b/ui/helpers/utils/settings-search.test.js index 74c2c08b4..f78c498b5 100644 --- a/ui/helpers/utils/settings-search.test.js +++ b/ui/helpers/utils/settings-search.test.js @@ -177,7 +177,7 @@ describe('Settings Search Utils', () => { }); it('should get good network section number', () => { - expect(getNumberOfSettingsInSection(t, t('networks'))).toStrictEqual(4); + expect(getNumberOfSettingsInSection(t, t('networks'))).toStrictEqual(5); }); it('should get good experimental section number', () => { diff --git a/ui/helpers/utils/util.js b/ui/helpers/utils/util.js index f6804c1f1..95c841bd5 100644 --- a/ui/helpers/utils/util.js +++ b/ui/helpers/utils/util.js @@ -56,6 +56,7 @@ export function isDefaultMetaMaskChain(chainId) { chainId === CHAIN_IDS.MAINNET || chainId === CHAIN_IDS.GOERLI || chainId === CHAIN_IDS.SEPOLIA || + chainId === CHAIN_IDS.LINEA_TESTNET || chainId === CHAIN_IDS.LOCALHOST ) { return true; diff --git a/ui/helpers/utils/util.test.js b/ui/helpers/utils/util.test.js index e4d152658..36fa14b43 100644 --- a/ui/helpers/utils/util.test.js +++ b/ui/helpers/utils/util.test.js @@ -1,5 +1,6 @@ import Bowser from 'bowser'; import { BN } from 'ethereumjs-util'; +import { CHAIN_IDS } from '../../../shared/constants/network'; import { addHexPrefixToObjectValues } from '../../../shared/lib/swaps-utils'; import { toPrecisionWithoutTrailingZeros } from '../../../shared/lib/transactions-controller-utils'; import * as util from './util'; @@ -589,4 +590,14 @@ describe('util', () => { ).toStrictEqual('The Quick Brown \\u202EFox Jumps Over The Lazy Dog'); }); }); + + describe('isDefaultMetaMaskChain()', () => { + it('should return true if the provided chainId is a default MetaMask chain', () => { + expect(util.isDefaultMetaMaskChain(CHAIN_IDS.GOERLI)).toBeTruthy(); + }); + + it('should return false if the provided chainId is a not default MetaMask chain', () => { + expect(util.isDefaultMetaMaskChain(CHAIN_IDS.CELO)).toBeFalsy(); + }); + }); }); diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index cca891231..2d8ccfbe5 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -472,6 +472,8 @@ export default class Routes extends Component { return t('connectingToGoerli'); case NETWORK_TYPES.SEPOLIA: return t('connectingToSepolia'); + case NETWORK_TYPES.LINEA_TESTNET: + return t('connectingToLineaTestnet'); default: return t('connectingTo', [providerId]); } diff --git a/ui/pages/settings/networks-tab/networks-tab.constants.js b/ui/pages/settings/networks-tab/networks-tab.constants.js index 088d8a991..ef34723b9 100644 --- a/ui/pages/settings/networks-tab/networks-tab.constants.js +++ b/ui/pages/settings/networks-tab/networks-tab.constants.js @@ -4,6 +4,7 @@ import { CURRENCY_SYMBOLS, CHAIN_IDS, NETWORK_TYPES, + LINEA_TESTNET_RPC_URL, } from '../../../../shared/constants/network'; const defaultNetworksData = [ @@ -43,6 +44,15 @@ const defaultNetworksData = [ ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.SEPOLIA], blockExplorerUrl: 'https://sepolia.etherscan.io', }, + { + labelKey: NETWORK_TYPES.LINEA_TESTNET, + iconColor: '#234FD5', + providerType: NETWORK_TYPES.LINEA_TESTNET, + rpcUrl: LINEA_TESTNET_RPC_URL, + chainId: CHAIN_IDS.LINEA_TESTNET, + ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_TESTNET], + blockExplorerUrl: 'https://explorer.goerli.linea.build', + }, ]; export { defaultNetworksData }; diff --git a/ui/pages/settings/networks-tab/networks-tab.js b/ui/pages/settings/networks-tab/networks-tab.js index 287b187df..785cbcf32 100644 --- a/ui/pages/settings/networks-tab/networks-tab.js +++ b/ui/pages/settings/networks-tab/networks-tab.js @@ -20,7 +20,9 @@ import { getProvider, } from '../../../selectors'; import { + CHAIN_IDS, NETWORK_TYPES, + SHOULD_SHOW_LINEA_TESTNET_NETWORK, TEST_CHAINS, } from '../../../../shared/constants/network'; import { defaultNetworksData } from './networks-tab.constants'; @@ -51,23 +53,29 @@ const NetworksTab = ({ addNewNetwork }) => { const provider = useSelector(getProvider); const networksTabSelectedRpcUrl = useSelector(getNetworksTabSelectedRpcUrl); - const frequentRpcNetworkListDetails = frequentRpcListDetail.map((rpc) => { - return { - label: rpc.nickname, - iconColor: 'var(--color-icon-alternative)', - providerType: NETWORK_TYPES.RPC, - rpcUrl: rpc.rpcUrl, - chainId: rpc.chainId, - ticker: rpc.ticker, - blockExplorerUrl: rpc.rpcPrefs?.blockExplorerUrl || '', - isATestNetwork: TEST_CHAINS.includes(rpc.chainId), - }; - }); + const frequentRpcNetworkListDetails = frequentRpcListDetail + .map((rpc) => { + return { + label: rpc.nickname, + iconColor: 'var(--color-icon-alternative)', + providerType: NETWORK_TYPES.RPC, + rpcUrl: rpc.rpcUrl, + chainId: rpc.chainId, + ticker: rpc.ticker, + blockExplorerUrl: rpc.rpcPrefs?.blockExplorerUrl || '', + isATestNetwork: TEST_CHAINS.includes(rpc.chainId), + }; + }) + .filter((network) => network.chainId !== CHAIN_IDS.LINEA_TESTNET); + + let networksToRender = [...defaultNetworks, ...frequentRpcNetworkListDetails]; + + if (!SHOULD_SHOW_LINEA_TESTNET_NETWORK) { + networksToRender = networksToRender.filter( + (network) => network.chainId !== CHAIN_IDS.LINEA_TESTNET, + ); + } - const networksToRender = [ - ...defaultNetworks, - ...frequentRpcNetworkListDetails, - ]; let selectedNetwork = networksToRender.find( (network) => network.rpcUrl === networksTabSelectedRpcUrl, diff --git a/ui/store/actions.ts b/ui/store/actions.ts index de453b6b1..50fa81bf3 100644 --- a/ui/store/actions.ts +++ b/ui/store/actions.ts @@ -2512,6 +2512,7 @@ export function setRpcTarget( chainId: string, ticker?: EtherDenomination, nickname?: string, + rpcPrefs?: object, ): ThunkAction { return async (dispatch) => { log.debug( @@ -2524,6 +2525,7 @@ export function setRpcTarget( chainId, ticker ?? EtherDenomination.ETH, nickname || newRpcUrl, + rpcPrefs, ]); } catch (error) { logErrorWithMessage(error);