From a3e7076bbf1d6c8c293dcd2a571c8e879ee33ad9 Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Mon, 23 Sep 2024 15:37:16 -0500 Subject: [PATCH 1/8] chore: remove unused view quote swaps page --- app/_locales/de/messages.json | 3 - app/_locales/el/messages.json | 3 - app/_locales/en/messages.json | 3 - app/_locales/en_GB/messages.json | 3 - app/_locales/es/messages.json | 3 - app/_locales/es_419/messages.json | 3 - app/_locales/fr/messages.json | 3 - app/_locales/hi/messages.json | 3 - app/_locales/id/messages.json | 3 - app/_locales/ja/messages.json | 3 - app/_locales/ko/messages.json | 3 - app/_locales/ph/messages.json | 3 - app/_locales/pt/messages.json | 3 - app/_locales/pt_BR/messages.json | 3 - app/_locales/ru/messages.json | 3 - app/_locales/tl/messages.json | 3 - app/_locales/tr/messages.json | 3 - app/_locales/vi/messages.json | 3 - app/_locales/zh_CN/messages.json | 3 - .../files-to-convert.json | 11 - ui/ducks/swaps/swaps.js | 6 +- ui/helpers/constants/routes.ts | 3 - ui/pages/home/home.component.js | 4 +- ui/pages/swaps/awaiting-swap/awaiting-swap.js | 8 +- ui/pages/swaps/build-quote/build-quote.js | 4 +- .../swaps/create-new-swap/create-new-swap.js | 4 +- .../create-new-swap/create-new-swap.test.js | 12 +- ui/pages/swaps/index.js | 101 +- ui/pages/swaps/index.scss | 11 - .../loading-swaps-quotes.js | 4 +- ui/pages/swaps/main-quote-summary/README.mdx | 14 - .../main-quote-summary.test.js.snap | 116 -- .../__snapshots__/quote-backdrop.test.js.snap | 74 -- ui/pages/swaps/main-quote-summary/index.js | 1 - ui/pages/swaps/main-quote-summary/index.scss | 125 -- .../main-quote-summary/main-quote-summary.js | 182 --- .../main-quote-summary.stories.js | 67 - .../main-quote-summary.test.js | 39 - .../main-quote-summary/quote-backdrop.js | 89 -- .../main-quote-summary/quote-backdrop.test.js | 23 - ui/pages/swaps/prepare-swap-page/index.scss | 10 +- .../swaps/prepare-swap-page/review-quote.js | 2 +- .../quote-details/index.scss | 12 - .../swaps/smart-transaction-status/index.scss | 12 + .../smart-transaction-status.js | 8 +- .../view-quote-price-difference.test.js.snap | 233 ---- .../__snapshots__/view-quote.test.js.snap | 145 --- ui/pages/swaps/view-quote/index.js | 1 - ui/pages/swaps/view-quote/index.scss | 179 --- .../view-quote/view-quote-price-difference.js | 111 -- .../view-quote-price-difference.test.js | 132 -- ui/pages/swaps/view-quote/view-quote.js | 1089 ----------------- ui/pages/swaps/view-quote/view-quote.test.js | 100 -- 53 files changed, 70 insertions(+), 2919 deletions(-) delete mode 100644 ui/pages/swaps/main-quote-summary/README.mdx delete mode 100644 ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap delete mode 100644 ui/pages/swaps/main-quote-summary/__snapshots__/quote-backdrop.test.js.snap delete mode 100644 ui/pages/swaps/main-quote-summary/index.js delete mode 100644 ui/pages/swaps/main-quote-summary/index.scss delete mode 100644 ui/pages/swaps/main-quote-summary/main-quote-summary.js delete mode 100644 ui/pages/swaps/main-quote-summary/main-quote-summary.stories.js delete mode 100644 ui/pages/swaps/main-quote-summary/main-quote-summary.test.js delete mode 100644 ui/pages/swaps/main-quote-summary/quote-backdrop.js delete mode 100644 ui/pages/swaps/main-quote-summary/quote-backdrop.test.js delete mode 100644 ui/pages/swaps/view-quote/__snapshots__/view-quote-price-difference.test.js.snap delete mode 100644 ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap delete mode 100644 ui/pages/swaps/view-quote/index.js delete mode 100644 ui/pages/swaps/view-quote/index.scss delete mode 100644 ui/pages/swaps/view-quote/view-quote-price-difference.js delete mode 100644 ui/pages/swaps/view-quote/view-quote-price-difference.test.js delete mode 100644 ui/pages/swaps/view-quote/view-quote.js delete mode 100644 ui/pages/swaps/view-quote/view-quote.test.js diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 9931e17a83a7..038c1a4c8f26 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -5347,9 +5347,6 @@ "message": "Preisdifferenz von ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Der Preiseinfluss ist die Differenz zwischen dem aktuellen Marktpreis und dem bei der Ausführung der Transaktion erhaltenen Betrag. Die Preisauswirkung ist eine Funktion der Größe Ihres Geschäfts im Verhältnis zur Größe des Liquiditätspools." - }, "swapPriceUnavailableDescription": { "message": "Die Auswirkungen auf den Preis konnten aufgrund fehlender Marktpreisdaten nicht ermittelt werden. Bitte bestätigen Sie vor dem Tausch, dass Sie mit der Menge der Tokens, die Sie erhalten werden, einverstanden sind." }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index 95e1e43cf51f..bb20e52ed99b 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -5347,9 +5347,6 @@ "message": "Διαφορά τιμής ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Η επίπτωση στις τιμές είναι η διαφορά μεταξύ της τρέχουσας τιμής αγοράς και του ποσού που εισπράττεται κατά την εκτέλεση της συναλλαγής. Η επίπτωση στις τιμές είναι συνάρτηση του μεγέθους της συναλλαγής σας σε σχέση με το μέγεθος του αποθέματος ρευστότητας." - }, "swapPriceUnavailableDescription": { "message": "Η επίπτωση στις τιμές δεν ήταν δυνατόν να προσδιοριστεί λόγω έλλειψης στοιχείων για τις τιμές της αγοράς. Παρακαλούμε επιβεβαιώστε ότι είστε ικανοποιημένοι με το ποσό των tokens που πρόκειται να λάβετε πριν από την ανταλλαγή." }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 862b761abd8f..242314a69cce 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -5763,9 +5763,6 @@ "message": "Price difference of ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Price impact is the difference between the current market price and the amount received during transaction execution. Price impact is a function of the size of your trade relative to the size of the liquidity pool." - }, "swapPriceUnavailableDescription": { "message": "Price impact could not be determined due to lack of market price data. Please confirm that you are comfortable with the amount of tokens you are about to receive before swapping." }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index 25cb6cd3df29..8eb23f784cb2 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -5493,9 +5493,6 @@ "message": "Price difference of ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Price impact is the difference between the current market price and the amount received during transaction execution. Price impact is a function of the size of your trade relative to the size of the liquidity pool." - }, "swapPriceUnavailableDescription": { "message": "Price impact could not be determined due to lack of market price data. Please confirm that you are comfortable with the amount of tokens you are about to receive before swapping." }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 9fd0f3d20941..37d4854e86aa 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -5344,9 +5344,6 @@ "message": "Diferencia de precio de ~$1 %", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "El impacto sobre el precio es la diferencia entre el precio actual del mercado y el monto recibido durante la ejecución de la transacción. El impacto sobre el precio es una función del tamaño de su transacción respecto de la dimensión del fondo de liquidez." - }, "swapPriceUnavailableDescription": { "message": "No se pudo determinar el impacto sobre el precio debido a la falta de datos de los precios del mercado. Antes de realizar el intercambio, confirme que está de acuerdo con la cantidad de tokens que está a punto de recibir." }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index cd980aaa99c2..f3bf86042f3d 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -2009,9 +2009,6 @@ "message": "Diferencia de precio de ~$1 %", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "El impacto sobre el precio es la diferencia entre el precio actual del mercado y el monto recibido durante la ejecución de la transacción. El impacto sobre el precio es una función del tamaño de su transacción respecto de la dimensión del fondo de liquidez." - }, "swapPriceUnavailableDescription": { "message": "No se pudo determinar el impacto sobre el precio debido a la falta de datos de los precios del mercado. Antes de realizar el canje, confirme que está de acuerdo con la cantidad de tokens que está a punto de recibir." }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 05c67e49462f..ec2ef130f2b9 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -5347,9 +5347,6 @@ "message": "Différence de prix de ~$1", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "L’incidence sur les prix correspond à la différence entre le prix actuel du marché et le montant reçu lors de l’exécution de la transaction. Cette répercussion dépend du volume de votre transaction par rapport au volume de la réserve de liquidités." - }, "swapPriceUnavailableDescription": { "message": "L’incidence sur les prix n’a pas pu être déterminée faute de données suffisantes sur les prix du marché. Veuillez confirmer que vous êtes satisfait·e du nombre de jetons que vous êtes sur le point de recevoir avant de procéder au swap." }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index e23b10a874f0..55a617ffbb63 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -5347,9 +5347,6 @@ "message": "~$1% का मूल्य अंतर", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "मूल्य प्रभाव, वर्तमान बाजार मूल्य और ट्रांसेक्शन निष्पादन के दौरान प्राप्त अमाउंट के बीच का अंतर है। मूल्य प्रभाव चलनिधि पूल के आकार के सापेक्ष आपके व्यापार के आकार का एक कार्य है।" - }, "swapPriceUnavailableDescription": { "message": "बाजार मूल्य डेटा की कमी के कारण मूल्य प्रभाव को निर्धारित नहीं किया जा सका। कृपया कन्फर्म करें कि आप स्वैप करने से पहले प्राप्त होने वाले टोकन की अमाउंट को लेकर सहज हैं।" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 12ab926cf9ce..1cad158ff0a7 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -5347,9 +5347,6 @@ "message": "Perbedaan harga ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Dampak harga adalah selisih antara harga pasar saat ini dan jumlah yang diterima selama terjadinya transaksi. Dampak harga adalah fungsi ukuran dagang relatif terhadap ukuran pul likuiditas." - }, "swapPriceUnavailableDescription": { "message": "Dampak harga tidak dapat ditentukan karena kurangnya data harga pasar. Harap konfirmasi bahwa Anda setuju dengan jumlah token yang akan Anda terima sebelum penukaran." }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 0c3887643691..1dfca7dda9ad 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -5347,9 +5347,6 @@ "message": "最大$1%の価格差", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "プライスインパクトとは、現在の市場価格と取引の約定時に受け取る金額の差のことです。プライスインパクトは、流動性プールに対する取引の大きさにより発生します。" - }, "swapPriceUnavailableDescription": { "message": "市場価格のデータが不足しているため、プライスインパクトを測定できませんでした。スワップする前に、これから受領するトークンの額に問題がないか確認してください。" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 6e4dad181512..9491d69c0ed2 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -5347,9 +5347,6 @@ "message": "~$1%의 가격 차이", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "가격 영향은 현재 시장 가격과 트랜잭션 실행 도중 받은 금액 사이의 차이입니다. 가격 영향은 유동성 풀의 크기 대비 트랜잭션의 크기를 나타내는 함수입니다." - }, "swapPriceUnavailableDescription": { "message": "시장 가격 데이터가 부족하여 가격 영향을 파악할 수 없습니다. 스왑하기 전에 받게 될 토큰 수가 만족스러운지 컨펌하시기 바랍니다." }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index e12eb4379cf1..1c2d5defa923 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -1355,9 +1355,6 @@ "message": "Kaibahan sa presyo na ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Ang epekto sa presyo ay ang pagkakaiba sa kasalukuyang presyo sa merkado at sa halagang natanggap sa pag-execute ng transaksyon. Ang epekto sa presyo ay isang function ng laki ng iyong trade kumpara sa laki ng liquidity pool." - }, "swapPriceUnavailableDescription": { "message": "Hindi natukoy ang epekto sa presyo dahil sa kakulangan ng data sa presyo sa merkado. Pakikumpirma na kumportable ka sa dami ng mga token na matatanggap mo bago makipag-swap." }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 47a53a6ed328..f68d028ea44b 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -5347,9 +5347,6 @@ "message": "Diferença de preço de aproximadamente $1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "O impacto do preço é a diferença entre o preço de mercado atual e o valor recebido quando é executada a transação. O impacto do preço é resultado do tamanho da sua transação relativo ao tamanho do pool de liquidez." - }, "swapPriceUnavailableDescription": { "message": "O impacto no preço não pôde ser determinado devido à ausência de dados sobre o preço de mercado. Confirme que você está satisfeito com a quantidade de tokens que você está prestes a receber antes de fazer a troca." }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index 2becf1c495a1..e8c8ae6ce563 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -2009,9 +2009,6 @@ "message": "Diferença de preço de aproximadamente $1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "O impacto no preço é a diferença entre o preço de mercado atual e o valor recebido durante a execução da transação. O impacto no preço é uma função do porte da sua operação em relação ao porte do pool de liquidez." - }, "swapPriceUnavailableDescription": { "message": "O impacto no preço não pôde ser determinado devido à ausência de dados sobre o preço de mercado. Confirme que você está satisfeito com a quantidade de tokens que você está prestes a receber antes de fazer a troca." }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 0ecd4f0eb8d6..afb76f592523 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -5347,9 +5347,6 @@ "message": "Разница в цене составляет ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Колебание цены — это разница между текущей рыночной ценой и суммой, полученной во время исполнения транзакции. Колебание цены зависит от соотношения размера вашей сделки и размера пула ликвидности." - }, "swapPriceUnavailableDescription": { "message": "Не удалось определить колебание цены из-за отсутствия данных о рыночных ценах. Перед свопом убедитесь, что вас устраивает количество токенов, которое вы получите." }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index c6614483aa5b..9f03d270d2f1 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -5347,9 +5347,6 @@ "message": "Deperensya ng presyo ng ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Ang price impact ay ang pagkakaiba sa pagitan ng kasalukuyang market price at ang halagang natanggap sa panahon ng pagpapatupad ng transaksyon. Ang price impact ay isang function ng laki ng iyong trade kaugnay sa laki ng pool ng liquidity." - }, "swapPriceUnavailableDescription": { "message": "Hindi matukoy ang price impact dahil sa kakulangan ng data ng market price. Pakikumpirma na komportable ka sa dami ng mga token na matatanggap mo bago mag-swap." }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 361b92cdd87e..43e4b8e9675a 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -5347,9 +5347,6 @@ "message": "~%$1 fiyat farkı", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Fiyat etkisi, mevcut piyasa fiyatı ile işlem gerçekleştirildiği sırada alınan tutar arasındaki farktır. Fiyat etkisi, likidite havuzunun boyutuna bağlı olarak işleminizin boyutunun bir fonksiyonudur." - }, "swapPriceUnavailableDescription": { "message": "Fiyat etkisi, piyasa fiyat verisinin mevcut olmaması nedeniyle belirlenememiştir. Swap işlemini gerçekleştirmeden önce lütfen almak üzere olduğunuz token tutarının sizin için uygun olduğunu onaylayın." }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 3be725af9351..315aacbf6d7e 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -5347,9 +5347,6 @@ "message": "Chênh lệch giá ~$1%", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "Tác động về giá là mức chênh lệch giữa giá thị trường hiện tại và số tiền nhận được trong quá trình thực hiện giao dịch. Tác động giá là một hàm trong quy mô giao dịch của bạn so với quy mô của nhóm thanh khoản." - }, "swapPriceUnavailableDescription": { "message": "Không thể xác định tác động giá do thiếu dữ liệu giá thị trường. Vui lòng xác nhận rằng bạn cảm thấy thoải mái với số lượng token bạn sắp nhận được trước khi hoán đổi." }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 58298abdf542..414b5ac750f2 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -5347,9 +5347,6 @@ "message": "~$1% 的价差", "description": "$1 is a number (ex: 1.23) that represents the price difference." }, - "swapPriceImpactTooltip": { - "message": "价格影响是当前市场价格与交易执行期间收到的金额之间的差异。价格影响是您的交易规模相对于流动性池规模的一个函数。" - }, "swapPriceUnavailableDescription": { "message": "由于缺乏市场价格数据,无法确定价格影响。在交换之前,请确认您对即将收到的代币数量感到满意。" }, diff --git a/development/ts-migration-dashboard/files-to-convert.json b/development/ts-migration-dashboard/files-to-convert.json index 7ffbd68472d1..d05bf6a24165 100644 --- a/development/ts-migration-dashboard/files-to-convert.json +++ b/development/ts-migration-dashboard/files-to-convert.json @@ -1544,12 +1544,6 @@ "ui/pages/swaps/loading-swaps-quotes/loading-swaps-quotes-stories-metadata.test.js", "ui/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.js", "ui/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.test.js", - "ui/pages/swaps/main-quote-summary/index.js", - "ui/pages/swaps/main-quote-summary/main-quote-summary.js", - "ui/pages/swaps/main-quote-summary/main-quote-summary.stories.js", - "ui/pages/swaps/main-quote-summary/main-quote-summary.test.js", - "ui/pages/swaps/main-quote-summary/quote-backdrop.js", - "ui/pages/swaps/main-quote-summary/quote-backdrop.test.js", "ui/pages/swaps/searchable-item-list/index.js", "ui/pages/swaps/searchable-item-list/item-list/index.js", "ui/pages/swaps/searchable-item-list/item-list/item-list.component.js", @@ -1599,11 +1593,6 @@ "ui/pages/swaps/view-on-block-explorer/index.js", "ui/pages/swaps/view-on-block-explorer/view-on-block-explorer.js", "ui/pages/swaps/view-on-block-explorer/view-on-block-explorer.test.js", - "ui/pages/swaps/view-quote/index.js", - "ui/pages/swaps/view-quote/view-quote-price-difference.js", - "ui/pages/swaps/view-quote/view-quote-price-difference.test.js", - "ui/pages/swaps/view-quote/view-quote.js", - "ui/pages/swaps/view-quote/view-quote.test.js", "ui/pages/token-details/index.js", "ui/pages/token-details/token-details-page.js", "ui/pages/token-details/token-details-page.test.js", diff --git a/ui/ducks/swaps/swaps.js b/ui/ducks/swaps/swaps.js index efbd781f943f..ba04c6f0db41 100644 --- a/ui/ducks/swaps/swaps.js +++ b/ui/ducks/swaps/swaps.js @@ -33,11 +33,11 @@ import { import { AWAITING_SIGNATURES_ROUTE, AWAITING_SWAP_ROUTE, - BUILD_QUOTE_ROUTE, LOADING_QUOTES_ROUTE, SWAPS_ERROR_ROUTE, SWAPS_MAINTENANCE_ROUTE, SMART_TRANSACTION_STATUS_ROUTE, + PREPARE_SWAP_ROUTE, } from '../../helpers/constants/routes'; import { fetchSwapsFeatureFlags, @@ -525,12 +525,12 @@ export { slice as swapsSlice, }; -export const navigateBackToBuildQuote = (history) => { +export const navigateBackToPrepareSwap = (history) => { return async (dispatch) => { // TODO: Ensure any fetch in progress is cancelled await dispatch(setBackgroundSwapRouteState('')); dispatch(navigatedBackToBuildQuote()); - history.push(BUILD_QUOTE_ROUTE); + history.push(PREPARE_SWAP_ROUTE); }; }; diff --git a/ui/helpers/constants/routes.ts b/ui/helpers/constants/routes.ts index 5e4fffe413e2..da76e0cef8b3 100644 --- a/ui/helpers/constants/routes.ts +++ b/ui/helpers/constants/routes.ts @@ -244,9 +244,6 @@ PATH_NAME_MAP[SWAPS_NOTIFICATION_ROUTE] = 'Swaps Notification Page'; export const BUILD_QUOTE_ROUTE = '/swaps/build-quote'; PATH_NAME_MAP[BUILD_QUOTE_ROUTE] = 'Swaps Build Quote Page'; -export const VIEW_QUOTE_ROUTE = '/swaps/view-quote'; -PATH_NAME_MAP[VIEW_QUOTE_ROUTE] = 'Swaps View Quotes Page'; - export const LOADING_QUOTES_ROUTE = '/swaps/loading-quotes'; PATH_NAME_MAP[LOADING_QUOTES_ROUTE] = 'Swaps Loading Quotes Page'; diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index 2df3f2907266..c999d3d71df7 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -63,7 +63,7 @@ import { CONNECTED_ACCOUNTS_ROUTE, AWAITING_SWAP_ROUTE, BUILD_QUOTE_ROUTE, - VIEW_QUOTE_ROUTE, + PREPARE_SWAP_ROUTE, CONFIRMATION_V_NEXT_ROUTE, ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) ONBOARDING_SECURE_YOUR_WALLET_ROUTE, @@ -329,7 +329,7 @@ export default class Home extends PureComponent { if (canRedirect && showAwaitingSwapScreen) { history.push(AWAITING_SWAP_ROUTE); } else if (canRedirect && haveSwapsQuotes) { - history.push(VIEW_QUOTE_ROUTE); + history.push(PREPARE_SWAP_ROUTE); } else if (canRedirect && swapsFetchParams) { history.push(BUILD_QUOTE_ROUTE); } else if (firstPermissionsRequestId) { diff --git a/ui/pages/swaps/awaiting-swap/awaiting-swap.js b/ui/pages/swaps/awaiting-swap/awaiting-swap.js index e7f47bc3f006..0ffbf2eba571 100644 --- a/ui/pages/swaps/awaiting-swap/awaiting-swap.js +++ b/ui/pages/swaps/awaiting-swap/awaiting-swap.js @@ -33,7 +33,7 @@ import { getApproveTxParams, getUsedSwapsGasPrice, fetchQuotesAndSetQuoteState, - navigateBackToBuildQuote, + navigateBackToPrepareSwap, prepareForRetryGetQuotes, prepareToLeaveSwaps, getCurrentSmartTransactionsEnabled, @@ -315,7 +315,7 @@ export default function AwaitingSwap({ ), ); } else if (errorKey) { - await dispatch(navigateBackToBuildQuote(history)); + await dispatch(navigateBackToPrepareSwap(history)); } else if ( isSwapsDefaultTokenSymbol(swapMetaData?.token_to, chainId) || swapComplete @@ -326,7 +326,9 @@ export default function AwaitingSwap({ history.push(DEFAULT_ROUTE); } }} - onCancel={async () => await dispatch(navigateBackToBuildQuote(history))} + onCancel={async () => + await dispatch(navigateBackToPrepareSwap(history)) + } submitText={submitText} disabled={submittingSwap} hideCancel={errorKey !== QUOTES_EXPIRED_ERROR} diff --git a/ui/pages/swaps/build-quote/build-quote.js b/ui/pages/swaps/build-quote/build-quote.js index 23ca35b3f2e9..73ea79d2953c 100644 --- a/ui/pages/swaps/build-quote/build-quote.js +++ b/ui/pages/swaps/build-quote/build-quote.js @@ -20,7 +20,7 @@ import { getTokens, getConversionRate } from '../../../ducks/metamask/metamask'; import InfoTooltip from '../../../components/ui/info-tooltip'; import ActionableMessage from '../../../components/ui/actionable-message/actionable-message'; import { - VIEW_QUOTE_ROUTE, + PREPARE_SWAP_ROUTE, LOADING_QUOTES_ROUTE, } from '../../../helpers/constants/routes'; @@ -776,7 +776,7 @@ export default function BuildQuote({ ); } else if (areQuotesPresent) { // If there are prefetched quotes already, go directly to the View Quote page. - history.push(VIEW_QUOTE_ROUTE); + history.push(PREPARE_SWAP_ROUTE); } else { // If the "Review swap" button was clicked while quotes are being fetched, go to the Loading Quotes page. await dispatch(setBackgroundSwapRouteState('loading')); diff --git a/ui/pages/swaps/create-new-swap/create-new-swap.js b/ui/pages/swaps/create-new-swap/create-new-swap.js index 3f19b68631b2..6d7963e36ca8 100644 --- a/ui/pages/swaps/create-new-swap/create-new-swap.js +++ b/ui/pages/swaps/create-new-swap/create-new-swap.js @@ -9,7 +9,7 @@ import { I18nContext } from '../../../contexts/i18n'; import { MetaMetricsContext } from '../../../contexts/metametrics'; import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics'; import { - navigateBackToBuildQuote, + navigateBackToPrepareSwap, setSwapsFromToken, } from '../../../ducks/swaps/swaps'; import { DEFAULT_ROUTE } from '../../../helpers/constants/routes'; @@ -32,7 +32,7 @@ export default function CreateNewSwap({ sensitiveTrackingProperties }) { sensitiveProperties: sensitiveTrackingProperties, }); history.push(DEFAULT_ROUTE); // It cleans up Swaps state. - await dispatch(navigateBackToBuildQuote(history)); + await dispatch(navigateBackToPrepareSwap(history)); dispatch(setSwapsFromToken(defaultSwapsToken)); }} > diff --git a/ui/pages/swaps/create-new-swap/create-new-swap.test.js b/ui/pages/swaps/create-new-swap/create-new-swap.test.js index 0ce6fa400150..86accf04da23 100644 --- a/ui/pages/swaps/create-new-swap/create-new-swap.test.js +++ b/ui/pages/swaps/create-new-swap/create-new-swap.test.js @@ -10,7 +10,7 @@ import { } from '../../../../test/jest'; import { setSwapsFromToken, - navigateBackToBuildQuote, + navigateBackToPrepareSwap, } from '../../../ducks/swaps/swaps'; import CreateNewSwap from '.'; @@ -23,7 +23,7 @@ const createProps = (customProps = {}) => { }; const backgroundConnection = { - navigateBackToBuildQuote: jest.fn(), + navigateBackToPrepareSwap: jest.fn(), setBackgroundSwapRouteState: jest.fn(), navigatedBackToBuildQuote: jest.fn(), }; @@ -35,7 +35,7 @@ jest.mock('../../../ducks/swaps/swaps', () => { return { ...actual, setSwapsFromToken: jest.fn(), - navigateBackToBuildQuote: jest.fn(), + navigateBackToPrepareSwap: jest.fn(), }; }); @@ -63,12 +63,12 @@ describe('CreateNewSwap', () => { }; }); setSwapsFromToken.mockImplementation(setSwapFromTokenMock); - const navigateBackToBuildQuoteMock = jest.fn(() => { + const navigateBackToPrepareSwapMock = jest.fn(() => { return { type: 'MOCK_ACTION', }; }); - navigateBackToBuildQuote.mockImplementation(navigateBackToBuildQuoteMock); + navigateBackToPrepareSwap.mockImplementation(navigateBackToPrepareSwapMock); const store = configureMockStore(middleware)(createSwapsMockStore()); const { getByText } = renderWithProvider( @@ -77,6 +77,6 @@ describe('CreateNewSwap', () => { ); await fireEvent.click(getByText('Create a new swap')); expect(setSwapFromTokenMock).toHaveBeenCalledTimes(1); - expect(navigateBackToBuildQuoteMock).toHaveBeenCalledTimes(1); + expect(navigateBackToPrepareSwapMock).toHaveBeenCalledTimes(1); }); }); diff --git a/ui/pages/swaps/index.js b/ui/pages/swaps/index.js index 877e38aa7c84..0c353c884465 100644 --- a/ui/pages/swaps/index.js +++ b/ui/pages/swaps/index.js @@ -40,10 +40,8 @@ import { prepareToLeaveSwaps, fetchSwapsLivenessAndFeatureFlags, getReviewSwapClickedTimestamp, - getPendingSmartTransactions, getCurrentSmartTransactionsEnabled, getCurrentSmartTransactionsError, - navigateBackToBuildQuote, getSwapRedesignEnabled, setTransactionSettingsOpened, getLatestAddedTokenTo, @@ -58,7 +56,6 @@ import { AWAITING_SWAP_ROUTE, SMART_TRANSACTION_STATUS_ROUTE, BUILD_QUOTE_ROUTE, - VIEW_QUOTE_ROUTE, LOADING_QUOTES_ROUTE, SWAPS_ERROR_ROUTE, DEFAULT_ROUTE, @@ -102,7 +99,6 @@ import LoadingQuote from './loading-swaps-quotes'; import BuildQuote from './build-quote'; import PrepareSwapPage from './prepare-swap-page/prepare-swap-page'; import NotificationPage from './notification-page/notification-page'; -import ViewQuote from './view-quote'; export default function Swap() { const t = useContext(I18nContext); @@ -117,7 +113,6 @@ export default function Swap() { const isLoadingQuotesRoute = pathname === LOADING_QUOTES_ROUTE; const isSmartTransactionStatusRoute = pathname === SMART_TRANSACTION_STATUS_ROUTE; - const isViewQuoteRoute = pathname === VIEW_QUOTE_ROUTE; const isPrepareSwapRoute = pathname === PREPARE_SWAP_ROUTE; const [currentStxErrorTracked, setCurrentStxErrorTracked] = useState(false); @@ -140,7 +135,6 @@ export default function Swap() { const tokenList = useSelector(getTokenList, isEqual); const shuffledTokensList = shuffle(Object.values(tokenList)); const reviewSwapClickedTimestamp = useSelector(getReviewSwapClickedTimestamp); - const pendingSmartTransactions = useSelector(getPendingSmartTransactions); const reviewSwapClicked = Boolean(reviewSwapClickedTimestamp); const smartTransactionsOptInStatus = useSelector( getSmartTransactionsOptInStatus, @@ -358,43 +352,31 @@ export default function Swap() {
- {!swapRedesignEnabled && ( -
{ - await dispatch(navigateBackToBuildQuote(history)); - }} - > - {isViewQuoteRoute && t('edit')} -
- )} - {swapRedesignEnabled && ( - { - if (e.key === 'Enter') { - redirectToDefaultRoute(); - } - }} - > - {!isAwaitingSwapRoute && - !isAwaitingSignaturesRoute && - !isSmartTransactionStatusRoute && ( - - )} - - )} + { + if (e.key === 'Enter') { + redirectToDefaultRoute(); + } + }} + > + {!isAwaitingSwapRoute && + !isAwaitingSignaturesRoute && + !isSmartTransactionStatusRoute && ( + + )} +
{t('swap')}
{!swapRedesignEnabled && (
- { - if ( - pendingSmartTransactions.length > 0 && - routeState === 'smartTransactionStatus' - ) { - return ( - - ); - } - if (swapRedesignEnabled) { - return ; - } - if (Object.values(quotes).length) { - return ( - - ); - } else if (fetchParams) { - return ; - } - return ; - }} - /> ) : ( - + ); }} /> diff --git a/ui/pages/swaps/index.scss b/ui/pages/swaps/index.scss index 33fc1e9a17cb..86d0e6d7b55c 100644 --- a/ui/pages/swaps/index.scss +++ b/ui/pages/swaps/index.scss @@ -12,12 +12,10 @@ @import 'exchange-rate-display/index'; @import 'fee-card/index'; @import 'loading-swaps-quotes/index'; -@import 'main-quote-summary/index'; @import 'searchable-item-list/index'; @import 'select-quote-popover/index'; @import 'slippage-buttons/index'; @import 'swaps-footer/index'; -@import 'view-quote/index'; @import 'create-new-swap/index'; @import 'view-on-block-explorer/index'; @import 'transaction-settings/index'; @@ -129,15 +127,6 @@ text-align: right; } - &__header-edit { - @include design-system.H7; - - color: var(--color-primary-default); - cursor: pointer; - padding-left: 24px; - flex: 1; - } - .actionable-message__message &__notification-close-button { background-color: transparent; position: absolute; diff --git a/ui/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.js b/ui/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.js index a8b7c9bf2a51..e98d275f8aa8 100644 --- a/ui/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.js +++ b/ui/pages/swaps/loading-swaps-quotes/loading-swaps-quotes.js @@ -6,7 +6,7 @@ import { shuffle } from 'lodash'; import { useHistory } from 'react-router-dom'; import isEqual from 'lodash/isEqual'; import { - navigateBackToBuildQuote, + navigateBackToPrepareSwap, getFetchParams, getQuotesFetchStartTime, getCurrentSmartTransactionsEnabled, @@ -183,7 +183,7 @@ export default function LoadingSwapsQuotes({ submitText={t('back')} onSubmit={async () => { trackEvent(quotesRequestCancelledEventConfig); - await dispatch(navigateBackToBuildQuote(history)); + await dispatch(navigateBackToPrepareSwap(history)); }} hideCancel /> diff --git a/ui/pages/swaps/main-quote-summary/README.mdx b/ui/pages/swaps/main-quote-summary/README.mdx deleted file mode 100644 index c32397d1e762..000000000000 --- a/ui/pages/swaps/main-quote-summary/README.mdx +++ /dev/null @@ -1,14 +0,0 @@ -import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; -import MainQuoteSummary from '.'; - -# MainQuoteSummary - -MainQuoteSummary displays the quote of a swap. - - - - - -## Props - - \ No newline at end of file diff --git a/ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap b/ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap deleted file mode 100644 index 3b202988fc42..000000000000 --- a/ui/pages/swaps/main-quote-summary/__snapshots__/main-quote-summary.test.js.snap +++ /dev/null @@ -1,116 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`MainQuoteSummary renders the component with initial props 1`] = ` -
- - 2 - -
- - E - -
- - ETH - -
-`; - -exports[`MainQuoteSummary renders the component with initial props 2`] = ` -
-
- - B - -
- - BAT - -
-`; - -exports[`MainQuoteSummary renders the component with initial props 3`] = ` -
-
-
- - 0.2 - -
-
-
-`; - -exports[`MainQuoteSummary renders the component with initial props 4`] = ` -
-
- - -
-
-`; diff --git a/ui/pages/swaps/main-quote-summary/__snapshots__/quote-backdrop.test.js.snap b/ui/pages/swaps/main-quote-summary/__snapshots__/quote-backdrop.test.js.snap deleted file mode 100644 index 2a1fef0ff0ac..000000000000 --- a/ui/pages/swaps/main-quote-summary/__snapshots__/quote-backdrop.test.js.snap +++ /dev/null @@ -1,74 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`QuotesBackdrop renders the component with initial props 1`] = ` - - - -`; - -exports[`QuotesBackdrop renders the component with initial props 2`] = ` - - - - - - - - - -`; - -exports[`QuotesBackdrop renders the component with initial props 3`] = ` - - - - -`; diff --git a/ui/pages/swaps/main-quote-summary/index.js b/ui/pages/swaps/main-quote-summary/index.js deleted file mode 100644 index 235070e29323..000000000000 --- a/ui/pages/swaps/main-quote-summary/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './main-quote-summary'; diff --git a/ui/pages/swaps/main-quote-summary/index.scss b/ui/pages/swaps/main-quote-summary/index.scss deleted file mode 100644 index 3f7693705db8..000000000000 --- a/ui/pages/swaps/main-quote-summary/index.scss +++ /dev/null @@ -1,125 +0,0 @@ -@use "design-system"; - -.main-quote-summary { - display: flex; - flex-flow: column; - justify-content: center; - align-items: center; - position: relative; - width: 100%; - color: var(--color-text-default); - margin-top: 28px; - margin-bottom: 56px; - - &__source-row, - &__destination-row { - width: 100%; - display: flex; - align-items: flex-start; - justify-content: center; - - @include design-system.H6; - - color: var(--color-text-alternative); - } - - &__source-row { - align-items: center; - } - - &__source-row-value, - &__source-row-symbol { - // Each of these spans can be half their container width minus the space - // needed for the token icon and the span margins - max-width: calc(50% - 13px); - } - - - &__source-row-value { - margin-right: 5px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } - - &__source-row-symbol { - margin-left: 5px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } - - &__destination-row { - margin-top: 6px; - } - - &__destination-row-symbol { - margin-left: 5px; - color: var(--color-text-default); - } - - &__icon, - &__icon-fallback { - height: 16px; - width: 16px; - } - - &__icon-fallback { - padding-top: 0; - font-size: 12px; - line-height: 16px; - } - - &__down-arrow { - margin-top: 5px; - color: var(--color-icon-muted); - } - - &__details { - display: flex; - flex-flow: column; - align-items: center; - width: 310px; - position: relative; - } - - &__quote-details-top { - display: flex; - flex-flow: column; - justify-content: center; - align-items: center; - width: 100%; - } - - &__quote-large { - display: flex; - align-items: flex-start; - margin-top: 8px; - height: 50px; - } - - &__quote-large-number { - font-size: 50px; - line-height: 48px; - } - - &__quote-large-white { - font-size: 40px; - text-overflow: ellipsis; - width: 295px; - overflow: hidden; - white-space: nowrap; - } - - &__exchange-rate-container { - display: flex; - justify-content: center; - align-items: center; - width: 287px; - margin-top: 14px; - } - - &__exchange-rate-display { - color: var(--color-text-alternative); - } -} diff --git a/ui/pages/swaps/main-quote-summary/main-quote-summary.js b/ui/pages/swaps/main-quote-summary/main-quote-summary.js deleted file mode 100644 index d7ff9646a3a6..000000000000 --- a/ui/pages/swaps/main-quote-summary/main-quote-summary.js +++ /dev/null @@ -1,182 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import BigNumber from 'bignumber.js'; -import Tooltip from '../../../components/ui/tooltip'; -import UrlIcon from '../../../components/ui/url-icon'; -import ExchangeRateDisplay from '../exchange-rate-display'; -import { formatSwapsValueForDisplay } from '../swaps.util'; -import { - calcTokenAmount, - toPrecisionWithoutTrailingZeros, -} from '../../../../shared/lib/transactions-controller-utils'; - -function getFontSizesAndLineHeights(fontSizeScore) { - if (fontSizeScore <= 9) { - return [50, 48]; - } - if (fontSizeScore <= 13) { - return [40, 32]; - } - return [26, 15]; -} - -export default function MainQuoteSummary({ - sourceValue, - sourceSymbol, - sourceDecimals, - sourceIconUrl, - destinationValue, - destinationSymbol, - destinationDecimals, - destinationIconUrl, -}) { - const sourceAmount = toPrecisionWithoutTrailingZeros( - calcTokenAmount(sourceValue, sourceDecimals).toString(10), - 12, - ); - const destinationAmount = calcTokenAmount( - destinationValue, - destinationDecimals, - ); - - const amountToDisplay = formatSwapsValueForDisplay(destinationAmount); - const amountDigitLength = amountToDisplay.match(/\d+/gu).join('').length; - const [numberFontSize, lineHeight] = - getFontSizesAndLineHeights(amountDigitLength); - let ellipsedAmountToDisplay = amountToDisplay; - - if (amountDigitLength > 20) { - ellipsedAmountToDisplay = `${amountToDisplay.slice(0, 20)}...`; - } - - return ( -
-
-
-
- - {formatSwapsValueForDisplay(sourceAmount)} - - - - {sourceSymbol} - -
- -
- - - {destinationSymbol} - -
-
- - - {`${ellipsedAmountToDisplay}`} - - -
-
-
- -
-
-
- ); -} - -MainQuoteSummary.propTypes = { - /** - * The amount that will be sent in the smallest denomination. - * For example, wei is the smallest denomination for ether. - */ - sourceValue: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.instanceOf(BigNumber), - ]).isRequired, - - /** - * Maximum number of decimal places for the source token. - */ - sourceDecimals: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), - - /** - * The ticker symbol for the source token. - */ - sourceSymbol: PropTypes.string.isRequired, - - /** - * The amount that will be received in the smallest denomination. - * For example, wei is the smallest denomination for ether. - */ - destinationValue: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.instanceOf(BigNumber), - ]).isRequired, - - /** - * Maximum number of decimal places for the destination token. - */ - destinationDecimals: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.number, - ]), - - /** - * The ticker symbol for the destination token. - */ - destinationSymbol: PropTypes.string.isRequired, - - /** - * The location of the source token icon file. - */ - sourceIconUrl: PropTypes.string, - - /** - * The location of the destination token icon file. - */ - destinationIconUrl: PropTypes.string, -}; diff --git a/ui/pages/swaps/main-quote-summary/main-quote-summary.stories.js b/ui/pages/swaps/main-quote-summary/main-quote-summary.stories.js deleted file mode 100644 index 56ed74624193..000000000000 --- a/ui/pages/swaps/main-quote-summary/main-quote-summary.stories.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; -import README from './README.mdx'; -import MainQuoteSummary from './main-quote-summary'; - -export default { - title: 'Pages/Swaps/MainQuoteSummary', - - component: MainQuoteSummary, - parameters: { - docs: { - page: README, - }, - }, - argTypes: { - sourceValue: { - control: 'text', - }, - sourceDecimals: { - control: 'number', - }, - sourceSymbol: { - control: 'text', - }, - destinationValue: { - control: 'text', - }, - destinationDecimals: { - control: 'number', - }, - destinationSymbol: { - control: 'text', - }, - sourceIconUrl: { - control: 'text', - }, - destinationIconUrl: { - control: 'text', - }, - }, - args: { - sourceValue: '2000000000000000000', - sourceDecimals: 18, - sourceSymbol: 'ETH', - destinationValue: '200000000000000000', - destinationDecimals: 18, - destinationSymbol: 'ABC', - sourceIconUrl: '.storybook/images/metamark.svg', - destinationIconUrl: '.storybook/images/sai.svg', - }, -}; - -export const DefaultStory = (args) => { - return ( -
- -
- ); -}; - -DefaultStory.storyName = 'Default'; diff --git a/ui/pages/swaps/main-quote-summary/main-quote-summary.test.js b/ui/pages/swaps/main-quote-summary/main-quote-summary.test.js deleted file mode 100644 index 85e17bd48de4..000000000000 --- a/ui/pages/swaps/main-quote-summary/main-quote-summary.test.js +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react'; - -import { renderWithProvider } from '../../../../test/jest'; -import MainQuoteSummary from '.'; - -const createProps = (customProps = {}) => { - return { - sourceValue: '2000000000000000000', - sourceDecimals: 18, - sourceSymbol: 'ETH', - destinationValue: '200000000000000000', - destinationDecimals: 18, - destinationSymbol: 'BAT', - ...customProps, - }; -}; - -describe('MainQuoteSummary', () => { - it('renders the component with initial props', () => { - const props = createProps(); - const { getAllByText } = renderWithProvider( - , - ); - expect(getAllByText(props.sourceSymbol)).toHaveLength(2); - expect(getAllByText(props.destinationSymbol)).toHaveLength(2); - expect( - document.querySelector('.main-quote-summary__source-row'), - ).toMatchSnapshot(); - expect( - document.querySelector('.main-quote-summary__destination-row'), - ).toMatchSnapshot(); - expect( - document.querySelector('.main-quote-summary__quote-large'), - ).toMatchSnapshot(); - expect( - document.querySelector('.main-quote-summary__exchange-rate-container'), - ).toMatchSnapshot(); - }); -}); diff --git a/ui/pages/swaps/main-quote-summary/quote-backdrop.js b/ui/pages/swaps/main-quote-summary/quote-backdrop.js deleted file mode 100644 index 44351c73bb5d..000000000000 --- a/ui/pages/swaps/main-quote-summary/quote-backdrop.js +++ /dev/null @@ -1,89 +0,0 @@ -/* eslint-disable @metamask/design-tokens/color-no-hex*/ -import React from 'react'; -import PropTypes from 'prop-types'; - -export default function QuotesBackdrop({ withTopTab }) { - return ( - - - - {withTopTab && ( - - )} - - - - - - - - - - - - - - - - - - - - - - ); -} - -QuotesBackdrop.propTypes = { - withTopTab: PropTypes.bool, -}; diff --git a/ui/pages/swaps/main-quote-summary/quote-backdrop.test.js b/ui/pages/swaps/main-quote-summary/quote-backdrop.test.js deleted file mode 100644 index 00d23c2656d6..000000000000 --- a/ui/pages/swaps/main-quote-summary/quote-backdrop.test.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; - -import { renderWithProvider } from '../../../../test/jest'; -import QuotesBackdrop from './quote-backdrop'; - -const createProps = (customProps = {}) => { - return { - withTopTab: false, - ...customProps, - }; -}; - -describe('QuotesBackdrop', () => { - it('renders the component with initial props', () => { - const { container } = renderWithProvider( - , - ); - expect(container.firstChild.nodeName).toBe('svg'); - expect(document.querySelector('g')).toMatchSnapshot(); - expect(document.querySelector('filter')).toMatchSnapshot(); - expect(document.querySelector('linearGradient')).toMatchSnapshot(); - }); -}); diff --git a/ui/pages/swaps/prepare-swap-page/index.scss b/ui/pages/swaps/prepare-swap-page/index.scss index 1909f11024b1..3db2791ae1fc 100644 --- a/ui/pages/swaps/prepare-swap-page/index.scss +++ b/ui/pages/swaps/prepare-swap-page/index.scss @@ -306,12 +306,6 @@ width: 100%; } - .main-quote-summary { - &__exchange-rate-display { - width: auto; - } - } - &::after { // Hide preloaded images. position: absolute; width: 0; @@ -365,6 +359,10 @@ &__edit-limit { white-space: nowrap; } + + &__exchange-rate-display { + color: var(--color-text-alternative); + } } @keyframes slide-in { diff --git a/ui/pages/swaps/prepare-swap-page/review-quote.js b/ui/pages/swaps/prepare-swap-page/review-quote.js index 9921161c4da4..4c47437b1bd8 100644 --- a/ui/pages/swaps/prepare-swap-page/review-quote.js +++ b/ui/pages/swaps/prepare-swap-page/review-quote.js @@ -1205,7 +1205,7 @@ export default function ReviewQuote({ setReceiveToAmount }) { secondaryTokenDecimals={destinationTokenDecimals} secondaryTokenSymbol={destinationTokenSymbol} boldSymbols={false} - className="main-quote-summary__exchange-rate-display" + className="review-quote__exchange-rate-display" showIconForSwappingTokens={false} /> diff --git a/ui/pages/swaps/select-quote-popover/quote-details/index.scss b/ui/pages/swaps/select-quote-popover/quote-details/index.scss index 861759235aba..80e034ab1d4d 100644 --- a/ui/pages/swaps/select-quote-popover/quote-details/index.scss +++ b/ui/pages/swaps/select-quote-popover/quote-details/index.scss @@ -30,10 +30,6 @@ align-items: center; height: inherit; - .view-quote__conversion-rate-eth-label { - color: var(--color-text-default); - } - i { color: var(--color-primary-default); } @@ -68,14 +64,6 @@ } } - .view-quote__conversion-rate-token-label { - @include design-system.H6; - - color: var(--color-text-default); - font-weight: bold; - margin-left: 2px; - } - &__metafox-logo { width: 17px; margin-right: 4px; diff --git a/ui/pages/swaps/smart-transaction-status/index.scss b/ui/pages/swaps/smart-transaction-status/index.scss index d19add085c65..f21e3e7752bf 100644 --- a/ui/pages/swaps/smart-transaction-status/index.scss +++ b/ui/pages/swaps/smart-transaction-status/index.scss @@ -70,4 +70,16 @@ &__remaining-time { font-variant-numeric: tabular-nums; } + + &__icon, + &__icon-fallback { + height: 16px; + width: 16px; + } + + &__icon-fallback { + padding-top: 0; + font-size: 12px; + line-height: 16px; + } } diff --git a/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js b/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js index b103ead2097c..2d69c3b0f53a 100644 --- a/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js +++ b/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js @@ -323,12 +323,12 @@ export default function SmartTransactionStatusPage() { {fetchParamsSourceTokenInfo.iconUrl ? ( ) : null} @@ -337,12 +337,12 @@ export default function SmartTransactionStatusPage() { {fetchParamsDestinationTokenInfo.iconUrl ? ( ) : null} -
-
- -
-
-
-
-
- Check your rate before proceeding -
-
-
- -
-
-
- Price impact could not be determined due to lack of market price data. Please confirm that you are comfortable with the amount of tokens you are about to receive before swapping. -
- -
-
-
-
-
-
-
-`; - -exports[`View Price Quote Difference displays an error when in high bucket 1`] = ` -
-
-
- -
-
-
-
-
- Price difference of ~% -
-
-
- -
-
-
- You are about to swap 1 ETH (~) for 42.947749 LINK (~). -
- -
-
-
-
-
-
-
-`; - -exports[`View Price Quote Difference displays an error when in medium bucket 1`] = ` -
-
-
- -
-
-
-
-
- Price difference of ~% -
-
-
- -
-
-
- You are about to swap 1 ETH (~) for 42.947749 LINK (~). -
- -
-
-
-
-
-
-
-`; - -exports[`View Price Quote Difference should match snapshot 1`] = ` -
-
-
- -
-
-
-
-
- Price difference of ~% -
-
-
- -
-
-
- You are about to swap 1 ETH (~) for 42.947749 LINK (~). -
- -
-
-
-
-
-
-
-`; diff --git a/ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap b/ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap deleted file mode 100644 index 3f6273f9f738..000000000000 --- a/ui/pages/swaps/view-quote/__snapshots__/view-quote.test.js.snap +++ /dev/null @@ -1,145 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ViewQuote renders the component with EIP-1559 enabled 1`] = ` -
- - 10 - -
- DAI -
- - DAI - -
-`; - -exports[`ViewQuote renders the component with EIP-1559 enabled 2`] = ` -
-
- - -
-
-`; - -exports[`ViewQuote renders the component with initial props 1`] = ` -
- - 10 - -
- DAI -
- - DAI - -
-`; - -exports[`ViewQuote renders the component with initial props 2`] = ` -
-
- - -
-
-`; diff --git a/ui/pages/swaps/view-quote/index.js b/ui/pages/swaps/view-quote/index.js deleted file mode 100644 index 4a412aa905fe..000000000000 --- a/ui/pages/swaps/view-quote/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './view-quote'; diff --git a/ui/pages/swaps/view-quote/index.scss b/ui/pages/swaps/view-quote/index.scss deleted file mode 100644 index f96451cc6f4c..000000000000 --- a/ui/pages/swaps/view-quote/index.scss +++ /dev/null @@ -1,179 +0,0 @@ -@use "design-system"; - -.view-quote { - display: flex; - flex-flow: column; - align-items: center; - flex: 1; - width: 100%; - - &::after { // Hide preloaded images. - position: absolute; - width: 0; - height: 0; - overflow: hidden; - z-index: -1; - content: url('/images/transaction-background-top.svg') url('/images/transaction-background-bottom.svg'); // Preload images for the STX status page. - } - - &__content { - display: flex; - flex-flow: column; - align-items: center; - width: 100%; - height: 100%; - padding-left: 20px; - padding-right: 20px; - - &_modal > div:not(.view-quote__warning-wrapper) { - opacity: 0.6; - pointer-events: none; - } - - @include design-system.screen-sm-max { - overflow-y: auto; - max-height: 420px; - } - } - - @include design-system.screen-sm-min { - width: 348px; - } - - &__price-difference-warning { - &-wrapper { - width: 100%; - - &.low, - &.medium, - &.high { - .actionable-message { - &::before { - background: none; - } - - .actionable-message__message { - color: inherit; - } - - button { - font-size: design-system.$font-size-h8; - padding: 4px 12px; - border-radius: 42px; - } - } - } - - &.low { - .actionable-message { - button { - background: var(--color-primary-default); - color: var(--color-primary-inverse); - } - } - } - - &.medium { - .actionable-message { - border-color: var(--color-warning-default); - background: var(--color-warning-muted); - - button { - background: var(--color-warning-default); - } - } - } - - &.high { - .actionable-message { - border-color: var(--color-error-default); - background: var(--color-error-muted); - - button { - background: var(--color-error-default); - color: var(--color-error-inverse); - } - } - } - } - - &-contents { - display: flex; - text-align: left; - - &-title { - font-weight: bold; - } - - &-actions { - text-align: end; - padding-top: 10px; - } - - i { - margin-inline-start: 10px; - } - } - } - - &__warning-wrapper { - width: 100%; - align-items: center; - justify-content: center; - max-width: 340px; - margin-top: 8px; - margin-bottom: 8px; - - @include design-system.screen-sm-min { - &--thin { - min-height: 36px; - } - - display: flex; - } - } - - &__bold { - font-weight: bold; - } - - &__countdown-timer-container { - display: flex; - justify-content: center; - margin-top: 8px; - } - - &__fee-card-container { - display: flex; - align-items: center; - width: 100%; - max-width: 311px; - margin-bottom: 8px; - - @include design-system.screen-sm-min { - margin-bottom: 0; - } - } - - &__metamask-rate { - display: flex; - } - - &__metamask-rate-text { - @include design-system.H7; - - color: var(--color-text-alternative); - } - - &__metamask-rate-info-icon { - margin-left: 4px; - } - - &__thin-swaps-footer { - max-height: 82px; - - @include design-system.screen-sm-min { - height: 72px; - } - } -} diff --git a/ui/pages/swaps/view-quote/view-quote-price-difference.js b/ui/pages/swaps/view-quote/view-quote-price-difference.js deleted file mode 100644 index 2607243494d4..000000000000 --- a/ui/pages/swaps/view-quote/view-quote-price-difference.js +++ /dev/null @@ -1,111 +0,0 @@ -import React, { useContext } from 'react'; - -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import { I18nContext } from '../../../contexts/i18n'; - -import ActionableMessage from '../../../components/ui/actionable-message/actionable-message'; -import Tooltip from '../../../components/ui/tooltip'; -import Box from '../../../components/ui/box'; -import { - JustifyContent, - DISPLAY, -} from '../../../helpers/constants/design-system'; -import { GasRecommendations } from '../../../../shared/constants/gas'; -import { Icon, IconName } from '../../../components/component-library'; - -export default function ViewQuotePriceDifference(props) { - const { - usedQuote, - sourceTokenValue, - destinationTokenValue, - onAcknowledgementClick, - acknowledged, - priceSlippageFromSource, - priceSlippageFromDestination, - priceDifferencePercentage, - priceSlippageUnknownFiatValue, - } = props; - - const t = useContext(I18nContext); - - let priceDifferenceTitle = ''; - let priceDifferenceMessage = ''; - let priceDifferenceClass = ''; - let priceDifferenceAcknowledgementText = ''; - if (priceSlippageUnknownFiatValue) { - // A calculation error signals we cannot determine dollar value - priceDifferenceTitle = t('swapPriceUnavailableTitle'); - priceDifferenceMessage = t('swapPriceUnavailableDescription'); - priceDifferenceClass = GasRecommendations.high; - priceDifferenceAcknowledgementText = t('tooltipApproveButton'); - } else { - priceDifferenceTitle = t('swapPriceDifferenceTitle', [ - priceDifferencePercentage, - ]); - priceDifferenceMessage = t('swapPriceDifference', [ - sourceTokenValue, // Number of source token to swap - usedQuote.sourceTokenInfo.symbol, // Source token symbol - priceSlippageFromSource, // Source tokens total value - destinationTokenValue, // Number of destination tokens in return - usedQuote.destinationTokenInfo.symbol, // Destination token symbol, - priceSlippageFromDestination, // Destination tokens total value - ]); - priceDifferenceClass = usedQuote.priceSlippage.bucket; - priceDifferenceAcknowledgementText = t('tooltipApproveButton'); - } - - return ( -
- -
- -
- {priceDifferenceTitle} -
- - - -
- {priceDifferenceMessage} - {!acknowledged && ( -
- -
- )} -
-
- } - /> -
- ); -} - -ViewQuotePriceDifference.propTypes = { - usedQuote: PropTypes.object, - sourceTokenValue: PropTypes.string, - destinationTokenValue: PropTypes.string, - onAcknowledgementClick: PropTypes.func, - acknowledged: PropTypes.bool, - priceSlippageFromSource: PropTypes.string, - priceSlippageFromDestination: PropTypes.string, - priceDifferencePercentage: PropTypes.number, - priceSlippageUnknownFiatValue: PropTypes.bool, -}; diff --git a/ui/pages/swaps/view-quote/view-quote-price-difference.test.js b/ui/pages/swaps/view-quote/view-quote-price-difference.test.js deleted file mode 100644 index 5702f39f67fe..000000000000 --- a/ui/pages/swaps/view-quote/view-quote-price-difference.test.js +++ /dev/null @@ -1,132 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; -import { renderWithProvider } from '../../../../test/lib/render-helpers'; -import { GasRecommendations } from '../../../../shared/constants/gas'; -import ViewQuotePriceDifference from './view-quote-price-difference'; - -describe('View Price Quote Difference', () => { - const mockState = { - metamask: { - tokens: [], - preferences: { showFiatInTestnets: true }, - currentCurrency: 'usd', - currencyRates: { - ETH: { - conversionRate: 600.0, - }, - }, - }, - }; - - const mockStore = configureMockStore()(mockState); - - // Sample transaction is 1 $ETH to ~42.880915 $LINK - const DEFAULT_PROPS = { - usedQuote: { - trade: { - data: '0x5f575529000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000007756e69737761700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000000000000000000000000000000dc1a09f859b20000000000000000000000000000000000000000000000000024855454cb32d335f0000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000005fc7b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f161421c8e0000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca', - from: '0xd7440fdcb70a9fba55dfe06942ddbc17679c90ac', - value: '0xde0b6b3a7640000', - gas: '0xbbfd0', - to: '0x881D40237659C251811CEC9c364ef91dC08D300C', - }, - sourceAmount: '1000000000000000000', - destinationAmount: '42947749216634160067', - error: null, - sourceToken: '0x0000000000000000000000000000000000000000', - destinationToken: '0x514910771af9ca656af840dff83e8264ecf986ca', - approvalNeeded: null, - maxGas: 770000, - averageGas: 210546, - estimatedRefund: 80000, - fetchTime: 647, - aggregator: 'uniswap', - aggType: 'DEX', - fee: 0.875, - gasMultiplier: 1.5, - priceSlippage: { - ratio: 1.007876641534847, - calculationError: '', - bucket: GasRecommendations.low, - sourceAmountInETH: 1, - destinationAmountInETH: 0.9921849150875727, - }, - slippage: 2, - sourceTokenInfo: { - symbol: 'ETH', - name: 'Ether', - address: '0x0000000000000000000000000000000000000000', - decimals: 18, - iconUrl: 'images/black-eth-logo.png', - }, - destinationTokenInfo: { - address: '0x514910771af9ca656af840dff83e8264ecf986ca', - symbol: 'LINK', - decimals: 18, - occurances: 12, - iconUrl: - 'https://cloudflare-ipfs.com/ipfs/QmQhZAdcZvW9T2tPm516yHqbGkfhyZwTZmLixW9MXJudTA', - }, - ethFee: '0.011791', - ethValueOfTokens: '0.99220724791716534441', - overallValueOfQuote: '0.98041624791716534441', - metaMaskFeeInEth: '0.00875844985551091729', - isBestQuote: true, - savings: { - performance: '0.00207907025112527799', - fee: '0.005581', - metaMaskFee: '0.00875844985551091729', - total: '-0.0010983796043856393', - medianMetaMaskFee: '0.00874009740688812165', - }, - }, - sourceTokenValue: '1', - destinationTokenValue: '42.947749', - }; - - it('should match snapshot', () => { - const { container } = renderWithProvider( - , - mockStore, - ); - - expect(container).toMatchSnapshot(); - }); - - it('displays an error when in medium bucket', () => { - const props = { ...DEFAULT_PROPS }; - props.usedQuote.priceSlippage.bucket = GasRecommendations.medium; - - const { container } = renderWithProvider( - , - mockStore, - ); - - expect(container).toMatchSnapshot(); - }); - - it('displays an error when in high bucket', () => { - const props = { ...DEFAULT_PROPS }; - props.usedQuote.priceSlippage.bucket = GasRecommendations.high; - - const { container } = renderWithProvider( - , - mockStore, - ); - - expect(container).toMatchSnapshot(); - }); - - it('displays a fiat error when calculationError is present', () => { - const props = { ...DEFAULT_PROPS, priceSlippageUnknownFiatValue: true }; - props.usedQuote.priceSlippage.calculationError = - 'Could not determine price.'; - - const { container } = renderWithProvider( - , - mockStore, - ); - - expect(container).toMatchSnapshot(); - }); -}); diff --git a/ui/pages/swaps/view-quote/view-quote.js b/ui/pages/swaps/view-quote/view-quote.js deleted file mode 100644 index be02ba840eb5..000000000000 --- a/ui/pages/swaps/view-quote/view-quote.js +++ /dev/null @@ -1,1089 +0,0 @@ -import React, { - useState, - useContext, - useMemo, - useEffect, - useRef, - useCallback, -} from 'react'; -import { shallowEqual, useSelector, useDispatch } from 'react-redux'; -import { useHistory } from 'react-router-dom'; -import BigNumber from 'bignumber.js'; -import { isEqual } from 'lodash'; -import classnames from 'classnames'; -import { captureException } from '@sentry/browser'; - -import { I18nContext } from '../../../contexts/i18n'; -import SelectQuotePopover from '../select-quote-popover'; -import { useEthFiatAmount } from '../../../hooks/useEthFiatAmount'; -import { useEqualityCheck } from '../../../hooks/useEqualityCheck'; -import { usePrevious } from '../../../hooks/usePrevious'; -import { useGasFeeInputs } from '../../confirmations/hooks/useGasFeeInputs'; -import { MetaMetricsContext } from '../../../contexts/metametrics'; -import FeeCard from '../fee-card'; -import { - getQuotes, - getApproveTxParams, - getFetchParams, - setBalanceError, - getQuotesLastFetched, - getBalanceError, - getCustomSwapsGas, // Gas limit. - getCustomMaxFeePerGas, - getCustomMaxPriorityFeePerGas, - getSwapsUserFeeLevel, - getDestinationTokenInfo, - getUsedSwapsGasPrice, - getTopQuote, - getUsedQuote, - signAndSendTransactions, - getBackgroundSwapRouteState, - swapsQuoteSelected, - getSwapsQuoteRefreshTime, - getReviewSwapClickedTimestamp, - signAndSendSwapsSmartTransaction, - getSwapsNetworkConfig, - getSmartTransactionsError, - getCurrentSmartTransactionsError, - getSwapsSTXLoading, - fetchSwapsSmartTransactionFees, - getSmartTransactionFees, - getCurrentSmartTransactionsEnabled, -} from '../../../ducks/swaps/swaps'; -import { - conversionRateSelector, - getSelectedAccount, - getCurrentCurrency, - getTokenExchangeRates, - getSwapsDefaultToken, - getCurrentChainId, - isHardwareWallet, - getHardwareWalletType, - checkNetworkAndAccountSupports1559, - getUSDConversionRate, -} from '../../../selectors'; -import { - getSmartTransactionsOptInStatus, - getSmartTransactionsEnabled, -} from '../../../../shared/modules/selectors'; -import { getNativeCurrency, getTokens } from '../../../ducks/metamask/metamask'; -import { - getLayer1GasFee, - safeRefetchQuotes, - setCustomApproveTxData, - setSwapsErrorKey, - showModal, - setSwapsQuotesPollingLimitEnabled, -} from '../../../store/actions'; -import { SET_SMART_TRANSACTIONS_ERROR } from '../../../store/actionConstants'; -import { - ASSET_ROUTE, - BUILD_QUOTE_ROUTE, - DEFAULT_ROUTE, - SWAPS_ERROR_ROUTE, - AWAITING_SWAP_ROUTE, -} from '../../../helpers/constants/routes'; -import MainQuoteSummary from '../main-quote-summary'; -import { getCustomTxParamsData } from '../../confirmations/confirm-approve/confirm-approve.util'; -import ActionableMessage from '../../../components/ui/actionable-message/actionable-message'; -import { - quotesToRenderableData, - getRenderableNetworkFeesForQuote, - getFeeForSmartTransaction, -} from '../swaps.util'; -import { useTokenTracker } from '../../../hooks/useTokenTracker'; -import { QUOTES_EXPIRED_ERROR } from '../../../../shared/constants/swaps'; -import { GasRecommendations } from '../../../../shared/constants/gas'; -import CountdownTimer from '../countdown-timer'; -import SwapsFooter from '../swaps-footer'; -import PulseLoader from '../../../components/ui/pulse-loader'; // TODO: Replace this with a different loading component. -import Box from '../../../components/ui/box'; -import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics'; -import { isEqualCaseInsensitive } from '../../../../shared/modules/string-utils'; -import { parseStandardTokenTransactionData } from '../../../../shared/modules/transaction.utils'; -import { getTokenValueParam } from '../../../../shared/lib/metamask-controller-utils'; -import { - calcGasTotal, - calcTokenAmount, - toPrecisionWithoutTrailingZeros, -} from '../../../../shared/lib/transactions-controller-utils'; -// TODO: Remove restricted import -// eslint-disable-next-line import/no-restricted-paths -import { addHexPrefix } from '../../../../app/scripts/lib/util'; -import { - calcTokenValue, - calculateMaxGasLimit, -} from '../../../../shared/lib/swaps-utils'; -import { - addHexes, - decGWEIToHexWEI, - decimalToHex, - decWEIToDecETH, - hexWEIToDecGWEI, - sumHexes, -} from '../../../../shared/modules/conversion.utils'; -import ViewQuotePriceDifference from './view-quote-price-difference'; - -let intervalId; - -export default function ViewQuote() { - const history = useHistory(); - const dispatch = useDispatch(); - const t = useContext(I18nContext); - const trackEvent = useContext(MetaMetricsContext); - - const [dispatchedSafeRefetch, setDispatchedSafeRefetch] = useState(false); - const [submitClicked, setSubmitClicked] = useState(false); - const [selectQuotePopoverShown, setSelectQuotePopoverShown] = useState(false); - const [warningHidden, setWarningHidden] = useState(false); - const [originalApproveAmount, setOriginalApproveAmount] = useState(null); - const [multiLayerL1FeeTotal, setMultiLayerL1FeeTotal] = useState(null); - const [multiLayerL1ApprovalFeeTotal, setMultiLayerL1ApprovalFeeTotal] = - useState(null); - // We need to have currentTimestamp in state, otherwise it would change with each rerender. - const [currentTimestamp] = useState(Date.now()); - - const [acknowledgedPriceDifference, setAcknowledgedPriceDifference] = - useState(false); - const priceDifferenceRiskyBuckets = [ - GasRecommendations.high, - GasRecommendations.medium, - ]; - - const routeState = useSelector(getBackgroundSwapRouteState); - const quotes = useSelector(getQuotes, isEqual); - useEffect(() => { - if (!Object.values(quotes).length) { - history.push(BUILD_QUOTE_ROUTE); - } else if (routeState === 'awaiting') { - history.push(AWAITING_SWAP_ROUTE); - } - }, [history, quotes, routeState]); - - const quotesLastFetched = useSelector(getQuotesLastFetched); - - // Select necessary data - const gasPrice = useSelector(getUsedSwapsGasPrice); - const customMaxGas = useSelector(getCustomSwapsGas); - const customMaxFeePerGas = useSelector(getCustomMaxFeePerGas); - const customMaxPriorityFeePerGas = useSelector(getCustomMaxPriorityFeePerGas); - const swapsUserFeeLevel = useSelector(getSwapsUserFeeLevel); - const tokenConversionRates = useSelector(getTokenExchangeRates, isEqual); - const memoizedTokenConversionRates = useEqualityCheck(tokenConversionRates); - const { balance: ethBalance } = useSelector(getSelectedAccount, shallowEqual); - const conversionRate = useSelector(conversionRateSelector); - const USDConversionRate = useSelector(getUSDConversionRate); - const currentCurrency = useSelector(getCurrentCurrency); - const swapsTokens = useSelector(getTokens, isEqual); - const networkAndAccountSupports1559 = useSelector( - checkNetworkAndAccountSupports1559, - ); - const balanceError = useSelector(getBalanceError); - const fetchParams = useSelector(getFetchParams, isEqual); - const approveTxParams = useSelector(getApproveTxParams, shallowEqual); - const topQuote = useSelector(getTopQuote, isEqual); - const usedQuote = useSelector(getUsedQuote, isEqual); - const tradeValue = usedQuote?.trade?.value ?? '0x0'; - const swapsQuoteRefreshTime = useSelector(getSwapsQuoteRefreshTime); - const defaultSwapsToken = useSelector(getSwapsDefaultToken, isEqual); - const chainId = useSelector(getCurrentChainId); - const nativeCurrencySymbol = useSelector(getNativeCurrency); - const reviewSwapClickedTimestamp = useSelector(getReviewSwapClickedTimestamp); - const smartTransactionsOptInStatus = useSelector( - getSmartTransactionsOptInStatus, - ); - const smartTransactionsEnabled = useSelector(getSmartTransactionsEnabled); - const swapsSTXLoading = useSelector(getSwapsSTXLoading); - const currentSmartTransactionsError = useSelector( - getCurrentSmartTransactionsError, - ); - const smartTransactionsError = useSelector(getSmartTransactionsError); - const smartTransactionFees = useSelector(getSmartTransactionFees, isEqual); - const currentSmartTransactionsEnabled = useSelector( - getCurrentSmartTransactionsEnabled, - ); - const swapsNetworkConfig = useSelector(getSwapsNetworkConfig, shallowEqual); - const unsignedTransaction = usedQuote.trade; - const isSmartTransaction = - currentSmartTransactionsEnabled && smartTransactionsOptInStatus; - - let gasFeeInputs; - if (networkAndAccountSupports1559) { - // For Swaps we want to get 'high' estimations by default. - // eslint-disable-next-line react-hooks/rules-of-hooks - gasFeeInputs = useGasFeeInputs(GasRecommendations.high, { - userFeeLevel: swapsUserFeeLevel || GasRecommendations.high, - }); - } - - const fetchParamsSourceToken = fetchParams?.sourceToken; - - const additionalTrackingParams = { - reg_tx_fee_in_usd: undefined, - reg_tx_fee_in_eth: undefined, - reg_tx_max_fee_in_usd: undefined, - reg_tx_max_fee_in_eth: undefined, - stx_fee_in_usd: undefined, - stx_fee_in_eth: undefined, - stx_max_fee_in_usd: undefined, - stx_max_fee_in_eth: undefined, - }; - - const usedGasLimit = - usedQuote?.gasEstimateWithRefund || - `0x${decimalToHex(usedQuote?.averageGas || 0)}`; - - const maxGasLimit = calculateMaxGasLimit( - usedQuote?.gasEstimate, - usedQuote?.gasMultiplier, - usedQuote?.maxGas, - customMaxGas, - ); - - let maxFeePerGas; - let maxPriorityFeePerGas; - let baseAndPriorityFeePerGas; - - // EIP-1559 gas fees. - if (networkAndAccountSupports1559) { - const { - maxFeePerGas: suggestedMaxFeePerGas, - maxPriorityFeePerGas: suggestedMaxPriorityFeePerGas, - gasFeeEstimates, - } = gasFeeInputs; - const estimatedBaseFee = gasFeeEstimates?.estimatedBaseFee ?? '0'; - maxFeePerGas = customMaxFeePerGas || decGWEIToHexWEI(suggestedMaxFeePerGas); - maxPriorityFeePerGas = - customMaxPriorityFeePerGas || - decGWEIToHexWEI(suggestedMaxPriorityFeePerGas); - baseAndPriorityFeePerGas = addHexes( - decGWEIToHexWEI(estimatedBaseFee), - maxPriorityFeePerGas, - ); - } - let gasTotalInWeiHex = calcGasTotal(maxGasLimit, maxFeePerGas || gasPrice); - if (multiLayerL1FeeTotal !== null) { - gasTotalInWeiHex = sumHexes( - gasTotalInWeiHex || '0x0', - multiLayerL1FeeTotal || '0x0', - ); - } - - const { tokensWithBalances } = useTokenTracker({ - tokens: swapsTokens, - includeFailedTokens: true, - }); - const balanceToken = - fetchParamsSourceToken === defaultSwapsToken.address - ? defaultSwapsToken - : tokensWithBalances.find(({ address }) => - isEqualCaseInsensitive(address, fetchParamsSourceToken), - ); - - const selectedFromToken = balanceToken || usedQuote.sourceTokenInfo; - const tokenBalance = - tokensWithBalances?.length && - calcTokenAmount( - selectedFromToken.balance || '0x0', - selectedFromToken.decimals, - ).toFixed(9); - const tokenBalanceUnavailable = - tokensWithBalances && balanceToken === undefined; - - const approveData = parseStandardTokenTransactionData(approveTxParams?.data); - const approveValue = approveData && getTokenValueParam(approveData); - const approveAmount = - approveValue && - selectedFromToken?.decimals !== undefined && - calcTokenAmount(approveValue, selectedFromToken.decimals).toFixed(9); - const approveGas = approveTxParams?.gas; - - const renderablePopoverData = useMemo(() => { - return quotesToRenderableData({ - quotes, - gasPrice: networkAndAccountSupports1559 - ? baseAndPriorityFeePerGas - : gasPrice, - conversionRate, - currentCurrency, - approveGas, - tokenConversionRates: memoizedTokenConversionRates, - chainId, - smartTransactionEstimatedGas: - smartTransactionsEnabled && - smartTransactionsOptInStatus && - smartTransactionFees?.tradeTxFees, - nativeCurrencySymbol, - multiLayerL1ApprovalFeeTotal, - }); - }, [ - quotes, - gasPrice, - baseAndPriorityFeePerGas, - networkAndAccountSupports1559, - conversionRate, - currentCurrency, - approveGas, - memoizedTokenConversionRates, - chainId, - smartTransactionFees?.tradeTxFees, - nativeCurrencySymbol, - smartTransactionsEnabled, - smartTransactionsOptInStatus, - multiLayerL1ApprovalFeeTotal, - ]); - - const renderableDataForUsedQuote = renderablePopoverData.find( - (renderablePopoverDatum) => - renderablePopoverDatum.aggId === usedQuote.aggregator, - ); - - const { - destinationTokenDecimals, - destinationTokenSymbol, - destinationTokenValue, - destinationIconUrl, - sourceTokenDecimals, - sourceTokenSymbol, - sourceTokenValue, - sourceTokenIconUrl, - } = renderableDataForUsedQuote; - - let { feeInFiat, feeInEth, rawEthFee, feeInUsd } = - getRenderableNetworkFeesForQuote({ - tradeGas: usedGasLimit, - approveGas, - gasPrice: networkAndAccountSupports1559 - ? baseAndPriorityFeePerGas - : gasPrice, - currentCurrency, - conversionRate, - USDConversionRate, - tradeValue, - sourceSymbol: sourceTokenSymbol, - sourceAmount: usedQuote.sourceAmount, - chainId, - nativeCurrencySymbol, - multiLayerL1FeeTotal, - }); - additionalTrackingParams.reg_tx_fee_in_usd = Number(feeInUsd); - additionalTrackingParams.reg_tx_fee_in_eth = Number(rawEthFee); - - const renderableMaxFees = getRenderableNetworkFeesForQuote({ - tradeGas: maxGasLimit, - approveGas, - gasPrice: maxFeePerGas || gasPrice, - currentCurrency, - conversionRate, - USDConversionRate, - tradeValue, - sourceSymbol: sourceTokenSymbol, - sourceAmount: usedQuote.sourceAmount, - chainId, - nativeCurrencySymbol, - multiLayerL1FeeTotal, - }); - let { - feeInFiat: maxFeeInFiat, - feeInEth: maxFeeInEth, - rawEthFee: maxRawEthFee, - feeInUsd: maxFeeInUsd, - } = renderableMaxFees; - additionalTrackingParams.reg_tx_max_fee_in_usd = Number(maxFeeInUsd); - additionalTrackingParams.reg_tx_max_fee_in_eth = Number(maxRawEthFee); - - if ( - currentSmartTransactionsEnabled && - smartTransactionsOptInStatus && - smartTransactionFees?.tradeTxFees - ) { - const stxEstimatedFeeInWeiDec = - smartTransactionFees?.tradeTxFees.feeEstimate + - (smartTransactionFees?.approvalTxFees?.feeEstimate || 0); - const stxMaxFeeInWeiDec = - stxEstimatedFeeInWeiDec * swapsNetworkConfig.stxMaxFeeMultiplier; - ({ feeInFiat, feeInEth, rawEthFee, feeInUsd } = getFeeForSmartTransaction({ - chainId, - currentCurrency, - conversionRate, - USDConversionRate, - nativeCurrencySymbol, - feeInWeiDec: stxEstimatedFeeInWeiDec, - })); - additionalTrackingParams.stx_fee_in_usd = Number(feeInUsd); - additionalTrackingParams.stx_fee_in_eth = Number(rawEthFee); - additionalTrackingParams.estimated_gas = - smartTransactionFees?.tradeTxFees.gasLimit; - ({ - feeInFiat: maxFeeInFiat, - feeInEth: maxFeeInEth, - rawEthFee: maxRawEthFee, - feeInUsd: maxFeeInUsd, - } = getFeeForSmartTransaction({ - chainId, - currentCurrency, - conversionRate, - USDConversionRate, - nativeCurrencySymbol, - feeInWeiDec: stxMaxFeeInWeiDec, - })); - additionalTrackingParams.stx_max_fee_in_usd = Number(maxFeeInUsd); - additionalTrackingParams.stx_max_fee_in_eth = Number(maxRawEthFee); - } - - const tokenCost = new BigNumber(usedQuote.sourceAmount); - const ethCost = new BigNumber(usedQuote.trade.value || 0, 10).plus( - new BigNumber(gasTotalInWeiHex, 16), - ); - - const insufficientTokens = - (tokensWithBalances?.length || balanceError) && - tokenCost.gt(new BigNumber(selectedFromToken.balance || '0x0')); - - const insufficientEth = ethCost.gt(new BigNumber(ethBalance || '0x0')); - - const tokenBalanceNeeded = insufficientTokens - ? toPrecisionWithoutTrailingZeros( - calcTokenAmount(tokenCost, selectedFromToken.decimals) - .minus(tokenBalance) - .toString(10), - 6, - ) - : null; - - const ethBalanceNeeded = insufficientEth - ? toPrecisionWithoutTrailingZeros( - ethCost - .minus(ethBalance, 16) - .div('1000000000000000000', 10) - .toString(10), - 6, - ) - : null; - - let ethBalanceNeededStx; - if (isSmartTransaction && smartTransactionsError?.balanceNeededWei) { - ethBalanceNeededStx = decWEIToDecETH( - smartTransactionsError.balanceNeededWei - - smartTransactionsError.currentBalanceWei, - ); - } - - const destinationToken = useSelector(getDestinationTokenInfo, isEqual); - useEffect(() => { - if (isSmartTransaction) { - if (insufficientTokens) { - dispatch(setBalanceError(true)); - } else if (balanceError && !insufficientTokens) { - dispatch(setBalanceError(false)); - } - } else if (insufficientTokens || insufficientEth) { - dispatch(setBalanceError(true)); - } else if (balanceError && !insufficientTokens && !insufficientEth) { - dispatch(setBalanceError(false)); - } - }, [ - insufficientTokens, - insufficientEth, - balanceError, - dispatch, - isSmartTransaction, - ]); - - useEffect(() => { - const currentTime = Date.now(); - const timeSinceLastFetched = currentTime - quotesLastFetched; - if ( - timeSinceLastFetched > swapsQuoteRefreshTime && - !dispatchedSafeRefetch - ) { - setDispatchedSafeRefetch(true); - dispatch(safeRefetchQuotes()); - } else if (timeSinceLastFetched > swapsQuoteRefreshTime) { - dispatch(setSwapsErrorKey(QUOTES_EXPIRED_ERROR)); - history.push(SWAPS_ERROR_ROUTE); - } - }, [ - quotesLastFetched, - dispatchedSafeRefetch, - dispatch, - history, - swapsQuoteRefreshTime, - ]); - - useEffect(() => { - if (!originalApproveAmount && approveAmount) { - setOriginalApproveAmount(approveAmount); - } - }, [originalApproveAmount, approveAmount]); - - // If it's not a Smart Transaction and ETH balance is needed, we want to show a warning. - const isNotStxAndEthBalanceIsNeeded = - (!currentSmartTransactionsEnabled || !smartTransactionsOptInStatus) && - ethBalanceNeeded; - - // If it's a Smart Transaction and ETH balance is needed, we want to show a warning. - const isStxAndEthBalanceIsNeeded = isSmartTransaction && ethBalanceNeededStx; - - // Indicates if we should show to a user a warning about insufficient funds for swapping. - const showInsufficientWarning = - (balanceError || - tokenBalanceNeeded || - isNotStxAndEthBalanceIsNeeded || - isStxAndEthBalanceIsNeeded) && - !warningHidden; - - const hardwareWalletUsed = useSelector(isHardwareWallet); - const hardwareWalletType = useSelector(getHardwareWalletType); - - const numberOfQuotes = Object.values(quotes).length; - const bestQuoteReviewedEventSent = useRef(); - const eventObjectBase = useMemo(() => { - return { - token_from: sourceTokenSymbol, - token_from_amount: sourceTokenValue, - token_to: destinationTokenSymbol, - token_to_amount: destinationTokenValue, - request_type: fetchParams?.balanceError, - slippage: fetchParams?.slippage, - custom_slippage: fetchParams?.slippage !== 2, - response_time: fetchParams?.responseTime, - best_quote_source: topQuote?.aggregator, - available_quotes: numberOfQuotes, - is_hardware_wallet: hardwareWalletUsed, - hardware_wallet_type: hardwareWalletType, - stx_enabled: smartTransactionsEnabled, - current_stx_enabled: currentSmartTransactionsEnabled, - stx_user_opt_in: smartTransactionsOptInStatus, - }; - }, [ - sourceTokenSymbol, - sourceTokenValue, - destinationTokenSymbol, - destinationTokenValue, - fetchParams?.balanceError, - fetchParams?.slippage, - fetchParams?.responseTime, - topQuote?.aggregator, - numberOfQuotes, - hardwareWalletUsed, - hardwareWalletType, - smartTransactionsEnabled, - currentSmartTransactionsEnabled, - smartTransactionsOptInStatus, - ]); - - const trackAllAvailableQuotesOpened = () => { - trackEvent({ - event: 'All Available Quotes Opened', - category: MetaMetricsEventCategory.Swaps, - sensitiveProperties: { - ...eventObjectBase, - other_quote_selected: usedQuote?.aggregator !== topQuote?.aggregator, - other_quote_selected_source: - usedQuote?.aggregator === topQuote?.aggregator - ? null - : usedQuote?.aggregator, - }, - }); - }; - const trackQuoteDetailsOpened = () => { - trackEvent({ - event: 'Quote Details Opened', - category: MetaMetricsEventCategory.Swaps, - sensitiveProperties: { - ...eventObjectBase, - other_quote_selected: usedQuote?.aggregator !== topQuote?.aggregator, - other_quote_selected_source: - usedQuote?.aggregator === topQuote?.aggregator - ? null - : usedQuote?.aggregator, - }, - }); - }; - const trackEditSpendLimitOpened = () => { - trackEvent({ - event: 'Edit Spend Limit Opened', - category: MetaMetricsEventCategory.Swaps, - sensitiveProperties: { - ...eventObjectBase, - custom_spend_limit_set: originalApproveAmount === approveAmount, - custom_spend_limit_amount: - originalApproveAmount === approveAmount ? null : approveAmount, - }, - }); - }; - const trackBestQuoteReviewedEvent = useCallback(() => { - trackEvent({ - event: 'Best Quote Reviewed', - category: MetaMetricsEventCategory.Swaps, - sensitiveProperties: { - ...eventObjectBase, - network_fees: feeInFiat, - }, - }); - }, [trackEvent, eventObjectBase, feeInFiat]); - const trackViewQuotePageLoadedEvent = useCallback(() => { - trackEvent({ - event: 'View Quote Page Loaded', - category: MetaMetricsEventCategory.Swaps, - sensitiveProperties: { - ...eventObjectBase, - response_time: currentTimestamp - reviewSwapClickedTimestamp, - }, - }); - }, [ - trackEvent, - eventObjectBase, - currentTimestamp, - reviewSwapClickedTimestamp, - ]); - - useEffect(() => { - if ( - !bestQuoteReviewedEventSent.current && - [ - sourceTokenSymbol, - sourceTokenValue, - destinationTokenSymbol, - destinationTokenValue, - fetchParams, - topQuote, - numberOfQuotes, - feeInFiat, - ].every((dep) => dep !== null && dep !== undefined) - ) { - bestQuoteReviewedEventSent.current = true; - trackBestQuoteReviewedEvent(); - } - }, [ - fetchParams, - topQuote, - numberOfQuotes, - feeInFiat, - destinationTokenSymbol, - destinationTokenValue, - sourceTokenSymbol, - sourceTokenValue, - trackBestQuoteReviewedEvent, - ]); - - const metaMaskFee = usedQuote.fee; - - /* istanbul ignore next */ - const onFeeCardTokenApprovalClick = () => { - trackEditSpendLimitOpened(); - dispatch( - showModal({ - name: 'EDIT_APPROVAL_PERMISSION', - decimals: selectedFromToken.decimals, - origin: 'MetaMask', - setCustomAmount: (newCustomPermissionAmount) => { - const customPermissionAmount = - newCustomPermissionAmount === '' - ? originalApproveAmount - : newCustomPermissionAmount; - const newData = getCustomTxParamsData(approveTxParams.data, { - customPermissionAmount, - decimals: selectedFromToken.decimals, - }); - - if ( - customPermissionAmount?.length && - approveTxParams.data !== newData - ) { - dispatch(setCustomApproveTxData(newData)); - } - }, - tokenAmount: originalApproveAmount, - customTokenAmount: - originalApproveAmount === approveAmount ? null : approveAmount, - tokenBalance, - tokenSymbol: selectedFromToken.symbol, - requiredMinimum: calcTokenAmount( - usedQuote.sourceAmount, - selectedFromToken.decimals, - ), - }), - ); - }; - const actionableBalanceErrorMessage = tokenBalanceUnavailable - ? t('swapTokenBalanceUnavailable', [sourceTokenSymbol]) - : t('swapApproveNeedMoreTokens', [ - - {tokenBalanceNeeded || ethBalanceNeededStx || ethBalanceNeeded} - , - tokenBalanceNeeded && !(sourceTokenSymbol === defaultSwapsToken.symbol) - ? sourceTokenSymbol - : defaultSwapsToken.symbol, - ]); - - // Price difference warning - const priceSlippageBucket = usedQuote?.priceSlippage?.bucket; - const lastPriceDifferenceBucket = usePrevious(priceSlippageBucket); - - // If the user agreed to a different bucket of risk, make them agree again - useEffect(() => { - if ( - acknowledgedPriceDifference && - lastPriceDifferenceBucket === GasRecommendations.medium && - priceSlippageBucket === GasRecommendations.high - ) { - setAcknowledgedPriceDifference(false); - } - }, [ - priceSlippageBucket, - acknowledgedPriceDifference, - lastPriceDifferenceBucket, - ]); - - let viewQuotePriceDifferenceComponent = null; - const priceSlippageFromSource = useEthFiatAmount( - usedQuote?.priceSlippage?.sourceAmountInETH || 0, - { showFiat: true }, - ); - const priceSlippageFromDestination = useEthFiatAmount( - usedQuote?.priceSlippage?.destinationAmountInETH || 0, - { showFiat: true }, - ); - - // We cannot present fiat value if there is a calculation error or no slippage - // from source or destination - const priceSlippageUnknownFiatValue = - !priceSlippageFromSource || - !priceSlippageFromDestination || - Boolean(usedQuote?.priceSlippage?.calculationError); - - let priceDifferencePercentage = 0; - if (usedQuote?.priceSlippage?.ratio) { - priceDifferencePercentage = parseFloat( - new BigNumber(usedQuote.priceSlippage.ratio, 10) - .minus(1, 10) - .times(100, 10) - .toFixed(2), - 10, - ); - } - - const shouldShowPriceDifferenceWarning = - !tokenBalanceUnavailable && - !showInsufficientWarning && - usedQuote && - (priceDifferenceRiskyBuckets.includes(priceSlippageBucket) || - priceSlippageUnknownFiatValue); - - if (shouldShowPriceDifferenceWarning) { - viewQuotePriceDifferenceComponent = ( - { - setAcknowledgedPriceDifference(true); - }} - acknowledged={acknowledgedPriceDifference} - /> - ); - } - - const disableSubmissionDueToPriceWarning = - shouldShowPriceDifferenceWarning && !acknowledgedPriceDifference; - - const isShowingWarning = - showInsufficientWarning || shouldShowPriceDifferenceWarning; - - const isSwapButtonDisabled = Boolean( - submitClicked || - balanceError || - tokenBalanceUnavailable || - disableSubmissionDueToPriceWarning || - (networkAndAccountSupports1559 && - baseAndPriorityFeePerGas === undefined) || - (!networkAndAccountSupports1559 && - (gasPrice === null || gasPrice === undefined)) || - (currentSmartTransactionsEnabled && - (currentSmartTransactionsError || smartTransactionsError)) || - (currentSmartTransactionsEnabled && - smartTransactionsOptInStatus && - !smartTransactionFees?.tradeTxFees), - ); - - useEffect(() => { - if ( - currentSmartTransactionsEnabled && - smartTransactionsOptInStatus && - !insufficientTokens - ) { - const unsignedTx = { - from: unsignedTransaction.from, - to: unsignedTransaction.to, - value: unsignedTransaction.value, - data: unsignedTransaction.data, - gas: unsignedTransaction.gas, - chainId, - }; - intervalId = setInterval(() => { - if (!swapsSTXLoading) { - dispatch( - fetchSwapsSmartTransactionFees({ - unsignedTransaction: unsignedTx, - approveTxParams, - fallbackOnNotEnoughFunds: false, - }), - ); - } - }, swapsNetworkConfig.stxGetTransactionsRefreshTime); - dispatch( - fetchSwapsSmartTransactionFees({ - unsignedTransaction: unsignedTx, - approveTxParams, - fallbackOnNotEnoughFunds: false, - }), - ); - } else if (intervalId) { - clearInterval(intervalId); - } - return () => clearInterval(intervalId); - // eslint-disable-next-line - }, [ - dispatch, - currentSmartTransactionsEnabled, - smartTransactionsOptInStatus, - unsignedTransaction.data, - unsignedTransaction.from, - unsignedTransaction.value, - unsignedTransaction.gas, - unsignedTransaction.to, - chainId, - swapsNetworkConfig.stxGetTransactionsRefreshTime, - insufficientTokens, - ]); - - useEffect(() => { - // Thanks to the next line we will only do quotes polling 3 times before showing a Quote Timeout modal. - dispatch(setSwapsQuotesPollingLimitEnabled(true)); - if (reviewSwapClickedTimestamp) { - trackViewQuotePageLoadedEvent(); - } - }, [dispatch, trackViewQuotePageLoadedEvent, reviewSwapClickedTimestamp]); - - useEffect(() => { - // if smart transaction error is turned off, reset submit clicked boolean - if ( - !currentSmartTransactionsEnabled && - currentSmartTransactionsError && - submitClicked - ) { - setSubmitClicked(false); - } - }, [ - currentSmartTransactionsEnabled, - currentSmartTransactionsError, - submitClicked, - ]); - - useEffect(() => { - if (!usedQuote?.multiLayerL1TradeFeeTotal) { - return; - } - const getEstimatedL1Fees = async () => { - try { - let l1ApprovalFeeTotal = '0x0'; - if (approveTxParams) { - l1ApprovalFeeTotal = await dispatch( - getLayer1GasFee({ - transactionParams: { - ...approveTxParams, - gasPrice: addHexPrefix(approveTxParams.gasPrice), - value: '0x0', // For approval txs we need to use "0x0" here. - }, - chainId, - }), - ); - setMultiLayerL1ApprovalFeeTotal(l1ApprovalFeeTotal); - } - const l1FeeTotal = sumHexes( - usedQuote.multiLayerL1TradeFeeTotal, - l1ApprovalFeeTotal, - ); - setMultiLayerL1FeeTotal(l1FeeTotal); - } catch (e) { - captureException(e); - setMultiLayerL1FeeTotal(null); - setMultiLayerL1ApprovalFeeTotal(null); - } - }; - getEstimatedL1Fees(); - }, [unsignedTransaction, approveTxParams, chainId, usedQuote]); - - useEffect(() => { - if (isSmartTransaction) { - // Removes a smart transactions error when the component loads. - dispatch({ - type: SET_SMART_TRANSACTIONS_ERROR, - payload: null, - }); - } - }, [isSmartTransaction, dispatch]); - - return ( -
-
- { - /* istanbul ignore next */ - selectQuotePopoverShown && ( - setSelectQuotePopoverShown(false)} - onSubmit={(aggId) => dispatch(swapsQuoteSelected(aggId))} - swapToSymbol={destinationTokenSymbol} - initialAggId={usedQuote.aggregator} - onQuoteDetailsIsOpened={trackQuoteDetailsOpened} - hideEstimatedGasFee={ - smartTransactionsEnabled && smartTransactionsOptInStatus - } - /> - ) - } - -
- {viewQuotePriceDifferenceComponent} - {(showInsufficientWarning || tokenBalanceUnavailable) && ( - setWarningHidden(true) - } - /> - )} -
-
- -
- - {currentSmartTransactionsEnabled && - smartTransactionsOptInStatus && - !smartTransactionFees?.tradeTxFees && - !showInsufficientWarning && ( - - - - )} - {(!currentSmartTransactionsEnabled || - !smartTransactionsOptInStatus || - smartTransactionFees?.tradeTxFees) && ( -
- { - trackAllAvailableQuotesOpened(); - setSelectQuotePopoverShown(true); - } - } - maxPriorityFeePerGasDecGWEI={hexWEIToDecGWEI( - maxPriorityFeePerGas, - )} - maxFeePerGasDecGWEI={hexWEIToDecGWEI(maxFeePerGas)} - /> -
- )} -
- { - setSubmitClicked(true); - if (!balanceError) { - if ( - currentSmartTransactionsEnabled && - smartTransactionsOptInStatus && - smartTransactionFees?.tradeTxFees - ) { - dispatch( - signAndSendSwapsSmartTransaction({ - unsignedTransaction, - trackEvent, - history, - additionalTrackingParams, - }), - ); - } else { - dispatch( - signAndSendTransactions( - history, - trackEvent, - additionalTrackingParams, - ), - ); - } - } else if (destinationToken.symbol === defaultSwapsToken.symbol) { - history.push(DEFAULT_ROUTE); - } else { - history.push(`${ASSET_ROUTE}/${destinationToken.address}`); - } - } - } - submitText={ - currentSmartTransactionsEnabled && - smartTransactionsOptInStatus && - swapsSTXLoading - ? t('preparingSwap') - : t('swap') - } - hideCancel - disabled={isSwapButtonDisabled} - className={isShowingWarning ? 'view-quote__thin-swaps-footer' : ''} - showTopBorder - /> -
- ); -} diff --git a/ui/pages/swaps/view-quote/view-quote.test.js b/ui/pages/swaps/view-quote/view-quote.test.js deleted file mode 100644 index 3193a54dfb35..000000000000 --- a/ui/pages/swaps/view-quote/view-quote.test.js +++ /dev/null @@ -1,100 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; -import thunk from 'redux-thunk'; - -import { NetworkType } from '@metamask/controller-utils'; -import { NetworkStatus } from '@metamask/network-controller'; -import { setBackgroundConnection } from '../../../store/background-connection'; -import { - renderWithProvider, - createSwapsMockStore, - MOCKS, -} from '../../../../test/jest'; - -import ViewQuote from '.'; - -jest.mock( - '../../../components/ui/info-tooltip/info-tooltip-icon', - () => () => '', -); - -jest.mock('../../confirmations/hooks/useGasFeeInputs', () => { - return { - useGasFeeInputs: () => { - return { - maxFeePerGas: 16, - maxPriorityFeePerGas: 3, - gasFeeEstimates: MOCKS.createGasFeeEstimatesForFeeMarket(), - }; - }, - }; -}); - -const middleware = [thunk]; -const createProps = (customProps = {}) => { - return { - inputValue: '5', - onInputChange: jest.fn(), - ethBalance: '6 ETH', - setMaxSlippage: jest.fn(), - maxSlippage: 15, - selectedAccountAddress: 'selectedAccountAddress', - isFeatureFlagLoaded: false, - ...customProps, - }; -}; - -setBackgroundConnection({ - resetPostFetchState: jest.fn(), - safeRefetchQuotes: jest.fn(), - setSwapsErrorKey: jest.fn(), - updateTransaction: jest.fn(), - getGasFeeTimeEstimate: jest.fn(), - setSwapsQuotesPollingLimitEnabled: jest.fn(), -}); - -describe('ViewQuote', () => { - it('renders the component with initial props', () => { - const store = configureMockStore(middleware)(createSwapsMockStore()); - const props = createProps(); - const { getByText, getByTestId } = renderWithProvider( - , - store, - ); - expect(getByText('New quotes in')).toBeInTheDocument(); - expect(getByTestId('main-quote-summary__source-row')).toMatchSnapshot(); - expect( - getByTestId('main-quote-summary__exchange-rate-container'), - ).toMatchSnapshot(); - expect(getByText('Estimated gas fee')).toBeInTheDocument(); - expect(getByText('0.00008 ETH')).toBeInTheDocument(); - expect(getByText('Max fee')).toBeInTheDocument(); - expect(getByText('Swap')).toBeInTheDocument(); - }); - - it('renders the component with EIP-1559 enabled', () => { - const state = createSwapsMockStore(); - state.metamask.selectedNetworkClientId = NetworkType.mainnet; - state.metamask.networksMetadata = { - [NetworkType.mainnet]: { - EIPS: { 1559: true }, - status: NetworkStatus.Available, - }, - }; - const store = configureMockStore(middleware)(state); - const props = createProps(); - const { getByText, getByTestId } = renderWithProvider( - , - store, - ); - expect(getByText('New quotes in')).toBeInTheDocument(); - expect(getByTestId('main-quote-summary__source-row')).toMatchSnapshot(); - expect( - getByTestId('main-quote-summary__exchange-rate-container'), - ).toMatchSnapshot(); - expect(getByText('Estimated gas fee')).toBeInTheDocument(); - expect(getByText('0.00008 ETH')).toBeInTheDocument(); - expect(getByText('Max fee')).toBeInTheDocument(); - expect(getByText('Swap')).toBeInTheDocument(); - }); -}); From 4a2bb2b1bf831aed2e2852ebbe1089fd0ae0e55b Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Thu, 26 Sep 2024 09:56:20 -0500 Subject: [PATCH 2/8] chore: remove unused build quote swaps page --- app/_locales/de/messages.json | 37 - app/_locales/el/messages.json | 37 - app/_locales/en/messages.json | 37 - app/_locales/en_GB/messages.json | 37 - app/_locales/es/messages.json | 37 - app/_locales/es_419/messages.json | 37 - app/_locales/fr/messages.json | 37 - app/_locales/hi/messages.json | 37 - app/_locales/id/messages.json | 37 - app/_locales/it/messages.json | 30 - app/_locales/ja/messages.json | 37 - app/_locales/ko/messages.json | 37 - app/_locales/ph/messages.json | 37 - app/_locales/pt/messages.json | 37 - app/_locales/pt_BR/messages.json | 37 - app/_locales/ru/messages.json | 37 - app/_locales/tl/messages.json | 37 - app/_locales/tr/messages.json | 37 - app/_locales/vi/messages.json | 37 - app/_locales/zh_CN/messages.json | 37 - app/_locales/zh_TW/messages.json | 4 - .../files-to-convert.json | 4 - .../app/wallet-overview/coin-buttons.tsx | 6 +- .../multichain/app-header/app-header.js | 7 +- ui/helpers/constants/routes.ts | 3 - ui/pages/asset/components/token-buttons.tsx | 6 +- ui/pages/home/home.component.js | 5 +- ui/pages/routes/routes.component.js | 8 - .../swaps/__snapshots__/index.test.js.snap | 11 +- .../awaiting-signatures.js | 4 +- .../__snapshots__/build-quote.test.js.snap | 33 - ui/pages/swaps/build-quote/build-quote.js | 800 ------------------ .../swaps/build-quote/build-quote.stories.js | 35 - .../swaps/build-quote/build-quote.test.js | 223 ----- ui/pages/swaps/build-quote/index.js | 1 - ui/pages/swaps/build-quote/index.scss | 223 ----- ui/pages/swaps/index.js | 52 +- ui/pages/swaps/index.scss | 1 - ui/pages/swaps/index.test.js | 2 +- .../smart-transaction-status.js | 4 +- 40 files changed, 31 insertions(+), 2134 deletions(-) delete mode 100644 ui/pages/swaps/build-quote/__snapshots__/build-quote.test.js.snap delete mode 100644 ui/pages/swaps/build-quote/build-quote.js delete mode 100644 ui/pages/swaps/build-quote/build-quote.stories.js delete mode 100644 ui/pages/swaps/build-quote/build-quote.test.js delete mode 100644 ui/pages/swaps/build-quote/index.js delete mode 100644 ui/pages/swaps/build-quote/index.scss diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index 038c1a4c8f26..a39c14265a1f 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Angebotsanfrage" }, - "swapReviewSwap": { - "message": "Swap überprüfen" - }, "swapSearchNameOrAddress": { "message": "Namen suchen oder Adresse einfügen" }, @@ -5502,20 +5499,6 @@ "message": "$1 mit $2 tauschen", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Dieses Token wurde manuell hinzugefügt." - }, - "swapTokenVerificationMessage": { - "message": "Bestätigen Sie immer die Token-Adresse auf $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Nur an 1 Quelle verifiziert." - }, - "swapTokenVerificationSources": { - "message": "Auf $1 Quellen überprüft.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 wurde nur auf 1 Quelle bestätigt. Ziehen Sie in Betracht, es vor dem Fortfahren auf $2 zu bestätigen.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Unbekannt" }, - "swapVerifyTokenExplanation": { - "message": "Mehrere Token können denselben Namen und dasselbe Symbol verwenden. Überprüfen Sie $1, um sicherzugehen, dass dies der Token ist, den Sie suchen.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 zum Swap verfügbar", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0 % Slippage" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Slippage-Toleranz" }, - "swapsNotEnoughForTx": { - "message": "Nicht genug $1, um diese Transaktion abzuschließen.", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Nicht genügend $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Drittanbieter-Details überprüfen" }, - "verifyThisTokenOn": { - "message": "Diesen Token auf $1 verifizieren", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Überprüfen Sie diesen Token auf $1 und stellen Sie sicher, dass dies der Token ist, den Sie handeln möchten.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Version" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index bb20e52ed99b..c3855be5b9f0 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Αίτημα για προσφορά" }, - "swapReviewSwap": { - "message": "Έλεγχος της ανταλλαγής" - }, "swapSearchNameOrAddress": { "message": "Αναζήτηση ονόματος ή επικόλληση διεύθυνσης" }, @@ -5502,20 +5499,6 @@ "message": "Ανταλλαγή $1 έως $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Αυτό το token έχει προστεθεί χειροκίνητα." - }, - "swapTokenVerificationMessage": { - "message": "Πάντα να επιβεβαιώνετε τη διεύθυνση του token στο $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Επαληθεύτηκε μόνο σε 1 πηγή." - }, - "swapTokenVerificationSources": { - "message": "Επαληθεύτηκε μόνο σε $1 πηγές.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "Το $1 επαληθεύτηκε μόνο από 1 πηγή. Εξετάστε το ενδεχόμενο επαλήθευσης σε $2 πριν προχωρήσετε.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Άγνωστο" }, - "swapVerifyTokenExplanation": { - "message": "Πολλαπλά tokens μπορούν να χρησιμοποιούν το ίδιο όνομα και σύμβολο. Ελέγξτε το $1 για να επιβεβαιώσετε ότι αυτό είναι το token που ψάχνετε.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 διαθέσιμα για ανταλλαγή", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% Απόκλιση" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Ανοχή απόκλισης" }, - "swapsNotEnoughForTx": { - "message": "Δεν υπάρχουν αρκετά $1 για να ολοκληρωθεί αυτή η συναλλαγή", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Δεν υπάρχουν αρκετά $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Επαλήθευση στοιχείων τρίτων" }, - "verifyThisTokenOn": { - "message": "Επαλήθευση αυτού του token στο $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Επαληθεύστε αυτό το token στο $1 και βεβαιωθείτε ότι αυτό είναι το token που θέλετε να κάνετε συναλλαγές.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Έκδοση" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 242314a69cce..081e43e0235e 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -5809,9 +5809,6 @@ "swapRequestForQuotation": { "message": "Request for quotation" }, - "swapReviewSwap": { - "message": "Review swap" - }, "swapSearchNameOrAddress": { "message": "Search name or paste address" }, @@ -5918,20 +5915,6 @@ "message": "Swap $1 to $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "This token has been added manually." - }, - "swapTokenVerificationMessage": { - "message": "Always confirm the token address on $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Only verified on 1 source." - }, - "swapTokenVerificationSources": { - "message": "Verified on $1 sources.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 is only verified on 1 source. Consider verifying it on $2 before proceeding.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5952,14 +5935,6 @@ "swapUnknown": { "message": "Unknown" }, - "swapVerifyTokenExplanation": { - "message": "Multiple tokens can use the same name and symbol. Check $1 to verify this is the token you're looking for.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 available to swap", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% Slippage" }, @@ -5972,10 +5947,6 @@ "swapsMaxSlippage": { "message": "Slippage tolerance" }, - "swapsNotEnoughForTx": { - "message": "Not enough $1 to complete this transaction", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Not enough $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6490,14 +6461,6 @@ "verifyContractDetails": { "message": "Verify third-party details" }, - "verifyThisTokenOn": { - "message": "Verify this token on $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Verify this token on $1 and make sure this is the token you want to trade.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Version" }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index 8eb23f784cb2..968f10cd9a58 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -5539,9 +5539,6 @@ "swapRequestForQuotation": { "message": "Request for quotation" }, - "swapReviewSwap": { - "message": "Review swap" - }, "swapSearchNameOrAddress": { "message": "Search name or paste address" }, @@ -5648,20 +5645,6 @@ "message": "Swap $1 to $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "This token has been added manually." - }, - "swapTokenVerificationMessage": { - "message": "Always confirm the token address on $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Only verified on 1 source." - }, - "swapTokenVerificationSources": { - "message": "Verified on $1 sources.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 is only verified on 1 source. Consider verifying it on $2 before proceeding.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5682,14 +5665,6 @@ "swapUnknown": { "message": "Unknown" }, - "swapVerifyTokenExplanation": { - "message": "Multiple tokens can use the same name and symbol. Check $1 to verify this is the token you're looking for.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 available to swap", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% Slippage" }, @@ -5702,10 +5677,6 @@ "swapsMaxSlippage": { "message": "Slippage tolerance" }, - "swapsNotEnoughForTx": { - "message": "Not enough $1 to complete this transaction", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Not enough $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6252,14 +6223,6 @@ "verifyContractDetails": { "message": "Verify third-party details" }, - "verifyThisTokenOn": { - "message": "Verify this token on $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Verify this token on $1 and make sure this is the token you want to trade.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Version" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 37d4854e86aa..2701d7bbbc4f 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -5390,9 +5390,6 @@ "swapRequestForQuotation": { "message": "Solicitud de cotización" }, - "swapReviewSwap": { - "message": "Revisar intercambio" - }, "swapSearchNameOrAddress": { "message": "Buscar nombre o pegar dirección" }, @@ -5499,20 +5496,6 @@ "message": "Intercambiar $1 por $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Este token se añadió de forma manual." - }, - "swapTokenVerificationMessage": { - "message": "Siempre confirme la dirección del token en $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Solo se verificó en una fuente." - }, - "swapTokenVerificationSources": { - "message": "Verificar en $1 fuentes.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 solo se verifica en 1 fuente. Considere verificarlo en $2 antes de continuar.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5533,14 +5516,6 @@ "swapUnknown": { "message": "Desconocido" }, - "swapVerifyTokenExplanation": { - "message": "Varios tokens pueden usar el mismo nombre y símbolo. Revise $1 para comprobar que este es el token que busca.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 disponibles para intercambio", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0 % de deslizamiento" }, @@ -5553,10 +5528,6 @@ "swapsMaxSlippage": { "message": "Tolerancia de deslizamiento" }, - "swapsNotEnoughForTx": { - "message": "No hay $1 suficientes para completar esta transacción", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "No hay suficiente $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6052,14 +6023,6 @@ "verifyContractDetails": { "message": "Verificar detalles de terceros" }, - "verifyThisTokenOn": { - "message": "Comprobar este token en $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Verifique este token en $1 y asegúrese de que sea el token con el que quiere realizar la transacción.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Versión" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index f3bf86042f3d..76956106a43a 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -2048,9 +2048,6 @@ "swapRequestForQuotation": { "message": "Solicitud de cotización" }, - "swapReviewSwap": { - "message": "Revisar canje" - }, "swapSelect": { "message": "Seleccionar" }, @@ -2099,20 +2096,6 @@ "message": "Canjear $1 por $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Este token se añadió de forma manual." - }, - "swapTokenVerificationMessage": { - "message": "Siempre confirme la dirección del token en $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Solo se verificó en una fuente." - }, - "swapTokenVerificationSources": { - "message": "Verificar en $1 fuentes.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTooManyDecimalsError": { "message": "$1 permite hasta $2 decimales", "description": "$1 is a token symbol and $2 is the max. number of decimals allowed for the token" @@ -2126,14 +2109,6 @@ "swapUnknown": { "message": "Desconocido" }, - "swapVerifyTokenExplanation": { - "message": "Varios tokens pueden usar el mismo nombre y símbolo. Revise $1 para comprobar que este es el token que busca.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 disponible para canje", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0 % de desfase" }, @@ -2146,10 +2121,6 @@ "swapsMaxSlippage": { "message": "Tolerancia de desfase" }, - "swapsNotEnoughForTx": { - "message": "No hay $1 suficientes para finalizar esta transacción", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsViewInActivity": { "message": "Ver en actividad" }, @@ -2386,14 +2357,6 @@ "userName": { "message": "Nombre de usuario" }, - "verifyThisTokenOn": { - "message": "Verificar este token en $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Verifique este token en $1 y asegúrese de que sea el token con el que quiere realizar la transacción.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "viewAllDetails": { "message": "Ver todos los detalles" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index ec2ef130f2b9..4bdad61274a0 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Demande de cotation" }, - "swapReviewSwap": { - "message": "Vérifier le swap" - }, "swapSearchNameOrAddress": { "message": "Rechercher le nom ou coller l’adresse" }, @@ -5502,20 +5499,6 @@ "message": "Swap de $1 vers $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Ce jeton a été ajouté manuellement." - }, - "swapTokenVerificationMessage": { - "message": "Confirmez toujours l’adresse du jeton sur $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Vérification effectuée uniquement sur 1 source." - }, - "swapTokenVerificationSources": { - "message": "Vérification effectuée sur $1 sources.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 n’a été vérifié que par 1 source. Envisagez de le vérifier auprès de $2 sources avant de continuer.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Inconnu" }, - "swapVerifyTokenExplanation": { - "message": "Attention, plusieurs jetons peuvent utiliser le même nom et le même symbole. Vérifiez $1 pour vous assurer qu’il s’agit bien du jeton que vous recherchez.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 disponibles pour un swap", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0 % de glissement" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Tolérance au slippage" }, - "swapsNotEnoughForTx": { - "message": "Pas assez de $1 pour effectuer cette transaction", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Pas assez de $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Vérifier les informations relatives aux tiers" }, - "verifyThisTokenOn": { - "message": "Vérifier ce jeton sur $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Vérifiez ce jeton sur $1 et qu’il s’agit bien de celui que vous souhaitez échanger.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Version" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 55a617ffbb63..15de05b31b58 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "उद्धरण के लिए अनुरोध" }, - "swapReviewSwap": { - "message": "स्वैप की समीक्षा करें" - }, "swapSearchNameOrAddress": { "message": "नाम खोजें या ऐड्रेस पेस्ट करें" }, @@ -5502,20 +5499,6 @@ "message": "$1 से $2 में स्वैप करें", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "इस टोकन को मैन्युअल रूप से जोड़ा गया है।" - }, - "swapTokenVerificationMessage": { - "message": "हमेशा $1 पर टोकन एड्रेस की कन्फर्म करें।", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "केवल 1 स्रोत पर वेरीफ़ाई।" - }, - "swapTokenVerificationSources": { - "message": "$1 स्रोतों पर वेरीफ़ाई।", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 केवल 1 स्रोत पर वेरीफ़ाई है। आगे बढ़ने से पहले इसे $2 पर वेरीफ़ाई करने पर विचार करें।", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "अज्ञात" }, - "swapVerifyTokenExplanation": { - "message": "एकाधिक टोकन एक ही नाम और प्रतीक का इस्तेमाल कर सकते हैं। यह वेरीफ़ाई करने के लिए $1 देखें कि यह वही टोकन है, जिसकी आप तलाश कर रहे हैं।", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 स्वैप के लिए उपलब्ध है", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% स्लिपेज" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "स्लिपेज टॉलरेंस" }, - "swapsNotEnoughForTx": { - "message": "इस ट्रांसेक्शन को पूरा करने के लिए $1 कम है", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "$1 कम", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "थर्ड-पार्टी विवरण वेरीफ़ाई करें" }, - "verifyThisTokenOn": { - "message": "इस टोकन को $1 पर वेरीफ़ाई करें", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "इस टोकन को $1 पर वेरीफ़ाई करें और पक्का करें कि यह वही टोकन है जिससे आप ट्रेड करना चाहते हैं।", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "वर्शन" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 1cad158ff0a7..4b8c1ee713ed 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Minta kuotasi" }, - "swapReviewSwap": { - "message": "Tinjau pertukaran" - }, "swapSearchNameOrAddress": { "message": "Cari nama atau tempel alamat" }, @@ -5502,20 +5499,6 @@ "message": "Tukar $1 ke $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Token ini telah ditambahkan secara manual." - }, - "swapTokenVerificationMessage": { - "message": "Selalu konfirmasikan alamat token di $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Hanya diverifikasi di 1 sumber." - }, - "swapTokenVerificationSources": { - "message": "Diverifikasi di $1 sumber.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 hanya diverifikasi di 1 sumber. Pertimbangkan untuk memverifikasinya di $2 sebelum melanjutkan.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Tidak diketahui" }, - "swapVerifyTokenExplanation": { - "message": "Beberapa token dapat menggunakan simbol dan nama yang sama. Periksa $1 untuk memverifikasi inilah token yang Anda cari.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 tersedia untuk ditukar", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "Selip 0%" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Toleransi selip" }, - "swapsNotEnoughForTx": { - "message": "$1 tidak cukup untuk menyelesaikan transaksi ini", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "$1 tidak cukup", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Verifikasikan detail pihak ketiga" }, - "verifyThisTokenOn": { - "message": "Verifikasikan token ini di $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Verifikasikan token ini di $1 dan pastikan ini adalah token yang ingin Anda perdagangkan.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Versi" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index 70e81c595852..05d23ee6ebe7 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -1484,9 +1484,6 @@ "swapRequestForQuotation": { "message": "Richiedi quotazione" }, - "swapReviewSwap": { - "message": "Verifica Scambio" - }, "swapSelect": { "message": "Selezione" }, @@ -1519,31 +1516,12 @@ "message": "Scambia da $1 a $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationMessage": { - "message": "Verifica sempre l'indirizzo del token su $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Verificato solo su una fonte." - }, - "swapTokenVerificationSources": { - "message": "Verificato su $1 fonti.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTransactionComplete": { "message": "Transazione completata" }, "swapUnknown": { "message": "Sconosciuto" }, - "swapVerifyTokenExplanation": { - "message": "Più token possono usare lo stesso nome e simbolo. Verifica su $1 che questo sia il token che stai cercando.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 disponibili allo scambio", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapsAdvancedOptions": { "message": "Impostazioni Avanzate" }, @@ -1553,10 +1531,6 @@ "swapsMaxSlippage": { "message": "Tolleranza Slippage" }, - "swapsNotEnoughForTx": { - "message": "Non hai abbastanza $1 per completare la transazione", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsViewInActivity": { "message": "Vedi in attività" }, @@ -1691,10 +1665,6 @@ "userName": { "message": "Nome utente" }, - "verifyThisTokenOn": { - "message": "Verifica questo token su $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "viewAllDetails": { "message": "Vedi tutti i dettagli" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 1dfca7dda9ad..94788730871c 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "見積もりのリクエスト" }, - "swapReviewSwap": { - "message": "スワップの確認" - }, "swapSearchNameOrAddress": { "message": "名前を検索するかアドレスを貼り付けてください" }, @@ -5502,20 +5499,6 @@ "message": "$1を$2にスワップ", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "このトークンは手動で追加されました。" - }, - "swapTokenVerificationMessage": { - "message": "常に$1のトークンアドレスを確認してください。", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "1つのソースでのみ検証済みです。" - }, - "swapTokenVerificationSources": { - "message": "$1個のソースで検証済みです。", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1は1つのソースでしか検証されていません。進める前に$2で検証することをご検討ください。", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "不明" }, - "swapVerifyTokenExplanation": { - "message": "複数のトークンで同じ名前とシンボルを使用できます。$1をチェックして、これが探しているトークンであることを確認してください。", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2がスワップに使用可能です", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0%スリッページ" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "最大スリッページ" }, - "swapsNotEnoughForTx": { - "message": "トランザクションを完了させるには、$1が不足しています", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "$1が不足しています", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "サードパーティの詳細を確認" }, - "verifyThisTokenOn": { - "message": "このトークンを$1で検証", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "このトークンを$1で検証して、取引したいトークンであることを確認してください。", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "バージョン" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 9491d69c0ed2..608ac6431e05 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "견적 요청" }, - "swapReviewSwap": { - "message": "스왑 검토" - }, "swapSearchNameOrAddress": { "message": "이름 검색 또는 주소 붙여넣기" }, @@ -5502,20 +5499,6 @@ "message": "$1에서 $2(으)로 스왑", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "이 토큰은 직접 추가되었습니다." - }, - "swapTokenVerificationMessage": { - "message": "항상 $1에서 토큰 주소를 컨펌하세요.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "1개의 소스에서만 확인됩니다." - }, - "swapTokenVerificationSources": { - "message": "$1개 소스에서 확인되었습니다.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 토큰은 1 소스에서만 확인됩니다. 계속 진행하기 전에 $2에서도 확인하세요.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "알 수 없음" }, - "swapVerifyTokenExplanation": { - "message": "여러 토큰이 같은 이름과 기호를 사용할 수 있습니다. $1에서 원하는 토큰인지 확인하세요.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 스왑 가능", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% 슬리패지" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "슬리피지 허용치" }, - "swapsNotEnoughForTx": { - "message": "$1이(가) 부족하여 이 트랜잭션을 완료할 수 없습니다.", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "$1 부족", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "타사 세부 정보 확인" }, - "verifyThisTokenOn": { - "message": "$1에서 이 토큰 확인", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "$1에서 이 토큰이 트랜잭션할 토큰이 맞는지 확인하세요.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "버전" }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index 1c2d5defa923..d795e1be8438 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -1394,9 +1394,6 @@ "swapRequestForQuotation": { "message": "Mag-request ng quotation" }, - "swapReviewSwap": { - "message": "Suriin ang Pag-swap" - }, "swapSelect": { "message": "Piliin" }, @@ -1439,20 +1436,6 @@ "message": "I-swap ang $1 sa $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Manual na idinagdag ang token na ito." - }, - "swapTokenVerificationMessage": { - "message": "Palaging kumpirmahin ang address ng token sa $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Na-verify lang sa 1 source." - }, - "swapTokenVerificationSources": { - "message": "Na-verify sa $1 source.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTransactionComplete": { "message": "Nakumpleto ang transaksyon" }, @@ -1462,14 +1445,6 @@ "swapUnknown": { "message": "Hindi Alam" }, - "swapVerifyTokenExplanation": { - "message": "Maaaring gamitin ng maraming token ang iisang pangalan at simbolo. Suriin ang $1 para ma-verify na ito ang token na hinahanap mo.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "Available ang $1 $2 na i-swap", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% Slippage" }, @@ -1482,10 +1457,6 @@ "swapsMaxSlippage": { "message": "Tolerance ng Slippage" }, - "swapsNotEnoughForTx": { - "message": "Hindi sapat ang $1 para makumpleto ang transaksyong ito", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsViewInActivity": { "message": "Tingnan sa aktibidad" }, @@ -1645,14 +1616,6 @@ "userName": { "message": "Username" }, - "verifyThisTokenOn": { - "message": "I-verify ang token na ito sa $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "I-verify ang token na ito sa $1 at tiyaking ito ang token na gusto mong i-trade.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "viewAllDetails": { "message": "Tingnan ang lahat ng detalye" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index f68d028ea44b..bbedfc133b41 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Solicitação de cotação" }, - "swapReviewSwap": { - "message": "Revisar troca" - }, "swapSearchNameOrAddress": { "message": "Pesquise o nome ou cole o endereço" }, @@ -5502,20 +5499,6 @@ "message": "Trocar $1 por $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Esse token foi adicionado manualmente." - }, - "swapTokenVerificationMessage": { - "message": "Sempre confirme o endereço do token no $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Verificado somente em 1 fonte." - }, - "swapTokenVerificationSources": { - "message": "Verificado em $1 fontes.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 só foi verificado em 1 fonte. Considere verificá-lo em $2 antes de prosseguir.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Desconhecido" }, - "swapVerifyTokenExplanation": { - "message": "Vários tokens podem usar o mesmo nome e símbolo. Confira $1 para verificar se esse é o token que você está buscando.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 disponível para troca", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% de slippage" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Tolerância a slippage" }, - "swapsNotEnoughForTx": { - "message": "Não há $1 suficiente para concluir essa transação", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "$1 insuficiente", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Verificar dados do terceiro" }, - "verifyThisTokenOn": { - "message": "Verifique esse token no $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Verifique esse token no $1 e confirme que é o token que você deseja negociar.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Versão" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index e8c8ae6ce563..9d8785fc9cf2 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -2048,9 +2048,6 @@ "swapRequestForQuotation": { "message": "Solicitação de cotação" }, - "swapReviewSwap": { - "message": "Revisar troca" - }, "swapSelect": { "message": "Selecione" }, @@ -2099,20 +2096,6 @@ "message": "Trocar $1 por $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Este token foi adicionado manualmente." - }, - "swapTokenVerificationMessage": { - "message": "Sempre confirme o endereço do token no $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Verificado somente em 1 fonte." - }, - "swapTokenVerificationSources": { - "message": "Verificado em $1 fontes.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTooManyDecimalsError": { "message": "$1 permite até $2 decimais", "description": "$1 is a token symbol and $2 is the max. number of decimals allowed for the token" @@ -2126,14 +2109,6 @@ "swapUnknown": { "message": "Desconhecido" }, - "swapVerifyTokenExplanation": { - "message": "Vários tokens podem usar o mesmo nome e símbolo. Confira $1 para verificar se esse é o token que você está buscando.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 disponível para troca", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% de slippage" }, @@ -2146,10 +2121,6 @@ "swapsMaxSlippage": { "message": "Tolerância a slippage" }, - "swapsNotEnoughForTx": { - "message": "Não há $1 suficiente para concluir essa transação", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsViewInActivity": { "message": "Ver na atividade" }, @@ -2386,14 +2357,6 @@ "userName": { "message": "Nome de usuário" }, - "verifyThisTokenOn": { - "message": "Verifique esse token no $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Verifique esse token no $1 e confirme que é o token que você deseja negociar.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "viewAllDetails": { "message": "Ver todos os detalhes" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index afb76f592523..8127e3c96418 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Запрос котировки" }, - "swapReviewSwap": { - "message": "Проверить своп" - }, "swapSearchNameOrAddress": { "message": "Выполните поиск по имени или вставьте адрес" }, @@ -5502,20 +5499,6 @@ "message": "Выполнить своп $1 на $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Этот токен был добавлен вручную." - }, - "swapTokenVerificationMessage": { - "message": "Всегда проверяйте адрес токена на $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Токен проверен только в 1 источнике." - }, - "swapTokenVerificationSources": { - "message": "Токен проверен в $1 источниках.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 проверяется только на 1 источнике. Попробуйте проверить его на $2, прежде чем продолжить.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Неизвестно" }, - "swapVerifyTokenExplanation": { - "message": "Для обозначения нескольких токенов могут использоваться одно и то же имя и символ. Убедитесь, что $1 — это именно тот токен, который вы ищете.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 доступны для свопа", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% проскальзывания" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Допуск проскальзывания" }, - "swapsNotEnoughForTx": { - "message": "Недостаточно $1 для выполнения этой транзакции", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Недостаточно $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Проверьте информацию о третьей стороне" }, - "verifyThisTokenOn": { - "message": "Проверить этот токен на $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Проверьте этот токен на $1 и убедитесь, что это тот токен, которым вы хотите торговать.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Версия" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 9f03d270d2f1..65234e093881 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Humiling ng quotation" }, - "swapReviewSwap": { - "message": "I-review ang pag-swap" - }, "swapSearchNameOrAddress": { "message": "Hanapin ang pangalan o i-paste ang address" }, @@ -5502,20 +5499,6 @@ "message": "I-swap ang $1 sa $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Manwal na naidagdag ang token na ito." - }, - "swapTokenVerificationMessage": { - "message": "Palaging kumpirmahin ang token address sa $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Na-verify sa 1 pinagmulan lang." - }, - "swapTokenVerificationSources": { - "message": "Na-verify sa $1 na source.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "Na-verify $1 sa 1 pinagmulan lang. Pag-isipang i-verify ito sa $2 bago magpatuloy.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Hindi Alam" }, - "swapVerifyTokenExplanation": { - "message": "Maaaring gamitin ng maraming token ang iisang pangalan at simbolo. Suriin ang $1 para ma-verify na ito ang token na hinahanap mo.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "Available ang $1 $2 na i-swap", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0% Slippage" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Slippage tolerance" }, - "swapsNotEnoughForTx": { - "message": "Hindi sapat ang $1 para makumpleto ang transaksyong ito", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Hindi sapat ang $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "I-verify ang mga detalye ng third-party" }, - "verifyThisTokenOn": { - "message": "I-verify ang token na ito sa $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "I-verify ang token na ito sa $1 at siguruhin na ito ang token na gusto mong i-trade.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Bersyon" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 43e4b8e9675a..441e293bfc9f 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Teklif talebi" }, - "swapReviewSwap": { - "message": "Swap'ı incele" - }, "swapSearchNameOrAddress": { "message": "İsmi arayın veya adresi yapıştırın" }, @@ -5502,20 +5499,6 @@ "message": "$1 ile $2 swap gerçekleştir", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Bu token manuel olarak eklendi." - }, - "swapTokenVerificationMessage": { - "message": "Her zaman token adresini $1 üzerinde onaylayın.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Sadece 1 kaynakta doğrulandı." - }, - "swapTokenVerificationSources": { - "message": "$1 kaynakta doğrulandı.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 sadece 1 kaynakta doğrulandı. İlerlemeden önce $2 üzerinde doğrulamayı deneyin.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Bilinmiyor" }, - "swapVerifyTokenExplanation": { - "message": "Birden fazla token aynı adı ve sembolü kullanabilir. Aradığınız tokenin bu olup olmadığını $1 alanında kontrol edin.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 için swap işlemi yapılabilir", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "%0 Kayma" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Kayma toleransı" }, - "swapsNotEnoughForTx": { - "message": "Bu işlemi tamamlamak için yeterli $1 yok", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Yeterli $1 yok", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Üçüncü taraf bilgilerini doğrula" }, - "verifyThisTokenOn": { - "message": "Şurada bu tokeni doğrula: $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Bu tokeni $1 ile doğrulayın ve işlem yapmak istediğiniz tokenin bu olduğundan emin olun.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Sürüm" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 315aacbf6d7e..32e3e36ca0a5 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "Yêu cầu báo giá" }, - "swapReviewSwap": { - "message": "Xem lại giao dịch hoán đổi" - }, "swapSearchNameOrAddress": { "message": "Tìm kiếm tên hoặc dán địa chỉ" }, @@ -5502,20 +5499,6 @@ "message": "Hoán đổi $1 sang $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "Token này đã được thêm theo cách thủ công." - }, - "swapTokenVerificationMessage": { - "message": "Luôn xác nhận địa chỉ token trên $1.", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "Chỉ được xác minh trên 1 nguồn." - }, - "swapTokenVerificationSources": { - "message": "Đã xác minh trên $1 nguồn.", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 chỉ được xác minh trên 1 nguồn. Hãy xem xét xác minh nó trên $2 trước khi tiếp tục.", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "Không xác định" }, - "swapVerifyTokenExplanation": { - "message": "Nhiều token có thể dùng cùng một tên và ký hiệu. Hãy kiểm tra $1 để xác minh xem đây có phải là token bạn đang tìm kiếm không.", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "Có sẵn $1 $2 để hoán đổi", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "Mức trượt giá 0%" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "Giới hạn trượt giá" }, - "swapsNotEnoughForTx": { - "message": "Không đủ $1 để hoàn thành giao dịch này", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "Không đủ $1", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "Xác minh thông tin bên thứ ba" }, - "verifyThisTokenOn": { - "message": "Xác minh token này trên $1", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "Hãy xác minh token này trên $1 và đảm bảo đây là token bạn muốn giao dịch.", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "Phiên bản" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 414b5ac750f2..abcc34963699 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -5393,9 +5393,6 @@ "swapRequestForQuotation": { "message": "请求报价" }, - "swapReviewSwap": { - "message": "审查交换" - }, "swapSearchNameOrAddress": { "message": "搜索名称或粘贴地址" }, @@ -5502,20 +5499,6 @@ "message": "用 $1 交换 $2", "description": "Used in the transaction display list to describe a swap. $1 and $2 are the symbols of tokens in involved in a swap." }, - "swapTokenVerificationAddedManually": { - "message": "此代币已手动添加。" - }, - "swapTokenVerificationMessage": { - "message": "始终在 $1 上确认代币地址。", - "description": "Points the user to Etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"Etherscan\" followed by an info icon that shows more info on hover." - }, - "swapTokenVerificationOnlyOneSource": { - "message": "仅在1个来源上进行了验证。" - }, - "swapTokenVerificationSources": { - "message": "在 $1 个来源上进行了验证。", - "description": "Indicates the number of token information sources that recognize the symbol + address. $1 is a decimal number." - }, "swapTokenVerifiedOn1SourceDescription": { "message": "$1 仅在 1 个源上进行了验证。在继续之前,考虑在 $2 上进行验证。", "description": "$1 is a token name, $2 points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" @@ -5536,14 +5519,6 @@ "swapUnknown": { "message": "未知" }, - "swapVerifyTokenExplanation": { - "message": "多个代币可以使用相同的名称和符号。检查 $1 以确认这是您正在寻找的代币。", - "description": "This appears in a tooltip next to the verifyThisTokenOn message. It gives the user more information about why they should check the token on a block explorer. $1 will be the name or url of the block explorer, which will be the translation of 'etherscan' or a block explorer url specified for a custom network." - }, - "swapYourTokenBalance": { - "message": "$1 $2 可用于交换", - "description": "Tells the user how much of a token they have in their balance. $1 is a decimal number amount of tokens, and $2 is a token symbol" - }, "swapZeroSlippage": { "message": "0%滑点" }, @@ -5556,10 +5531,6 @@ "swapsMaxSlippage": { "message": "最大滑点" }, - "swapsNotEnoughForTx": { - "message": "没有足够的 $1 来完成此交易", - "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" - }, "swapsNotEnoughToken": { "message": "$1 不足", "description": "Tells the user that they don't have enough of a token for a proposed swap. $1 is a token symbol" @@ -6055,14 +6026,6 @@ "verifyContractDetails": { "message": "验证第三方详情" }, - "verifyThisTokenOn": { - "message": "在 $1 上验证此代币", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, - "verifyThisUnconfirmedTokenOn": { - "message": "在 $1 上验证此代币,并确保这是您想要交易的代币。", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "version": { "message": "版本" }, diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json index 32e98ed12288..870e76a98d67 100644 --- a/app/_locales/zh_TW/messages.json +++ b/app/_locales/zh_TW/messages.json @@ -1373,10 +1373,6 @@ "userName": { "message": "使用者名稱" }, - "verifyThisTokenOn": { - "message": "在 $1 驗證這個代幣的資訊", - "description": "Points the user to etherscan as a place they can verify information about a token. $1 is replaced with the translation for \"etherscan\"" - }, "viewAllDetails": { "message": "查看所有詳情" }, diff --git a/development/ts-migration-dashboard/files-to-convert.json b/development/ts-migration-dashboard/files-to-convert.json index d05bf6a24165..f90146bf2ebb 100644 --- a/development/ts-migration-dashboard/files-to-convert.json +++ b/development/ts-migration-dashboard/files-to-convert.json @@ -1499,10 +1499,6 @@ "ui/pages/swaps/awaiting-swap/swap-failure-icon.test.js", "ui/pages/swaps/awaiting-swap/swap-success-icon.js", "ui/pages/swaps/awaiting-swap/swap-success-icon.test.js", - "ui/pages/swaps/build-quote/build-quote.js", - "ui/pages/swaps/build-quote/build-quote.stories.js", - "ui/pages/swaps/build-quote/build-quote.test.js", - "ui/pages/swaps/build-quote/index.js", "ui/pages/swaps/countdown-timer/countdown-timer.js", "ui/pages/swaps/countdown-timer/countdown-timer.stories.js", "ui/pages/swaps/countdown-timer/countdown-timer.test.js", diff --git a/ui/components/app/wallet-overview/coin-buttons.tsx b/ui/components/app/wallet-overview/coin-buttons.tsx index 0e1947d023f3..63bcdd2f58e6 100644 --- a/ui/components/app/wallet-overview/coin-buttons.tsx +++ b/ui/components/app/wallet-overview/coin-buttons.tsx @@ -28,7 +28,7 @@ import { import { I18nContext } from '../../../contexts/i18n'; import { ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) - BUILD_QUOTE_ROUTE, + PREPARE_SWAP_ROUTE, ///: END:ONLY_INCLUDE_IF SEND_ROUTE, } from '../../../helpers/constants/routes'; @@ -270,10 +270,10 @@ const CoinButtons = ({ dispatch(setSwapsFromToken(defaultSwapsToken)); if (usingHardwareWallet) { if (global.platform.openExtensionInBrowser) { - global.platform.openExtensionInBrowser(BUILD_QUOTE_ROUTE); + global.platform.openExtensionInBrowser(PREPARE_SWAP_ROUTE); } } else { - history.push(BUILD_QUOTE_ROUTE); + history.push(PREPARE_SWAP_ROUTE); } } ///: END:ONLY_INCLUDE_IF diff --git a/ui/components/multichain/app-header/app-header.js b/ui/components/multichain/app-header/app-header.js index 9d30874c6b7b..904862ae7bb8 100644 --- a/ui/components/multichain/app-header/app-header.js +++ b/ui/components/multichain/app-header/app-header.js @@ -9,7 +9,6 @@ import { MetaMetricsEventName, } from '../../../../shared/constants/metametrics'; import { - BUILD_QUOTE_ROUTE, CONFIRM_TRANSACTION_ROUTE, SWAPS_ROUTE, } from '../../../helpers/constants/routes'; @@ -66,17 +65,13 @@ export const AppHeader = ({ location }) => { const isSwapsPage = Boolean( matchPath(location.pathname, { path: SWAPS_ROUTE, exact: false }), ); - const isSwapsBuildQuotePage = Boolean( - matchPath(location.pathname, { path: BUILD_QUOTE_ROUTE, exact: false }), - ); const unapprovedTransactions = useSelector(getUnapprovedTransactions); const hasUnapprovedTransactions = Object.keys(unapprovedTransactions).length > 0; - const disableAccountPicker = - isConfirmationPage || (isSwapsPage && !isSwapsBuildQuotePage); + const disableAccountPicker = isConfirmationPage || isSwapsPage; const disableNetworkPicker = isSwapsPage || diff --git a/ui/helpers/constants/routes.ts b/ui/helpers/constants/routes.ts index da76e0cef8b3..bf38109ec9d7 100644 --- a/ui/helpers/constants/routes.ts +++ b/ui/helpers/constants/routes.ts @@ -241,9 +241,6 @@ PATH_NAME_MAP[PREPARE_SWAP_ROUTE] = 'Prepare Swap Page'; export const SWAPS_NOTIFICATION_ROUTE = '/swaps/notification-page'; PATH_NAME_MAP[SWAPS_NOTIFICATION_ROUTE] = 'Swaps Notification Page'; -export const BUILD_QUOTE_ROUTE = '/swaps/build-quote'; -PATH_NAME_MAP[BUILD_QUOTE_ROUTE] = 'Swaps Build Quote Page'; - export const LOADING_QUOTES_ROUTE = '/swaps/loading-quotes'; PATH_NAME_MAP[LOADING_QUOTES_ROUTE] = 'Swaps Loading Quotes Page'; diff --git a/ui/pages/asset/components/token-buttons.tsx b/ui/pages/asset/components/token-buttons.tsx index bb3f129bade8..7921af85f2ce 100644 --- a/ui/pages/asset/components/token-buttons.tsx +++ b/ui/pages/asset/components/token-buttons.tsx @@ -6,7 +6,7 @@ import { I18nContext } from '../../../contexts/i18n'; import { SEND_ROUTE, ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) - BUILD_QUOTE_ROUTE, + PREPARE_SWAP_ROUTE, ///: END:ONLY_INCLUDE_IF } from '../../../helpers/constants/routes'; import { startNewDraftTransaction } from '../../../ducks/send'; @@ -276,12 +276,12 @@ const TokenButtons = ({ ); if (usingHardwareWallet) { global.platform.openExtensionInBrowser?.( - BUILD_QUOTE_ROUTE, + PREPARE_SWAP_ROUTE, undefined, false, ); } else { - history.push(BUILD_QUOTE_ROUTE); + history.push(PREPARE_SWAP_ROUTE); } ///: END:ONLY_INCLUDE_IF }} diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index c999d3d71df7..37c147427ac5 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -62,7 +62,6 @@ import { CONNECTED_ROUTE, CONNECTED_ACCOUNTS_ROUTE, AWAITING_SWAP_ROUTE, - BUILD_QUOTE_ROUTE, PREPARE_SWAP_ROUTE, CONFIRMATION_V_NEXT_ROUTE, ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) @@ -328,10 +327,8 @@ export default class Home extends PureComponent { const canRedirect = !isNotification && !stayOnHomePage; if (canRedirect && showAwaitingSwapScreen) { history.push(AWAITING_SWAP_ROUTE); - } else if (canRedirect && haveSwapsQuotes) { + } else if (canRedirect && (haveSwapsQuotes || swapsFetchParams)) { history.push(PREPARE_SWAP_ROUTE); - } else if (canRedirect && swapsFetchParams) { - history.push(BUILD_QUOTE_ROUTE); } else if (firstPermissionsRequestId) { history.push(`${CONNECT_ROUTE}/${firstPermissionsRequestId}`); } else if (pendingConfirmationsPrioritized.length > 0) { diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index 7cfd33f655ac..a27d59e3b33b 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -71,7 +71,6 @@ import { SWAPS_ROUTE, SETTINGS_ROUTE, UNLOCK_ROUTE, - BUILD_QUOTE_ROUTE, CONFIRMATION_V_NEXT_ROUTE, ONBOARDING_ROUTE, ONBOARDING_UNLOCK_ROUTE, @@ -493,13 +492,6 @@ export default class Routes extends Component { ); } - onSwapsBuildQuotePage() { - const { location } = this.props; - return Boolean( - matchPath(location.pathname, { path: BUILD_QUOTE_ROUTE, exact: false }), - ); - } - onHomeScreen() { const { location } = this.props; return location.pathname === DEFAULT_ROUTE; diff --git a/ui/pages/swaps/__snapshots__/index.test.js.snap b/ui/pages/swaps/__snapshots__/index.test.js.snap index 779bb78555d5..f60f68e78844 100644 --- a/ui/pages/swaps/__snapshots__/index.test.js.snap +++ b/ui/pages/swaps/__snapshots__/index.test.js.snap @@ -12,8 +12,15 @@ exports[`Swap renders the component with initial props 1`] = ` class="swaps__header" >
+ class="box box--margin-left-4 box--display-flex box--flex-direction-row box--justify-content-center box--width-1/12" + tabindex="0" + > + +
diff --git a/ui/pages/swaps/awaiting-signatures/awaiting-signatures.js b/ui/pages/swaps/awaiting-signatures/awaiting-signatures.js index 777e253a70fe..a1b4179beefb 100644 --- a/ui/pages/swaps/awaiting-signatures/awaiting-signatures.js +++ b/ui/pages/swaps/awaiting-signatures/awaiting-signatures.js @@ -20,7 +20,7 @@ import { } from '../../../../shared/modules/selectors'; import { DEFAULT_ROUTE, - BUILD_QUOTE_ROUTE, + PREPARE_SWAP_ROUTE, } from '../../../helpers/constants/routes'; import PulseLoader from '../../../components/ui/pulse-loader'; import Box from '../../../components/ui/box'; @@ -150,7 +150,7 @@ export default function AwaitingSignatures() { // Go to the default route and then to the build quote route in order to clean up // the `inputValue` local state in `pages/swaps/index.js` history.push(DEFAULT_ROUTE); - history.push(BUILD_QUOTE_ROUTE); + history.push(PREPARE_SWAP_ROUTE); }} submitText={t('cancel')} hideCancel diff --git a/ui/pages/swaps/build-quote/__snapshots__/build-quote.test.js.snap b/ui/pages/swaps/build-quote/__snapshots__/build-quote.test.js.snap deleted file mode 100644 index b0551966d1c6..000000000000 --- a/ui/pages/swaps/build-quote/__snapshots__/build-quote.test.js.snap +++ /dev/null @@ -1,33 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`BuildQuote renders the component with initial props 1`] = ` -
- - - -
-`; diff --git a/ui/pages/swaps/build-quote/build-quote.js b/ui/pages/swaps/build-quote/build-quote.js deleted file mode 100644 index 73ea79d2953c..000000000000 --- a/ui/pages/swaps/build-quote/build-quote.js +++ /dev/null @@ -1,800 +0,0 @@ -import React, { useContext, useEffect, useState, useCallback } from 'react'; -import BigNumber from 'bignumber.js'; -import PropTypes from 'prop-types'; -import { shallowEqual, useDispatch, useSelector } from 'react-redux'; -import classnames from 'classnames'; -import { uniqBy, isEqual } from 'lodash'; -import { useHistory } from 'react-router-dom'; -import { getTokenTrackerLink } from '@metamask/etherscan-link'; -import { MetaMetricsContext } from '../../../contexts/metametrics'; -import { - useTokensToSearch, - getRenderableTokenData, -} from '../../../hooks/useTokensToSearch'; -import { useEqualityCheck } from '../../../hooks/useEqualityCheck'; -import { I18nContext } from '../../../contexts/i18n'; -import DropdownInputPair from '../dropdown-input-pair'; -import DropdownSearchList from '../dropdown-search-list'; -import SlippageButtons from '../slippage-buttons'; -import { getTokens, getConversionRate } from '../../../ducks/metamask/metamask'; -import InfoTooltip from '../../../components/ui/info-tooltip'; -import ActionableMessage from '../../../components/ui/actionable-message/actionable-message'; -import { - PREPARE_SWAP_ROUTE, - LOADING_QUOTES_ROUTE, -} from '../../../helpers/constants/routes'; - -import { - fetchQuotesAndSetQuoteState, - setSwapsFromToken, - setSwapToToken, - getFromToken, - getToToken, - getBalanceError, - getTopAssets, - getFetchParams, - getQuotes, - setBalanceError, - setFromTokenInputValue, - setFromTokenError, - setMaxSlippage, - setReviewSwapClickedTimestamp, - getCurrentSmartTransactionsEnabled, - getFromTokenInputValue, - getFromTokenError, - getMaxSlippage, - getIsFeatureFlagLoaded, - getSmartTransactionFees, - getLatestAddedTokenTo, -} from '../../../ducks/swaps/swaps'; -import { - getSwapsDefaultToken, - getTokenExchangeRates, - getCurrentCurrency, - getCurrentChainId, - getRpcPrefsForCurrentProvider, - getTokenList, - isHardwareWallet, - getHardwareWalletType, - getUseCurrencyRateCheck, -} from '../../../selectors'; -import { - getSmartTransactionsOptInStatus, - getSmartTransactionsEnabled, -} from '../../../../shared/modules/selectors'; - -import { getURLHostName } from '../../../helpers/utils/util'; -import { usePrevious } from '../../../hooks/usePrevious'; -import { useTokenTracker } from '../../../hooks/useTokenTracker'; -import { useTokenFiatAmount } from '../../../hooks/useTokenFiatAmount'; -import { useEthFiatAmount } from '../../../hooks/useEthFiatAmount'; - -import { - isSwapsDefaultTokenAddress, - isSwapsDefaultTokenSymbol, -} from '../../../../shared/modules/swaps.utils'; -import { - MetaMetricsEventCategory, - MetaMetricsEventLinkType, - MetaMetricsEventName, -} from '../../../../shared/constants/metametrics'; -import { - SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP, - SWAPS_CHAINID_DEFAULT_TOKEN_MAP, - TokenBucketPriority, - MAX_ALLOWED_SLIPPAGE, -} from '../../../../shared/constants/swaps'; - -import { - resetSwapsPostFetchState, - ignoreTokens, - setBackgroundSwapRouteState, - clearSwapsQuotes, - stopPollingForQuotes, - clearSmartTransactionFees, -} from '../../../store/actions'; -import { countDecimals, fetchTokenPrice } from '../swaps.util'; -import SwapsFooter from '../swaps-footer'; -import { isEqualCaseInsensitive } from '../../../../shared/modules/string-utils'; -import { calcTokenAmount } from '../../../../shared/lib/transactions-controller-utils'; -import { fetchTokenBalance } from '../../../../shared/lib/token-util'; -import { shouldEnableDirectWrapping } from '../../../../shared/lib/swaps-utils'; -import { - getValueFromWeiHex, - hexToDecimal, -} from '../../../../shared/modules/conversion.utils'; - -const fuseSearchKeys = [ - { name: 'name', weight: 0.499 }, - { name: 'symbol', weight: 0.499 }, - { name: 'address', weight: 0.002 }, -]; - -let timeoutIdForQuotesPrefetching; - -export default function BuildQuote({ - ethBalance, - selectedAccountAddress, - shuffledTokensList, -}) { - const t = useContext(I18nContext); - const dispatch = useDispatch(); - const history = useHistory(); - const trackEvent = useContext(MetaMetricsContext); - - const [fetchedTokenExchangeRate, setFetchedTokenExchangeRate] = - useState(undefined); - const [verificationClicked, setVerificationClicked] = useState(false); - - const isFeatureFlagLoaded = useSelector(getIsFeatureFlagLoaded); - const balanceError = useSelector(getBalanceError); - const fetchParams = useSelector(getFetchParams, isEqual); - const { sourceTokenInfo = {}, destinationTokenInfo = {} } = - fetchParams?.metaData || {}; - const tokens = useSelector(getTokens, isEqual); - const topAssets = useSelector(getTopAssets, isEqual); - const fromToken = useSelector(getFromToken, isEqual); - const fromTokenInputValue = useSelector(getFromTokenInputValue); - const fromTokenError = useSelector(getFromTokenError); - const maxSlippage = useSelector(getMaxSlippage); - const toToken = useSelector(getToToken, isEqual) || destinationTokenInfo; - const defaultSwapsToken = useSelector(getSwapsDefaultToken, isEqual); - const chainId = useSelector(getCurrentChainId); - const rpcPrefs = useSelector(getRpcPrefsForCurrentProvider, shallowEqual); - const tokenList = useSelector(getTokenList, isEqual); - const quotes = useSelector(getQuotes, isEqual); - const areQuotesPresent = Object.keys(quotes).length > 0; - const latestAddedTokenTo = useSelector(getLatestAddedTokenTo, isEqual); - - const tokenConversionRates = useSelector(getTokenExchangeRates, isEqual); - const conversionRate = useSelector(getConversionRate); - const useCurrencyRateCheck = useSelector(getUseCurrencyRateCheck); - const hardwareWalletUsed = useSelector(isHardwareWallet); - const hardwareWalletType = useSelector(getHardwareWalletType); - const smartTransactionsOptInStatus = useSelector( - getSmartTransactionsOptInStatus, - ); - const smartTransactionsEnabled = useSelector(getSmartTransactionsEnabled); - const currentSmartTransactionsEnabled = useSelector( - getCurrentSmartTransactionsEnabled, - ); - const smartTransactionFees = useSelector(getSmartTransactionFees); - const currentCurrency = useSelector(getCurrentCurrency); - - const fetchParamsFromToken = isSwapsDefaultTokenSymbol( - sourceTokenInfo?.symbol, - chainId, - ) - ? defaultSwapsToken - : sourceTokenInfo; - - const { loading, tokensWithBalances } = useTokenTracker({ tokens }); - - // If the fromToken was set in a call to `onFromSelect` (see below), and that from token has a balance - // but is not in tokensWithBalances or tokens, then we want to add it to the usersTokens array so that - // the balance of the token can appear in the from token selection dropdown - const fromTokenArray = - !isSwapsDefaultTokenSymbol(fromToken?.symbol, chainId) && fromToken?.balance - ? [fromToken] - : []; - const usersTokens = uniqBy( - [...tokensWithBalances, ...tokens, ...fromTokenArray], - 'address', - ); - const memoizedUsersTokens = useEqualityCheck(usersTokens); - - const selectedFromToken = getRenderableTokenData( - fromToken || fetchParamsFromToken, - tokenConversionRates, - conversionRate, - currentCurrency, - chainId, - tokenList, - ); - - const tokensToSearchSwapFrom = useTokensToSearch({ - usersTokens: memoizedUsersTokens, - topTokens: topAssets, - shuffledTokensList, - tokenBucketPriority: TokenBucketPriority.owned, - }); - const tokensToSearchSwapTo = useTokensToSearch({ - usersTokens: memoizedUsersTokens, - topTokens: topAssets, - shuffledTokensList, - tokenBucketPriority: TokenBucketPriority.top, - }); - const selectedToToken = - tokensToSearchSwapFrom.find(({ address }) => - isEqualCaseInsensitive(address, toToken?.address), - ) || toToken; - const toTokenIsNotDefault = - selectedToToken?.address && - !isSwapsDefaultTokenAddress(selectedToToken?.address, chainId); - const occurrences = Number( - selectedToToken?.occurances || selectedToToken?.occurrences || 0, - ); - const { - address: fromTokenAddress, - symbol: fromTokenSymbol, - string: fromTokenString, - decimals: fromTokenDecimals, - balance: rawFromTokenBalance, - } = selectedFromToken || {}; - const { address: toTokenAddress } = selectedToToken || {}; - - const fromTokenBalance = - rawFromTokenBalance && - calcTokenAmount(rawFromTokenBalance, fromTokenDecimals).toString(10); - - const prevFromTokenBalance = usePrevious(fromTokenBalance); - - const swapFromTokenFiatValue = useTokenFiatAmount( - fromTokenAddress, - fromTokenInputValue || 0, - fromTokenSymbol, - { - showFiat: useCurrencyRateCheck, - }, - true, - ); - const swapFromEthFiatValue = useEthFiatAmount( - fromTokenInputValue || 0, - { showFiat: useCurrencyRateCheck }, - true, - ); - const swapFromFiatValue = isSwapsDefaultTokenSymbol(fromTokenSymbol, chainId) - ? swapFromEthFiatValue - : swapFromTokenFiatValue; - - const onInputChange = useCallback( - (newInputValue, balance) => { - dispatch(setFromTokenInputValue(newInputValue)); - const newBalanceError = new BigNumber(newInputValue || 0).gt( - balance || 0, - ); - // "setBalanceError" is just a warning, a user can still click on the "Review swap" button. - if (balanceError !== newBalanceError) { - dispatch(setBalanceError(newBalanceError)); - } - dispatch( - setFromTokenError( - fromToken && countDecimals(newInputValue) > fromToken.decimals - ? 'tooManyDecimals' - : null, - ), - ); - }, - [dispatch, fromToken, balanceError], - ); - - const onFromSelect = (token) => { - if ( - token?.address && - !swapFromFiatValue && - fetchedTokenExchangeRate !== null - ) { - fetchTokenPrice(token.address).then((rate) => { - if (rate !== null && rate !== undefined) { - setFetchedTokenExchangeRate(rate); - } - }); - } else { - setFetchedTokenExchangeRate(null); - } - if ( - token?.address && - !memoizedUsersTokens.find((usersToken) => - isEqualCaseInsensitive(usersToken.address, token.address), - ) - ) { - fetchTokenBalance( - token.address, - selectedAccountAddress, - global.ethereumProvider, - ).then((fetchedBalance) => { - if (fetchedBalance?.balance) { - const balanceAsDecString = fetchedBalance.balance.toString(10); - const userTokenBalance = calcTokenAmount( - balanceAsDecString, - token.decimals, - ); - dispatch( - setSwapsFromToken({ - ...token, - string: userTokenBalance.toString(10), - balance: balanceAsDecString, - }), - ); - } - }); - } - dispatch(setSwapsFromToken(token)); - onInputChange( - token?.address ? fromTokenInputValue : '', - token.string, - token.decimals, - ); - }; - - const blockExplorerTokenLink = getTokenTrackerLink( - selectedToToken.address, - chainId, - null, // no networkId - null, // no holderAddress - { - blockExplorerUrl: - SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP[chainId] ?? null, - }, - ); - - const blockExplorerLabel = rpcPrefs.blockExplorerUrl - ? getURLHostName(blockExplorerTokenLink) - : t('etherscan'); - - const { address: toAddress } = toToken || {}; - const onToSelect = useCallback( - (token) => { - if (latestAddedTokenTo && token.address !== toAddress) { - dispatch( - ignoreTokens({ - tokensToIgnore: toAddress, - dontShowLoadingIndicator: true, - }), - ); - } - dispatch(setSwapToToken(token)); - setVerificationClicked(false); - }, - [dispatch, latestAddedTokenTo, toAddress], - ); - - const hideDropdownItemIf = useCallback( - (item) => isEqualCaseInsensitive(item.address, fromTokenAddress), - [fromTokenAddress], - ); - - const tokensWithBalancesFromToken = tokensWithBalances.find((token) => - isEqualCaseInsensitive(token.address, fromToken?.address), - ); - const previousTokensWithBalancesFromToken = usePrevious( - tokensWithBalancesFromToken, - ); - - useEffect(() => { - const notDefault = !isSwapsDefaultTokenAddress( - tokensWithBalancesFromToken?.address, - chainId, - ); - const addressesAreTheSame = isEqualCaseInsensitive( - tokensWithBalancesFromToken?.address, - previousTokensWithBalancesFromToken?.address, - ); - const balanceHasChanged = - tokensWithBalancesFromToken?.balance !== - previousTokensWithBalancesFromToken?.balance; - if (notDefault && addressesAreTheSame && balanceHasChanged) { - dispatch( - setSwapsFromToken({ - ...fromToken, - balance: tokensWithBalancesFromToken?.balance, - string: tokensWithBalancesFromToken?.string, - }), - ); - } - }, [ - dispatch, - tokensWithBalancesFromToken, - previousTokensWithBalancesFromToken, - fromToken, - chainId, - ]); - - // If the eth balance changes while on build quote, we update the selected from token - useEffect(() => { - if ( - isSwapsDefaultTokenAddress(fromToken?.address, chainId) && - fromToken?.balance !== hexToDecimal(ethBalance) - ) { - dispatch( - setSwapsFromToken({ - ...fromToken, - balance: hexToDecimal(ethBalance), - string: getValueFromWeiHex({ - value: ethBalance, - numberOfDecimals: 4, - toDenomination: 'ETH', - }), - }), - ); - } - }, [dispatch, fromToken, ethBalance, chainId]); - - useEffect(() => { - if (prevFromTokenBalance !== fromTokenBalance) { - onInputChange(fromTokenInputValue, fromTokenBalance); - } - }, [ - onInputChange, - prevFromTokenBalance, - fromTokenInputValue, - fromTokenBalance, - ]); - - const trackBuildQuotePageLoadedEvent = useCallback(() => { - trackEvent({ - event: 'Build Quote Page Loaded', - category: MetaMetricsEventCategory.Swaps, - sensitiveProperties: { - is_hardware_wallet: hardwareWalletUsed, - hardware_wallet_type: hardwareWalletType, - stx_enabled: smartTransactionsEnabled, - current_stx_enabled: currentSmartTransactionsEnabled, - stx_user_opt_in: smartTransactionsOptInStatus, - }, - }); - }, [ - trackEvent, - hardwareWalletUsed, - hardwareWalletType, - smartTransactionsEnabled, - currentSmartTransactionsEnabled, - smartTransactionsOptInStatus, - ]); - - useEffect(() => { - dispatch(resetSwapsPostFetchState()); - dispatch(setReviewSwapClickedTimestamp()); - trackBuildQuotePageLoadedEvent(); - }, [dispatch, trackBuildQuotePageLoadedEvent]); - - useEffect(() => { - if (smartTransactionsEnabled && smartTransactionFees?.tradeTxFees) { - // We want to clear STX fees, because we only want to use fresh ones on the View Quote page. - clearSmartTransactionFees(); - } - }, [smartTransactionsEnabled, smartTransactionFees]); - - const BlockExplorerLink = () => { - return ( - { - /* istanbul ignore next */ - trackEvent({ - event: MetaMetricsEventName.ExternalLinkClicked, - category: MetaMetricsEventCategory.Swaps, - properties: { - link_type: MetaMetricsEventLinkType.TokenTracker, - location: 'Swaps Confirmation', - url_domain: getURLHostName(blockExplorerTokenLink), - }, - }); - global.platform.openTab({ - url: blockExplorerTokenLink, - }); - }} - target="_blank" - rel="noopener noreferrer" - > - {blockExplorerLabel} - - ); - }; - - let tokenVerificationDescription = ''; - if (blockExplorerTokenLink) { - if (occurrences === 1) { - tokenVerificationDescription = t('verifyThisTokenOn', [ - , - ]); - } else if (occurrences === 0) { - tokenVerificationDescription = t('verifyThisUnconfirmedTokenOn', [ - , - ]); - } - } - - const swapYourTokenBalance = t('swapYourTokenBalance', [ - fromTokenString || '0', - fromTokenSymbol || SWAPS_CHAINID_DEFAULT_TOKEN_MAP[chainId]?.symbol || '', - ]); - - const isDirectWrappingEnabled = shouldEnableDirectWrapping( - chainId, - fromTokenAddress, - selectedToToken.address, - ); - const isReviewSwapButtonDisabled = - fromTokenError || - !isFeatureFlagLoaded || - !Number(fromTokenInputValue) || - !selectedToToken?.address || - !fromTokenAddress || - Number(maxSlippage) < 0 || - Number(maxSlippage) > MAX_ALLOWED_SLIPPAGE || - (toTokenIsNotDefault && occurrences < 2 && !verificationClicked); - - // It's triggered every time there is a change in form values (token from, token to, amount and slippage). - useEffect(() => { - dispatch(clearSwapsQuotes()); - dispatch(stopPollingForQuotes()); - const prefetchQuotesWithoutRedirecting = async () => { - const pageRedirectionDisabled = true; - await dispatch( - fetchQuotesAndSetQuoteState( - history, - fromTokenInputValue, - maxSlippage, - trackEvent, - pageRedirectionDisabled, - ), - ); - }; - // Delay fetching quotes until a user is done typing an input value. If they type a new char in less than a second, - // we will cancel previous setTimeout call and start running a new one. - timeoutIdForQuotesPrefetching = setTimeout(() => { - timeoutIdForQuotesPrefetching = null; - if (!isReviewSwapButtonDisabled) { - // Only do quotes prefetching if the Review swap button is enabled. - prefetchQuotesWithoutRedirecting(); - } - }, 1000); - return () => clearTimeout(timeoutIdForQuotesPrefetching); - }, [ - dispatch, - history, - maxSlippage, - trackEvent, - isReviewSwapButtonDisabled, - fromTokenInputValue, - fromTokenAddress, - toTokenAddress, - smartTransactionsOptInStatus, - ]); - - return ( -
-
-
-
{t('swapSwapFrom')}
- {!isSwapsDefaultTokenSymbol(fromTokenSymbol, chainId) && ( -
- onInputChange(fromTokenBalance || '0', fromTokenBalance) - } - > - {t('max')} -
- )} -
- { - /* istanbul ignore next */ - onInputChange(value, fromTokenBalance); - }} - inputValue={fromTokenInputValue} - leftValue={fromTokenInputValue && swapFromFiatValue} - selectedItem={selectedFromToken} - maxListItems={30} - loading={ - loading && - (!tokensToSearchSwapFrom?.length || - !topAssets || - !Object.keys(topAssets).length) - } - selectPlaceHolderText={t('swapSelect')} - hideItemIf={(item) => - isEqualCaseInsensitive(item.address, selectedToToken?.address) - } - listContainerClassName="build-quote__open-dropdown" - autoFocus - /> -
- {!fromTokenError && - !balanceError && - fromTokenSymbol && - swapYourTokenBalance} - {!fromTokenError && balanceError && fromTokenSymbol && ( -
-
- {t('swapsNotEnoughForTx', [fromTokenSymbol])} -
-
- {swapYourTokenBalance} -
-
- )} - {fromTokenError && ( - <> -
- {t('swapTooManyDecimalsError', [ - fromTokenSymbol, - fromTokenDecimals, - ])} -
-
{swapYourTokenBalance}
- - )} -
-
- -
-
-
{t('swapSwapTo')}
-
-
- -
- {toTokenIsNotDefault && - (occurrences < 2 ? ( - -
- {occurrences === 1 - ? t('swapTokenVerificationOnlyOneSource') - : t('swapTokenVerificationAddedManually')} -
-
{tokenVerificationDescription}
-
- } - primaryAction={ - /* istanbul ignore next */ - verificationClicked - ? null - : { - label: t('continue'), - onClick: () => setVerificationClicked(true), - } - } - withRightButton - infoTooltipText={ - blockExplorerTokenLink && - t('swapVerifyTokenExplanation', [blockExplorerLabel]) - } - /> - ) : ( - - ))} - {!isDirectWrappingEnabled && ( -
- { - dispatch(setMaxSlippage(newSlippage)); - }} - maxAllowedSlippage={MAX_ALLOWED_SLIPPAGE} - currentSlippage={maxSlippage} - isDirectWrappingEnabled={isDirectWrappingEnabled} - /> -
- )} -
- { - // We need this to know how long it took to go from clicking on the Review swap button to rendered View Quote page. - dispatch(setReviewSwapClickedTimestamp(Date.now())); - // In case that quotes prefetching is waiting to be executed, but hasn't started yet, - // we want to cancel it and fetch quotes from here. - if (timeoutIdForQuotesPrefetching) { - clearTimeout(timeoutIdForQuotesPrefetching); - dispatch( - fetchQuotesAndSetQuoteState( - history, - fromTokenInputValue, - maxSlippage, - trackEvent, - ), - ); - } else if (areQuotesPresent) { - // If there are prefetched quotes already, go directly to the View Quote page. - history.push(PREPARE_SWAP_ROUTE); - } else { - // If the "Review swap" button was clicked while quotes are being fetched, go to the Loading Quotes page. - await dispatch(setBackgroundSwapRouteState('loading')); - history.push(LOADING_QUOTES_ROUTE); - } - } - } - submitText={t('swapReviewSwap')} - disabled={isReviewSwapButtonDisabled} - hideCancel - showTermsOfService - /> -
- ); -} - -BuildQuote.propTypes = { - ethBalance: PropTypes.string, - selectedAccountAddress: PropTypes.string, - shuffledTokensList: PropTypes.array, -}; diff --git a/ui/pages/swaps/build-quote/build-quote.stories.js b/ui/pages/swaps/build-quote/build-quote.stories.js deleted file mode 100644 index 008b4b4a3ed4..000000000000 --- a/ui/pages/swaps/build-quote/build-quote.stories.js +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import { shuffle } from 'lodash'; -import testData from '../../../../.storybook/test-data'; -import BuildQuote from './build-quote'; - -const tokenValuesArr = shuffle(testData.metamask.tokenList); - -export default { - title: 'Pages/Swaps/BuildQuote', - - argTypes: { - ethBalance: { - control: { type: 'text' }, - }, - selectedAccountAddress: { - control: { type: 'text' }, - }, - shuffledTokensList: { control: 'object' }, - }, - args: { - ethBalance: '0x8', - selectedAccountAddress: '0xb19ac54efa18cc3a14a5b821bfec73d284bf0c5e', - shuffledTokensList: tokenValuesArr, - }, -}; - -export const DefaultStory = (args) => { - return ( - <> - - - ); -}; - -DefaultStory.storyName = 'Default'; diff --git a/ui/pages/swaps/build-quote/build-quote.test.js b/ui/pages/swaps/build-quote/build-quote.test.js deleted file mode 100644 index aa8738e43ecb..000000000000 --- a/ui/pages/swaps/build-quote/build-quote.test.js +++ /dev/null @@ -1,223 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; -import thunk from 'redux-thunk'; -import { setBackgroundConnection } from '../../../store/background-connection'; -import { - renderWithProvider, - createSwapsMockStore, - fireEvent, -} from '../../../../test/jest'; -import { createTestProviderTools } from '../../../../test/stub/provider'; -import { - setSwapsFromToken, - setSwapToToken, - setFromTokenInputValue, -} from '../../../ducks/swaps/swaps'; -import { mockNetworkState } from '../../../../test/stub/networks'; -import { CHAIN_IDS } from '../../../../shared/constants/network'; -import BuildQuote from '.'; - -const middleware = [thunk]; -const createProps = (customProps = {}) => { - return { - ethBalance: '0x8', - selectedAccountAddress: 'selectedAccountAddress', - isFeatureFlagLoaded: false, - shuffledTokensList: [], - ...customProps, - }; -}; - -setBackgroundConnection({ - resetPostFetchState: jest.fn(), - ignoreTokens: jest.fn(), - setBackgroundSwapRouteState: jest.fn(), - clearSwapsQuotes: jest.fn(), - stopPollingForQuotes: jest.fn(), - clearSmartTransactionFees: jest.fn(), - setSwapsFromToken: jest.fn(), - setSwapToToken: jest.fn(), - setFromTokenInputValue: jest.fn(), -}); - -jest.mock('../../../ducks/swaps/swaps', () => { - const actual = jest.requireActual('../../../ducks/swaps/swaps'); - return { - ...actual, - setSwapsFromToken: jest.fn(), - setSwapToToken: jest.fn(), - setFromTokenInputValue: jest.fn(() => { - return { - type: 'MOCK_ACTION', - }; - }), - }; -}); - -jest.mock('../swaps.util', () => { - const actual = jest.requireActual('../swaps.util'); - return { - ...actual, - fetchTokenBalance: jest.fn(() => Promise.resolve()), - fetchTokenPrice: jest.fn(() => Promise.resolve()), - }; -}); - -const providerResultStub = { - eth_getCode: '0x123', - eth_call: - '0x00000000000000000000000000000000000000000000000029a2241af62c0000', -}; -const { provider } = createTestProviderTools({ - scaffold: providerResultStub, - networkId: '5', - chainId: '5', -}); - -describe('BuildQuote', () => { - beforeAll(() => { - jest.clearAllMocks(); - }); - - beforeEach(() => { - global.ethereumProvider = provider; - }); - - afterEach(() => { - jest.clearAllMocks(); - }); - - it('renders the component with initial props', () => { - const store = configureMockStore(middleware)(createSwapsMockStore()); - const props = createProps(); - const { getByText } = renderWithProvider(, store); - expect(getByText('Swap from')).toBeInTheDocument(); - expect(getByText('Swap to')).toBeInTheDocument(); - expect(getByText('Select')).toBeInTheDocument(); - expect(getByText('Slippage tolerance')).toBeInTheDocument(); - expect(getByText('2%')).toBeInTheDocument(); - expect(getByText('3%')).toBeInTheDocument(); - expect(getByText('Review swap')).toBeInTheDocument(); - expect( - document.querySelector('.slippage-buttons__button-group'), - ).toMatchSnapshot(); - }); - - it('switches swap from and to tokens', () => { - const setSwapFromTokenMock = jest.fn(() => { - return { - type: 'MOCK_ACTION', - }; - }); - setSwapsFromToken.mockImplementation(setSwapFromTokenMock); - const setSwapToTokenMock = jest.fn(() => { - return { - type: 'MOCK_ACTION', - }; - }); - setSwapToToken.mockImplementation(setSwapToTokenMock); - const mockStore = createSwapsMockStore(); - const store = configureMockStore(middleware)(mockStore); - const props = createProps(); - const { getByText, getByTestId } = renderWithProvider( - , - store, - ); - expect(getByText('Swap from')).toBeInTheDocument(); - fireEvent.click(getByTestId('build-quote__swap-arrows')); - expect(setSwapsFromToken).toHaveBeenCalledWith(mockStore.swaps.toToken); - expect(setSwapToToken).toHaveBeenCalled(); - }); - - it('renders the block explorer link, only 1 verified source', () => { - const mockStore = createSwapsMockStore(); - mockStore.swaps.toToken.occurances = 1; - const store = configureMockStore(middleware)({ - ...mockStore, - metamask: { - ...mockStore.metamask, - ...mockNetworkState({ - chainId: CHAIN_IDS.MAINNET, - blockExplorerUrl: 'https://etherscan.io', - }), - }, - }); - const props = createProps(); - const { getByText } = renderWithProvider(, store); - expect(getByText('Swap from')).toBeInTheDocument(); - expect(getByText('Only verified on 1 source.')).toBeInTheDocument(); - expect(getByText('etherscan.io')).toBeInTheDocument(); - }); - - it('renders the block explorer link, 0 verified sources', () => { - const mockStore = createSwapsMockStore(); - mockStore.swaps.toToken.occurances = 0; - const store = configureMockStore(middleware)({ - ...mockStore, - metamask: { - ...mockStore.metamask, - ...mockNetworkState({ - chainId: CHAIN_IDS.MAINNET, - blockExplorerUrl: 'https://etherscan.io', - }), - }, - }); - const props = createProps(); - const { getByText } = renderWithProvider(, store); - expect(getByText('Swap from')).toBeInTheDocument(); - expect( - getByText('This token has been added manually.'), - ).toBeInTheDocument(); - expect(getByText('etherscan.io')).toBeInTheDocument(); - }); - - it('clicks on a block explorer link', () => { - global.platform = { openTab: jest.fn() }; - const mockStore = createSwapsMockStore(); - mockStore.swaps.toToken.occurances = 1; - const store = configureMockStore(middleware)({ - ...mockStore, - metamask: { - ...mockStore.metamask, - ...mockNetworkState({ - chainId: CHAIN_IDS.MAINNET, - blockExplorerUrl: 'https://etherscan.io', - }), - }, - }); - const props = createProps(); - const { getByText } = renderWithProvider(, store); - const blockExplorer = getByText('etherscan.io'); - expect(blockExplorer).toBeInTheDocument(); - fireEvent.click(blockExplorer); - expect(global.platform.openTab).toHaveBeenCalledWith({ - url: 'https://etherscan.io/token/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - }); - }); - - it('clicks on the "max" link', () => { - const setFromTokenInputValueMock = jest.fn(() => { - return { - type: 'MOCK_ACTION', - }; - }); - setFromTokenInputValue.mockImplementation(setFromTokenInputValueMock); - const mockStore = createSwapsMockStore(); - mockStore.swaps.fromToken = 'DAI'; - const store = configureMockStore(middleware)({ - ...mockStore, - metamask: { - ...mockStore.metamask, - ...mockNetworkState({ - chainId: CHAIN_IDS.MAINNET, - blockExplorerUrl: 'https://etherscan.io', - }), - }, - }); - const props = createProps(); - const { getByText } = renderWithProvider(, store); - const maxLink = getByText('Max'); - fireEvent.click(maxLink); - expect(setFromTokenInputValue).toHaveBeenCalled(); - }); -}); diff --git a/ui/pages/swaps/build-quote/index.js b/ui/pages/swaps/build-quote/index.js deleted file mode 100644 index 772229f2a187..000000000000 --- a/ui/pages/swaps/build-quote/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './build-quote'; diff --git a/ui/pages/swaps/build-quote/index.scss b/ui/pages/swaps/build-quote/index.scss deleted file mode 100644 index 5d454002a0b8..000000000000 --- a/ui/pages/swaps/build-quote/index.scss +++ /dev/null @@ -1,223 +0,0 @@ -@use "design-system"; - -.build-quote { - display: flex; - flex-flow: column; - align-items: center; - flex: 1; - width: 100%; - padding-top: 4px; - - &__content { - display: flex; - height: 100%; - flex-direction: column; - padding-left: 24px; - padding-right: 24px; - } - - &__content { - display: flex; - } - - &__dropdown-swap-to-header { - display: flex; - justify-content: space-between; - align-items: center; - width: 100%; - margin-top: 0; - margin-bottom: 12px; - } - - &__dropdown-input-pair-header { - display: flex; - justify-content: space-between; - align-items: flex-end; - width: 100%; - margin-bottom: 12px; - flex: 0.5 1 auto; - max-height: 56px; - } - - &__title, - &__input-label { - @include design-system.H5; - - font-weight: bold; - color: var(--color-text-default); - margin-top: 3px; - } - - &__swap-arrows-row { - width: 100%; - display: flex; - justify-content: flex-end; - padding-right: 16px; - padding-top: 12px; - height: 24px; - position: relative; - } - - &__swap-arrows { - display: flex; - flex: 0 0 auto; - height: 24px; - cursor: pointer; - background: unset; - color: var(--color-icon-muted); - } - - &__max-button { - @include design-system.H7; - - color: var(--color-primary-default); - cursor: pointer; - } - - &__balance-message { - @include design-system.H7; - - width: 100%; - color: var(--color-text-muted); - margin-top: 4px; - display: flex; - flex-flow: column; - height: 18px; - - &--error { - div:first-of-type { - font-weight: bold; - color: var(--color-text-default); - } - - .build-quote__form-error:first-of-type { - font-weight: bold; - color: var(--color-error-default); - } - - div:last-of-type { - font-weight: normal; - color: var(--color-text-alternative); - } - } - } - - &__slippage-buttons-container { - display: flex; - justify-content: center; - align-items: center; - margin-top: 32px; - } - - &__open-dropdown, - &__open-to-dropdown { - max-height: 330px; - box-shadow: var(--shadow-size-sm) var(--color-shadow-default); - position: absolute; - width: 100%; - } - - .dropdown-input-pair { - .searchable-item-list { - &__item--add-token { - display: none; - } - } - - &__to { - .searchable-item-list { - &__item--add-token { - display: flex; - } - } - } - - &__input { - div { - border: 1px solid var(--color-border-default); - border-left: 0; - } - } - } - - &__open-to-dropdown { - max-height: 194px; - - @include design-system.screen-sm-min { - max-height: 276px; - } - } - - &__token-message { - @include design-system.H7; - - width: 100%; - color: var(--color-text-alternative); - margin-top: 4px; - - .info-tooltip { - display: inline-block; - } - } - - &__token-etherscan-link { - color: var(--color-primary-default); - cursor: pointer; - } - - &__token-tooltip-container { - // Needed to override the style property added by the react-tippy library - display: flex !important; - } - - &__bold { - font-weight: bold; - } - - &__underline { - text-decoration: underline; - } - - /* Prevents the swaps "Swap to" field from overflowing */ - .dropdown-input-pair__to .dropdown-search-list { - width: 100%; - } -} - -@keyframes slide-in { - 100% { transform: translateY(0%); } -} - -.smart-transactions-popover { - transform: translateY(-100%); - animation: slide-in 0.5s forwards; - - &__content { - flex-direction: column; - - ul { - list-style: inside; - } - - a { - color: var(--color-primary-default); - cursor: pointer; - } - } - - &__footer { - flex-direction: column; - flex: 1; - align-items: center; - border-top: 0; - - button { - border-radius: 50px; - } - - a { - font-size: inherit; - padding-bottom: 0; - } - } -} diff --git a/ui/pages/swaps/index.js b/ui/pages/swaps/index.js index 0c353c884465..e27c1297f068 100644 --- a/ui/pages/swaps/index.js +++ b/ui/pages/swaps/index.js @@ -55,7 +55,6 @@ import { AWAITING_SIGNATURES_ROUTE, AWAITING_SWAP_ROUTE, SMART_TRANSACTION_STATUS_ROUTE, - BUILD_QUOTE_ROUTE, LOADING_QUOTES_ROUTE, SWAPS_ERROR_ROUTE, DEFAULT_ROUTE, @@ -96,7 +95,6 @@ import AwaitingSignatures from './awaiting-signatures'; import SmartTransactionStatus from './smart-transaction-status'; import AwaitingSwap from './awaiting-swap'; import LoadingQuote from './loading-swaps-quotes'; -import BuildQuote from './build-quote'; import PrepareSwapPage from './prepare-swap-page/prepare-swap-page'; import NotificationPage from './notification-page/notification-page'; @@ -428,50 +426,18 @@ export default function Swap() { })} > - { - if (swapRedesignEnabled) { - return ; - } - if (tradeTxData && !conversionError) { - return ; - } else if (tradeTxData && routeState) { - return ; - } else if (routeState === 'loading' && aggregatorMetadata) { - return ; - } - - return ( - - ); - }} - /> { - if (!swapRedesignEnabled) { - return ; - } - - return ( - - ); - }} + render={() => ( + + )} /> ); } - return ; + return ; }} /> ) : ( - + ); }} /> diff --git a/ui/pages/swaps/index.scss b/ui/pages/swaps/index.scss index 86d0e6d7b55c..1cf25c83d23a 100644 --- a/ui/pages/swaps/index.scss +++ b/ui/pages/swaps/index.scss @@ -3,7 +3,6 @@ @import 'awaiting-swap/index'; @import 'awaiting-signatures/index'; @import 'smart-transaction-status/index'; -@import 'build-quote/index'; @import 'prepare-swap-page/index'; @import 'notification-page/index'; @import 'countdown-timer/index'; diff --git a/ui/pages/swaps/index.test.js b/ui/pages/swaps/index.test.js index aa4109567f99..6e948a78790c 100644 --- a/ui/pages/swaps/index.test.js +++ b/ui/pages/swaps/index.test.js @@ -22,7 +22,7 @@ jest.mock('react-router-dom', () => ({ }), useLocation: jest.fn(() => { return { - pathname: '/swaps/build-quote', + pathname: '/swaps/prepare-swap-page', }; }), })); diff --git a/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js b/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js index 2d69c3b0f53a..eeab70f2a4cb 100644 --- a/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js +++ b/ui/pages/swaps/smart-transaction-status/smart-transaction-status.js @@ -26,7 +26,7 @@ import { import { SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP } from '../../../../shared/constants/swaps'; import { DEFAULT_ROUTE, - BUILD_QUOTE_ROUTE, + PREPARE_SWAP_ROUTE, } from '../../../helpers/constants/routes'; import { Text } from '../../../components/component-library'; import Box from '../../../components/ui/box'; @@ -465,7 +465,7 @@ export default function SmartTransactionStatusPage() { await dispatch(prepareToLeaveSwaps()); history.push(DEFAULT_ROUTE); } else { - history.push(BUILD_QUOTE_ROUTE); + history.push(PREPARE_SWAP_ROUTE); } }} onCancel={async () => { From 1e56a02f02cc005c65d3174d9675c67b79997d4a Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Tue, 1 Oct 2024 22:20:52 -0500 Subject: [PATCH 3/8] chore: remove swap redesign flag --- .../data/integration-init-state.json | 4 - test/jest/mock-store.js | 4 - ui/ducks/swaps/swaps.js | 9 --- ui/ducks/swaps/swaps.test.js | 19 ----- ui/pages/bridge/index.test.tsx | 2 - .../swaps/__snapshots__/index.test.js.snap | 9 ++- ui/pages/swaps/index.js | 73 +++++++------------ ui/pages/swaps/index.scss | 18 +---- ui/pages/swaps/index.test.js | 2 - 9 files changed, 33 insertions(+), 107 deletions(-) diff --git a/test/integration/data/integration-init-state.json b/test/integration/data/integration-init-state.json index 82c55c9bd7e0..2d9e50002a18 100644 --- a/test/integration/data/integration-init-state.json +++ b/test/integration/data/integration-init-state.json @@ -1209,10 +1209,6 @@ "extension_active": true, "mobile_active": true }, - "swapRedesign": { - "extensionActive": true, - "mobileActive": false - }, "zksync": { "extensionActive": true, "extension_active": true, diff --git a/test/jest/mock-store.js b/test/jest/mock-store.js index a18f2e0b6944..55ffa7f9ba1b 100644 --- a/test/jest/mock-store.js +++ b/test/jest/mock-store.js @@ -397,10 +397,6 @@ export const createSwapsMockStore = () => { mobileActive: true, extensionActive: true, }, - swapRedesign: { - mobileActive: true, - extensionActive: true, - }, }, quotes: { TEST_AGG_1: { diff --git a/ui/ducks/swaps/swaps.js b/ui/ducks/swaps/swaps.js index ba04c6f0db41..3a9ccd94fa34 100644 --- a/ui/ducks/swaps/swaps.js +++ b/ui/ducks/swaps/swaps.js @@ -334,15 +334,6 @@ export const getCurrentSmartTransactionsEnabled = (state) => { return smartTransactionsEnabled && !currentSmartTransactionsError; }; -export const getSwapRedesignEnabled = (state) => { - const swapRedesign = - state.metamask.swapsState?.swapsFeatureFlags?.swapRedesign; - if (swapRedesign === undefined) { - return true; // By default show the redesign if we don't have feature flags returned yet. - } - return swapRedesign.extensionActive; -}; - export const getSwapsQuoteRefreshTime = (state) => state.metamask.swapsState.swapsQuoteRefreshTime; diff --git a/ui/ducks/swaps/swaps.test.js b/ui/ducks/swaps/swaps.test.js index 83c133572c0d..fb2cc5e78a05 100644 --- a/ui/ducks/swaps/swaps.test.js +++ b/ui/ducks/swaps/swaps.test.js @@ -924,24 +924,5 @@ describe('Ducks - Swaps', () => { expect(newState.customGas.limit).toBe(null); }); }); - - describe('getSwapRedesignEnabled', () => { - it('returns true if feature flags are not returned from backend yet', () => { - const state = createSwapsMockStore(); - delete state.metamask.swapsState.swapsFeatureFlags.swapRedesign; - expect(swaps.getSwapRedesignEnabled(state)).toBe(true); - }); - - it('returns false if the extension feature flag for swaps redesign is false', () => { - const state = createSwapsMockStore(); - state.metamask.swapsState.swapsFeatureFlags.swapRedesign.extensionActive = false; - expect(swaps.getSwapRedesignEnabled(state)).toBe(false); - }); - - it('returns true if the extension feature flag for swaps redesign is true', () => { - const state = createSwapsMockStore(); - expect(swaps.getSwapRedesignEnabled(state)).toBe(true); - }); - }); }); }); diff --git a/ui/pages/bridge/index.test.tsx b/ui/pages/bridge/index.test.tsx index a73cfa370681..0d0d4c21c71f 100644 --- a/ui/pages/bridge/index.test.tsx +++ b/ui/pages/bridge/index.test.tsx @@ -64,8 +64,6 @@ describe('Bridge', () => { it('renders the component with initial props', async () => { const swapsMockStore = createBridgeMockStore({ extensionSupport: true }); - swapsMockStore.metamask.swapsState.swapsFeatureFlags.swapRedesign.extensionActive = - true; const store = configureMockStore(middleware)(swapsMockStore); const { container, getByText } = renderWithProvider( diff --git a/ui/pages/swaps/__snapshots__/index.test.js.snap b/ui/pages/swaps/__snapshots__/index.test.js.snap index f60f68e78844..c7a58c20dac8 100644 --- a/ui/pages/swaps/__snapshots__/index.test.js.snap +++ b/ui/pages/swaps/__snapshots__/index.test.js.snap @@ -27,9 +27,14 @@ exports[`Swap renders the component with initial props 1`] = ` Swap
- Cancel +
{t('swap')}
- {!swapRedesignEnabled && ( -
{ - clearTemporaryTokenRef.current(); - dispatch(clearSwapsState()); - await dispatch(resetBackgroundSwapsState()); - history.push(DEFAULT_ROUTE); - }} - > - {!isAwaitingSwapRoute && - !isAwaitingSignaturesRoute && - !isSmartTransactionStatusRoute && - t('cancel')} -
- )} - {swapRedesignEnabled && ( - { - if (e.key === 'Enter') { + { + if (e.key === 'Enter') { + dispatch(setTransactionSettingsOpened(true)); + } + }} + > + {isPrepareSwapRoute && ( + { dispatch(setTransactionSettingsOpened(true)); - } - }} - > - {isPrepareSwapRoute && ( - { - dispatch(setTransactionSettingsOpened(true)); - }} - style={{ cursor: 'pointer' }} - title={t('transactionSettings')} - /> - )} - - )} + }} + style={{ cursor: 'pointer' }} + title={t('transactionSettings')} + /> + )} +
{ it('renders the component with initial props', async () => { const swapsMockStore = createSwapsMockStore(); - swapsMockStore.metamask.swapsState.swapsFeatureFlags.swapRedesign.extensionActive = false; const store = configureMockStore(middleware)(swapsMockStore); const { container, getByText } = renderWithProvider(, store); await waitFor(() => expect(featureFlagsNock.isDone()).toBe(true)); expect(getByText('Swap')).toBeInTheDocument(); - expect(getByText('Cancel')).toBeInTheDocument(); expect(container).toMatchSnapshot(); }); }); From b9e55577443f39d494b2daacd77c0952b36c4a52 Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Wed, 2 Oct 2024 11:40:13 -0500 Subject: [PATCH 4/8] chore: remove unused dropdown search list and input components in swaps --- app/_locales/de/messages.json | 10 - app/_locales/el/messages.json | 10 - app/_locales/en/messages.json | 10 - app/_locales/en_GB/messages.json | 10 - app/_locales/es/messages.json | 10 - app/_locales/es_419/messages.json | 7 - app/_locales/fr/messages.json | 10 - app/_locales/hi/messages.json | 10 - app/_locales/id/messages.json | 10 - app/_locales/it/messages.json | 7 - app/_locales/ja/messages.json | 10 - app/_locales/ko/messages.json | 10 - app/_locales/ph/messages.json | 7 - app/_locales/pt/messages.json | 10 - app/_locales/pt_BR/messages.json | 7 - app/_locales/ru/messages.json | 10 - app/_locales/tl/messages.json | 10 - app/_locales/tr/messages.json | 10 - app/_locales/vi/messages.json | 10 - app/_locales/zh_CN/messages.json | 10 - app/_locales/zh_TW/messages.json | 3 - .../files-to-convert.json | 8 - ui/pages/swaps/dropdown-input-pair/README.mdx | 15 - .../dropdown-input-pair.test.js.snap | 20 -- .../dropdown-input-pair.js | 177 ---------- .../dropdown-input-pair.stories.js | 173 --------- .../dropdown-input-pair.test.js | 44 --- ui/pages/swaps/dropdown-input-pair/index.js | 1 - ui/pages/swaps/dropdown-input-pair/index.scss | 78 ---- .../dropdown-search-list.test.js.snap | 46 --- .../dropdown-search-list.js | 334 ------------------ .../dropdown-search-list.stories.js | 147 -------- .../dropdown-search-list.test.js | 50 --- ui/pages/swaps/dropdown-search-list/index.js | 1 - .../swaps/dropdown-search-list/index.scss | 167 --------- ui/pages/swaps/index.scss | 3 +- ui/pages/swaps/prepare-swap-page/index.scss | 98 ----- .../__snapshots__/selected-token.test.js.snap | 82 +++-- ui/pages/swaps/selected-token/index.scss | 142 ++++++++ .../swaps/selected-token/selected-token.js | 24 +- .../selected-token/selected-token.test.js | 2 +- 41 files changed, 202 insertions(+), 1601 deletions(-) delete mode 100644 ui/pages/swaps/dropdown-input-pair/README.mdx delete mode 100644 ui/pages/swaps/dropdown-input-pair/__snapshots__/dropdown-input-pair.test.js.snap delete mode 100644 ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.js delete mode 100644 ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.stories.js delete mode 100644 ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.test.js delete mode 100644 ui/pages/swaps/dropdown-input-pair/index.js delete mode 100644 ui/pages/swaps/dropdown-input-pair/index.scss delete mode 100644 ui/pages/swaps/dropdown-search-list/__snapshots__/dropdown-search-list.test.js.snap delete mode 100644 ui/pages/swaps/dropdown-search-list/dropdown-search-list.js delete mode 100644 ui/pages/swaps/dropdown-search-list/dropdown-search-list.stories.js delete mode 100644 ui/pages/swaps/dropdown-search-list/dropdown-search-list.test.js delete mode 100644 ui/pages/swaps/dropdown-search-list/index.js delete mode 100644 ui/pages/swaps/dropdown-search-list/index.scss create mode 100644 ui/pages/swaps/selected-token/index.scss diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index a39c14265a1f..bc5c5abda623 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Wir sind bereit, Ihnen die neuesten Angebote zu zeigen, wenn Sie fortfahren möchten." }, - "swapBuildQuotePlaceHolderText": { - "message": "Keine Tokens verfügbar, die mit $1 übereinstimmen.", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Mit Ihrer Hardware-Wallet bestätigen" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Fehler beim Abrufen der Preisangaben" }, - "swapFetchingTokens": { - "message": "Token abrufen..." - }, "swapFromTo": { "message": "Swap von $1 auf $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Angebotsanfrage" }, - "swapSearchNameOrAddress": { - "message": "Namen suchen oder Adresse einfügen" - }, "swapSelect": { "message": "Auswählen" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index c3855be5b9f0..dcb1d2a3c827 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Είμαστε έτοιμοι να σας δείξουμε τις τελευταίες προσφορές, όποτε θέλετε να συνεχίσετε" }, - "swapBuildQuotePlaceHolderText": { - "message": "Δεν υπάρχουν διαθέσιμα tokens που να αντιστοιχούν σε $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Επιβεβαιώστε με το πορτοφόλι υλικού σας" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Σφάλμα κατά τη λήψη προσφορών" }, - "swapFetchingTokens": { - "message": "Λήψη tokens..." - }, "swapFromTo": { "message": "Η ανταλλαγή από $1 έως $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Αίτημα για προσφορά" }, - "swapSearchNameOrAddress": { - "message": "Αναζήτηση ονόματος ή επικόλληση διεύθυνσης" - }, "swapSelect": { "message": "Επιλογή" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 081e43e0235e..892321282e7e 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -5593,10 +5593,6 @@ "swapAreYouStillThereDescription": { "message": "We’re ready to show you the latest quotes when you want to continue" }, - "swapBuildQuotePlaceHolderText": { - "message": "No tokens available matching $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Confirm with your hardware wallet" }, @@ -5661,9 +5657,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Error fetching quotes" }, - "swapFetchingTokens": { - "message": "Fetching tokens..." - }, "swapFromTo": { "message": "The swap of $1 to $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5809,9 +5802,6 @@ "swapRequestForQuotation": { "message": "Request for quotation" }, - "swapSearchNameOrAddress": { - "message": "Search name or paste address" - }, "swapSelect": { "message": "Select" }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index 968f10cd9a58..bfa5ea23a96e 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -5341,10 +5341,6 @@ "swapAreYouStillThereDescription": { "message": "We’re ready to show you the latest quotes when you want to continue" }, - "swapBuildQuotePlaceHolderText": { - "message": "No tokens available matching $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Confirm with your hardware wallet" }, @@ -5409,9 +5405,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Error fetching quotes" }, - "swapFetchingTokens": { - "message": "Fetching tokens..." - }, "swapFromTo": { "message": "The swap of $1 to $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5539,9 +5532,6 @@ "swapRequestForQuotation": { "message": "Request for quotation" }, - "swapSearchNameOrAddress": { - "message": "Search name or paste address" - }, "swapSelect": { "message": "Select" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index 2701d7bbbc4f..de247c24702d 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -5192,10 +5192,6 @@ "swapAreYouStillThereDescription": { "message": "Estamos listos para mostrarle las últimas cotizaciones cuando desee continuar" }, - "swapBuildQuotePlaceHolderText": { - "message": "No hay tokens disponibles que coincidan con $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Confirmar con su monedero físico" }, @@ -5260,9 +5256,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Error al capturar cotizaciones" }, - "swapFetchingTokens": { - "message": "Capturando tokens…" - }, "swapFromTo": { "message": "El intercambio de $1 por $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5390,9 +5383,6 @@ "swapRequestForQuotation": { "message": "Solicitud de cotización" }, - "swapSearchNameOrAddress": { - "message": "Buscar nombre o pegar dirección" - }, "swapSelect": { "message": "Seleccionar" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index 76956106a43a..e4d2ab065d6e 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -1894,10 +1894,6 @@ "message": "Necesita $1 más $2 para realizar este canje", "description": "Tells the user how many more of a given token they need for a specific swap. $1 is an amount of tokens and $2 is the token symbol." }, - "swapBuildQuotePlaceHolderText": { - "message": "No hay tokens disponibles que coincidan con $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Confirmar con la cartera de hardware" }, @@ -1949,9 +1945,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Error al capturar cotizaciones" }, - "swapFetchingTokens": { - "message": "Capturando tokens..." - }, "swapFromTo": { "message": "El canje de $1 por $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 4bdad61274a0..ba8ca7c409f6 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Si vous le souhaitez, nous sommes prêts à vous présenter les dernières cotations" }, - "swapBuildQuotePlaceHolderText": { - "message": "Aucun jeton disponible correspondant à $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Confirmez avec votre portefeuille matériel" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Erreur lors de la récupération des cotations" }, - "swapFetchingTokens": { - "message": "Récupération des jetons…" - }, "swapFromTo": { "message": "Le swap de $1 vers $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Demande de cotation" }, - "swapSearchNameOrAddress": { - "message": "Rechercher le nom ou coller l’adresse" - }, "swapSelect": { "message": "Sélectionner" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 15de05b31b58..4f2aca604e0c 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "जब आप जारी रखना चाहते हैं तो हम आपको लेटेस्ट उद्धरण दिखाने के लिए तैयार हैं" }, - "swapBuildQuotePlaceHolderText": { - "message": "$1 के मिलान वाले कोई भी टोकन उपलब्ध नहीं हैं", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "अपने hardware wallet से कन्फर्म करें" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "उद्धरण प्राप्त करने में गड़बड़ी" }, - "swapFetchingTokens": { - "message": "टोकन प्राप्त किए जा रहे हैं..." - }, "swapFromTo": { "message": "$1 से $2 का स्वैप", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "उद्धरण के लिए अनुरोध" }, - "swapSearchNameOrAddress": { - "message": "नाम खोजें या ऐड्रेस पेस्ट करें" - }, "swapSelect": { "message": "चयन करें" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 4b8c1ee713ed..ef248b59202b 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Kami siap menampilkan kuotasi terbaru jika Anda ingin melanjutkan" }, - "swapBuildQuotePlaceHolderText": { - "message": "Tidak ada token yang cocok yang tersedia $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Konfirmasikan dengan dompet perangkat keras Anda" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Terjadi kesalahan saat mengambil kuota" }, - "swapFetchingTokens": { - "message": "Mengambil token..." - }, "swapFromTo": { "message": "Pertukaran dari $1 ke $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Minta kuotasi" }, - "swapSearchNameOrAddress": { - "message": "Cari nama atau tempel alamat" - }, "swapSelect": { "message": "Pilih" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index 05d23ee6ebe7..b05eab6755fc 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -1387,10 +1387,6 @@ "message": "Devi avere $1 $2 in più per completare lo scambio", "description": "Tells the user how many more of a given token they need for a specific swap. $1 is an amount of tokens and $2 is the token symbol." }, - "swapBuildQuotePlaceHolderText": { - "message": "Non ci sono token disponibile con questo nome $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapCustom": { "message": "personalizza" }, @@ -1419,9 +1415,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Errore recuperando le quotazioni" }, - "swapFetchingTokens": { - "message": "Recuperando i token..." - }, "swapLowSlippageError": { "message": "La transazione può fallire, il massimo slippage è troppo basso." }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 94788730871c..4afd2ab58f24 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "続ける際には、最新のクォートを表示する準備ができています" }, - "swapBuildQuotePlaceHolderText": { - "message": "$1と一致するトークンがありません", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "ハードウェアウォレットで確定" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "見積もり取得エラー" }, - "swapFetchingTokens": { - "message": "トークンを取得中..." - }, "swapFromTo": { "message": "$1から$2へのスワップ", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "見積もりのリクエスト" }, - "swapSearchNameOrAddress": { - "message": "名前を検索するかアドレスを貼り付けてください" - }, "swapSelect": { "message": "選択" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 608ac6431e05..f3f499074769 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "계속하기 원하시면 최신 견적을 보여드리겠습니다" }, - "swapBuildQuotePlaceHolderText": { - "message": "$1와(과) 일치하는 토큰이 없습니다.", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "하드웨어 지갑으로 컨펌합니다." }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "견적을 가져오는 중 오류 발생" }, - "swapFetchingTokens": { - "message": "토큰 가져오는 중..." - }, "swapFromTo": { "message": "$1을(를) $2(으)로 스왑", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "견적 요청" }, - "swapSearchNameOrAddress": { - "message": "이름 검색 또는 주소 붙여넣기" - }, "swapSelect": { "message": "선택" }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index d795e1be8438..f4ff8d6915b5 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -1268,10 +1268,6 @@ "message": "Kailangan mo ng $1 pa $2 para makumpleto ang pag-swap na ito", "description": "Tells the user how many more of a given token they need for a specific swap. $1 is an amount of tokens and $2 is the token symbol." }, - "swapBuildQuotePlaceHolderText": { - "message": "Walang available na token na tumutugma sa $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Kumpirmahin ang iyong hardware wallet" }, @@ -1313,9 +1309,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Nagka-error sa pagkuha ng mga quote" }, - "swapFetchingTokens": { - "message": "Kinukuha ang mga token..." - }, "swapFromTo": { "message": "Ang pag-swap ng $1 sa $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index bbedfc133b41..4ccd9b32e4d6 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Estamos prontos para exibir as últimas cotações quando quiser continuar" }, - "swapBuildQuotePlaceHolderText": { - "message": "Nenhum token disponível correspondente a $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Confirme com sua carteira de hardware" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Erro ao obter cotações" }, - "swapFetchingTokens": { - "message": "Obtendo tokens..." - }, "swapFromTo": { "message": "A troca de $1 por $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Solicitação de cotação" }, - "swapSearchNameOrAddress": { - "message": "Pesquise o nome ou cole o endereço" - }, "swapSelect": { "message": "Selecione" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index 9d8785fc9cf2..d2dc2791a983 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -1894,10 +1894,6 @@ "message": "Você precisa de mais $1 $2 para concluir essa troca", "description": "Tells the user how many more of a given token they need for a specific swap. $1 is an amount of tokens and $2 is the token symbol." }, - "swapBuildQuotePlaceHolderText": { - "message": "Nenhum token disponível correspondente a $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Confirme com sua carteira de hardware" }, @@ -1949,9 +1945,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Erro ao obter cotações" }, - "swapFetchingTokens": { - "message": "Obtendo tokens..." - }, "swapFromTo": { "message": "A troca de $1 para $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 8127e3c96418..102f6793fcaf 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Мы готовы показать вам последние котировки, когда вы захотите продолжить" }, - "swapBuildQuotePlaceHolderText": { - "message": "Нет доступных токенов, соответствующих $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Подтвердите с помощью аппаратного кошелька" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Ошибка при получении котировок" }, - "swapFetchingTokens": { - "message": "Получение токенов..." - }, "swapFromTo": { "message": "Своп $1 на $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Запрос котировки" }, - "swapSearchNameOrAddress": { - "message": "Выполните поиск по имени или вставьте адрес" - }, "swapSelect": { "message": "Выбрать" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 65234e093881..f83c6ba7bbc0 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Handa kaming ipakita sa iyo ang mga pinakabagong quote kapag gusto mo ng magpatuloy" }, - "swapBuildQuotePlaceHolderText": { - "message": "Walang available na token na tumutugma sa $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Kumpirmahin gamit ang iyong wallet na hardware" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Nagka-error sa pagkuha ng mga quote" }, - "swapFetchingTokens": { - "message": "Kinukuha ang mga token..." - }, "swapFromTo": { "message": "Ang pag-swap ng $1 sa $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Humiling ng quotation" }, - "swapSearchNameOrAddress": { - "message": "Hanapin ang pangalan o i-paste ang address" - }, "swapSelect": { "message": "Piliin" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 441e293bfc9f..ffa23d934762 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Devam etmek istediğinizde size en yeni kotaları göstermeye hazırız" }, - "swapBuildQuotePlaceHolderText": { - "message": "$1 ile eşleşen token yok", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Donanım cüzdanınızla onaylayın" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Teklifler alınırken hata" }, - "swapFetchingTokens": { - "message": "Tokenler alınıyor..." - }, "swapFromTo": { "message": "$1 ile $2 swap işlemi", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Teklif talebi" }, - "swapSearchNameOrAddress": { - "message": "İsmi arayın veya adresi yapıştırın" - }, "swapSelect": { "message": "Seç" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 32e3e36ca0a5..c33bee15a291 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "Chúng tôi sẵn sàng cho bạn xem báo giá mới nhất khi bạn muốn tiếp tục" }, - "swapBuildQuotePlaceHolderText": { - "message": "Không có token nào khớp với $1", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "Xác nhận ví cứng của bạn" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Lỗi tìm nạp báo giá" }, - "swapFetchingTokens": { - "message": "Đang tìm nạp token..." - }, "swapFromTo": { "message": "Giao dịch hoán đổi $1 sang $2", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "Yêu cầu báo giá" }, - "swapSearchNameOrAddress": { - "message": "Tìm kiếm tên hoặc dán địa chỉ" - }, "swapSelect": { "message": "Chọn" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index abcc34963699..c7e30369d9fd 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -5195,10 +5195,6 @@ "swapAreYouStillThereDescription": { "message": "如果您想继续,我们准备好为您显示最新报价" }, - "swapBuildQuotePlaceHolderText": { - "message": "没有与 $1 匹配的代币", - "description": "Tells the user that a given search string does not match any tokens in our token lists. $1 can be any string of text" - }, "swapConfirmWithHwWallet": { "message": "使用您的硬件钱包确认" }, @@ -5263,9 +5259,6 @@ "swapFetchingQuotesErrorTitle": { "message": "获取报价出错" }, - "swapFetchingTokens": { - "message": "获取代币中……" - }, "swapFromTo": { "message": "$1 到 $2 的交换", "description": "Tells a user that they need to confirm on their hardware wallet a swap of 2 tokens. $1 is a source token and $2 is a destination token" @@ -5393,9 +5386,6 @@ "swapRequestForQuotation": { "message": "请求报价" }, - "swapSearchNameOrAddress": { - "message": "搜索名称或粘贴地址" - }, "swapSelect": { "message": "选择" }, diff --git a/app/_locales/zh_TW/messages.json b/app/_locales/zh_TW/messages.json index 870e76a98d67..7cdfa8e28add 100644 --- a/app/_locales/zh_TW/messages.json +++ b/app/_locales/zh_TW/messages.json @@ -1211,9 +1211,6 @@ "supportCenter": { "message": "造訪我們的協助中心" }, - "swapSearchNameOrAddress": { - "message": "用名稱搜尋或貼上地址" - }, "switchEthereumChainConfirmationDescription": { "message": "這將在 MetaMask 中將目前選擇的網路切換到剛才新增的網路:" }, diff --git a/development/ts-migration-dashboard/files-to-convert.json b/development/ts-migration-dashboard/files-to-convert.json index f90146bf2ebb..62ba042a86eb 100644 --- a/development/ts-migration-dashboard/files-to-convert.json +++ b/development/ts-migration-dashboard/files-to-convert.json @@ -1508,14 +1508,6 @@ "ui/pages/swaps/create-new-swap/create-new-swap.js", "ui/pages/swaps/create-new-swap/create-new-swap.test.js", "ui/pages/swaps/create-new-swap/index.js", - "ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.js", - "ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.stories.js", - "ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.test.js", - "ui/pages/swaps/dropdown-input-pair/index.js", - "ui/pages/swaps/dropdown-search-list/dropdown-search-list.js", - "ui/pages/swaps/dropdown-search-list/dropdown-search-list.stories.js", - "ui/pages/swaps/dropdown-search-list/dropdown-search-list.test.js", - "ui/pages/swaps/dropdown-search-list/index.js", "ui/pages/swaps/exchange-rate-display/exchange-rate-display.js", "ui/pages/swaps/exchange-rate-display/exchange-rate-display.stories.js", "ui/pages/swaps/exchange-rate-display/exchange-rate-display.test.js", diff --git a/ui/pages/swaps/dropdown-input-pair/README.mdx b/ui/pages/swaps/dropdown-input-pair/README.mdx deleted file mode 100644 index cac84e714daa..000000000000 --- a/ui/pages/swaps/dropdown-input-pair/README.mdx +++ /dev/null @@ -1,15 +0,0 @@ -import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'; - -import DropdownInputPair from '.'; - -# Dropdown Input Pair - -Dropdown to choose cryptocurrency with amount input field. - - - - - -## Props - - diff --git a/ui/pages/swaps/dropdown-input-pair/__snapshots__/dropdown-input-pair.test.js.snap b/ui/pages/swaps/dropdown-input-pair/__snapshots__/dropdown-input-pair.test.js.snap deleted file mode 100644 index d58907ed2684..000000000000 --- a/ui/pages/swaps/dropdown-input-pair/__snapshots__/dropdown-input-pair.test.js.snap +++ /dev/null @@ -1,20 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DropdownInputPair renders the component with initial props 1`] = ` - -`; diff --git a/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.js b/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.js deleted file mode 100644 index 9da47ddf80ea..000000000000 --- a/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.js +++ /dev/null @@ -1,177 +0,0 @@ -import React, { useState, useRef, useEffect } from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import DropdownSearchList from '../dropdown-search-list'; -import TextField from '../../../components/ui/text-field'; - -const characterWidthMap = { - 1: 5.86, - 2: 10.05, - 3: 10.45, - 4: 11.1, - 5: 10, - 6: 10.06, - 7: 9.17, - 8: 10.28, - 9: 10.06, - 0: 11.22, - '.': 4.55, -}; - -const getInputWidth = (value) => { - const valueString = String(value); - const charArray = valueString.split(''); - return charArray.reduce( - (inputWidth, _char) => inputWidth + characterWidthMap[_char], - 12, - ); -}; -export default function DropdownInputPair({ - itemsToSearch = [], - onInputChange, - inputValue = '', - onSelect, - leftValue, - selectedItem, - SearchListPlaceholder, - maxListItems, - selectPlaceHolderText, - loading, - hideItemIf, - listContainerClassName, - autoFocus, -}) { - const [isOpen, setIsOpen] = useState(false); - const open = () => setIsOpen(true); - const close = () => setIsOpen(false); - const inputRef = useRef(); - const onTextFieldChange = (event) => { - event.stopPropagation(); - // Automatically prefix value with 0. if user begins typing . - const valueToUse = event.target.value === '.' ? '0.' : event.target.value; - - // Regex that validates strings with only numbers, 'x.', '.x', and 'x.x' - const regexp = /^(\.\d+|\d+(\.\d+)?|\d+\.)$/u; - // If the value is either empty or contains only numbers and '.' and only has one '.', update input to match - if (valueToUse === '' || regexp.test(valueToUse)) { - onInputChange(valueToUse); - } else { - // otherwise, use the previously set inputValue (effectively denying the user from inputting the last char) - // or an empty string if we do not yet have an inputValue - onInputChange(inputValue || ''); - } - }; - const [applyTwoLineStyle, setApplyTwoLineStyle] = useState(null); - useEffect(() => { - setApplyTwoLineStyle( - (inputRef?.current?.getBoundingClientRect()?.width || 0) + - getInputWidth(inputValue || '') > - 137, - ); - }, [inputValue, inputRef]); - - return ( -
- - {!isOpen && ( - - )} - {!isOpen && leftValue && ( -
- ≈ {leftValue} -
- )} -
- ); -} - -DropdownInputPair.propTypes = { - /** - * Give items data for the component - */ - itemsToSearch: PropTypes.array, - /** - * Handler for input change - */ - onInputChange: PropTypes.func, - /** - * Show input value content - */ - inputValue: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), - /** - * Handler for onSelect - */ - onSelect: PropTypes.func, - /** - * Set value to left - */ - leftValue: PropTypes.string, - /** - * Show selected item - */ - selectedItem: PropTypes.object, - /** - * Doesn't look like this is used - */ - SearchListPlaceholder: PropTypes.func, - /** - * Define maximum item per list - */ - maxListItems: PropTypes.number, - /** - * Show select placeholder text - */ - selectPlaceHolderText: PropTypes.string, - /** - * Check if the component is loading - */ - loading: PropTypes.bool, - /** - * Handler for hide item - */ - hideItemIf: PropTypes.func, - /** - * Add custom CSS class for list container - */ - listContainerClassName: PropTypes.string, - /** - * Check if the component is auto focus - */ - autoFocus: PropTypes.bool, -}; diff --git a/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.stories.js b/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.stories.js deleted file mode 100644 index ff5a6c756c1b..000000000000 --- a/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.stories.js +++ /dev/null @@ -1,173 +0,0 @@ -import React from 'react'; -import { useArgs } from '@storybook/client-api'; - -import README from './README.mdx'; -import DropdownInputPair from '.'; - -const tokens = [ - { - primaryLabel: 'MetaMark (META)', - name: 'MetaMark', - iconUrl: '.storybook/images/metamark.svg', - erc20: true, - decimals: 18, - symbol: 'META', - address: '0x617b3f8050a0BD94b6b1da02B4384eE5B4DF13F4', - }, - { - primaryLabel: '0x (ZRX)', - name: '0x', - iconUrl: '.storybook/images/0x.svg', - erc20: true, - symbol: 'ZRX', - decimals: 18, - address: '0xE41d2489571d322189246DaFA5ebDe1F4699F498', - }, - { - primaryLabel: 'AirSwap Token (AST)', - name: 'AirSwap Token', - iconUrl: '.storybook/images/AST.png', - erc20: true, - symbol: 'AST', - decimals: 4, - address: '0x27054b13b1B798B345b591a4d22e6562d47eA75a', - }, - { - primaryLabel: 'Basic Attention Token (BAT)', - name: 'Basic Attention Token', - iconUrl: '.storybook/images/BAT_icon.svg', - erc20: true, - symbol: 'BAT', - decimals: 18, - address: '0x0D8775F648430679A709E98d2b0Cb6250d2887EF', - }, - { - primaryLabel: 'Civil Token (CVL)', - name: 'Civil Token', - iconUrl: '.storybook/images/CVL_token.svg', - erc20: true, - symbol: 'CVL', - decimals: 18, - address: '0x01FA555c97D7958Fa6f771f3BbD5CCD508f81e22', - }, - { - primaryLabel: 'Gladius (GLA)', - name: 'Gladius', - iconUrl: '.storybook/images/gladius.svg', - erc20: true, - symbol: 'GLA', - decimals: 8, - address: '0x71D01dB8d6a2fBEa7f8d434599C237980C234e4C', - }, - { - primaryLabel: 'Gnosis Token (GNO)', - name: 'Gnosis Token', - iconUrl: '.storybook/images/gnosis.svg', - erc20: true, - symbol: 'GNO', - decimals: 18, - address: '0x6810e776880C02933D47DB1b9fc05908e5386b96', - }, - { - primaryLabel: 'OmiseGO (OMG)', - name: 'OmiseGO', - iconUrl: '.storybook/images/omg.jpg', - erc20: true, - symbol: 'OMG', - decimals: 18, - address: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', - }, - { - primaryLabel: 'Sai Stablecoin v1.0 (SAI)', - name: 'Sai Stablecoin v1.0', - iconUrl: '.storybook/images/sai.svg', - erc20: true, - symbol: 'SAI', - decimals: 18, - address: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', - }, - { - primaryLabel: 'Tether USD (USDT)', - name: 'Tether USD', - iconUrl: '.storybook/images/tether_usd.png', - erc20: true, - symbol: 'USDT', - decimals: 6, - address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - }, - { - primaryLabel: 'WednesdayCoin (WED)', - name: 'WednesdayCoin', - iconUrl: '.storybook/images/wed.png', - erc20: true, - symbol: 'WED', - decimals: 18, - address: '0x7848ae8F19671Dc05966dafBeFbBbb0308BDfAbD', - }, - { - primaryLabel: 'Wrapped BTC (WBTC)', - name: 'Wrapped BTC', - iconUrl: '.storybook/images/wbtc.png', - erc20: true, - symbol: 'WBTC', - decimals: 8, - address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', - }, -]; - -export default { - title: 'Pages/Swaps/DropdownInputPair', - - component: DropdownInputPair, - parameters: { - docs: { - page: README, - }, - }, - argTypes: { - itemsToSearch: { control: 'array' }, - onInputChange: { action: 'onInputChange' }, - inputValue: { control: 'text' }, - onSelect: { action: 'onSelect' }, - leftValue: { control: 'text' }, - selectedItem: { control: 'object' }, - maxListItems: { control: 'number' }, - selectPlaceHolderText: { control: 'text' }, - loading: { control: 'boolean' }, - listContainerClassName: { control: 'text' }, - autoFocus: { control: 'boolean' }, - }, -}; - -const tokensToSearch = tokens.map((token) => ({ - ...token, - primaryLabel: token.symbol, - secondaryLabel: token.name, - rightPrimaryLabel: `${(Math.random() * 100).toFixed( - Math.floor(Math.random() * 6), - )} ${token.symbol}`, - rightSecondaryLabel: `$${(Math.random() * 1000).toFixed(2)}`, -})); - -export const DefaultStory = (args) => { - const [{ inputValue, selectedItem = tokensToSearch[0] }, updateArgs] = - useArgs(); - return ( - { - updateArgs({ ...args, inputValue: value }); - }} - selectedItem={selectedItem} - /> - ); -}; - -DefaultStory.storyName = 'Default'; - -DefaultStory.args = { - itemsToSearch: tokensToSearch, - maxListItems: tokensToSearch.length, - loading: false, -}; diff --git a/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.test.js b/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.test.js deleted file mode 100644 index e9f319d25fcc..000000000000 --- a/ui/pages/swaps/dropdown-input-pair/dropdown-input-pair.test.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; - -import { - renderWithProvider, - createSwapsMockStore, - fireEvent, -} from '../../../../test/jest'; -import DropdownInputPair from '.'; - -const createProps = (customProps = {}) => { - return { - onInputChange: jest.fn(), - ...customProps, - }; -}; - -describe('DropdownInputPair', () => { - it('renders the component with initial props', () => { - const store = configureMockStore()(createSwapsMockStore()); - const props = createProps(); - const { getByPlaceholderText } = renderWithProvider( - , - store, - ); - expect(getByPlaceholderText('0')).toBeInTheDocument(); - expect( - document.querySelector('.dropdown-input-pair__input'), - ).toMatchSnapshot(); - }); - - it('changes the input field', () => { - const store = configureMockStore()(createSwapsMockStore()); - const props = createProps(); - const { getByPlaceholderText } = renderWithProvider( - , - store, - ); - fireEvent.change(getByPlaceholderText('0'), { - target: { value: 1.1 }, - }); - expect(props.onInputChange).toHaveBeenCalledWith('1.1'); - }); -}); diff --git a/ui/pages/swaps/dropdown-input-pair/index.js b/ui/pages/swaps/dropdown-input-pair/index.js deleted file mode 100644 index d89fc83b8de2..000000000000 --- a/ui/pages/swaps/dropdown-input-pair/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './dropdown-input-pair'; diff --git a/ui/pages/swaps/dropdown-input-pair/index.scss b/ui/pages/swaps/dropdown-input-pair/index.scss deleted file mode 100644 index 30d5440e0de6..000000000000 --- a/ui/pages/swaps/dropdown-input-pair/index.scss +++ /dev/null @@ -1,78 +0,0 @@ -@use "design-system"; - -.dropdown-input-pair { - display: flex; - width: 312px; - height: 60px; - position: relative; - - &__input { - margin: 0 !important; - - input { - @include design-system.H4; - - padding-top: 6px; - } - - div { - border: 1px solid var(--color-border-default); - border-top-left-radius: 0; - border-bottom-left-radius: 0; - border-left-color: transparent; - height: 60px; - } - - input::-webkit-outer-spin-button, - input::-webkit-inner-spin-button { - /* display: none; <- Crashes Chrome on hover */ - -webkit-appearance: none; - margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ - } - - input[type=number] { - -moz-appearance: textfield; /* Firefox */ - } - } - - &__list { - &--full-width { - width: 100%; - } - } - - &__left-value { - @include design-system.H7; - - position: absolute; - right: 16px; - height: 100%; - display: flex; - align-items: center; - color: var(--color-text-alternative); - - &--two-lines { - right: inherit; - left: 157px; - align-items: unset; - top: 34px; - } - } - - .dropdown-input-pair__selector--closed { - height: 60px; - width: 142px; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } - - &__two-line-input { - div { - align-items: flex-start; - } - - input { - padding-top: 14px; - } - } -} diff --git a/ui/pages/swaps/dropdown-search-list/__snapshots__/dropdown-search-list.test.js.snap b/ui/pages/swaps/dropdown-search-list/__snapshots__/dropdown-search-list.test.js.snap deleted file mode 100644 index 6057b37ee370..000000000000 --- a/ui/pages/swaps/dropdown-search-list/__snapshots__/dropdown-search-list.test.js.snap +++ /dev/null @@ -1,46 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DropdownSearchList renders the component with initial props 1`] = ` -
- -
-`; diff --git a/ui/pages/swaps/dropdown-search-list/dropdown-search-list.js b/ui/pages/swaps/dropdown-search-list/dropdown-search-list.js deleted file mode 100644 index 1182ad12d72a..000000000000 --- a/ui/pages/swaps/dropdown-search-list/dropdown-search-list.js +++ /dev/null @@ -1,334 +0,0 @@ -import React, { - useState, - useCallback, - useEffect, - useContext, - useRef, -} from 'react'; -import { useSelector } from 'react-redux'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import { isEqual } from 'lodash'; -import { I18nContext } from '../../../contexts/i18n'; -import SearchableItemList from '../searchable-item-list'; -import PulseLoader from '../../../components/ui/pulse-loader'; -import UrlIcon from '../../../components/ui/url-icon'; -import { - Icon, - IconName, - IconSize, -} from '../../../components/component-library'; -import ActionableMessage from '../../../components/ui/actionable-message/actionable-message'; -import ImportToken from '../import-token'; -import { - isHardwareWallet, - getHardwareWalletType, - getCurrentChainId, - getRpcPrefsForCurrentProvider, -} from '../../../selectors/selectors'; -import { - getSmartTransactionsOptInStatus, - getSmartTransactionsEnabled, -} from '../../../../shared/modules/selectors'; -import { SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP } from '../../../../shared/constants/swaps'; -import { getURLHostName } from '../../../helpers/utils/util'; -import { getCurrentSmartTransactionsEnabled } from '../../../ducks/swaps/swaps'; -import { MetaMetricsContext } from '../../../contexts/metametrics'; -import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics'; - -export default function DropdownSearchList({ - searchListClassName, - itemsToSearch, - selectPlaceHolderText, - fuseSearchKeys, - defaultToAll, - maxListItems, - onSelect, - startingItem, - onOpen, - onClose, - className = '', - externallySelectedItem, - selectorClosedClassName, - loading, - hideRightLabels, - hideItemIf, - listContainerClassName, - shouldSearchForImports, -}) { - const t = useContext(I18nContext); - const [isOpen, setIsOpen] = useState(false); - const [isImportTokenModalOpen, setIsImportTokenModalOpen] = useState(false); - const [selectedItem, setSelectedItem] = useState(startingItem); - const [tokenForImport, setTokenForImport] = useState(null); - const [searchQuery, setSearchQuery] = useState(''); - - const hardwareWalletUsed = useSelector(isHardwareWallet); - const hardwareWalletType = useSelector(getHardwareWalletType); - const chainId = useSelector(getCurrentChainId); - const rpcPrefs = useSelector(getRpcPrefsForCurrentProvider); - const smartTransactionsOptInStatus = useSelector( - getSmartTransactionsOptInStatus, - ); - const smartTransactionsEnabled = useSelector(getSmartTransactionsEnabled); - const currentSmartTransactionsEnabled = useSelector( - getCurrentSmartTransactionsEnabled, - ); - - const trackEvent = useContext(MetaMetricsContext); - - const close = useCallback(() => { - setIsOpen(false); - onClose?.(); - }, [onClose]); - - const onClickItem = useCallback( - (item) => { - onSelect?.(item); - setSelectedItem(item); - close(); - }, - [onSelect, close], - ); - - const onOpenImportTokenModalClick = (item) => { - setTokenForImport(item); - setIsImportTokenModalOpen(true); - }; - - /* istanbul ignore next */ - const onImportTokenClick = () => { - trackEvent({ - event: 'Token Imported', - category: MetaMetricsEventCategory.Swaps, - sensitiveProperties: { - symbol: tokenForImport?.symbol, - address: tokenForImport?.address, - chain_id: chainId, - is_hardware_wallet: hardwareWalletUsed, - hardware_wallet_type: hardwareWalletType, - stx_enabled: smartTransactionsEnabled, - current_stx_enabled: currentSmartTransactionsEnabled, - stx_user_opt_in: smartTransactionsOptInStatus, - }, - }); - // Only when a user confirms import of a token, we add it and show it in a dropdown. - onSelect?.(tokenForImport); - setSelectedItem(tokenForImport); - setTokenForImport(null); - close(); - }; - - const onImportTokenCloseClick = () => { - setIsImportTokenModalOpen(false); - close(); - }; - - const onClickSelector = useCallback(() => { - if (!isOpen) { - setIsOpen(true); - onOpen?.(); - } - }, [isOpen, onOpen]); - - const prevExternallySelectedItemRef = useRef(); - useEffect(() => { - prevExternallySelectedItemRef.current = externallySelectedItem; - }); - const prevExternallySelectedItem = prevExternallySelectedItemRef.current; - - useEffect(() => { - if ( - externallySelectedItem && - !isEqual(externallySelectedItem, selectedItem) - ) { - setSelectedItem(externallySelectedItem); - } else if (prevExternallySelectedItem && !externallySelectedItem) { - setSelectedItem(null); - } - }, [externallySelectedItem, selectedItem, prevExternallySelectedItem]); - - const onKeyUp = (e) => { - if (e.key === 'Escape') { - close(); - } else if (e.key === 'Enter') { - onClickSelector(e); - } - }; - - const blockExplorerLink = - rpcPrefs.blockExplorerUrl ?? - SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP[chainId] ?? - null; - - const blockExplorerHostName = getURLHostName(blockExplorerLink); - - const importTokenProps = { - onImportTokenCloseClick, - onImportTokenClick, - setIsImportTokenModalOpen, - tokenForImport, - }; - - return ( -
- {tokenForImport && isImportTokenModalOpen && ( - - )} - {!isOpen && ( -
-
- {selectedItem?.iconUrl && ( - - )} - {!selectedItem?.iconUrl && ( -
- )} -
-
- - {selectedItem?.symbol || selectPlaceHolderText} - -
-
-
- -
- )} - {isOpen && ( - <> - - /* istanbul ignore next */ - loading ? ( -
- -
- - {t('swapFetchingTokens')} - -
-
- ) : ( -
- {t('swapBuildQuotePlaceHolderText', [searchQuery])} - {blockExplorerLink && ( -
- { - trackEvent({ - event: 'Clicked Block Explorer Link', - category: MetaMetricsEventCategory.Swaps, - properties: { - link_type: 'Token Tracker', - action: 'Verify Contract Address', - block_explorer_domain: blockExplorerHostName, - }, - }); - global.platform.openTab({ - url: blockExplorerLink, - }); - }} - target="_blank" - rel="noopener noreferrer" - > - {blockExplorerHostName} - , - ])} - /> -
- )} -
- ) - } - searchPlaceholderText={t('swapSearchNameOrAddress')} - fuseSearchKeys={fuseSearchKeys} - defaultToAll={defaultToAll} - onClickItem={onClickItem} - onOpenImportTokenModalClick={onOpenImportTokenModalClick} - maxListItems={maxListItems} - className={classnames( - 'dropdown-search-list__token-container', - searchListClassName, - { - 'dropdown-search-list--open': isOpen, - }, - )} - hideRightLabels={hideRightLabels} - hideItemIf={hideItemIf} - listContainerClassName={listContainerClassName} - shouldSearchForImports={shouldSearchForImports} - searchQuery={searchQuery} - setSearchQuery={setSearchQuery} - /> -
{ - event.stopPropagation(); - setIsOpen(false); - onClose?.(); - }} - /> - - )} -
- ); -} - -DropdownSearchList.propTypes = { - itemsToSearch: PropTypes.array, - onSelect: PropTypes.func, - searchListClassName: PropTypes.string, - fuseSearchKeys: PropTypes.arrayOf( - PropTypes.shape({ - name: PropTypes.string, - weight: PropTypes.number, - }), - ), - defaultToAll: PropTypes.bool, - maxListItems: PropTypes.number, - startingItem: PropTypes.object, - onOpen: PropTypes.func, - onClose: PropTypes.func, - className: PropTypes.string, - externallySelectedItem: PropTypes.object, - loading: PropTypes.bool, - selectPlaceHolderText: PropTypes.string, - selectorClosedClassName: PropTypes.string, - hideRightLabels: PropTypes.bool, - hideItemIf: PropTypes.func, - listContainerClassName: PropTypes.string, - shouldSearchForImports: PropTypes.bool, -}; diff --git a/ui/pages/swaps/dropdown-search-list/dropdown-search-list.stories.js b/ui/pages/swaps/dropdown-search-list/dropdown-search-list.stories.js deleted file mode 100644 index 73ec3ea7aec8..000000000000 --- a/ui/pages/swaps/dropdown-search-list/dropdown-search-list.stories.js +++ /dev/null @@ -1,147 +0,0 @@ -import React from 'react'; -import DropdownSearchList from '.'; - -const tokens = [ - { - primaryLabel: 'MetaMark (META)', - name: 'MetaMark', - iconUrl: 'metamark.svg', - erc20: true, - decimals: 18, - symbol: 'META', - address: '0x617b3f8050a0BD94b6b1da02B4384eE5B4DF13F4', - }, - { - primaryLabel: '0x (ZRX)', - name: '0x', - iconUrl: '0x.svg', - erc20: true, - symbol: 'ZRX', - decimals: 18, - address: '0xE41d2489571d322189246DaFA5ebDe1F4699F498', - }, - { - primaryLabel: 'AirSwap Token (AST)', - name: 'AirSwap Token', - iconUrl: 'AST.png', - erc20: true, - symbol: 'AST', - decimals: 4, - address: '0x27054b13b1B798B345b591a4d22e6562d47eA75a', - }, - { - primaryLabel: 'Basic Attention Token (BAT)', - name: 'Basic Attention Token', - iconUrl: 'BAT_icon.svg', - erc20: true, - symbol: 'BAT', - decimals: 18, - address: '0x0D8775F648430679A709E98d2b0Cb6250d2887EF', - }, - { - primaryLabel: 'Civil Token (CVL)', - name: 'Civil Token', - iconUrl: 'CVL_token.svg', - erc20: true, - symbol: 'CVL', - decimals: 18, - address: '0x01FA555c97D7958Fa6f771f3BbD5CCD508f81e22', - }, - { - primaryLabel: 'Gladius (GLA)', - name: 'Gladius', - iconUrl: 'gladius.svg', - erc20: true, - symbol: 'GLA', - decimals: 8, - address: '0x71D01dB8d6a2fBEa7f8d434599C237980C234e4C', - }, - { - primaryLabel: 'Gnosis Token (GNO)', - name: 'Gnosis Token', - iconUrl: 'gnosis.svg', - erc20: true, - symbol: 'GNO', - decimals: 18, - address: '0x6810e776880C02933D47DB1b9fc05908e5386b96', - }, - { - primaryLabel: 'OmiseGO (OMG)', - name: 'OmiseGO', - iconUrl: 'omg.jpg', - erc20: true, - symbol: 'OMG', - decimals: 18, - address: '0xd26114cd6EE289AccF82350c8d8487fedB8A0C07', - }, - { - primaryLabel: 'Sai Stablecoin v1.0 (SAI)', - name: 'Sai Stablecoin v1.0', - iconUrl: 'sai.svg', - erc20: true, - symbol: 'SAI', - decimals: 18, - address: '0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359', - }, - { - primaryLabel: 'Tether USD (USDT)', - name: 'Tether USD', - iconUrl: 'tether_usd.png', - erc20: true, - symbol: 'USDT', - decimals: 6, - address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', - }, - { - primaryLabel: 'WednesdayCoin (WED)', - name: 'WednesdayCoin', - iconUrl: 'wed.png', - erc20: true, - symbol: 'WED', - decimals: 18, - address: '0x7848ae8F19671Dc05966dafBeFbBbb0308BDfAbD', - }, - { - primaryLabel: 'Wrapped BTC (WBTC)', - name: 'Wrapped BTC', - iconUrl: 'wbtc.png', - erc20: true, - symbol: 'WBTC', - decimals: 8, - address: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', - }, -]; - -export default { - title: 'Pages/Swaps/DropdownSearchList', -}; - -const tokensToSearch = tokens.map((token) => ({ - ...token, - primaryLabel: token.symbol, - secondaryLabel: token.name, - rightPrimaryLabel: `${(Math.random() * 100).toFixed( - Math.floor(Math.random() * 6), - )} ${token.symbol}`, - rightSecondaryLabel: `$${(Math.random() * 1000).toFixed(2)}`, -})); - -export const DefaultStory = () => { - return ( -
- -
- ); -}; - -DefaultStory.storyName = 'Default'; diff --git a/ui/pages/swaps/dropdown-search-list/dropdown-search-list.test.js b/ui/pages/swaps/dropdown-search-list/dropdown-search-list.test.js deleted file mode 100644 index f0ae4a889169..000000000000 --- a/ui/pages/swaps/dropdown-search-list/dropdown-search-list.test.js +++ /dev/null @@ -1,50 +0,0 @@ -import React from 'react'; -import configureMockStore from 'redux-mock-store'; - -import { - renderWithProvider, - createSwapsMockStore, - fireEvent, -} from '../../../../test/jest'; -import DropdownSearchList from '.'; - -const createProps = (customProps = {}) => { - return { - startingItem: { - iconUrl: 'iconUrl', - symbol: 'symbol', - }, - ...customProps, - }; -}; - -jest.mock('../searchable-item-list', () => jest.fn(() => null)); - -describe('DropdownSearchList', () => { - it('renders the component with initial props', () => { - const store = configureMockStore()(createSwapsMockStore()); - const props = createProps(); - const { container, getByText } = renderWithProvider( - , - store, - ); - expect(container).toMatchSnapshot(); - expect(getByText('symbol')).toBeInTheDocument(); - }); - - it('renders the component, opens the list and closes it', () => { - const store = configureMockStore()(createSwapsMockStore()); - const props = createProps(); - const { getByTestId } = renderWithProvider( - , - store, - ); - const dropdownSearchList = getByTestId('dropdown-search-list'); - expect(dropdownSearchList).toBeInTheDocument(); - fireEvent.click(dropdownSearchList); - const closeButton = getByTestId('dropdown-search-list__close-area'); - expect(closeButton).toBeInTheDocument(); - fireEvent.click(closeButton); - expect(closeButton).not.toBeInTheDocument(); - }); -}); diff --git a/ui/pages/swaps/dropdown-search-list/index.js b/ui/pages/swaps/dropdown-search-list/index.js deleted file mode 100644 index 3dd2e4ecf63e..000000000000 --- a/ui/pages/swaps/dropdown-search-list/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './dropdown-search-list'; diff --git a/ui/pages/swaps/dropdown-search-list/index.scss b/ui/pages/swaps/dropdown-search-list/index.scss deleted file mode 100644 index 904f9530d341..000000000000 --- a/ui/pages/swaps/dropdown-search-list/index.scss +++ /dev/null @@ -1,167 +0,0 @@ -@use "design-system"; - -.dropdown-search-list { - &__search-list-open { - margin: 24px; - box-shadow: none; - border-radius: 6px; - min-height: 297px; - width: 100%; - } - - &__token-container { - margin: 0; - min-height: auto; - border: 1px solid var(--color-border-default); - box-sizing: border-box; - box-shadow: none; - border-radius: 6px; - width: 100%; - } - - &--open { - box-shadow: var(--shadow-size-sm) var(--color-shadow-default); - border: 1px solid var(--color-border-default); - } - - &__close-area { - position: fixed; - top: 0; - left: 0; - z-index: 1000; - width: 100%; - height: 100%; - } - - &__selector-closed-container { - display: flex; - width: 100%; - position: relative; - align-items: center; - max-height: 60px; - transition: 200ms ease-in-out; - border-radius: 6px; - box-shadow: none; - border: 1px solid var(--color-border-default); - height: 60px; - - &:hover { - background: var(--color-background-default-hover); - } - } - - &__caret { - position: absolute; - right: 16px; - color: var(--color-icon-default); - } - - &__selector-closed { - display: flex; - flex-flow: row nowrap; - align-items: center; - padding: 16px 12px; - box-sizing: border-box; - cursor: pointer; - position: relative; - align-items: center; - flex: 1; - height: 60px; - - i { - font-size: 1.2em; - } - - .dropdown-search-list__item-labels { - width: 100%; - } - } - - &__selector-closed-icon { - width: 34px; - height: 34px; - } - - &__closed-primary-label { - @include design-system.H4; - - color: var(--color-text-default); - max-width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - - &__search-list--open { - box-shadow: var(--shadow-size-md) var(--color-shadow-default); - border: 1px solid var(--color-border-muted); - } - - &__default-dropdown-icon { - width: 34px; - height: 34px; - border-radius: 50%; - background: var(--color-background-alternative); - flex: 0 1 auto; - } - - &__labels { - display: flex; - justify-content: space-between; - width: 100%; - flex: 1; - } - - &__item-labels { - display: flex; - flex-direction: column; - justify-content: center; - margin-left: 8px; - } - - &__select-default { - color: var(--color-text-muted); - } - - &__placeholder { - @include design-system.H6; - - padding: 16px; - color: var(--color-text-alternative); - min-height: 300px; - position: relative; - z-index: 1002; - background: var(--color-background-default); - border-radius: 6px; - min-height: 194px; - overflow: hidden; - text-overflow: ellipsis; - - .searchable-item-list__item--add-token { - padding: 8px 0; - } - } - - &__loading-item { - transition: 200ms ease-in-out; - display: flex; - flex-flow: row nowrap; - align-items: center; - justify-content: center; - padding: 16px 12px; - box-sizing: border-box; - cursor: pointer; - border-top: 1px solid var(--color-border-muted); - position: relative; - z-index: 1; - background: var(--color-background-default); - } - - &__loading-item-text-container { - margin-left: 4px; - } - - &__loading-item-text { - font-weight: bold; - } -} diff --git a/ui/pages/swaps/index.scss b/ui/pages/swaps/index.scss index 4d5a5e3f4129..024fdd47dd47 100644 --- a/ui/pages/swaps/index.scss +++ b/ui/pages/swaps/index.scss @@ -6,8 +6,6 @@ @import 'prepare-swap-page/index'; @import 'notification-page/index'; @import 'countdown-timer/index'; -@import 'dropdown-input-pair/index'; -@import 'dropdown-search-list/index'; @import 'exchange-rate-display/index'; @import 'fee-card/index'; @import 'loading-swaps-quotes/index'; @@ -21,6 +19,7 @@ @import 'list-with-search/index'; @import 'popover-custom-background/index'; @import 'mascot-background-animation/index'; +@import 'selected-token/index'; .swaps { display: flex; diff --git a/ui/pages/swaps/prepare-swap-page/index.scss b/ui/pages/swaps/prepare-swap-page/index.scss index 3db2791ae1fc..60e24c6cdbce 100644 --- a/ui/pages/swaps/prepare-swap-page/index.scss +++ b/ui/pages/swaps/prepare-swap-page/index.scss @@ -27,12 +27,6 @@ margin-top: 16px; position: relative; - .dropdown-input-pair__input { - input { - text-align: right; - } - } - .MuiInputBase-root { padding-right: 0; } @@ -124,98 +118,6 @@ } } - .dropdown-search-list { - background-color: var(--color-background-alternative); - border-radius: 100px; - - &__select-default { - color: var(--color-text-default); - } - - &__labels { - flex: auto; - max-width: 110px; - - &--with-icon { - max-width: 95px; - } - } - - &__closed-primary-label { - font-weight: 500; - } - - &__selector-closed-container { - border: 0; - border-radius: 100px; - height: 32px; - max-height: 32px; - max-width: 165px; - width: auto; - } - - &__selector-closed-icon { - width: 24px; - height: 24px; - margin-right: 8px; - } - - &__selector-closed { - height: 32px; - max-width: 140px; - - div { - display: flex; - } - - &__item-labels { - width: 100%; - margin-left: 0; - } - } - } - - .dropdown-input-pair { - height: 32px; - width: auto; - - &__selector--closed { - height: 32px; - border-top-right-radius: 100px; - border-bottom-right-radius: 100px; - } - - .searchable-item-list { - &__item--add-token { - display: none; - } - } - - &__to { - display: flex; - justify-content: space-between; - align-items: center; - - .searchable-item-list { - &__item--add-token { - display: flex; - } - } - } - - &__input { - div { - border: 0; - } - } - - &__two-line-input { - input { - padding-bottom: 0; - } - } - } - &__token-etherscan-link { color: var(--color-primary-default); cursor: pointer; diff --git a/ui/pages/swaps/selected-token/__snapshots__/selected-token.test.js.snap b/ui/pages/swaps/selected-token/__snapshots__/selected-token.test.js.snap index 11cd9372ed7f..189eda3e38e3 100644 --- a/ui/pages/swaps/selected-token/__snapshots__/selected-token.test.js.snap +++ b/ui/pages/swaps/selected-token/__snapshots__/selected-token.test.js.snap @@ -3,40 +3,44 @@ exports[`SelectedToken renders the component with initial props 1`] = `
-
`; @@ -44,31 +48,35 @@ exports[`SelectedToken renders the component with initial props 1`] = ` exports[`SelectedToken renders the component with no token selected 1`] = `
-
`; diff --git a/ui/pages/swaps/selected-token/index.scss b/ui/pages/swaps/selected-token/index.scss new file mode 100644 index 000000000000..06d63963c8c5 --- /dev/null +++ b/ui/pages/swaps/selected-token/index.scss @@ -0,0 +1,142 @@ +@use "design-system"; + +.selected-token { + .selected-token-list { + background-color: var(--color-background-alternative); + border-radius: 100px; + + &__close-area { + position: fixed; + top: 0; + left: 0; + z-index: 1000; + width: 100%; + height: 100%; + } + + &__select-default { + color: var(--color-text-default); + } + + &__labels { + display: flex; + justify-content: space-between; + width: 100%; + flex: auto; + max-width: 110px; + + &--with-icon { + max-width: 95px; + } + } + + &__closed-primary-label { + @include design-system.H4; + + color: var(--color-text-default); + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: 500; + } + + &__selector-closed-container { + display: flex; + position: relative; + align-items: center; + transition: 200ms ease-in-out; + box-shadow: none; + border: 0; + border-radius: 100px; + height: 32px; + max-height: 32px; + max-width: 165px; + width: auto; + + &:hover { + background: var(--color-background-default-hover); + } + } + + &__selector-closed-icon { + width: 24px; + height: 24px; + margin-right: 8px; + } + + &__selector-closed { + display: flex; + flex-flow: row nowrap; + padding: 16px 12px; + box-sizing: border-box; + cursor: pointer; + position: relative; + align-items: center; + flex: 1; + height: 32px; + max-width: 140px; + + i { + font-size: 1.2em; + } + + div { + display: flex; + } + + &__item-labels { + width: 100%; + margin-left: 0; + } + } + + &__item-labels { + display: flex; + flex-direction: column; + justify-content: center; + margin-left: 8px; + } + } + + .selected-token-input-pair { + height: 32px; + width: auto; + + &__selector--closed { + height: 60px; + border-top-right-radius: 100px; + border-bottom-right-radius: 100px; + } + + .searchable-item-list { + &__item--add-token { + display: none; + } + } + + &__to { + display: flex; + justify-content: space-between; + align-items: center; + + .searchable-item-list { + &__item--add-token { + display: flex; + } + } + } + + &__input { + div { + border: 0; + } + } + + &__two-line-input { + input { + padding-bottom: 0; + } + } + } +} diff --git a/ui/pages/swaps/selected-token/selected-token.js b/ui/pages/swaps/selected-token/selected-token.js index 516dbdc246e3..775df66ec72e 100644 --- a/ui/pages/swaps/selected-token/selected-token.js +++ b/ui/pages/swaps/selected-token/selected-token.js @@ -29,37 +29,38 @@ export default function SelectedToken({ }; return ( +
-
+
{hasIcon && ( )}
-
+
+
); } diff --git a/ui/pages/swaps/selected-token/selected-token.test.js b/ui/pages/swaps/selected-token/selected-token.test.js index 15cca222a8ae..af70ed0bd8f1 100644 --- a/ui/pages/swaps/selected-token/selected-token.test.js +++ b/ui/pages/swaps/selected-token/selected-token.test.js @@ -37,7 +37,7 @@ describe('SelectedToken', () => { it('renders the component and opens the list', () => { const props = createProps(); const { getByTestId } = renderWithProvider(); - const dropdownSearchList = getByTestId('dropdown-search-list'); + const dropdownSearchList = getByTestId('selected-token-list'); expect(dropdownSearchList).toBeInTheDocument(); fireEvent.click(dropdownSearchList); expect(props.onClick).toHaveBeenCalledTimes(1); From be10e84aa9559a0cf2b8b6c54e41965545646725 Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Wed, 2 Oct 2024 14:11:15 -0500 Subject: [PATCH 5/8] chore: remove unused swaps custom background --- ui/pages/swaps/index.scss | 1 - .../swaps/popover-custom-background/index.scss | 6 ------ .../popover-custom-background.js | 14 -------------- 3 files changed, 21 deletions(-) delete mode 100644 ui/pages/swaps/popover-custom-background/index.scss delete mode 100644 ui/pages/swaps/popover-custom-background/popover-custom-background.js diff --git a/ui/pages/swaps/index.scss b/ui/pages/swaps/index.scss index 024fdd47dd47..d900db1e05c2 100644 --- a/ui/pages/swaps/index.scss +++ b/ui/pages/swaps/index.scss @@ -17,7 +17,6 @@ @import 'view-on-block-explorer/index'; @import 'transaction-settings/index'; @import 'list-with-search/index'; -@import 'popover-custom-background/index'; @import 'mascot-background-animation/index'; @import 'selected-token/index'; diff --git a/ui/pages/swaps/popover-custom-background/index.scss b/ui/pages/swaps/popover-custom-background/index.scss deleted file mode 100644 index 07bc852edbfd..000000000000 --- a/ui/pages/swaps/popover-custom-background/index.scss +++ /dev/null @@ -1,6 +0,0 @@ -.popover-custom-background { - height: 100%; - width: 100%; - background: var(--color-background-alternative); - opacity: 0.6; -} diff --git a/ui/pages/swaps/popover-custom-background/popover-custom-background.js b/ui/pages/swaps/popover-custom-background/popover-custom-background.js deleted file mode 100644 index 8e8af648ad7f..000000000000 --- a/ui/pages/swaps/popover-custom-background/popover-custom-background.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import Box from '../../../components/ui/box'; - -const PopoverCustomBackground = ({ onClose }) => { - return ; -}; - -export default PopoverCustomBackground; - -PopoverCustomBackground.propTypes = { - onClose: PropTypes.func, -}; From 075b88407cf37cc4cdd5245b362a87d2916d4813 Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Thu, 3 Oct 2024 09:14:17 -0500 Subject: [PATCH 6/8] chore: remove unused swaps slippage buttons component --- app/_locales/de/messages.json | 12 - app/_locales/el/messages.json | 12 - app/_locales/en/messages.json | 12 - app/_locales/en_GB/messages.json | 12 - app/_locales/es/messages.json | 12 - app/_locales/es_419/messages.json | 12 - app/_locales/fr/messages.json | 12 - app/_locales/hi/messages.json | 12 - app/_locales/id/messages.json | 12 - app/_locales/it/messages.json | 9 - app/_locales/ja/messages.json | 12 - app/_locales/ko/messages.json | 12 - app/_locales/ph/messages.json | 12 - app/_locales/pt/messages.json | 12 - app/_locales/pt_BR/messages.json | 12 - app/_locales/ru/messages.json | 12 - app/_locales/tl/messages.json | 12 - app/_locales/tr/messages.json | 12 - app/_locales/vi/messages.json | 12 - app/_locales/zh_CN/messages.json | 12 - .../files-to-convert.json | 4 - ui/pages/swaps/index.scss | 1 - .../prepare-swap-page.test.js.snap | 3 - .../prepare-swap-page.test.js | 3 - .../slippage-buttons.test.js.snap | 48 ---- ui/pages/swaps/slippage-buttons/index.js | 1 - ui/pages/swaps/slippage-buttons/index.scss | 111 --------- .../slippage-buttons/slippage-buttons.js | 224 ------------------ .../slippage-buttons.stories.js | 15 -- .../slippage-buttons/slippage-buttons.test.js | 99 -------- 30 files changed, 746 deletions(-) delete mode 100644 ui/pages/swaps/prepare-swap-page/__snapshots__/prepare-swap-page.test.js.snap delete mode 100644 ui/pages/swaps/slippage-buttons/__snapshots__/slippage-buttons.test.js.snap delete mode 100644 ui/pages/swaps/slippage-buttons/index.js delete mode 100644 ui/pages/swaps/slippage-buttons/index.scss delete mode 100644 ui/pages/swaps/slippage-buttons/slippage-buttons.js delete mode 100644 ui/pages/swaps/slippage-buttons/slippage-buttons.stories.js delete mode 100644 ui/pages/swaps/slippage-buttons/slippage-buttons.test.js diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index bc5c5abda623..f77ac8920921 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Hohe Slippage" }, - "swapHighSlippageWarning": { - "message": "Der Slippage-Betrag ist sehr hoch." - }, "swapIncludesMMFee": { "message": "Enthält eine MetaMask-Gebühr von $1%.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Niedrige Slippage" }, - "swapLowSlippageError": { - "message": "Transaktion kann fehlschlagen, maximale Slippage zu niedrig." - }, "swapMaxSlippage": { "message": "Max. Slippage" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0 % Slippage" }, - "swapsAdvancedOptions": { - "message": "Erweiterte Optionen" - }, - "swapsExcessiveSlippageWarning": { - "message": "Der Slippage-Betrag ist zu hoch und wird zu einem schlechten Kurs führen. Bitte reduzieren Sie die Slippage-Toleranz auf einen Wert unter 15 %." - }, "swapsMaxSlippage": { "message": "Slippage-Toleranz" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index dcb1d2a3c827..be5df894c82b 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Υψηλή ολίσθηση" }, - "swapHighSlippageWarning": { - "message": "Το ποσό ολίσθησης είναι πολύ υψηλό." - }, "swapIncludesMMFee": { "message": "Περιλαμβάνει μια χρέωση $1% στο MetaMask.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Χαμηλή ολίσθηση" }, - "swapLowSlippageError": { - "message": "Η συναλλαγή ενδέχεται να αποτύχει, η μέγιστη ολίσθηση είναι πολύ χαμηλή." - }, "swapMaxSlippage": { "message": "Μέγιστη ολίσθηση" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0% Απόκλιση" }, - "swapsAdvancedOptions": { - "message": "Προηγμένες επιλογές" - }, - "swapsExcessiveSlippageWarning": { - "message": "Το ποσοστό απόκλισης είναι πολύ υψηλό και θα οδηγήσει σε χαμηλή τιμή. Παρακαλούμε μειώστε την ανοχή απόκλισης σε τιμή κάτω του 15%." - }, "swapsMaxSlippage": { "message": "Ανοχή απόκλισης" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 892321282e7e..7717bbcb9938 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -5691,9 +5691,6 @@ "swapHighSlippage": { "message": "High slippage" }, - "swapHighSlippageWarning": { - "message": "Slippage amount is very high." - }, "swapIncludesGasAndMetaMaskFee": { "message": "Includes gas and a $1% MetaMask fee", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5719,9 +5716,6 @@ "swapLowSlippage": { "message": "Low slippage" }, - "swapLowSlippageError": { - "message": "Transaction may fail, max slippage too low." - }, "swapMaxSlippage": { "message": "Max slippage" }, @@ -5928,12 +5922,6 @@ "swapZeroSlippage": { "message": "0% Slippage" }, - "swapsAdvancedOptions": { - "message": "Advanced options" - }, - "swapsExcessiveSlippageWarning": { - "message": "Slippage amount is too high and will result in a bad rate. Please reduce your slippage tolerance to a value below 15%." - }, "swapsMaxSlippage": { "message": "Slippage tolerance" }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index bfa5ea23a96e..0d207136be9d 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -5425,9 +5425,6 @@ "swapHighSlippage": { "message": "High slippage" }, - "swapHighSlippageWarning": { - "message": "Slippage amount is very high." - }, "swapIncludesMMFee": { "message": "Includes a $1% MetaMask fee.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5449,9 +5446,6 @@ "swapLowSlippage": { "message": "Low slippage" }, - "swapLowSlippageError": { - "message": "Transaction may fail, max slippage too low." - }, "swapMaxSlippage": { "message": "Max slippage" }, @@ -5658,12 +5652,6 @@ "swapZeroSlippage": { "message": "0% Slippage" }, - "swapsAdvancedOptions": { - "message": "Advanced options" - }, - "swapsExcessiveSlippageWarning": { - "message": "Slippage amount is too high and will result in a bad rate. Please reduce your slippage tolerance to a value below 15%." - }, "swapsMaxSlippage": { "message": "Slippage tolerance" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index de247c24702d..d9e57fbdec32 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -5276,9 +5276,6 @@ "swapHighSlippage": { "message": "Deslizamiento alto" }, - "swapHighSlippageWarning": { - "message": "El monto del deslizamiento es muy alto." - }, "swapIncludesMMFee": { "message": "Incluye una tasa de MetaMask del $1%.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5300,9 +5297,6 @@ "swapLowSlippage": { "message": "Deslizamiento bajo" }, - "swapLowSlippageError": { - "message": "Es posible que la transacción tenga errores, el deslizamiento máximo es demasiado bajo." - }, "swapMaxSlippage": { "message": "Desfase máximo" }, @@ -5509,12 +5503,6 @@ "swapZeroSlippage": { "message": "0 % de deslizamiento" }, - "swapsAdvancedOptions": { - "message": "Opciones avanzadas" - }, - "swapsExcessiveSlippageWarning": { - "message": "El monto del deslizamiento es muy alto, por lo que recibirá una tasa de conversión desfavorable. Disminuya su tolerancia de deslizamiento a un valor menor al 15 %." - }, "swapsMaxSlippage": { "message": "Tolerancia de deslizamiento" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index e4d2ab065d6e..84a496738e65 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -1962,16 +1962,10 @@ "message": "Las tarifas de gas se pagan a los mineros de criptomonedas que procesan transacciones en la red $1. MetaMask no se beneficia de las tarifas de gas.", "description": "$1 is the selected network, e.g. Ethereum or BSC" }, - "swapHighSlippageWarning": { - "message": "El monto del desfase es muy alto." - }, "swapIncludesMMFee": { "message": "Incluye una tasa de MetaMask del $1%.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." }, - "swapLowSlippageError": { - "message": "Es posible que la transacción tenga errores, el desfase máximo es demasiado bajo." - }, "swapMaxSlippage": { "message": "Desfase máximo" }, @@ -2105,12 +2099,6 @@ "swapZeroSlippage": { "message": "0 % de desfase" }, - "swapsAdvancedOptions": { - "message": "Opciones avanzadas" - }, - "swapsExcessiveSlippageWarning": { - "message": "El monto del desfase es muy alto, por lo que recibirá una tasa de conversión desfavorable. Disminuya su tolerancia de desfase a un valor menor al 15 %." - }, "swapsMaxSlippage": { "message": "Tolerancia de desfase" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index ba8ca7c409f6..8a3c99cd72d7 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Important effet de glissement" }, - "swapHighSlippageWarning": { - "message": "Le montant du glissement est très élevé." - }, "swapIncludesMMFee": { "message": "Comprend des frais MetaMask à hauteur de $1 %.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Faible effet de glissement" }, - "swapLowSlippageError": { - "message": "La transaction peut échouer, car le glissement maximal est trop faible." - }, "swapMaxSlippage": { "message": "Glissement maximal" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0 % de glissement" }, - "swapsAdvancedOptions": { - "message": "Options avancées" - }, - "swapsExcessiveSlippageWarning": { - "message": "Le montant du glissement est trop élevé et donnera lieu à un mauvais taux. Veuillez réduire votre tolérance de glissement à une valeur inférieure à 15 %." - }, "swapsMaxSlippage": { "message": "Tolérance au slippage" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 4f2aca604e0c..296b4f030928 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "अधिक स्लिपेज" }, - "swapHighSlippageWarning": { - "message": "स्लिपेज अमाउंट बहुत अधिक है।" - }, "swapIncludesMMFee": { "message": "$1% MetaMask फ़ीस शामिल है।", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "कम स्लिपेज" }, - "swapLowSlippageError": { - "message": "ट्रांसेक्शन विफल हो सकता है, अधिकतम स्लिपेज बहुत कम है।" - }, "swapMaxSlippage": { "message": "अधिकतम स्लिपेज" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0% स्लिपेज" }, - "swapsAdvancedOptions": { - "message": "एडवांस्ड विकल्प" - }, - "swapsExcessiveSlippageWarning": { - "message": "स्लिपेज अमाउंट बहुत अधिक है और इस वजह से खराब दर होगी। कृपया अपने स्लिपेज टॉलरेंस को 15% से नीचे के वैल्यू तक कम करें।" - }, "swapsMaxSlippage": { "message": "स्लिपेज टॉलरेंस" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index ef248b59202b..2d42163a4c88 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Selip tinggi" }, - "swapHighSlippageWarning": { - "message": "Jumlah slippage sangat tinggi." - }, "swapIncludesMMFee": { "message": "Termasuk $1% biaya MetaMask.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Selip rendah" }, - "swapLowSlippageError": { - "message": "Transaksi berpotensi gagal, selip maks terlalu rendah." - }, "swapMaxSlippage": { "message": "Selipi maks" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "Selip 0%" }, - "swapsAdvancedOptions": { - "message": "Opsi lanjutan" - }, - "swapsExcessiveSlippageWarning": { - "message": "Jumlah selip terlalu tinggi dan akan mengakibatkan tarif yang buruk. Kurangi toleransi selip Anda ke nilai di bawah 15%." - }, "swapsMaxSlippage": { "message": "Toleransi selip" }, diff --git a/app/_locales/it/messages.json b/app/_locales/it/messages.json index b05eab6755fc..4dac80c253b3 100644 --- a/app/_locales/it/messages.json +++ b/app/_locales/it/messages.json @@ -1415,9 +1415,6 @@ "swapFetchingQuotesErrorTitle": { "message": "Errore recuperando le quotazioni" }, - "swapLowSlippageError": { - "message": "La transazione può fallire, il massimo slippage è troppo basso." - }, "swapMaxSlippage": { "message": "Slippage massimo" }, @@ -1515,12 +1512,6 @@ "swapUnknown": { "message": "Sconosciuto" }, - "swapsAdvancedOptions": { - "message": "Impostazioni Avanzate" - }, - "swapsExcessiveSlippageWarning": { - "message": "L'importo di slippage è troppo alto e risulterà in una tariffa sconveniente. Riduci la tolleranza allo slippage ad un valore minore di 15%." - }, "swapsMaxSlippage": { "message": "Tolleranza Slippage" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 4afd2ab58f24..09f8e4af9762 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "高スリッページ" }, - "swapHighSlippageWarning": { - "message": "スリッページが非常に大きいです。" - }, "swapIncludesMMFee": { "message": "$1%のMetaMask手数料が含まれています。", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "低スリッページ" }, - "swapLowSlippageError": { - "message": "トランザクションが失敗する可能性があります。最大スリッページが低すぎます。" - }, "swapMaxSlippage": { "message": "最大スリッページ" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0%スリッページ" }, - "swapsAdvancedOptions": { - "message": "詳細オプション" - }, - "swapsExcessiveSlippageWarning": { - "message": "スリッページ額が非常に大きいので、レートが不利になります。最大スリッページを15%未満の値に減らしてください。" - }, "swapsMaxSlippage": { "message": "最大スリッページ" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index f3f499074769..59e89b3ab0cc 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "높은 슬리피지" }, - "swapHighSlippageWarning": { - "message": "슬리패지 금액이 아주 큽니다." - }, "swapIncludesMMFee": { "message": "$1%의 MetaMask 요금이 포함됩니다.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "낮은 슬리피지" }, - "swapLowSlippageError": { - "message": "트랜잭션이 실패할 수도 있습니다. 최대 슬리패지가 너무 낮습니다." - }, "swapMaxSlippage": { "message": "최대 슬리패지" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0% 슬리패지" }, - "swapsAdvancedOptions": { - "message": "고급 옵션" - }, - "swapsExcessiveSlippageWarning": { - "message": "슬리패지 금액이 너무 커서 전환율이 좋지 않습니다. 슬리패지 허용치를 15% 값 이하로 줄이세요." - }, "swapsMaxSlippage": { "message": "슬리피지 허용치" }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index f4ff8d6915b5..23f9c012d74c 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -1316,12 +1316,6 @@ "swapGasFeesSplit": { "message": "Hahatiin sa pagitan ng dalawang transaksyon na ito ang mga bayarin sa gas sa nakaraang screen." }, - "swapHighSlippageWarning": { - "message": "Sobrang laki ng halaga ng slippage." - }, - "swapLowSlippageError": { - "message": "Posibleng hindi magtagumpay ang transaksyon, masyadong mababa ang max na slippage." - }, "swapMaxSlippage": { "message": "Max na slippage" }, @@ -1441,12 +1435,6 @@ "swapZeroSlippage": { "message": "0% Slippage" }, - "swapsAdvancedOptions": { - "message": "Mga Advanced na Opsyon" - }, - "swapsExcessiveSlippageWarning": { - "message": "Masyadong mataas ang halaga ng slippage at magreresulta ito sa masamang rating. Pakibabaan ang iyong tolerance ng slippage sa value na mas mababa sa 15%." - }, "swapsMaxSlippage": { "message": "Tolerance ng Slippage" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 4ccd9b32e4d6..61e03d503c88 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Slippage alto" }, - "swapHighSlippageWarning": { - "message": "O valor de slippage está muito alto." - }, "swapIncludesMMFee": { "message": "Inclui uma taxa de $1% da MetaMask.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Slippage baixo" }, - "swapLowSlippageError": { - "message": "A transação pode falhar; o slippage máximo está baixo demais." - }, "swapMaxSlippage": { "message": "Slippage máximo" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0% de slippage" }, - "swapsAdvancedOptions": { - "message": "Opções avançadas" - }, - "swapsExcessiveSlippageWarning": { - "message": "O valor de slippage está muito alto e resultará em uma taxa ruim. Reduza sua tolerância a slippage para um valor inferior a 15%." - }, "swapsMaxSlippage": { "message": "Tolerância a slippage" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index d2dc2791a983..18ef9976a149 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -1962,16 +1962,10 @@ "message": "As taxas de gás são pagas aos mineradores de criptoativos que processam as transações na rede de $1. A MetaMask não lucra com taxas de gás.", "description": "$1 is the selected network, e.g. Ethereum or BSC" }, - "swapHighSlippageWarning": { - "message": "O valor de slippage está muito alto." - }, "swapIncludesMMFee": { "message": "Inclui uma taxa de $1% da MetaMask.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." }, - "swapLowSlippageError": { - "message": "A transação pode falhar; o slippage máximo está baixo demais." - }, "swapMaxSlippage": { "message": "Slippage máximo" }, @@ -2105,12 +2099,6 @@ "swapZeroSlippage": { "message": "0% de slippage" }, - "swapsAdvancedOptions": { - "message": "Opções avançadas" - }, - "swapsExcessiveSlippageWarning": { - "message": "O valor de slippage está muito alto e resultará em uma taxa ruim. Reduza sua tolerância a slippage para um valor inferior a 15%." - }, "swapsMaxSlippage": { "message": "Tolerância a slippage" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 102f6793fcaf..f024c52f205c 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Высокое проскальзывание" }, - "swapHighSlippageWarning": { - "message": "Сумма проскальзывания очень велика." - }, "swapIncludesMMFee": { "message": "Включает комиссию MetaMask в размере $1%.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Низкое проскальзывание" }, - "swapLowSlippageError": { - "message": "Возможно, не удастся выполнить транзакцию. Ммаксимальное проскальзывание слишком низкое." - }, "swapMaxSlippage": { "message": "Максимальное проскальзывание" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0% проскальзывания" }, - "swapsAdvancedOptions": { - "message": "Дополнительные параметры" - }, - "swapsExcessiveSlippageWarning": { - "message": "Величина проскальзывания очень велика. Сделка будет невыгодной. Снизьте допуск проскальзывания ниже 15%." - }, "swapsMaxSlippage": { "message": "Допуск проскальзывания" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index f83c6ba7bbc0..3c2ade1586ad 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Mataas na slippage" }, - "swapHighSlippageWarning": { - "message": "Napakataas ng halaga ng slippage." - }, "swapIncludesMMFee": { "message": "Kasama ang $1% MetaMask fee.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Mababang slippage" }, - "swapLowSlippageError": { - "message": "Maaaring hindi magtagumpay ang transaksyon, masyadong mababa ang max na slippage." - }, "swapMaxSlippage": { "message": "Max na slippage" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0% Slippage" }, - "swapsAdvancedOptions": { - "message": "Mga Advanced na Opsyon" - }, - "swapsExcessiveSlippageWarning": { - "message": "Masyadong mataas ang halaga ng slippage at magreresulta sa masamang rate. Mangyaring bawasan ang iyong slippage tolerance sa halagang mas mababa sa 15%." - }, "swapsMaxSlippage": { "message": "Slippage tolerance" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index ffa23d934762..9c41cb7bd6b2 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Yüksek kayma" }, - "swapHighSlippageWarning": { - "message": "Kayma tutarı çok yüksek." - }, "swapIncludesMMFee": { "message": "%$1 MetaMask ücreti dahildir.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Düşük kayma" }, - "swapLowSlippageError": { - "message": "İşlem başarısız olabilir, maks. kayma çok düşük." - }, "swapMaxSlippage": { "message": "Maks. kayma" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "%0 Kayma" }, - "swapsAdvancedOptions": { - "message": "Gelişmiş seçenekler" - }, - "swapsExcessiveSlippageWarning": { - "message": "Kayma tutarı çok yüksek ve kötü bir orana neden olacak. Lütfen kayma toleransınızı %15'in altında bir değere düşürün." - }, "swapsMaxSlippage": { "message": "Kayma toleransı" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index c33bee15a291..e7b2659af6b2 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "Mức trượt giá cao" }, - "swapHighSlippageWarning": { - "message": "Số tiền trượt giá rất cao." - }, "swapIncludesMMFee": { "message": "Bao gồm $1% phí của MetaMask.", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "Mức trượt giá thấp" }, - "swapLowSlippageError": { - "message": "Giao dịch có thể không thành công, mức trượt giá tối đa quá thấp." - }, "swapMaxSlippage": { "message": "Mức trượt giá tối đa" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "Mức trượt giá 0%" }, - "swapsAdvancedOptions": { - "message": "Tùy chọn nâng cao" - }, - "swapsExcessiveSlippageWarning": { - "message": "Mức trượt giá quá cao và sẽ dẫn đến tỷ giá không sinh lời. Vui lòng giảm giới hạn trượt giá xuống một giá trị thấp hơn 15%." - }, "swapsMaxSlippage": { "message": "Giới hạn trượt giá" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index c7e30369d9fd..786903e9a42a 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -5279,9 +5279,6 @@ "swapHighSlippage": { "message": "高滑点" }, - "swapHighSlippageWarning": { - "message": "滑点金额非常高。" - }, "swapIncludesMMFee": { "message": "包括 $1% 的 MetaMask 费用。", "description": "Provides information about the fee that metamask takes for swaps. $1 is a decimal number." @@ -5303,9 +5300,6 @@ "swapLowSlippage": { "message": "低滑点" }, - "swapLowSlippageError": { - "message": "交易可能会失败,最大滑点过低。" - }, "swapMaxSlippage": { "message": "最大滑点" }, @@ -5512,12 +5506,6 @@ "swapZeroSlippage": { "message": "0%滑点" }, - "swapsAdvancedOptions": { - "message": "高级选项" - }, - "swapsExcessiveSlippageWarning": { - "message": "滑点金额太高,会导致不良率。请将最大滑点降低到低于15%的值。" - }, "swapsMaxSlippage": { "message": "最大滑点" }, diff --git a/development/ts-migration-dashboard/files-to-convert.json b/development/ts-migration-dashboard/files-to-convert.json index 62ba042a86eb..bc21a744210a 100644 --- a/development/ts-migration-dashboard/files-to-convert.json +++ b/development/ts-migration-dashboard/files-to-convert.json @@ -1552,10 +1552,6 @@ "ui/pages/swaps/select-quote-popover/sort-list/index.js", "ui/pages/swaps/select-quote-popover/sort-list/sort-list.js", "ui/pages/swaps/select-quote-popover/sort-list/sort-list.test.js", - "ui/pages/swaps/slippage-buttons/index.js", - "ui/pages/swaps/slippage-buttons/slippage-buttons.js", - "ui/pages/swaps/slippage-buttons/slippage-buttons.stories.js", - "ui/pages/swaps/slippage-buttons/slippage-buttons.test.js", "ui/pages/swaps/smart-transaction-status/arrow-icon.js", "ui/pages/swaps/smart-transaction-status/arrow-icon.test.js", "ui/pages/swaps/smart-transaction-status/canceled-icon.js", diff --git a/ui/pages/swaps/index.scss b/ui/pages/swaps/index.scss index d900db1e05c2..4de2ac35707f 100644 --- a/ui/pages/swaps/index.scss +++ b/ui/pages/swaps/index.scss @@ -11,7 +11,6 @@ @import 'loading-swaps-quotes/index'; @import 'searchable-item-list/index'; @import 'select-quote-popover/index'; -@import 'slippage-buttons/index'; @import 'swaps-footer/index'; @import 'create-new-swap/index'; @import 'view-on-block-explorer/index'; diff --git a/ui/pages/swaps/prepare-swap-page/__snapshots__/prepare-swap-page.test.js.snap b/ui/pages/swaps/prepare-swap-page/__snapshots__/prepare-swap-page.test.js.snap deleted file mode 100644 index 8991347eecfc..000000000000 --- a/ui/pages/swaps/prepare-swap-page/__snapshots__/prepare-swap-page.test.js.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PrepareSwapPage renders the component with initial props 1`] = `null`; diff --git a/ui/pages/swaps/prepare-swap-page/prepare-swap-page.test.js b/ui/pages/swaps/prepare-swap-page/prepare-swap-page.test.js index d576dad0933d..a76160ef77bb 100644 --- a/ui/pages/swaps/prepare-swap-page/prepare-swap-page.test.js +++ b/ui/pages/swaps/prepare-swap-page/prepare-swap-page.test.js @@ -82,9 +82,6 @@ describe('PrepareSwapPage', () => { store, ); expect(getByText('Select token')).toBeInTheDocument(); - expect( - document.querySelector('.slippage-buttons__button-group'), - ).toMatchSnapshot(); }); it('switches swap from and to tokens', () => { diff --git a/ui/pages/swaps/slippage-buttons/__snapshots__/slippage-buttons.test.js.snap b/ui/pages/swaps/slippage-buttons/__snapshots__/slippage-buttons.test.js.snap deleted file mode 100644 index 4f1f1d15f355..000000000000 --- a/ui/pages/swaps/slippage-buttons/__snapshots__/slippage-buttons.test.js.snap +++ /dev/null @@ -1,48 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`SlippageButtons renders the component with initial props 1`] = ` - -`; - -exports[`SlippageButtons renders the component with initial props 2`] = ` -
- - - -
-`; diff --git a/ui/pages/swaps/slippage-buttons/index.js b/ui/pages/swaps/slippage-buttons/index.js deleted file mode 100644 index 6cdbe8843019..000000000000 --- a/ui/pages/swaps/slippage-buttons/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from './slippage-buttons'; diff --git a/ui/pages/swaps/slippage-buttons/index.scss b/ui/pages/swaps/slippage-buttons/index.scss deleted file mode 100644 index de6e68ba3556..000000000000 --- a/ui/pages/swaps/slippage-buttons/index.scss +++ /dev/null @@ -1,111 +0,0 @@ -@use "design-system"; - -.slippage-buttons { - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: center; - - &__header { - display: flex; - align-items: center; - color: var(--color-primary-default); - margin-bottom: 0; - margin-left: auto; - margin-right: auto; - background: unset; - - &--open { - margin-bottom: 8px; - } - } - - &__content { - padding-left: 10px; - } - - &__dropdown-content { - display: flex; - align-items: center; - } - - &__buttons-prefix { - display: flex; - align-items: center; - margin-right: 8px; - } - - &__button-group { - & &-custom-button { - cursor: text; - display: flex; - align-items: center; - justify-content: center; - position: relative; - min-width: 72px; - margin-right: 0; - } - } - - &__custom-input { - display: flex; - justify-content: center; - - input { - border: none; - width: 64px; - text-align: center; - background: var(--color-primary-default); - color: var(--color-primary-inverse); - font-weight: inherit; - - &::-webkit-input-placeholder { /* WebKit, Blink, Edge */ - color: var(--color-primary-inverse); - } - - &:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ - color: var(--color-primary-inverse); - opacity: 1; - } - - &::-moz-placeholder { /* Mozilla Firefox 19+ */ - color: var(--color-primary-inverse); - opacity: 1; - } - - &:-ms-input-placeholder { /* Internet Explorer 10-11 */ - color: var(--color-primary-inverse); - } - - &::-ms-input-placeholder { /* Microsoft Edge */ - color: var(--color-primary-inverse); - } - - &::placeholder { /* Most modern browsers support this now. */ - color: var(--color-primary-inverse); - } - } - - input::-webkit-outer-spin-button, - input::-webkit-inner-spin-button { - /* display: none; <- Crashes Chrome on hover */ - -webkit-appearance: none; - margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ - } - - input[type=number] { - -moz-appearance: textfield; - } - - &--danger { - input { - background: var(--color-error-default); - } - } - } - - &__percentage-suffix { - position: absolute; - right: 5px; - } -} diff --git a/ui/pages/swaps/slippage-buttons/slippage-buttons.js b/ui/pages/swaps/slippage-buttons/slippage-buttons.js deleted file mode 100644 index 387958753e3c..000000000000 --- a/ui/pages/swaps/slippage-buttons/slippage-buttons.js +++ /dev/null @@ -1,224 +0,0 @@ -import React, { useState, useEffect, useContext } from 'react'; -import PropTypes from 'prop-types'; -import classnames from 'classnames'; -import { I18nContext } from '../../../contexts/i18n'; -import ButtonGroup from '../../../components/ui/button-group'; -import Button from '../../../components/ui/button'; -import InfoTooltip from '../../../components/ui/info-tooltip'; -import { Slippage } from '../../../../shared/constants/swaps'; -import { Text } from '../../../components/component-library'; -import { - TextVariant, - TextColor, -} from '../../../helpers/constants/design-system'; - -export default function SlippageButtons({ - onSelect, - maxAllowedSlippage, - currentSlippage, - isDirectWrappingEnabled, -}) { - const t = useContext(I18nContext); - const [customValue, setCustomValue] = useState(() => { - if ( - typeof currentSlippage === 'number' && - !Object.values(Slippage).includes(currentSlippage) - ) { - return currentSlippage.toString(); - } - return ''; - }); - const [enteringCustomValue, setEnteringCustomValue] = useState(false); - const [activeButtonIndex, setActiveButtonIndex] = useState(() => { - if (currentSlippage === Slippage.high) { - return 1; // 3% slippage. - } else if (currentSlippage === Slippage.default) { - return 0; // 2% slippage. - } else if (typeof currentSlippage === 'number') { - return 2; // Custom slippage. - } - return 0; - }); - const [open, setOpen] = useState(() => { - return currentSlippage !== Slippage.default; // Only open Advanced options by default if it's not default slippage. - }); - const [inputRef, setInputRef] = useState(null); - - let errorText = ''; - if (customValue) { - // customValue is a string, e.g. '0' - if (Number(customValue) < 0) { - errorText = t('swapSlippageNegative'); - } else if (Number(customValue) > 0 && Number(customValue) <= 1) { - // We will not show this warning for 0% slippage, because we will only - // return non-slippage quotes from off-chain makers. - errorText = t('swapLowSlippageError'); - } else if ( - Number(customValue) >= 5 && - Number(customValue) <= maxAllowedSlippage - ) { - errorText = t('swapHighSlippageWarning'); - } else if (Number(customValue) > maxAllowedSlippage) { - errorText = t('swapsExcessiveSlippageWarning'); - } - } - - const customValueText = customValue || t('swapCustom'); - - useEffect(() => { - if ( - inputRef && - enteringCustomValue && - window.document.activeElement !== inputRef - ) { - inputRef.focus(); - } - }, [inputRef, enteringCustomValue]); - - return ( -
- -
- {open && ( - <> - {!isDirectWrappingEnabled && ( -
-
- - {t('swapsMaxSlippage')} - - -
- - - - - -
- )} - - )} - {errorText && ( - - {errorText} - - )} -
-
- ); -} - -SlippageButtons.propTypes = { - onSelect: PropTypes.func.isRequired, - maxAllowedSlippage: PropTypes.number.isRequired, - currentSlippage: PropTypes.number, - isDirectWrappingEnabled: PropTypes.bool, -}; diff --git a/ui/pages/swaps/slippage-buttons/slippage-buttons.stories.js b/ui/pages/swaps/slippage-buttons/slippage-buttons.stories.js deleted file mode 100644 index 68cfd8762f44..000000000000 --- a/ui/pages/swaps/slippage-buttons/slippage-buttons.stories.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { action } from '@storybook/addon-actions'; -import SlippageButtons from './slippage-buttons'; - -export default { - title: 'Pages/Swaps/SlippageButtons', -}; - -export const DefaultStory = () => ( -
- -
-); - -DefaultStory.storyName = 'Default'; diff --git a/ui/pages/swaps/slippage-buttons/slippage-buttons.test.js b/ui/pages/swaps/slippage-buttons/slippage-buttons.test.js deleted file mode 100644 index 7834eefd59ea..000000000000 --- a/ui/pages/swaps/slippage-buttons/slippage-buttons.test.js +++ /dev/null @@ -1,99 +0,0 @@ -import React from 'react'; - -import { renderWithProvider, fireEvent } from '../../../../test/jest'; -import { Slippage } from '../../../../shared/constants/swaps'; -import SlippageButtons from './slippage-buttons'; - -const createProps = (customProps = {}) => { - return { - onSelect: jest.fn(), - maxAllowedSlippage: 15, - currentSlippage: Slippage.high, - smartTransactionsEnabled: false, - ...customProps, - }; -}; - -describe('SlippageButtons', () => { - it('renders the component with initial props', () => { - const { getByText, queryByText, getByTestId } = renderWithProvider( - , - ); - expect(getByText('2%')).toBeInTheDocument(); - expect(getByText('3%')).toBeInTheDocument(); - expect(getByText('custom')).toBeInTheDocument(); - expect(getByText('Advanced options')).toBeInTheDocument(); - expect( - document.querySelector('.slippage-buttons__header'), - ).toMatchSnapshot(); - expect( - document.querySelector('.slippage-buttons__button-group'), - ).toMatchSnapshot(); - expect(queryByText('Smart Swaps')).not.toBeInTheDocument(); - expect(getByTestId('button-group__button1')).toHaveAttribute( - 'aria-checked', - 'true', - ); - }); - - it('renders slippage with a custom value', () => { - const { getByText } = renderWithProvider( - , - ); - expect(getByText('2.5')).toBeInTheDocument(); - }); - - it('renders the default slippage with Advanced options hidden', () => { - const { getByText, queryByText } = renderWithProvider( - , - ); - expect(getByText('Advanced options')).toBeInTheDocument(); - expect(document.querySelector('.fa-angle-down')).toBeInTheDocument(); - expect(queryByText('2%')).not.toBeInTheDocument(); - }); - - it('opens the Advanced options section and sets a default slippage', () => { - const { getByText, getByTestId } = renderWithProvider( - , - ); - fireEvent.click(getByText('Advanced options')); - fireEvent.click(getByTestId('button-group__button0')); - expect(getByTestId('button-group__button0')).toHaveAttribute( - 'aria-checked', - 'true', - ); - }); - - it('opens the Advanced options section and sets a high slippage', () => { - const { getByText, getByTestId } = renderWithProvider( - , - ); - fireEvent.click(getByText('Advanced options')); - fireEvent.click(getByTestId('button-group__button1')); - expect(getByTestId('button-group__button1')).toHaveAttribute( - 'aria-checked', - 'true', - ); - }); - - it('sets a custom slippage value', () => { - const { getByTestId } = renderWithProvider( - , - ); - fireEvent.click(getByTestId('button-group__button2')); - expect(getByTestId('button-group__button2')).toHaveAttribute( - 'aria-checked', - 'true', - ); - const input = getByTestId('slippage-buttons__custom-slippage'); - fireEvent.change(input, { target: { value: 5 } }); - fireEvent.click(document); - expect(input).toHaveAttribute('value', '5'); - }); -}); From 39785e40d9712d4ec27eb9df740bf77af6d72bd9 Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Mon, 7 Oct 2024 13:37:06 -0500 Subject: [PATCH 7/8] chore: fix lint issues --- ui/pages/swaps/index.js | 4 +- ui/pages/swaps/selected-token/index.scss | 4 +- .../swaps/selected-token/selected-token.js | 86 +++++++++---------- 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/ui/pages/swaps/index.js b/ui/pages/swaps/index.js index 214f92c2c296..cf079acc9623 100644 --- a/ui/pages/swaps/index.js +++ b/ui/pages/swaps/index.js @@ -399,9 +399,7 @@ export default function Swap() { )}
-
+
-
-
- {hasIcon && ( - +
-
- - {selectedToken?.symbol || t('swapSelectAToken')} - + data-testid="selected-token-list" + tabIndex="0" + onClick={onClick} + onKeyUp={onKeyUp} + > +
+ {hasIcon && ( + + )} +
+
+ + {selectedToken?.symbol || t('swapSelectAToken')} + +
+
- -
); } From 81d8db193d6573c1a0c4c832551a0769e8a02c94 Mon Sep 17 00:00:00 2001 From: Marta Poling Date: Mon, 7 Oct 2024 14:57:40 -0500 Subject: [PATCH 8/8] chore: remove unused translation item --- app/_locales/de/messages.json | 3 --- app/_locales/el/messages.json | 3 --- app/_locales/en/messages.json | 3 --- app/_locales/en_GB/messages.json | 3 --- app/_locales/es/messages.json | 3 --- app/_locales/es_419/messages.json | 3 --- app/_locales/fr/messages.json | 3 --- app/_locales/hi/messages.json | 3 --- app/_locales/id/messages.json | 3 --- app/_locales/ja/messages.json | 3 --- app/_locales/ko/messages.json | 3 --- app/_locales/ph/messages.json | 3 --- app/_locales/pt/messages.json | 3 --- app/_locales/pt_BR/messages.json | 3 --- app/_locales/ru/messages.json | 3 --- app/_locales/tl/messages.json | 3 --- app/_locales/tr/messages.json | 3 --- app/_locales/vi/messages.json | 3 --- app/_locales/zh_CN/messages.json | 3 --- 19 files changed, 57 deletions(-) diff --git a/app/_locales/de/messages.json b/app/_locales/de/messages.json index f77ac8920921..d7d6301ae1fc 100644 --- a/app/_locales/de/messages.json +++ b/app/_locales/de/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Niedriger Slippage" }, - "swapSlippageNegative": { - "message": "Slippage muss größer oder gleich Null sein" - }, "swapSlippageNegativeDescription": { "message": "Slippage muss größer oder gleich Null sein" }, diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index be5df894c82b..0568043f4012 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Χαμηλή απόκλιση" }, - "swapSlippageNegative": { - "message": "Η απόκλιση πρέπει να είναι μεγαλύτερη ή ίση με το μηδέν" - }, "swapSlippageNegativeDescription": { "message": "Η απόκλιση πρέπει να είναι μεγαλύτερη ή ίση με μηδέν" }, diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 7717bbcb9938..955bc1436f58 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -5828,9 +5828,6 @@ "swapSlippageLowTitle": { "message": "Low slippage" }, - "swapSlippageNegative": { - "message": "Slippage must be greater or equal to zero" - }, "swapSlippageNegativeDescription": { "message": "Slippage must be greater or equal to zero" }, diff --git a/app/_locales/en_GB/messages.json b/app/_locales/en_GB/messages.json index 0d207136be9d..fc635e33a708 100644 --- a/app/_locales/en_GB/messages.json +++ b/app/_locales/en_GB/messages.json @@ -5558,9 +5558,6 @@ "swapSlippageLowTitle": { "message": "Low slippage" }, - "swapSlippageNegative": { - "message": "Slippage must be greater or equal to zero" - }, "swapSlippageNegativeDescription": { "message": "Slippage must be greater or equal to zero" }, diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json index d9e57fbdec32..5d0b73dc8320 100644 --- a/app/_locales/es/messages.json +++ b/app/_locales/es/messages.json @@ -5409,9 +5409,6 @@ "swapSlippageLowTitle": { "message": "Deslizamiento bajo" }, - "swapSlippageNegative": { - "message": "El deslizamiento debe ser mayor o igual que cero" - }, "swapSlippageNegativeDescription": { "message": "El deslizamiento debe ser mayor o igual que cero" }, diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json index 84a496738e65..672823c370ba 100644 --- a/app/_locales/es_419/messages.json +++ b/app/_locales/es_419/messages.json @@ -2047,9 +2047,6 @@ "swapSelectQuotePopoverDescription": { "message": "A continuación se muestran todas las cotizaciones recopiladas de diversas fuentes de liquidez." }, - "swapSlippageNegative": { - "message": "El desfase debe ser mayor o igual que cero" - }, "swapSource": { "message": "Fuente de liquidez" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 8a3c99cd72d7..21250169ffdc 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Faible effet de glissement" }, - "swapSlippageNegative": { - "message": "Le glissement doit être supérieur ou égal à zéro" - }, "swapSlippageNegativeDescription": { "message": "Le slippage doit être supérieur ou égal à zéro" }, diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index 296b4f030928..7eea762d1d57 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "कम स्लिपेज" }, - "swapSlippageNegative": { - "message": "स्लिपेज शून्य से अधिक या बराबर होना चाहिए" - }, "swapSlippageNegativeDescription": { "message": "स्लिपेज शून्य से अधिक या बराबर होना चाहिए" }, diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 2d42163a4c88..f3fe6141e2ed 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Selip rendah" }, - "swapSlippageNegative": { - "message": "Selip harus lebih besar atau sama dengan nol" - }, "swapSlippageNegativeDescription": { "message": "Selip harus lebih besar atau sama dengan nol" }, diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index 09f8e4af9762..af6be4b37e7b 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "低スリッページ" }, - "swapSlippageNegative": { - "message": "スリッページは0以上でなければなりません。" - }, "swapSlippageNegativeDescription": { "message": "スリッページは0以上でなければなりません" }, diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 59e89b3ab0cc..3fe8ac15b118 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "낮은 슬리피지" }, - "swapSlippageNegative": { - "message": "슬리패지는 0보다 크거나 같아야 합니다." - }, "swapSlippageNegativeDescription": { "message": "슬리피지는 0보다 크거나 같아야 합니다." }, diff --git a/app/_locales/ph/messages.json b/app/_locales/ph/messages.json index 23f9c012d74c..1687cb7818f0 100644 --- a/app/_locales/ph/messages.json +++ b/app/_locales/ph/messages.json @@ -1393,9 +1393,6 @@ "swapSelectQuotePopoverDescription": { "message": "Makikita sa ibaba ang lahat ng quote na nakuha mula sa maraming pinagkukunan ng liquidity." }, - "swapSlippageNegative": { - "message": "Dapat ay mas malaki sa o katumbas ng zero ang slippage" - }, "swapSource": { "message": "Pinagkunan ng liquidity" }, diff --git a/app/_locales/pt/messages.json b/app/_locales/pt/messages.json index 61e03d503c88..8893b8eb4a7d 100644 --- a/app/_locales/pt/messages.json +++ b/app/_locales/pt/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Slippage baixo" }, - "swapSlippageNegative": { - "message": "O slippage deve ser maior ou igual a zero" - }, "swapSlippageNegativeDescription": { "message": "O slippage deve ser maior ou igual a zero" }, diff --git a/app/_locales/pt_BR/messages.json b/app/_locales/pt_BR/messages.json index 18ef9976a149..6062013d6d6f 100644 --- a/app/_locales/pt_BR/messages.json +++ b/app/_locales/pt_BR/messages.json @@ -2047,9 +2047,6 @@ "swapSelectQuotePopoverDescription": { "message": "Abaixo estão todas as cotações reunidas de diversas fontes de liquidez." }, - "swapSlippageNegative": { - "message": "O slippage deve ser maior ou igual a zero" - }, "swapSource": { "message": "Fonte de liquidez" }, diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index f024c52f205c..6dfb865f2af4 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Низкое проскальзывание" }, - "swapSlippageNegative": { - "message": "Проскальзывание должно быть больше нуля или равно нулю" - }, "swapSlippageNegativeDescription": { "message": "Проскальзывание должно быть больше или равно нулю" }, diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index 3c2ade1586ad..fc78fcef911d 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Mababang slippage" }, - "swapSlippageNegative": { - "message": "Ang slippage ay dapat mas malaki o katumbas ng zero" - }, "swapSlippageNegativeDescription": { "message": "Dapat na mas malaki o katumbas ng zero ang slippage" }, diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index 9c41cb7bd6b2..ee0a6c62cb52 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Düşük kayma" }, - "swapSlippageNegative": { - "message": "Kayma en az sıfır olmalıdır" - }, "swapSlippageNegativeDescription": { "message": "Kayma en az sıfır olmalıdır" }, diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index e7b2659af6b2..aeffda3ac634 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "Mức trượt giá thấp" }, - "swapSlippageNegative": { - "message": "Mức trượt giá phải lớn hơn hoặc bằng 0" - }, "swapSlippageNegativeDescription": { "message": "Mức trượt giá phải lớn hơn hoặc bằng 0" }, diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index 786903e9a42a..83aea34f655d 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -5412,9 +5412,6 @@ "swapSlippageLowTitle": { "message": "低滑点" }, - "swapSlippageNegative": { - "message": "滑点必须大于或等于0" - }, "swapSlippageNegativeDescription": { "message": "滑点必须大于或等于 0" },