From 9a153d2388ae890fd284d727649b5cf6ba34c7e7 Mon Sep 17 00:00:00 2001 From: Daniel <80175477+dan437@users.noreply.github.com> Date: Wed, 11 May 2022 20:30:03 +0200 Subject: [PATCH] Remove gas editing in Swaps (#14673) * Remove gas editing in Swaps * Remove "extraApprovalGas" --- app/_locales/de/messages.json | 13 - app/_locales/el/messages.json | 13 - app/_locales/en/messages.json | 13 - app/_locales/es/messages.json | 13 - app/_locales/es_419/messages.json | 13 - app/_locales/fr/messages.json | 13 - app/_locales/hi/messages.json | 13 - app/_locales/id/messages.json | 13 - app/_locales/it/messages.json | 13 - app/_locales/ja/messages.json | 13 - app/_locales/ko/messages.json | 13 - app/_locales/ph/messages.json | 13 - app/_locales/pt/messages.json | 13 - app/_locales/pt_BR/messages.json | 13 - app/_locales/ru/messages.json | 13 - app/_locales/tl/messages.json | 13 - app/_locales/tr/messages.json | 13 - app/_locales/vi/messages.json | 13 - app/_locales/zh/messages.json | 13 - app/_locales/zh_CN/messages.json | 13 - ui/components/app/modals/modal.js | 26 -- ui/pages/swaps/fee-card/fee-card.js | 12 - ...customization-modal.component.test.js.snap | 136 --------- ...customization-modal.container.test.js.snap | 98 ------ .../swaps-gas-customization-modal/index.js | 1 - ...swaps-gas-customization-modal.component.js | 281 ------------------ ...-gas-customization-modal.component.test.js | 81 ----- ...swaps-gas-customization-modal.container.js | 186 ------------ ...-gas-customization-modal.container.test.js | 34 --- .../swaps-gas-customization-modal.stories.js | 253 ---------------- ui/pages/swaps/view-quote/view-quote.js | 78 ----- 31 files changed, 1446 deletions(-) delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.container.test.js.snap delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/index.js delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.js delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.test.js delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.js delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.test.js delete mode 100644 ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.stories.js diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 0fae6cf34..ed85a38cf 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Ich stimme zu" }, - "aggregatorFeeCost": { - "message": "Aggregator-Netzwerkgebühr" - }, "airgapVault": { "message": "AirGap-Tresor" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Netzwerkgebühr für Freigabe und Aggregator" - }, - "approvalTxGasCost": { - "message": "Tx-Gaskosten genehmigen" - }, "approve": { "message": "Genehmigen" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Externe Erweiterung" }, - "extraApprovalGas": { - "message": "+$1 Genehmigungsgas", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Fehlgeschlagen" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index 74b1a1167..fec2fcdc2 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Συμφωνώ" }, - "aggregatorFeeCost": { - "message": "Αμοιβή ανταλλακτηρίου" - }, "airgapVault": { "message": "Θησαυροφυλάκιο AirGap" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Τέλος έγκρισης και δικτύου ανταλλακτηρίου" - }, - "approvalTxGasCost": { - "message": "Έγκριση Tx τέλους συναλλαγής" - }, "approve": { "message": "Έγκριση" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Εξωτερική Επέκταση" }, - "extraApprovalGas": { - "message": "+$1 τέλος συναλλαγής", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Απέτυχε" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 90e0eed44..b63775632 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -203,9 +203,6 @@ "affirmAgree": { "message": "I Agree" }, - "aggregatorFeeCost": { - "message": "Aggregator network fee" - }, "airgapVault": { "message": "AirGap Vault" }, @@ -263,12 +260,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Approval and aggregator network fee" - }, - "approvalTxGasCost": { - "message": "Approval Tx Gas Cost" - }, "approve": { "message": "Approve spend limit" }, @@ -1185,10 +1176,6 @@ "externalExtension": { "message": "External Extension" }, - "extraApprovalGas": { - "message": "+$1 approval gas", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Failed" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index cff3d812c..e31832da5 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Acepto" }, - "aggregatorFeeCost": { - "message": "Cuota de red de agregador" - }, "airgapVault": { "message": "Bóveda AirGap" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Cuota de red de agregador y aprobación" - }, - "approvalTxGasCost": { - "message": "Costo de gas por transacción de aprobación" - }, "approve": { "message": "Aprobar límite de gastos" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Extensión externa" }, - "extraApprovalGas": { - "message": "+$1 gas por aprobación", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Con errores" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index 3ac62593e..25ff367a3 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -179,9 +179,6 @@ "affirmAgree": { "message": "Acepto" }, - "aggregatorFeeCost": { - "message": "Cuota de red de agregador" - }, "alertDisableTooltip": { "message": "Esto se puede modificar en \"Configuración > Alertas\"" }, @@ -233,12 +230,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Cuota de red de agregador y aprobación" - }, - "approvalTxGasCost": { - "message": "Costo de gas por transacción de aprobación" - }, "approve": { "message": "Aprobar límite de gastos" }, @@ -1047,10 +1038,6 @@ "externalExtension": { "message": "Extensión externa" }, - "extraApprovalGas": { - "message": "+$1 de gas por aprobación", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Con errores" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 424c76bf9..ffed6ee1b 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Je suis d’accord" }, - "aggregatorFeeCost": { - "message": "Frais de réseau de l’agrégateur" - }, "airgapVault": { "message": "Coffre-fort AirGap" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Approbation et frais du réseau d’agrégateur" - }, - "approvalTxGasCost": { - "message": "Approbation du coût de carburant Tx" - }, "approve": { "message": "Approuver" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Extension externe" }, - "extraApprovalGas": { - "message": "+$1 de carburant approuvé", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Échec" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 5e64aa17b..1b55a7c66 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "मैं सहमत हूं" }, - "aggregatorFeeCost": { - "message": "एग्रीगेटर नेटवर्क शुल्क" - }, "airgapVault": { "message": "AirGap का वॉल्ट" }, @@ -252,12 +249,6 @@ "message": "MetaMask Fask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "अनुमोदन और एग्रीगेटर नेटवर्क शुल्क" - }, - "approvalTxGasCost": { - "message": "अनुमोदन Tx गैस कीमत" - }, "approve": { "message": "खर्च सीमा अनुमोदित करें" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "बाहरी विस्तार" }, - "extraApprovalGas": { - "message": "+$1 अनुमोदन गैस", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "विफल" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 30c09796a..f7109be0d 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Saya Setuju" }, - "aggregatorFeeCost": { - "message": "Biaya jaringan agregator" - }, "airgapVault": { "message": "Brankas AirGap" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Persetujuan dan biaya jaringan agregator" - }, - "approvalTxGasCost": { - "message": "Persetujuan Ongkos Jaringan Tx" - }, "approve": { "message": "Setujui batas penggunaan" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Ekstensi Eksternal" }, - "extraApprovalGas": { - "message": "+$1 gas yang disetujui", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Gagal" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index 7e92d2b21..faaa3079f 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -67,9 +67,6 @@ "affirmAgree": { "message": "Acconsento" }, - "aggregatorFeeCost": { - "message": "Tassa per la rete aggregatore" - }, "alertDisableTooltip": { "message": "Può essere cambiato in \"Impostazioni > Avvisi\"" }, @@ -117,12 +114,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Tassa di approvazione per la rete aggregatore" - }, - "approvalTxGasCost": { - "message": "Costo Gas Approvazione Tx" - }, "approve": { "message": "Approva" }, @@ -568,10 +559,6 @@ "externalExtension": { "message": "Estensione Esterna" }, - "extraApprovalGas": { - "message": "+$1 gas approvazione", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Fallita" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index eba06c489..302b7f7c4 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "同意する" }, - "aggregatorFeeCost": { - "message": "アグリゲーター ネットワーク料金" - }, "airgapVault": { "message": "AirGap Vault" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "承認およびアグリゲーターネットワークの手数料" - }, - "approvalTxGasCost": { - "message": "承認送信のガス代" - }, "approve": { "message": "使用限度額の承認" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "外部拡張機能" }, - "extraApprovalGas": { - "message": "+$1承認ガス", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "失敗しました" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index b3d343e89..6325712ee 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "동의함" }, - "aggregatorFeeCost": { - "message": "애그리게이터 네트워크 수수료" - }, "airgapVault": { "message": "에어갭 볼트" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "승인 및 애그리게이터 네트워크 수수료" - }, - "approvalTxGasCost": { - "message": "승인 Tx 가스 비용" - }, "approve": { "message": "지출 한도 승인" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "외부 확장" }, - "extraApprovalGas": { - "message": "+$1의 승인 가스", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "실패" }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index 36da6fd32..9855e4452 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -91,9 +91,6 @@ "affirmAgree": { "message": "Sang-ayon ako" }, - "aggregatorFeeCost": { - "message": "Bayarin sa aggregator network" - }, "alertDisableTooltip": { "message": "Mababago ito sa \"Mga Setting > Mga Alerto\"" }, @@ -141,12 +138,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Bayarin sa pag-apruba at aggregator network" - }, - "approvalTxGasCost": { - "message": "Approval Tx Gas Cost" - }, "approve": { "message": "Aprubahan ang limitasyon sa paggastos" }, @@ -674,10 +665,6 @@ "externalExtension": { "message": "External Extension" }, - "extraApprovalGas": { - "message": "+$1 na pag-apruba sa gas", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Hindi matagumpay" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 1fb3d812d..8337211df 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Concordo" }, - "aggregatorFeeCost": { - "message": "Taxa de rede do agregador" - }, "airgapVault": { "message": "AirGap Vault" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Taxa de aprovação e da rede do agregador" - }, - "approvalTxGasCost": { - "message": "Custo em gás da transação de aprovação" - }, "approve": { "message": "Aprovar" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Extensão externa" }, - "extraApprovalGas": { - "message": "+$1 de gás por aprovação", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Falhou" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index c59a092a2..3062c1574 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -179,9 +179,6 @@ "affirmAgree": { "message": "Concordo" }, - "aggregatorFeeCost": { - "message": "Taxa de rede do agregador" - }, "alertDisableTooltip": { "message": "Isso pode ser alterado em \"Configurações > Alertas\"" }, @@ -233,12 +230,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Taxa de aprovação e da rede do agregador" - }, - "approvalTxGasCost": { - "message": "Custo em gás da transação de aprovação" - }, "approve": { "message": "Aprovar limite de gastos" }, @@ -1031,10 +1022,6 @@ "externalExtension": { "message": "Extensão externa" }, - "extraApprovalGas": { - "message": "+$1 de gás por aprovação", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Falhou" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index eb402933f..c61d7d9a5 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Я согласен(-на)" }, - "aggregatorFeeCost": { - "message": "Комиссия сети агрегатора" - }, "airgapVault": { "message": "Хранилище AirGap" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Комиссия сети за одобрение и для агрегатора" - }, - "approvalTxGasCost": { - "message": "Стоимость газа для утверждения транзакции" - }, "approve": { "message": "Одобрить лимит расходов" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Внешнее расширение" }, - "extraApprovalGas": { - "message": "+$1 газа для утверждения", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Не удалось" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index b59c10d9f..fb3fcb92a 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Sang-ayon Ako" }, - "aggregatorFeeCost": { - "message": "Bayarin sa aggregator network" - }, "airgapVault": { "message": "AirGap Vault" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Bayarin sa pag-apruba at aggregator network" - }, - "approvalTxGasCost": { - "message": "Pag-apruba Tx Halaga ng Gas" - }, "approve": { "message": "Aprubahan ang limitasyon sa paggastos" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "External Extension" }, - "extraApprovalGas": { - "message": "+$1 na pag-apruba sa gas", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Hindi matagumpay" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 00c61eaf1..df04f15ba 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Kabul Ediyorum" }, - "aggregatorFeeCost": { - "message": "Toplayıcı ağ ücreti" - }, "airgapVault": { "message": "AirGap Kasası" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Onaylayıcı ve toplayıcı ağ ücreti" - }, - "approvalTxGasCost": { - "message": "Onaylayıcı İşlem Gaz Maliyeti" - }, "approve": { "message": "Harcama limitini onayla" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Harici Uzantı" }, - "extraApprovalGas": { - "message": "+1$ onay gazı", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Başarısız oldu" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 6cfcdf758..02eaddd38 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "Tôi đồng ý" }, - "aggregatorFeeCost": { - "message": "Phí mạng cho trình tổng hợp" - }, "airgapVault": { "message": "AirGap Vault" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "Phí mạng cho trình tổng hợp và việc phê duyệt" - }, - "approvalTxGasCost": { - "message": "Chi phí gas cho giao dịch phê duyệt" - }, "approve": { "message": "Phê duyệt giới hạn chi tiêu" }, @@ -1174,10 +1165,6 @@ "externalExtension": { "message": "Tiện ích bên ngoài" }, - "extraApprovalGas": { - "message": "+$1 gas phê duyệt", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "Không thành công" }, diff --git a/app/_locales/zh/messages.json b/app/_locales/zh/messages.json index 0f6f28b90..5e6bfd118 100644 --- a/app/_locales/zh/messages.json +++ b/app/_locales/zh/messages.json @@ -192,9 +192,6 @@ "affirmAgree": { "message": "我同意" }, - "aggregatorFeeCost": { - "message": "聚合器网络费用" - }, "airgapVault": { "message": "AirGap Vault" }, @@ -252,12 +249,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "批准和聚合器网络费用" - }, - "approvalTxGasCost": { - "message": "批准 Tx 燃料成本" - }, "approve": { "message": "批准消费限额" }, @@ -1177,10 +1168,6 @@ "externalExtension": { "message": "外部扩展程序" }, - "extraApprovalGas": { - "message": "额外的 $1 批准燃料", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "失败" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index ad530bbd8..8e5ed751e 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -179,9 +179,6 @@ "affirmAgree": { "message": "我同意" }, - "aggregatorFeeCost": { - "message": "聚集器网络手续费" - }, "alertDisableTooltip": { "message": "这个可以在“设置 > 提醒”中进行更改" }, @@ -233,12 +230,6 @@ "message": "MetaMask Flask", "description": "The name of the application (Flask)" }, - "approvalAndAggregatorTxFeeCost": { - "message": "批准聚合商网络手续费" - }, - "approvalTxGasCost": { - "message": "批准交易燃料成本" - }, "approve": { "message": "批准消费限额" }, @@ -1017,10 +1008,6 @@ "externalExtension": { "message": "外部扩展" }, - "extraApprovalGas": { - "message": "+$1 批准燃料", - "description": "Expresses an additional gas amount the user will have to pay, on top of some other displayed amount. $1 is a decimal amount of gas" - }, "failed": { "message": "失败" }, diff --git a/ui/components/app/modals/modal.js b/ui/components/app/modals/modal.js index 3eab79fcc..0e5d1dcda 100644 --- a/ui/components/app/modals/modal.js +++ b/ui/components/app/modals/modal.js @@ -10,7 +10,6 @@ import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app'; // Modal Components import ConfirmCustomizeGasModal from '../gas-customization/gas-modal-page-container'; -import SwapsGasCustomizationModal from '../../../pages/swaps/swaps-gas-customization-modal'; import DepositEtherModal from './deposit-ether-modal'; import AccountDetailsModal from './account-details-modal'; import ExportPrivateKeyModal from './export-private-key-modal'; @@ -265,31 +264,6 @@ const MODALS = { }, }, - CUSTOMIZE_METASWAP_GAS: { - contents: , - mobileModalStyle: { - width: '100vw', - height: '100vh', - top: '0', - transform: 'none', - left: '0', - right: '0', - margin: '0 auto', - }, - laptopModalStyle: { - width: 'auto', - height: '0px', - top: '80px', - left: '0px', - transform: 'none', - margin: '0 auto', - position: 'relative', - }, - contentStyle: { - borderRadius: '8px', - }, - }, - EDIT_APPROVAL_PERMISSION: { contents: , mobileModalStyle: { diff --git a/ui/pages/swaps/fee-card/fee-card.js b/ui/pages/swaps/fee-card/fee-card.js index 3c2a11946..f2451f624 100644 --- a/ui/pages/swaps/fee-card/fee-card.js +++ b/ui/pages/swaps/fee-card/fee-card.js @@ -29,7 +29,6 @@ export default function FeeCard({ primaryFee, secondaryFee, hideTokenApprovalRow, - onFeeCardMaxRowClick, tokenApprovalSourceTokenSymbol, onTokenApprovalClick, metaMaskFee, @@ -139,16 +138,6 @@ export default function FeeCard({ {t('maxFee')} {`: ${secondaryFee.maxFee}`} - {!supportsEIP1559V2 && - (!smartTransactionsEnabled || - !smartTransactionsOptInStatus) && ( - onFeeCardMaxRowClick()} - > - {t('edit')} - - )} ) } @@ -213,7 +202,6 @@ FeeCard.propTypes = { fee: PropTypes.string.isRequired, maxFee: PropTypes.string.isRequired, }), - onFeeCardMaxRowClick: PropTypes.func.isRequired, hideTokenApprovalRow: PropTypes.bool.isRequired, tokenApprovalSourceTokenSymbol: PropTypes.string, onTokenApprovalClick: PropTypes.func, diff --git a/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap b/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap deleted file mode 100644 index 44ff12529..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.component.test.js.snap +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`GasCustomizationModalComponent renders the component with initial props 1`] = ` -
-
- Customize Gas -
-
- Increasing fee may decrease processing times, but it is not guaranteed. -
- - Close - -
    -
  • - -
  • -
  • - -
  • -
-
-`; - -exports[`GasCustomizationModalComponent renders the component with initial props 2`] = ` - -`; - -exports[`GasCustomizationModalComponent renders the component with initial props 3`] = ` - -`; - -exports[`GasCustomizationModalComponent renders the component with initial props 4`] = ` - -`; - -exports[`GasCustomizationModalComponent renders the component with initial props 5`] = ` - -`; diff --git a/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.container.test.js.snap b/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.container.test.js.snap deleted file mode 100644 index 91d0d69ba..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/__snapshots__/swaps-gas-customization-modal.container.test.js.snap +++ /dev/null @@ -1,98 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`GasCustomizationModalContainer renders the component with initial props 1`] = ` -
-
- Customize Gas -
-
- Increasing fee may decrease processing times, but it is not guaranteed. -
- - Close - -
    -
  • - -
  • -
  • - -
  • -
-
-`; - -exports[`GasCustomizationModalContainer renders the component with initial props 2`] = ` - -`; - -exports[`GasCustomizationModalContainer renders the component with initial props 3`] = ` - -`; - -exports[`GasCustomizationModalContainer renders the component with initial props 4`] = ` - -`; diff --git a/ui/pages/swaps/swaps-gas-customization-modal/index.js b/ui/pages/swaps/swaps-gas-customization-modal/index.js deleted file mode 100644 index a54988ab9..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './swaps-gas-customization-modal.container'; diff --git a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.js b/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.js deleted file mode 100644 index 848f34feb..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.js +++ /dev/null @@ -1,281 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import PageContainer from '../../../components/ui/page-container'; -import { Tabs, Tab } from '../../../components/ui/tabs'; -import { calcGasTotal } from '../../send/send.utils'; -import { sumHexWEIsToUnformattedFiat } from '../../../helpers/utils/conversions.util'; -import AdvancedGasInputs from '../../../components/app/gas-customization/advanced-gas-inputs'; -import BasicTabContent from '../../../components/app/gas-customization/gas-modal-page-container/basic-tab-content'; -import { GAS_ESTIMATE_TYPES } from '../../../helpers/constants/common'; -import { CUSTOM_GAS_ESTIMATE } from '../../../../shared/constants/gas'; -import { EVENT } from '../../../../shared/constants/metametrics'; - -export default class GasModalPageContainer extends Component { - static contextTypes = { - t: PropTypes.func, - trackEvent: PropTypes.func, - }; - - static propTypes = { - insufficientBalance: PropTypes.bool, - gasPriceButtonGroupProps: PropTypes.object, - infoRowProps: PropTypes.shape({ - originalTotalFiat: PropTypes.string, - originalTotalEth: PropTypes.string, - newTotalFiat: PropTypes.string, - newTotalEth: PropTypes.string, - sendAmount: PropTypes.string, - transactionFee: PropTypes.string, - extraInfoRow: PropTypes.shape({ - label: PropTypes.string, - value: PropTypes.string, - }), - }), - onSubmit: PropTypes.func, - cancelAndClose: PropTypes.func, - showCustomPriceTooLowWarning: PropTypes.bool, - disableSave: PropTypes.bool, - customGasLimitMessage: PropTypes.string, - customTotalSupplement: PropTypes.string, - usdConversionRate: PropTypes.number, - customGasPrice: PropTypes.string, - customGasLimit: PropTypes.string, - setSwapsCustomizationModalPrice: PropTypes.func, - setSwapsCustomizationModalLimit: PropTypes.func, - gasEstimateLoadingHasFailed: PropTypes.bool, - minimumGasLimit: PropTypes.number.isRequired, - }; - - state = { - gasSpeedType: '', - }; - - setGasSpeedType(gasEstimateType) { - if (gasEstimateType === GAS_ESTIMATE_TYPES.AVERAGE) { - this.setState({ gasSpeedType: 'average' }); - } else { - this.setState({ gasSpeedType: 'fast' }); - } - } - - renderBasicTabContent(gasPriceButtonGroupProps) { - return ( - { - this.setGasSpeedType(gasEstimateType); - this.props.setSwapsCustomizationModalPrice(gasPrice); - }, - }} - /> - ); - } - - renderAdvancedTabContent() { - const { - insufficientBalance, - showCustomPriceTooLowWarning, - infoRowProps: { transactionFee }, - customGasLimitMessage, - setSwapsCustomizationModalPrice, - setSwapsCustomizationModalLimit, - customGasPrice, - customGasLimit, - minimumGasLimit, - } = this.props; - - return ( -
-
-
- {this.context.t('newTransactionFee')} -
-
-
- {transactionFee} -
-
-
-
-
- { - this.setState({ gasSpeedType: CUSTOM_GAS_ESTIMATE }); - setSwapsCustomizationModalPrice(updatedPrice); - }} - updateCustomGasLimit={(updatedLimit) => { - this.setState({ gasSpeedType: CUSTOM_GAS_ESTIMATE }); - setSwapsCustomizationModalLimit(updatedLimit); - }} - customGasPrice={customGasPrice} - customGasLimit={customGasLimit} - insufficientBalance={insufficientBalance} - customPriceIsSafe={!showCustomPriceTooLowWarning} - customGasLimitMessage={customGasLimitMessage} - minimumGasLimit={minimumGasLimit} - /> -
-
-
- ); - } - - renderInfoRows( - newTotalFiat, - newTotalEth, - sendAmount, - transactionFee, - extraInfoRow, - ) { - return ( -
-
-
- - {this.context.t('sendAmount')} - - - {sendAmount} - -
-
- - {this.context.t('transactionFee')} - - - {transactionFee} - -
- {extraInfoRow && ( -
- - {extraInfoRow.label} - - - {extraInfoRow.value} - -
- )} -
- - {this.context.t('newTotal')} - - - {newTotalEth} - -
-
- - {newTotalFiat} - -
-
-
- ); - } - - renderTabs() { - const { - gasPriceButtonGroupProps, - infoRowProps: { - newTotalFiat, - newTotalEth, - sendAmount, - transactionFee, - extraInfoRow, - }, - gasEstimateLoadingHasFailed, - } = this.props; - - const basicTabInfo = { - name: this.context.t('basic'), - content: this.renderBasicTabContent({ - ...gasPriceButtonGroupProps, - handleGasPriceSelection: this.props.setSwapsCustomizationModalPrice, - }), - }; - const advancedTabInfo = { - name: this.context.t('advanced'), - content: this.renderAdvancedTabContent(), - }; - - const tabsToRender = gasEstimateLoadingHasFailed - ? [advancedTabInfo] - : [basicTabInfo, advancedTabInfo]; - - return ( - - {tabsToRender.map(({ name, content }, i) => ( - -
- {content} - {this.renderInfoRows( - newTotalFiat, - newTotalEth, - sendAmount, - transactionFee, - extraInfoRow, - )} -
-
- ))} -
- ); - } - - render() { - const { - cancelAndClose, - onSubmit, - disableSave, - customGasPrice, - customGasLimit, - } = this.props; - - return ( -
- cancelAndClose()} - onClose={() => cancelAndClose()} - onSubmit={() => { - const newSwapGasTotal = calcGasTotal( - customGasLimit, - customGasPrice, - ); - - this.context.trackEvent({ - event: 'Gas Fees Changed', - category: EVENT.CATEGORIES.SWAPS, - properties: { - speed_set: this.state.gasSpeedType, - gas_fees: sumHexWEIsToUnformattedFiat( - [newSwapGasTotal, this.props.customTotalSupplement], - 'usd', - this.props.usdConversionRate, - )?.slice(1), - }, - }); - onSubmit(customGasLimit, customGasPrice); - }} - submitText={this.context.t('save')} - headerCloseText={this.context.t('close')} - hideCancel - /> -
- ); - } -} diff --git a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.test.js b/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.test.js deleted file mode 100644 index 5e8660608..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.component.test.js +++ /dev/null @@ -1,81 +0,0 @@ -import React from 'react'; - -import { renderWithProvider } from '../../../../test/jest'; -import GasCustomizationModalComponent from './swaps-gas-customization-modal.component'; - -const createProps = (customProps = {}) => { - return { - insufficientBalance: false, - onSubmit: jest.fn(), - cancelAndClose: jest.fn(), - minimumGasLimit: 100, - gasPriceButtonGroupProps: { - buttonDataLoading: false, - className: 'gas-price-button-group', - gasButtonInfo: [ - { - feeInPrimaryCurrency: '$0.52', - feeInSecondaryCurrency: '0.0048 ETH', - timeEstimate: '~ 1 min 0 sec', - priceInHexWei: '0xa1b2c3f', - gasEstimateType: 'FAST', - }, - { - feeInPrimaryCurrency: '$0.39', - feeInSecondaryCurrency: '0.004 ETH', - timeEstimate: '~ 1 min 30 sec', - priceInHexWei: '0xa1b2c39', - gasEstimateType: 'FAST', - }, - { - feeInPrimaryCurrency: '$0.30', - feeInSecondaryCurrency: '0.00354 ETH', - timeEstimate: '~ 2 min 1 sec', - priceInHexWei: '0xa1b2c30', - gasEstimateType: 'FAST', - }, - ], - handleGasPriceSelection: 'mockSelectionFunction', - noButtonActiveByDefault: true, - showCheck: true, - newTotalFiat: 'mockNewTotalFiat', - newTotalEth: 'mockNewTotalEth', - }, - infoRowProps: { - originalTotalFiat: 'mockOriginalTotalFiat', - originalTotalEth: 'mockOriginalTotalEth', - newTotalFiat: 'mockNewTotalFiat', - newTotalEth: 'mockNewTotalEth', - sendAmount: 'mockSendAmount', - transactionFee: 'mockTransactionFee', - extraInfoRow: { label: 'mockLabel', value: 'mockValue' }, - }, - ...customProps, - }; -}; - -describe('GasCustomizationModalComponent', () => { - it('renders the component with initial props', () => { - const props = createProps(); - const { getByText, getByTestId } = renderWithProvider( - , - ); - expect(getByTestId('page-container__header')).toMatchSnapshot(); - expect(getByText('$0.52')).toBeInTheDocument(); - expect(getByText('0.0048 ETH')).toBeInTheDocument(); - expect(getByTestId('button-group__button0')).toMatchSnapshot(); - expect(getByText('~ 1 min 30 sec')).toBeInTheDocument(); - expect(getByText('$0.39')).toBeInTheDocument(); - expect(getByText('0.004 ETH')).toBeInTheDocument(); - expect( - getByTestId('gas-modal-content__info-row__send-info'), - ).toMatchSnapshot(); - expect( - getByTestId('gas-modal-content__info-row__transaction-info'), - ).toMatchSnapshot(); - expect( - getByTestId('gas-modal-content__info-row__total-info'), - ).toMatchSnapshot(); - expect(getByText('Save')).toBeInTheDocument(); - }); -}); diff --git a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.js b/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.js deleted file mode 100644 index e4e78009b..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.js +++ /dev/null @@ -1,186 +0,0 @@ -import { connect } from 'react-redux'; -import BigNumber from 'bignumber.js'; -import { hideModal, customSwapsGasParamsUpdated } from '../../../store/actions'; -import { - conversionRateSelector as getConversionRate, - getCurrentCurrency, - getCurrentEthBalance, - getDefaultActiveButtonIndex, - getRenderableGasButtonData, - getUSDConversionRate, - getSwapsDefaultToken, -} from '../../../selectors'; -import { getNativeCurrency } from '../../../ducks/metamask/metamask'; - -import { - getSwapsCustomizationModalPrice, - getSwapsCustomizationModalLimit, - swapGasEstimateLoadingHasFailed, - swapGasPriceEstimateIsLoading, - getSwapGasPriceEstimateData, - swapCustomGasModalPriceEdited, - swapCustomGasModalLimitEdited, - shouldShowCustomPriceTooLowWarning, - swapCustomGasModalClosed, -} from '../../../ducks/swaps/swaps'; -import { - addHexes, - getValueFromWeiHex, - sumHexWEIsToRenderableFiat, -} from '../../../helpers/utils/conversions.util'; -import { formatETHFee } from '../../../helpers/utils/formatters'; -import { calcGasTotal, isBalanceSufficient } from '../../send/send.utils'; -import SwapsGasCustomizationModalComponent from './swaps-gas-customization-modal.component'; - -const mapStateToProps = (state) => { - const currentCurrency = getCurrentCurrency(state); - const conversionRate = getConversionRate(state); - const nativeCurrencySymbol = getNativeCurrency(state); - const { symbol: swapsDefaultCurrencySymbol } = getSwapsDefaultToken(state); - const usedCurrencySymbol = nativeCurrencySymbol || swapsDefaultCurrencySymbol; - - const { modalState: { props: modalProps } = {} } = state.appState.modal || {}; - const { - value, - customGasLimitMessage = '', - customTotalSupplement = '', - extraInfoRow = null, - initialGasPrice, - initialGasLimit, - minimumGasLimit, - } = modalProps; - const buttonDataLoading = swapGasPriceEstimateIsLoading(state); - - const swapsCustomizationModalPrice = getSwapsCustomizationModalPrice(state); - const swapsCustomizationModalLimit = getSwapsCustomizationModalLimit(state); - - const customGasPrice = swapsCustomizationModalPrice || initialGasPrice; - const customGasLimit = swapsCustomizationModalLimit || initialGasLimit; - - const customGasTotal = calcGasTotal(customGasLimit, customGasPrice); - - const gasEstimates = getSwapGasPriceEstimateData(state); - const gasEstimatesInNewFormat = { - low: gasEstimates.safeLow, - medium: gasEstimates.average, - high: gasEstimates.fast, - }; - - const { averageEstimateData, fastEstimateData } = getRenderableGasButtonData( - gasEstimatesInNewFormat, - customGasLimit, - true, - conversionRate, - currentCurrency, - usedCurrencySymbol, - ); - const gasButtonInfo = [averageEstimateData, fastEstimateData]; - - const newTotalFiat = sumHexWEIsToRenderableFiat( - [value, customGasTotal, customTotalSupplement], - currentCurrency, - conversionRate, - ); - - const balance = getCurrentEthBalance(state); - - const newTotalEth = sumHexWEIsToRenderableEth( - [value, customGasTotal, customTotalSupplement], - usedCurrencySymbol, - ); - - const sendAmount = sumHexWEIsToRenderableEth( - [value, '0x0'], - usedCurrencySymbol, - ); - - const insufficientBalance = !isBalanceSufficient({ - amount: value, - gasTotal: customGasTotal, - balance, - conversionRate, - }); - - const customGasLimitTooLow = new BigNumber(customGasLimit, 16).lt( - minimumGasLimit, - 10, - ); - - return { - customGasPrice, - customGasLimit, - showCustomPriceTooLowWarning: shouldShowCustomPriceTooLowWarning(state), - gasPriceButtonGroupProps: { - buttonDataLoading, - defaultActiveButtonIndex: getDefaultActiveButtonIndex( - gasButtonInfo, - customGasPrice, - ), - gasButtonInfo, - }, - infoRowProps: { - originalTotalFiat: sumHexWEIsToRenderableFiat( - [value, customGasTotal, customTotalSupplement], - currentCurrency, - conversionRate, - ), - originalTotalEth: sumHexWEIsToRenderableEth( - [value, customGasTotal, customTotalSupplement], - usedCurrencySymbol, - ), - newTotalFiat, - newTotalEth, - transactionFee: sumHexWEIsToRenderableEth( - ['0x0', customGasTotal], - usedCurrencySymbol, - ), - sendAmount, - extraInfoRow, - }, - gasEstimateLoadingHasFailed: swapGasEstimateLoadingHasFailed(state), - insufficientBalance, - customGasLimitMessage, - customTotalSupplement, - usdConversionRate: getUSDConversionRate(state), - disableSave: insufficientBalance || customGasLimitTooLow, - minimumGasLimit, - }; -}; - -const mapDispatchToProps = (dispatch) => { - return { - cancelAndClose: () => { - dispatch(swapCustomGasModalClosed()); - dispatch(hideModal()); - }, - onSubmit: async (gasLimit, gasPrice) => { - await dispatch(customSwapsGasParamsUpdated(gasLimit, gasPrice)); - dispatch(swapCustomGasModalClosed()); - dispatch(hideModal()); - }, - setSwapsCustomizationModalPrice: (newPrice) => { - dispatch(swapCustomGasModalPriceEdited(newPrice)); - }, - setSwapsCustomizationModalLimit: (newLimit) => { - dispatch(swapCustomGasModalLimitEdited(newLimit)); - }, - }; -}; - -export default connect( - mapStateToProps, - mapDispatchToProps, -)(SwapsGasCustomizationModalComponent); - -function sumHexWEIsToRenderableEth(hexWEIs, currencySymbol = 'ETH') { - const hexWEIsSum = hexWEIs.filter(Boolean).reduce(addHexes); - return formatETHFee( - getValueFromWeiHex({ - value: hexWEIsSum, - fromCurrency: currencySymbol, - toCurrency: currencySymbol, - numberOfDecimals: 6, - }), - currencySymbol, - ); -} diff --git a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.test.js b/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.test.js deleted file mode 100644 index 957458b39..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.container.test.js +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; - -import { - renderWithProvider, - createSwapsMockStore, -} from '../../../../test/jest'; -import GasCustomizationModalContainer from '.'; - -describe('GasCustomizationModalContainer', () => { - it('renders the component with initial props', () => { - const store = configureMockStore()(createSwapsMockStore()); - const { getByText, getByTestId } = renderWithProvider( - , - store, - ); - expect(getByTestId('page-container__header')).toMatchSnapshot(); - expect(getByText('Basic')).toBeInTheDocument(); - expect(getByText('Advanced')).toBeInTheDocument(); - expect(getByText('Estimated Processing Times')).toBeInTheDocument(); - expect(getByText('Send Amount')).toBeInTheDocument(); - expect(getByText('Transaction fee')).toBeInTheDocument(); - expect( - getByTestId('gas-modal-content__info-row__send-info'), - ).toMatchSnapshot(); - expect( - getByTestId('gas-modal-content__info-row__transaction-info'), - ).toMatchSnapshot(); - expect( - getByTestId('gas-modal-content__info-row__total-info'), - ).toMatchSnapshot(); - expect(getByText('Save')).toBeInTheDocument(); - }); -}); diff --git a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.stories.js b/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.stories.js deleted file mode 100644 index 4be1e5fcb..000000000 --- a/ui/pages/swaps/swaps-gas-customization-modal/swaps-gas-customization-modal.stories.js +++ /dev/null @@ -1,253 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { Provider } from 'react-redux'; -import configureStore from '../../../store/store'; -import testData from '../../../../.storybook/test-data'; -import { formatETHFee } from '../../../helpers/utils/formatters'; -import { - addHexes, - getValueFromWeiHex, - getWeiHexFromDecimalValue, - sumHexWEIsToRenderableFiat, -} from '../../../helpers/utils/conversions.util'; -import { ETH } from '../../../helpers/constants/common'; -import { calcGasTotal, isBalanceSufficient } from '../../send/send.utils'; -import { conversionLessThan } from '../../../../shared/modules/conversion.utils'; -import GasModalPageContainer from './swaps-gas-customization-modal.component'; -// Using Test Data For Redux -const store = configureStore(testData); - -export default { - title: 'Pages/Swaps/GasModalPageContainer', - id: __filename, - component: GasModalPageContainer, - argTypes: { - sendAmountArg: { - name: 'Send Amount (this should be static)', - control: { type: 'number', min: 0, step: 0.01 }, - }, - walletBalance: { - name: 'Wallet Balance (this should be static)', - control: { type: 'number', min: 0, step: 0.01 }, - }, - averageGasPrice: { - name: 'Average Gas Price', - control: { type: 'number', min: 0, step: 0.01 }, - }, - insufficientBalance: { - table: { - disable: true, - }, - }, - gasPriceButtonGroupProps: { - table: { - disable: true, - }, - }, - infoRowProps: { - table: { - disable: true, - }, - }, - onSubmit: { - table: { - disable: true, - }, - }, - cancelAndClose: { - table: { - disable: true, - }, - }, - showCustomPriceTooLowWarning: { - table: { - disable: true, - }, - }, - disableSave: { - table: { - disable: true, - }, - }, - customGasLimitMessage: { - table: { - disable: true, - }, - }, - usdConversionRate: { - table: { - disable: true, - }, - }, - customGasPrice: { - table: { - disable: true, - }, - }, - customGasLimit: { - table: { - disable: true, - }, - }, - setSwapsCustomizationModalLimit: { - table: { - disable: true, - }, - }, - setSwapsCustomizationModalPrice: { - table: { - disable: true, - }, - }, - customTotalSupplement: { - table: { - disable: true, - }, - }, - gasEstimateLoadingHasFailed: { - table: { - disable: true, - }, - }, - minimumGasLimit: { - table: { - disable: true, - }, - }, - }, - args: { - sendAmountArg: 0.01, - walletBalance: 10, - averageGasPrice: 2, - }, - decorators: [(story) => {story()}], -}; - -// Convert Hex Wei to Decimal ETH -const sumHexWEIsToRenderableEth = (hexWEIs, currencySymbol = 'ETH') => { - const hexWEIsSum = hexWEIs.filter(Boolean).reduce(addHexes); - return formatETHFee( - getValueFromWeiHex({ - value: hexWEIsSum, - fromCurrency: currencySymbol, - toCurrency: currencySymbol, - numberOfDecimals: 6, - }), - currencySymbol, - ); -}; - -export const DefaultStory = (args) => { - const { sendAmountArg, walletBalance, averageGasPrice } = args; - - const hexWei = getWeiHexFromDecimalValue({ - value: sendAmountArg, - fromCurrency: ETH, - fromDenomination: ETH, - }); - - // ETH Balance - const balanceHexWei = getWeiHexFromDecimalValue({ - value: walletBalance, - fromCurrency: ETH, - fromDenomination: ETH, - }); - - const sendAmount = sumHexWEIsToRenderableEth([hexWei, '0x0']); - const [gasLimit, setGasLimit] = useState('5208'); - const [gasPrice, setGasPrice] = useState('ee6b2800'); - const [transactionFee, setTransactionFee] = useState(''); - const [totalETH, setTotalETH] = useState(''); - const [totalFiat, setTotalFiat] = useState(''); - const [isInsufficientBalance, setIsInsufficientBalance] = useState(false); - - const { metamask } = store.getState(); - const { currentCurrency, conversionRate } = metamask; - - useEffect(() => { - // Transfer Fee - const customGasTotal = calcGasTotal(gasLimit, gasPrice); - setTransactionFee(sumHexWEIsToRenderableEth(['0x0', customGasTotal])); - - // New Total ETH - setTotalETH(sumHexWEIsToRenderableEth([hexWei, customGasTotal, ''])); - - // New Total Fiat - setTotalFiat( - sumHexWEIsToRenderableFiat( - [hexWei, customGasTotal, ''], - currentCurrency, - conversionRate, - ), - ); - - // Check If Balance is Sufficient - setIsInsufficientBalance( - !isBalanceSufficient({ - amount: hexWei, - gasTotal: customGasTotal, - balance: balanceHexWei, - conversionRate, - }), - ); - }, [ - gasPrice, - gasLimit, - hexWei, - totalETH, - conversionRate, - currentCurrency, - totalFiat, - balanceHexWei, - ]); - - // Check If Gas Price Is Too Low - const shouldShowCustomPriceTooLowWarning = () => { - const customGasPrice = gasPrice; - - if (!customGasPrice || averageGasPrice === undefined) { - return false; - } - - const customPriceRisksSwapFailure = conversionLessThan( - { - value: customGasPrice, - fromNumericBase: 'hex', - fromDenomination: 'WEI', - toDenomination: 'GWEI', - }, - { value: averageGasPrice, fromNumericBase: 'dec' }, - ); - - return customPriceRisksSwapFailure; - }; - - return ( - { - setGasPrice(newPrice); - }} - setSwapsCustomizationModalLimit={(newLimit) => { - setGasLimit(newLimit); - }} - customGasPrice={gasPrice} - customGasLimit={gasLimit} - disableSave={ - isInsufficientBalance || shouldShowCustomPriceTooLowWarning() - } - /> - ); -}; - -DefaultStory.storyName = 'Default'; diff --git a/ui/pages/swaps/view-quote/view-quote.js b/ui/pages/swaps/view-quote/view-quote.js index a067e5dea..e1a098b2b 100644 --- a/ui/pages/swaps/view-quote/view-quote.js +++ b/ui/pages/swaps/view-quote/view-quote.js @@ -19,7 +19,6 @@ import { usePrevious } from '../../../hooks/usePrevious'; import { useGasFeeInputs } from '../../../hooks/gasFeeInput/useGasFeeInputs'; import { MetaMetricsContext } from '../../../contexts/metametrics'; import FeeCard from '../fee-card'; -import EditGasPopover from '../../../components/app/edit-gas-popover/edit-gas-popover.component'; import { FALLBACK_GAS_MULTIPLIER, getQuotes, @@ -89,16 +88,12 @@ import { } from '../../../helpers/utils/token-util'; import { decimalToHex, - hexToDecimal, - getValueFromWeiHex, decGWEIToHexWEI, hexWEIToDecGWEI, addHexes, } from '../../../helpers/utils/conversions.util'; import { GasFeeContextProvider } from '../../../contexts/gasFee'; import { TransactionModalContextProvider } from '../../../contexts/transaction-modal'; -import AdvancedGasFeePopover from '../../../components/app/advanced-gas-fee-popover'; -import EditGasFeePopover from '../../../components/app/edit-gas-fee-popover'; import MainQuoteSummary from '../main-quote-summary'; import { calcGasTotal } from '../../send/send.utils'; import { getCustomTxParamsData } from '../../confirm-approve/confirm-approve.util'; @@ -137,7 +132,6 @@ export default function ViewQuote() { const [selectQuotePopoverShown, setSelectQuotePopoverShown] = useState(false); const [warningHidden, setWarningHidden] = useState(false); const [originalApproveAmount, setOriginalApproveAmount] = useState(null); - const [showEditGasPopover, setShowEditGasPopover] = useState(false); // We need to have currentTimestamp in state, otherwise it would change with each rerender. const [currentTimestamp] = useState(Date.now()); @@ -391,7 +385,6 @@ export default function ViewQuote() { rawEthFee: maxRawEthFee, feeInUsd: maxFeeInUsd, } = renderableMaxFees; - const { nonGasFee } = renderableMaxFees; additionalTrackingParams.reg_tx_max_fee_in_usd = Number(maxFeeInUsd); additionalTrackingParams.reg_tx_max_fee_in_eth = Number(maxRawEthFee); @@ -678,53 +671,6 @@ export default function ViewQuote() { ); }; - const nonGasFeeIsPositive = new BigNumber(nonGasFee, 16).gt(0); - const approveGasTotal = calcGasTotal( - approveGas || '0x0', - networkAndAccountSupports1559 ? baseAndPriorityFeePerGas : gasPrice, - ); - const extraNetworkFeeTotalInHexWEI = new BigNumber(nonGasFee, 16) - .plus(approveGasTotal, 16) - .toString(16); - const extraNetworkFeeTotalInEth = getValueFromWeiHex({ - value: extraNetworkFeeTotalInHexWEI, - toDenomination: 'ETH', - numberOfDecimals: 4, - }); - - let extraInfoRowLabel = ''; - if (approveGas && nonGasFeeIsPositive) { - extraInfoRowLabel = t('approvalAndAggregatorTxFeeCost'); - } else if (approveGas) { - extraInfoRowLabel = t('approvalTxGasCost'); - } else if (nonGasFeeIsPositive) { - extraInfoRowLabel = t('aggregatorFeeCost'); - } - - const onFeeCardMaxRowClick = () => { - networkAndAccountSupports1559 - ? setShowEditGasPopover(true) - : dispatch( - showModal({ - name: 'CUSTOMIZE_METASWAP_GAS', - value: tradeValue, - customGasLimitMessage: approveGas - ? t('extraApprovalGas', [hexToDecimal(approveGas)]) - : '', - customTotalSupplement: approveGasTotal, - extraInfoRow: extraInfoRowLabel - ? { - label: extraInfoRowLabel, - value: `${extraNetworkFeeTotalInEth} ${nativeCurrencySymbol}`, - } - : null, - initialGasPrice: gasPrice, - initialGasLimit: maxGasLimit, - minimumGasLimit: new BigNumber(nonCustomMaxGasLimit, 16).toNumber(), - }), - ); - }; - const actionableBalanceErrorMessage = tokenBalanceUnavailable ? t('swapTokenBalanceUnavailable', [sourceTokenSymbol]) : t('swapApproveNeedMoreTokens', [ @@ -863,10 +809,6 @@ export default function ViewQuote() { isSwapButtonDisabled, ]); - const onCloseEditGasPopover = () => { - setShowEditGasPopover(false); - }; - useEffect(() => { // Thanks to the next line we will only do quotes polling 3 times before showing a Quote Timeout modal. dispatch(setSwapsQuotesPollingLimitEnabled(true)); @@ -928,25 +870,6 @@ export default function ViewQuote() { /> )} - {!supportsEIP1559V2 && - showEditGasPopover && - networkAndAccountSupports1559 && ( - - )} - {supportsEIP1559V2 && ( - <> - - - - )} -