From b723c9ad4c70bfa67d417e08e55759cda4787234 Mon Sep 17 00:00:00 2001 From: Daniel <80175477+dan437@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:03:37 +0100 Subject: [PATCH] chore: Remove STX opt in modal (#28291) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** [This recent PR](https://github.com/MetaMask/metamask-extension/pull/27885) enabled STX by default for new users and only hid the STX opt in modal. The purpose of this PR is to clean up unused code for the STX opt in modal. ## **Related issues** Fixes: ## **Manual testing steps** 1. Install the extension from scratch 2. Be on Ethereum mainnet and have some funds there 3. You will not see any STX opt in modal ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. # Conflicts: # app/_locales/en/messages.json --- app/_locales/de/messages.json | 22 -- app/_locales/el/messages.json | 22 -- app/_locales/en/messages.json | 22 -- app/_locales/en_GB/messages.json | 22 -- app/_locales/es/messages.json | 22 -- app/_locales/fr/messages.json | 22 -- app/_locales/hi/messages.json | 22 -- app/_locales/id/messages.json | 22 -- app/_locales/ja/messages.json | 22 -- app/_locales/ko/messages.json | 22 -- app/_locales/pt/messages.json | 22 -- app/_locales/ru/messages.json | 22 -- app/_locales/tl/messages.json | 22 -- app/_locales/tr/messages.json | 22 -- app/_locales/vi/messages.json | 22 -- app/_locales/zh_CN/messages.json | 22 -- .../preferences-controller.test.ts | 4 +- .../controllers/preferences-controller.ts | 4 +- app/scripts/lib/backup.test.js | 2 +- shared/modules/selectors/index.test.ts | 124 +--------- .../modules/selectors/smart-transactions.ts | 41 +--- test/data/mock-state.json | 2 +- test/e2e/default-fixture.js | 2 +- test/e2e/fixture-builder.js | 4 +- test/e2e/restore/MetaMaskUserData.json | 2 +- ...rs-after-init-opt-in-background-state.json | 2 +- .../errors-after-init-opt-in-ui-state.json | 2 +- ...s-before-init-opt-in-background-state.json | 2 +- .../errors-before-init-opt-in-ui-state.json | 2 +- .../data/integration-init-state.json | 2 +- .../data/onboarding-completion-route.json | 2 +- ui/ducks/metamask/metamask.js | 2 +- ui/pages/home/home.component.js | 21 +- ui/pages/home/home.container.js | 4 - .../advanced-tab.component.test.js.snap | 12 +- ...rt-transactions-opt-in-modal.test.tsx.snap | 3 - .../smart-transactions/components/index.scss | 26 --- .../smart-transactions-opt-in-modal.test.tsx | 70 ------ .../smart-transactions-opt-in-modal.tsx | 219 ------------------ ui/pages/smart-transactions/index.scss | 1 - 40 files changed, 31 insertions(+), 876 deletions(-) delete mode 100644 ui/pages/smart-transactions/components/__snapshots__/smart-transactions-opt-in-modal.test.tsx.snap delete mode 100644 ui/pages/smart-transactions/components/index.scss delete mode 100644 ui/pages/smart-transactions/components/smart-transactions-opt-in-modal.test.tsx delete mode 100644 ui/pages/smart-transactions/components/smart-transactions-opt-in-modal.tsx diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 9af24022bcb3..771deef4c28c 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Beschleunigung der Gasgebühr bearbeiten" }, - "enable": { - "message": "Aktivieren" - }, "enableAutoDetect": { "message": " Automatische Erkennung aktivieren" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Smart Transactions" }, - "smartTransactionsBenefit1": { - "message": "Erfolgsrate: 99,5 %" - }, - "smartTransactionsBenefit2": { - "message": "Spart Ihnen Geld" - }, - "smartTransactionsBenefit3": { - "message": "Updates in Echtzeit" - }, - "smartTransactionsDescription": { - "message": "Erzielen Sie mit Smart Transactions höhere Erfolgsraten, einen Frontrunning-Schutz und eine bessere Transparenz." - }, - "smartTransactionsDescription2": { - "message": "Nur auf Ethereum verfügbar. Sie können diese Funktion jederzeit in den Einstellungen aktivieren oder deaktivieren. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Verbesserter Transaktionsschutz" - }, "snapAccountCreated": { "message": "Konto erstellt" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index 308099b1c2b1..7ae594c8b9b8 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Επεξεργασία τελών επίσπευσης συναλλαγής" }, - "enable": { - "message": "Ενεργοποίηση" - }, "enableAutoDetect": { "message": " Ενεργοποίηση αυτόματου εντοπισμού" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Έξυπνες συναλλαγές" }, - "smartTransactionsBenefit1": { - "message": "Ποσοστό επιτυχίας 99,5%" - }, - "smartTransactionsBenefit2": { - "message": "Σας εξοικονομεί χρήματα" - }, - "smartTransactionsBenefit3": { - "message": "Ενημερώσεις σε πραγματικό χρόνο" - }, - "smartTransactionsDescription": { - "message": "Ξεκλειδώστε υψηλότερα ποσοστά επιτυχίας, προστασία σε \"προπορευόμενες συναλλαγές\" και καλύτερη ορατότητα με τις Έξυπνες Συναλλαγές." - }, - "smartTransactionsDescription2": { - "message": "Διατίθεται μόνο στο Ethereum. Ενεργοποιήστε ή απενεργοποιήστε το ανά πάσα στιγμή στις ρυθμίσεις. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Ενισχυμένη Προστασία Συναλλαγών" - }, "snapAccountCreated": { "message": "Ο λογαριασμός δημιουργήθηκε" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 512eb3b0ee36..28ceda9efb6b 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1824,9 +1824,6 @@ "editSpendingCapError": { "message": "The spending cap can’t exceed $1 decimal digits. Remove decimal digits to continue." }, - "enable": { - "message": "Enable" - }, "enableAutoDetect": { "message": " Enable autodetect" }, @@ -5033,25 +5030,6 @@ "smartTransactions": { "message": "Smart Transactions" }, - "smartTransactionsBenefit1": { - "message": "99.5% success rate" - }, - "smartTransactionsBenefit2": { - "message": "Saves you money" - }, - "smartTransactionsBenefit3": { - "message": "Real-time updates" - }, - "smartTransactionsDescription": { - "message": "Unlock higher success rates, frontrunning protection, and better visibility with Smart Transactions." - }, - "smartTransactionsDescription2": { - "message": "Only available on Ethereum. Enable or disable any time in settings. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Enhanced Transaction Protection" - }, "snapAccountCreated": { "message": "Account created" }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index fc635e33a708..e8eb1e58ea71 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -1707,9 +1707,6 @@ "effortlesslyNavigateYourDigitalAssets": { "message": "Effortlessly navigate your digital assets" }, - "enable": { - "message": "Enable" - }, "enableAutoDetect": { "message": " Enable autodetect" }, @@ -4815,25 +4812,6 @@ "smartTransactions": { "message": "Smart Transactions" }, - "smartTransactionsBenefit1": { - "message": "99.5% success rate" - }, - "smartTransactionsBenefit2": { - "message": "Saves you money" - }, - "smartTransactionsBenefit3": { - "message": "Real-time updates" - }, - "smartTransactionsDescription": { - "message": "Unlock higher success rates, frontrunning protection, and better visibility with Smart Transactions." - }, - "smartTransactionsDescription2": { - "message": "Only available on Ethereum. Enable or disable any time in settings. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Enhanced Transaction Protection" - }, "snapAccountCreated": { "message": "Account created" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index ada162b9a12b..0f774d8f6ba2 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -1617,9 +1617,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Editar la tarifa de aceleración de gas" }, - "enable": { - "message": "Habilitar" - }, "enableAutoDetect": { "message": " Activar autodetección" }, @@ -4634,25 +4631,6 @@ "smartTransactions": { "message": "Transacciones inteligentes" }, - "smartTransactionsBenefit1": { - "message": "Índice de éxito del 99.5%" - }, - "smartTransactionsBenefit2": { - "message": "Le permite ahorrar dinero" - }, - "smartTransactionsBenefit3": { - "message": "Actualizaciones en tiempo real" - }, - "smartTransactionsDescription": { - "message": "Desbloquee índices de éxito más altos, protección contra frontrunning y mejor visibilidad con transacciones inteligentes." - }, - "smartTransactionsDescription2": { - "message": "Solo disponible en Ethereum. Active o desactive en cualquier momento en la configuración. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Protección mejorada de transacciones" - }, "snapAccountCreated": { "message": "Cuenta creada" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 856638ba2b8a..985dfd44c9dd 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Modifier les gas fees d’accélération" }, - "enable": { - "message": "Activer" - }, "enableAutoDetect": { "message": " Activer la détection automatique" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Transactions intelligentes" }, - "smartTransactionsBenefit1": { - "message": "Taux de réussite de 99,5 %" - }, - "smartTransactionsBenefit2": { - "message": "Cela vous permet d’économiser de l’argent" - }, - "smartTransactionsBenefit3": { - "message": "Mises à jour en temps réel" - }, - "smartTransactionsDescription": { - "message": "Bénéficiez de taux de réussite plus élevés, d’une protection contre le « front running » et d’une meilleure visibilité grâce aux transactions intelligentes." - }, - "smartTransactionsDescription2": { - "message": "Disponible uniquement sur Ethereum. Vous pouvez activer ou désactiver cette option à tout moment dans les paramètres. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Protection renforcée des transactions" - }, "snapAccountCreated": { "message": "Le compte a été créé" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 45e64a972e17..540023a75fac 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "गैस फ़ीस स्पीड अप को बदलें" }, - "enable": { - "message": "चालू करें" - }, "enableAutoDetect": { "message": " ऑटो डिटेक्ट इनेबल करें" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "स्मार्ट ट्रांसेक्शन" }, - "smartTransactionsBenefit1": { - "message": "99.5% सफलता दर" - }, - "smartTransactionsBenefit2": { - "message": "आपका पैसा बचाता है" - }, - "smartTransactionsBenefit3": { - "message": "रियल-टाइम अपडेट" - }, - "smartTransactionsDescription": { - "message": "स्मार्ट ट्रांसेक्शन के साथ उच्च सफलता दर, फ्रंटरनिंग सुरक्षा और बेहतर दृश्यता अनलॉक करें।" - }, - "smartTransactionsDescription2": { - "message": "केवल Ethereum पर उपलब्ध है। सेटिंग्स में किसी भी समय चालू करें या बंद करें। $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "एनहांस्ड ट्रांसेक्शन प्रोटेक्शन" - }, "snapAccountCreated": { "message": "अकाउंट बनाया गया" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 6314d9ed3468..81f7d2a9c633 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Edit biaya gas percepatan" }, - "enable": { - "message": "Aktifkan" - }, "enableAutoDetect": { "message": " Aktifkan deteksi otomatis" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Transaksi Pintar" }, - "smartTransactionsBenefit1": { - "message": "Tingkat keberhasilan 99,5%" - }, - "smartTransactionsBenefit2": { - "message": "Menghemat uang Anda" - }, - "smartTransactionsBenefit3": { - "message": "Pembaruan waktu nyata" - }, - "smartTransactionsDescription": { - "message": "Raih tingkat keberhasilan yang lebih tinggi, perlindungan frontrunning, dan visibilitas yang lebih baik dengan Transaksi Pintar." - }, - "smartTransactionsDescription2": { - "message": "Hanya tersedia di Ethereum. Aktifkan atau nonaktifkan kapan saja di pengaturan. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Peningkatan Perlindungan Transaksi" - }, "snapAccountCreated": { "message": "Akun dibuat" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 61730b2bc325..5787bb88c397 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "高速化用のガス代を編集" }, - "enable": { - "message": "有効にする" - }, "enableAutoDetect": { "message": " 自動検出を有効にする" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "スマートトランザクション" }, - "smartTransactionsBenefit1": { - "message": "99.5%の成功率" - }, - "smartTransactionsBenefit2": { - "message": "お金を節約できます" - }, - "smartTransactionsBenefit3": { - "message": "リアルタイムの最新情報" - }, - "smartTransactionsDescription": { - "message": "スマートトランザクションで、成功率を上げ、フロントランニングを防ぎ、可視性を高めましょう。" - }, - "smartTransactionsDescription2": { - "message": "イーサリアムでのみご利用いただけ、いつでも設定で有効・無効を切り替えられます。$1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "強化されたトランザクション保護" - }, "snapAccountCreated": { "message": "アカウントが作成されました" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 05c04fbd17a9..32d7bd4399b5 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "가스비 가속 편집" }, - "enable": { - "message": "활성화" - }, "enableAutoDetect": { "message": " 자동 감지 활성화" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "스마트 트랜잭션" }, - "smartTransactionsBenefit1": { - "message": "99.5% 성공률" - }, - "smartTransactionsBenefit2": { - "message": "비용 절감" - }, - "smartTransactionsBenefit3": { - "message": "실시간 업데이트" - }, - "smartTransactionsDescription": { - "message": "스마트 트랜잭션으로 선행거래를 방지하고 더 높은 성공률과 가시성을 확보하세요." - }, - "smartTransactionsDescription2": { - "message": "이더리움에서만 사용할 수 있습니다. 설정에서 언제든지 활성화하거나 비활성화할 수 있습니다. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "트랜잭션 보호 강화" - }, "snapAccountCreated": { "message": "계정 생성됨" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 4c02a9dc223e..4eecb941d36f 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Editar taxa de gás para aceleração" }, - "enable": { - "message": "Ativar" - }, "enableAutoDetect": { "message": " Ativar detecção automática" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Transações inteligentes" }, - "smartTransactionsBenefit1": { - "message": "99,5% de taxa de sucesso" - }, - "smartTransactionsBenefit2": { - "message": "Faz você economizar dinheiro" - }, - "smartTransactionsBenefit3": { - "message": "Atualizações em tempo real" - }, - "smartTransactionsDescription": { - "message": "Desbloqueie taxas de sucesso maiores, proteção contra front running e melhor visibilidade com as transações inteligentes." - }, - "smartTransactionsDescription2": { - "message": "Disponível somente na Ethereum. Ative ou desative a qualquer momento nas configurações. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Proteção de transações aprimorada" - }, "snapAccountCreated": { "message": "Conta criada" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index f1e5d27589c5..ce53cc239de5 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Изменить плату за газ за ускорение" }, - "enable": { - "message": "Включить" - }, "enableAutoDetect": { "message": " Включить автоопределение" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Умные транзакции" }, - "smartTransactionsBenefit1": { - "message": "Коэффициент успеха 99,5%" - }, - "smartTransactionsBenefit2": { - "message": "Экономит вам деньги" - }, - "smartTransactionsBenefit3": { - "message": "Обновления в реальном времени" - }, - "smartTransactionsDescription": { - "message": "Откройте для себя более высокие коэффициенты успеха, передовую защиту и лучшую прозрачность с помощью умных транзакций." - }, - "smartTransactionsDescription2": { - "message": "Доступно только на Ethereum. Включайте или отключайте в любое время в настройках. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Улучшенная защита транзакций" - }, "snapAccountCreated": { "message": "Счет создан" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 76e91829fc2c..8909ac662e34 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "I-edit ang pagpapabilis ng bayad sa gas" }, - "enable": { - "message": "Payagan" - }, "enableAutoDetect": { "message": " Paganahin ang autodetect" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Mga Smart Transaction" }, - "smartTransactionsBenefit1": { - "message": "99.5% tiyansa ng tagumpay" - }, - "smartTransactionsBenefit2": { - "message": "Makatitipid ng pera" - }, - "smartTransactionsBenefit3": { - "message": "Mga real-time na update" - }, - "smartTransactionsDescription": { - "message": "Mag-unlock na mas mataas na tiyansa ng tagumpay, proteksyon sa frontrunning, at mas mahusay na visibility sa mga Smart Transaction." - }, - "smartTransactionsDescription2": { - "message": "Available lamang sa Ethereum. I-enable o i-disable anumang oras sa mga setting. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Pinahusay na Proteksyon sa Transaksyon" - }, "snapAccountCreated": { "message": "Nagawa ang account" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 3b1899614d70..8c4e44d3192e 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Hızlandırma gaz ücretini düzenle" }, - "enable": { - "message": "Etkinleştir" - }, "enableAutoDetect": { "message": " Otomatik algılamayı etkinleştir" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Akıllı İşlemler" }, - "smartTransactionsBenefit1": { - "message": "%99,5 başarı oranı" - }, - "smartTransactionsBenefit2": { - "message": "Paradan tasarruf sağlar" - }, - "smartTransactionsBenefit3": { - "message": "Gerçek zamanlı güncellemeler" - }, - "smartTransactionsDescription": { - "message": "Akıllı İşlemler ile daha yüksek başarı oranlarının, arkadan çalıştırma korumasının ve daha iyi görünürlüğün kilidini açın." - }, - "smartTransactionsDescription2": { - "message": "Sadece Ethereum'da mevcuttur. Dilediğiniz zaman ayarlar kısmında etkinleştirin veya devre dışı bırakın. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "İyileştirilmiş İşlem Koruması" - }, "snapAccountCreated": { "message": "Hesap oluşturuldu" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 4bfcba6dac1f..b741fe6eb536 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "Chỉnh sửa phí gas tăng tốc" }, - "enable": { - "message": "Bật" - }, "enableAutoDetect": { "message": " Bật tự động phát hiện" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "Giao dịch thông minh" }, - "smartTransactionsBenefit1": { - "message": "Tỷ lệ thành công 99,5%" - }, - "smartTransactionsBenefit2": { - "message": "Tiết kiệm tiền của bạn" - }, - "smartTransactionsBenefit3": { - "message": "Cập nhật theo thời gian thực" - }, - "smartTransactionsDescription": { - "message": "Đạt tỷ lệ thành công cao hơn, bảo vệ chống hành vi lợi dụng thông tin biết trước và khả năng hiển thị tốt hơn với Giao dịch thông minh." - }, - "smartTransactionsDescription2": { - "message": "Chỉ có sẵn trên Ethereum. Có thể bật/tắt bất cứ lúc nào trong phần Cài đặt. $1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "Tăng cường bảo vệ giao dịch" - }, "snapAccountCreated": { "message": "Tài khoản đã được tạo" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 80a31d532482..e5695cdfaecf 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -1620,9 +1620,6 @@ "editSpeedUpEditGasFeeModalTitle": { "message": "编辑加速燃料费用" }, - "enable": { - "message": "启用" - }, "enableAutoDetect": { "message": " 启用自动检测" }, @@ -4637,25 +4634,6 @@ "smartTransactions": { "message": "智能交易" }, - "smartTransactionsBenefit1": { - "message": "99.5%的成功率" - }, - "smartTransactionsBenefit2": { - "message": "为您省钱" - }, - "smartTransactionsBenefit3": { - "message": "实时更新" - }, - "smartTransactionsDescription": { - "message": "通过智能交易解锁更高的成功率、抢先交易保护和更高的透明度。" - }, - "smartTransactionsDescription2": { - "message": "仅适用于以太坊。可随时在设置中启用或禁用。$1", - "description": "$1 is an external link to learn more about Smart Transactions" - }, - "smartTransactionsOptItModalTitle": { - "message": "增强型交易保护" - }, "snapAccountCreated": { "message": "账户已创建" }, diff --git a/app/scripts/controllers/preferences-controller.test.ts b/app/scripts/controllers/preferences-controller.test.ts index 74daf39e17ad..f415bab05f96 100644 --- a/app/scripts/controllers/preferences-controller.test.ts +++ b/app/scripts/controllers/preferences-controller.test.ts @@ -733,7 +733,7 @@ describe('preferences controller', () => { privacyMode: false, showFiatInTestnets: false, showTestNetworks: false, - smartTransactionsOptInStatus: null, + smartTransactionsOptInStatus: true, useNativeCurrencyAsPrimaryCurrency: true, hideZeroBalanceTokens: false, petnamesEnabled: true, @@ -762,7 +762,7 @@ describe('preferences controller', () => { showExtensionInFullSizeView: false, showFiatInTestnets: false, showTestNetworks: false, - smartTransactionsOptInStatus: null, + smartTransactionsOptInStatus: true, useNativeCurrencyAsPrimaryCurrency: true, hideZeroBalanceTokens: false, petnamesEnabled: true, diff --git a/app/scripts/controllers/preferences-controller.ts b/app/scripts/controllers/preferences-controller.ts index f6537952d651..77c2b38826af 100644 --- a/app/scripts/controllers/preferences-controller.ts +++ b/app/scripts/controllers/preferences-controller.ts @@ -103,7 +103,7 @@ export type Preferences = { showExtensionInFullSizeView: boolean; showFiatInTestnets: boolean; showTestNetworks: boolean; - smartTransactionsOptInStatus: boolean | null; + smartTransactionsOptInStatus: boolean; showNativeTokenAsMainBalance: boolean; useNativeCurrencyAsPrimaryCurrency: boolean; hideZeroBalanceTokens: boolean; @@ -205,7 +205,7 @@ export const getDefaultPreferencesControllerState = showExtensionInFullSizeView: false, showFiatInTestnets: false, showTestNetworks: false, - smartTransactionsOptInStatus: null, // null means we will show the Smart Transactions opt-in modal to a user if they are eligible + smartTransactionsOptInStatus: true, showNativeTokenAsMainBalance: false, useNativeCurrencyAsPrimaryCurrency: true, hideZeroBalanceTokens: false, diff --git a/app/scripts/lib/backup.test.js b/app/scripts/lib/backup.test.js index 7a322148c847..b3a7f176c2e6 100644 --- a/app/scripts/lib/backup.test.js +++ b/app/scripts/lib/backup.test.js @@ -165,7 +165,7 @@ const jsonData = JSON.stringify({ showExtensionInFullSizeView: false, showFiatInTestnets: false, showTestNetworks: true, - smartTransactionsOptInStatus: false, + smartTransactionsOptInStatus: true, useNativeCurrencyAsPrimaryCurrency: true, showMultiRpcModal: false, }, diff --git a/shared/modules/selectors/index.test.ts b/shared/modules/selectors/index.test.ts index 9f0b1b201a5c..2e40d47db102 100644 --- a/shared/modules/selectors/index.test.ts +++ b/shared/modules/selectors/index.test.ts @@ -9,7 +9,6 @@ import { getCurrentChainSupportsSmartTransactions, getSmartTransactionsEnabled, getIsSmartTransaction, - getIsSmartTransactionsOptInModalAvailable, getSmartTransactionsPreferenceEnabled, } from '.'; @@ -70,7 +69,7 @@ describe('Selectors', () => { }; describe('getSmartTransactionsOptInStatusForMetrics and getSmartTransactionsPreferenceEnabled', () => { - const createMockOptInStatusState = (status: boolean | null) => { + const createMockOptInStatusState = (status: boolean) => { return { metamask: { preferences: { @@ -89,7 +88,6 @@ describe('Selectors', () => { jestIt.each([ { status: true, expected: true }, { status: false, expected: false }, - { status: null, expected: null }, ])( 'should return $expected if the smart transactions opt-in status is $status', ({ status, expected }) => { @@ -113,7 +111,6 @@ describe('Selectors', () => { jestIt.each([ { status: true, expected: true }, { status: false, expected: false }, - { status: null, expected: true }, ])( 'should return $expected if the smart transactions opt-in status is $status', ({ status, expected }) => { @@ -316,123 +313,4 @@ describe('Selectors', () => { expect(result).toBe(false); }); }); - - describe('getIsSmartTransactionsOptInModalAvailable', () => { - jestIt( - 'returns true for Ethereum Mainnet + supported RPC URL + null opt-in status and non-zero balance', - () => { - const state = createMockState(); - const newState = { - ...state, - metamask: { - ...state.metamask, - preferences: { - ...state.metamask.preferences, - smartTransactionsOptInStatus: null, - }, - }, - }; - expect(getIsSmartTransactionsOptInModalAvailable(newState)).toBe(true); - }, - ); - - jestIt( - 'returns false for Polygon Mainnet + supported RPC URL + null opt-in status and non-zero balance', - () => { - const state = createMockState(); - const newState = { - ...state, - metamask: { - ...state.metamask, - preferences: { - ...state.metamask.preferences, - smartTransactionsOptInStatus: null, - }, - ...mockNetworkState({ chainId: CHAIN_IDS.POLYGON }), - }, - }; - expect(getIsSmartTransactionsOptInModalAvailable(newState)).toBe(false); - }, - ); - - jestIt( - 'returns false for Ethereum Mainnet + unsupported RPC URL + null opt-in status and non-zero balance', - () => { - const state = createMockState(); - const newState = { - ...state, - metamask: { - ...state.metamask, - preferences: { - ...state.metamask.preferences, - smartTransactionsOptInStatus: null, - }, - ...mockNetworkState({ - chainId: CHAIN_IDS.MAINNET, - rpcUrl: 'https://mainnet.quiknode.pro/', - }), - }, - }; - expect(getIsSmartTransactionsOptInModalAvailable(newState)).toBe(false); - }, - ); - - jestIt( - 'returns false for Ethereum Mainnet + supported RPC URL + true opt-in status and non-zero balance', - () => { - const state = createMockState(); - expect(getIsSmartTransactionsOptInModalAvailable(state)).toBe(false); - }, - ); - - jestIt( - 'returns false for Ethereum Mainnet + supported RPC URL + null opt-in status and zero balance (0x0)', - () => { - const state = createMockState(); - const newState = { - ...state, - metamask: { - ...state.metamask, - preferences: { - ...state.metamask.preferences, - smartTransactionsOptInStatus: null, - }, - accounts: { - ...state.metamask.accounts, - '0x123': { - address: '0x123', - balance: '0x0', - }, - }, - }, - }; - expect(getIsSmartTransactionsOptInModalAvailable(newState)).toBe(false); - }, - ); - - jestIt( - 'returns false for Ethereum Mainnet + supported RPC URL + null opt-in status and zero balance (0x00)', - () => { - const state = createMockState(); - const newState = { - ...state, - metamask: { - ...state.metamask, - preferences: { - ...state.metamask.preferences, - smartTransactionsOptInStatus: null, - }, - accounts: { - ...state.metamask.accounts, - '0x123': { - address: '0x123', - balance: '0x00', - }, - }, - }, - }; - expect(getIsSmartTransactionsOptInModalAvailable(newState)).toBe(false); - }, - ); - }); }); diff --git a/shared/modules/selectors/smart-transactions.ts b/shared/modules/selectors/smart-transactions.ts index a02fe63692b3..4fb6d56fc87d 100644 --- a/shared/modules/selectors/smart-transactions.ts +++ b/shared/modules/selectors/smart-transactions.ts @@ -7,21 +7,16 @@ import { getCurrentChainId, getCurrentNetwork, accountSupportsSmartTx, - getSelectedAccount, getPreferences, // TODO: Remove restricted import // eslint-disable-next-line import/no-restricted-paths } from '../../../ui/selectors/selectors'; // TODO: Migrate shared selectors to this file. import { isProduction } from '../environment'; -// TODO: Remove restricted import -// eslint-disable-next-line import/no-restricted-paths -import { MultichainState } from '../../../ui/selectors/multichain'; - type SmartTransactionsMetaMaskState = { metamask: { preferences: { - smartTransactionsOptInStatus?: boolean | null; + smartTransactionsOptInStatus?: boolean; }; internalAccounts: { selectedAccount: string; @@ -72,10 +67,8 @@ type SmartTransactionsMetaMaskState = { */ export const getSmartTransactionsOptInStatusInternal = createSelector( getPreferences, - (preferences: { - smartTransactionsOptInStatus?: boolean | null; - }): boolean | null => { - return preferences?.smartTransactionsOptInStatus ?? null; + (preferences: { smartTransactionsOptInStatus?: boolean }): boolean => { + return preferences?.smartTransactionsOptInStatus ?? true; }, ); @@ -93,7 +86,7 @@ export const getSmartTransactionsOptInStatusInternal = createSelector( */ export const getSmartTransactionsOptInStatusForMetrics = createSelector( getSmartTransactionsOptInStatusInternal, - (optInStatus: boolean | null): boolean | null => optInStatus, + (optInStatus: boolean): boolean => optInStatus, ); /** @@ -105,7 +98,7 @@ export const getSmartTransactionsOptInStatusForMetrics = createSelector( */ export const getSmartTransactionsPreferenceEnabled = createSelector( getSmartTransactionsOptInStatusInternal, - (optInStatus: boolean | null): boolean => { + (optInStatus: boolean): boolean => { // In the absence of an explicit opt-in or opt-out, // the Smart Transactions toggle is enabled. const DEFAULT_SMART_TRANSACTIONS_ENABLED = true; @@ -137,30 +130,6 @@ const getIsAllowedRpcUrlForSmartTransactions = ( return rpcUrl?.hostname?.endsWith('.infura.io'); }; -/** - * Checks if the selected account has a non-zero balance. - * - * @param state - The state object containing account information. - * @returns true if the selected account has a non-zero balance, otherwise false. - */ -const hasNonZeroBalance = (state: SmartTransactionsMetaMaskState) => { - const selectedAccount = getSelectedAccount( - state as unknown as MultichainState, - ); - return BigInt(selectedAccount?.balance || '0x0') > 0n; -}; - -export const getIsSmartTransactionsOptInModalAvailable = ( - state: SmartTransactionsMetaMaskState, -) => { - return ( - getCurrentChainSupportsSmartTransactions(state) && - getIsAllowedRpcUrlForSmartTransactions(state) && - getSmartTransactionsOptInStatusInternal(state) === null && - hasNonZeroBalance(state) - ); -}; - export const getSmartTransactionsEnabled = ( state: SmartTransactionsMetaMaskState, ): boolean => { diff --git a/test/data/mock-state.json b/test/data/mock-state.json index 2865478912f3..184787b07836 100644 --- a/test/data/mock-state.json +++ b/test/data/mock-state.json @@ -372,7 +372,7 @@ "showFiatInTestnets": false, "showNativeTokenAsMainBalance": true, "showTestNetworks": true, - "smartTransactionsOptInStatus": false, + "smartTransactionsOptInStatus": true, "tokenSortConfig": { "key": "tokenFiatAmount", "order": "dsc", diff --git a/test/e2e/default-fixture.js b/test/e2e/default-fixture.js index 95f35bf1694c..2d3d2999ed43 100644 --- a/test/e2e/default-fixture.js +++ b/test/e2e/default-fixture.js @@ -212,7 +212,7 @@ function defaultFixture(inputChainId = CHAIN_IDS.LOCALHOST) { showExtensionInFullSizeView: false, showFiatInTestnets: false, showTestNetworks: false, - smartTransactionsOptInStatus: false, + smartTransactionsOptInStatus: true, showNativeTokenAsMainBalance: true, petnamesEnabled: true, showMultiRpcModal: false, diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index 4d7e1873bff4..334e2f74ceca 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -77,7 +77,7 @@ function onboardingFixture() { showFiatInTestnets: false, privacyMode: false, showTestNetworks: false, - smartTransactionsOptInStatus: false, + smartTransactionsOptInStatus: true, showNativeTokenAsMainBalance: true, petnamesEnabled: true, showMultiRpcModal: false, @@ -124,7 +124,7 @@ function onboardingFixture() { [ETHERSCAN_SUPPORTED_CHAIN_IDS.GNOSIS]: true, }, showTestNetworks: false, - smartTransactionsOptInStatus: false, + smartTransactionsOptInStatus: true, }, QueuedRequestController: { queuedRequestCount: 0, diff --git a/test/e2e/restore/MetaMaskUserData.json b/test/e2e/restore/MetaMaskUserData.json index 846acc8164cd..7a687ec254c0 100644 --- a/test/e2e/restore/MetaMaskUserData.json +++ b/test/e2e/restore/MetaMaskUserData.json @@ -36,7 +36,7 @@ "showExtensionInFullSizeView": false, "showFiatInTestnets": false, "showTestNetworks": false, - "smartTransactionsOptInStatus": false + "smartTransactionsOptInStatus": true }, "theme": "light", "useBlockie": false, diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json index 6d77cd3ae351..1a871780591f 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json @@ -224,7 +224,7 @@ "showExtensionInFullSizeView": false, "showFiatInTestnets": false, "showTestNetworks": false, - "smartTransactionsOptInStatus": false, + "smartTransactionsOptInStatus": true, "showNativeTokenAsMainBalance": true, "petnamesEnabled": true, "showMultiRpcModal": "boolean", diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json index e577bb71a6be..e8f8f81a6293 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json @@ -30,7 +30,7 @@ "showExtensionInFullSizeView": false, "showFiatInTestnets": false, "showTestNetworks": false, - "smartTransactionsOptInStatus": false, + "smartTransactionsOptInStatus": true, "showNativeTokenAsMainBalance": true, "petnamesEnabled": true, "showMultiRpcModal": "boolean", diff --git a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json index 89b1b29100bb..1a51023a2ca1 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json @@ -128,7 +128,7 @@ "showExtensionInFullSizeView": false, "showFiatInTestnets": false, "showTestNetworks": false, - "smartTransactionsOptInStatus": false, + "smartTransactionsOptInStatus": true, "showNativeTokenAsMainBalance": true, "petnamesEnabled": true, "isRedesignedConfirmationsDeveloperEnabled": "boolean", diff --git a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json index f13d3e078c64..bf7f87a16134 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json @@ -128,7 +128,7 @@ "showExtensionInFullSizeView": false, "showFiatInTestnets": false, "showTestNetworks": false, - "smartTransactionsOptInStatus": false, + "smartTransactionsOptInStatus": true, "showNativeTokenAsMainBalance": true, "petnamesEnabled": true, "isRedesignedConfirmationsDeveloperEnabled": "boolean", diff --git a/test/integration/data/integration-init-state.json b/test/integration/data/integration-init-state.json index 7949e19cfa51..a0ae3a8fb146 100644 --- a/test/integration/data/integration-init-state.json +++ b/test/integration/data/integration-init-state.json @@ -781,7 +781,7 @@ "showExtensionInFullSizeView": false, "showFiatInTestnets": false, "showTestNetworks": true, - "smartTransactionsOptInStatus": false, + "smartTransactionsOptInStatus": true, "petnamesEnabled": false, "showConfirmationAdvancedDetails": false, "showMultiRpcModal": false diff --git a/test/integration/data/onboarding-completion-route.json b/test/integration/data/onboarding-completion-route.json index e47d1379b2eb..b2c19536a138 100644 --- a/test/integration/data/onboarding-completion-route.json +++ b/test/integration/data/onboarding-completion-route.json @@ -223,7 +223,7 @@ "showExtensionInFullSizeView": false, "showFiatInTestnets": false, "showTestNetworks": false, - "smartTransactionsOptInStatus": null, + "smartTransactionsOptInStatus": true, "hideZeroBalanceTokens": false, "petnamesEnabled": true, "redesignedConfirmationsEnabled": true, diff --git a/ui/ducks/metamask/metamask.js b/ui/ducks/metamask/metamask.js index 9627608eb709..63ff92a11ccc 100644 --- a/ui/ducks/metamask/metamask.js +++ b/ui/ducks/metamask/metamask.js @@ -47,7 +47,7 @@ const initialState = { showExtensionInFullSizeView: false, showFiatInTestnets: false, showTestNetworks: false, - smartTransactionsOptInStatus: false, + smartTransactionsOptInStatus: true, petnamesEnabled: true, featureNotificationsEnabled: false, privacyMode: false, diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index 37c147427ac5..9ac71dd6a766 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -13,7 +13,6 @@ import TermsOfUsePopup from '../../components/app/terms-of-use-popup'; import RecoveryPhraseReminder from '../../components/app/recovery-phrase-reminder'; import WhatsNewPopup from '../../components/app/whats-new-popup'; import { FirstTimeFlowType } from '../../../shared/constants/onboarding'; -import SmartTransactionsOptInModal from '../smart-transactions/components/smart-transactions-opt-in-modal'; ///: END:ONLY_INCLUDE_IF import HomeNotification from '../../components/app/home-notification'; import MultipleNotifications from '../../components/app/multiple-notifications'; @@ -155,7 +154,6 @@ export default class Home extends PureComponent { hideWhatsNewPopup: PropTypes.func.isRequired, announcementsToShow: PropTypes.bool.isRequired, onboardedInThisUISession: PropTypes.bool, - isSmartTransactionsOptInModalAvailable: PropTypes.bool.isRequired, showMultiRpcModal: PropTypes.bool.isRequired, ///: END:ONLY_INCLUDE_IF newNetworkAddedConfigurationId: PropTypes.string, @@ -937,7 +935,6 @@ export default class Home extends PureComponent { announcementsToShow, firstTimeFlowType, newNetworkAddedConfigurationId, - isSmartTransactionsOptInModalAvailable, showMultiRpcModal, ///: END:ONLY_INCLUDE_IF } = this.props; @@ -956,20 +953,11 @@ export default class Home extends PureComponent { !process.env.IN_TEST && !newNetworkAddedConfigurationId; - const showSmartTransactionsOptInModal = - canSeeModals && isSmartTransactionsOptInModalAvailable; - const showWhatsNew = - canSeeModals && - announcementsToShow && - showWhatsNewPopup && - !showSmartTransactionsOptInModal; + canSeeModals && announcementsToShow && showWhatsNewPopup; const showMultiRpcEditModal = - canSeeModals && - showMultiRpcModal && - !showSmartTransactionsOptInModal && - !showWhatsNew; + canSeeModals && showMultiRpcModal && !showWhatsNew; const showTermsOfUse = completedOnboarding && !onboardedInThisUISession && showTermsOfUsePopup; @@ -991,11 +979,6 @@ export default class Home extends PureComponent { { ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) } - - {showMultiRpcEditModal && } {showWhatsNew ? : null} {!showWhatsNew && showRecoveryPhraseReminder ? ( diff --git a/ui/pages/home/home.container.js b/ui/pages/home/home.container.js index dfeb1a5e7cdb..9d4511021529 100644 --- a/ui/pages/home/home.container.js +++ b/ui/pages/home/home.container.js @@ -222,10 +222,6 @@ const mapStateToProps = (state) => { custodianDeepLink: getCustodianDeepLink(state), accountType: getAccountType(state), ///: END:ONLY_INCLUDE_IF - - // Set to false to prevent the opt-in modal from showing. - // TODO(dbrans): Remove opt-in modal once default opt-in is stable. - isSmartTransactionsOptInModalAvailable: false, showMultiRpcModal: state.metamask.preferences.showMultiRpcModal, }; }; diff --git a/ui/pages/settings/advanced-tab/__snapshots__/advanced-tab.component.test.js.snap b/ui/pages/settings/advanced-tab/__snapshots__/advanced-tab.component.test.js.snap index 6318abd37570..25a5a9b526f6 100644 --- a/ui/pages/settings/advanced-tab/__snapshots__/advanced-tab.component.test.js.snap +++ b/ui/pages/settings/advanced-tab/__snapshots__/advanced-tab.component.test.js.snap @@ -98,34 +98,34 @@ exports[`AdvancedTab Component should match snapshot 1`] = ` class="settings-page__content-item-col" >