From 79d18272dee4cdf3ff919223a49cb9c435a63447 Mon Sep 17 00:00:00 2001 From: yakuramori <62520712+yury-dubinin@users.noreply.github.com> Date: Wed, 13 Nov 2024 17:00:11 +0100 Subject: [PATCH 1/2] Updated ATOM tests and swap amounts (#3948) * Updated ATOM tests and swap amounts --- packages/web/e2e/tests/stables.wallet.spec.ts | 2 +- packages/web/e2e/tests/trade.wallet.spec.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/web/e2e/tests/stables.wallet.spec.ts b/packages/web/e2e/tests/stables.wallet.spec.ts index 52b05d6cf3..0cf3715892 100644 --- a/packages/web/e2e/tests/stables.wallet.spec.ts +++ b/packages/web/e2e/tests/stables.wallet.spec.ts @@ -18,7 +18,7 @@ test.describe("Test Swap Stables feature", () => { "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858"; const allUSDT = "factory/osmo1em6xs47hd82806f5cxgyufguxrrc7l0aqx7nzzptjuqgswczk8csavdxek/alloyed/allUSDT"; - const swapAmount = "0.25"; + const swapAmount = "0.55"; test.beforeAll(async () => { const pathToExtension = new UnzipExtension().getPathToExtension(); diff --git a/packages/web/e2e/tests/trade.wallet.spec.ts b/packages/web/e2e/tests/trade.wallet.spec.ts index 7cc06250ab..dc5fb8e54b 100644 --- a/packages/web/e2e/tests/trade.wallet.spec.ts +++ b/packages/web/e2e/tests/trade.wallet.spec.ts @@ -1,6 +1,5 @@ /* eslint-disable import/no-extraneous-dependencies */ import { type BrowserContext, chromium, expect, test } from "@playwright/test"; -import process from "process"; import { TransactionsPage } from "~/e2e/pages/transactions-page"; import { TestConfig } from "~/e2e/test-config"; @@ -47,14 +46,14 @@ test.describe("Test Trade feature", () => { await context.close(); }); - test("User should be able to Buy OSMO", async () => { + test("User should be able to Buy ATOM", async () => { await tradePage.goto(); await tradePage.openBuyTab(); - await tradePage.selectAsset("OSMO"); - await tradePage.enterAmount("1.1"); + await tradePage.selectAsset("ATOM"); + await tradePage.enterAmount("1.12"); const { msgContentAmount } = await tradePage.buyAndGetWalletMsg(context); expect(msgContentAmount).toBeTruthy(); - expect(msgContentAmount).toContain("token_out_denom: uosmo"); + expect(msgContentAmount).toContain(`denom: ${ATOM}`); expect(msgContentAmount).toContain("type: osmosis/poolmanager/"); expect(msgContentAmount).toContain(`denom: ${USDC}`); await tradePage.isTransactionSuccesful(); From dba7d078af4196677ae45ad0c4a9107172538c73 Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Thu, 14 Nov 2024 11:45:03 -0400 Subject: [PATCH 2/2] (Asset listing) Fix preview assets flag (#3949) * fix: preview assets flag * improvement: remove unnecessary exports --- packages/web/hooks/use-show-preview-assets.ts | 77 ++++++++++++++++++- packages/web/localizations/de.json | 3 + packages/web/localizations/en.json | 3 + packages/web/localizations/es.json | 3 + packages/web/localizations/fa.json | 3 + packages/web/localizations/fr.json | 3 + packages/web/localizations/gu.json | 3 + packages/web/localizations/hi.json | 3 + packages/web/localizations/ja.json | 3 + packages/web/localizations/ko.json | 3 + packages/web/localizations/pl.json | 3 + packages/web/localizations/pt-br.json | 3 + packages/web/localizations/ro.json | 3 + packages/web/localizations/ru.json | 3 + packages/web/localizations/tr.json | 3 + packages/web/localizations/zh-cn.json | 3 + packages/web/localizations/zh-hk.json | 3 + packages/web/localizations/zh-tw.json | 3 + 18 files changed, 124 insertions(+), 4 deletions(-) diff --git a/packages/web/hooks/use-show-preview-assets.ts b/packages/web/hooks/use-show-preview-assets.ts index 6511116d00..726f4a7c1c 100644 --- a/packages/web/hooks/use-show-preview-assets.ts +++ b/packages/web/hooks/use-show-preview-assets.ts @@ -1,13 +1,82 @@ -import { useSessionStorage } from "react-use"; +import { useMount } from "react-use"; +import { create } from "zustand"; +import { createJSONStorage, persist } from "zustand/middleware"; + +import { displayToast } from "~/components/alert/toast"; +import { ToastType } from "~/components/alert/types"; const ShowPreviewAssetsKey = "show_preview_assets"; +interface PreviewAssetsState { + initialized: boolean; + showPreviewAssets: boolean; + setShowPreviewAssets: (value: boolean) => void; +} + +const usePreviewAssetsStore = create()( + persist( + (set) => ({ + initialized: false, + showPreviewAssets: false, + setShowPreviewAssets: (value: boolean) => { + if (value === true) { + displayToast( + { + titleTranslationKey: "previewAssetsEnabled", + captionTranslationKey: "previewAssetsEnabledForSession", + }, + ToastType.SUCCESS + ); + } else { + displayToast( + { + titleTranslationKey: "previewAssetsDisabled", + }, + ToastType.SUCCESS + ); + } + + set({ initialized: true, showPreviewAssets: value }); + }, + }), + { + name: ShowPreviewAssetsKey, + partialize: (state) => ({ + showPreviewAssets: state.showPreviewAssets, + }), + storage: createJSONStorage(() => sessionStorage), + } + ) +); + export const useShowPreviewAssets = () => { - const [showPreviewAssets] = useSessionStorage( - ShowPreviewAssetsKey, - false + const { showPreviewAssets, setShowPreviewAssets } = usePreviewAssetsStore( + (state) => ({ + showPreviewAssets: state.showPreviewAssets, + setShowPreviewAssets: state.setShowPreviewAssets, + }) ); + useMount(() => { + if (usePreviewAssetsStore.getState().initialized) return; + + const urlParams = new URLSearchParams(window.location.search); + + if ( + urlParams.get(ShowPreviewAssetsKey) === "true" && + showPreviewAssets !== true + ) { + return setShowPreviewAssets(true); + } + + if ( + urlParams.get(ShowPreviewAssetsKey) === "false" && + showPreviewAssets === true + ) { + return setShowPreviewAssets(false); + } + }); + return { showPreviewAssets, }; diff --git a/packages/web/localizations/de.json b/packages/web/localizations/de.json index 53e68c350e..89e824c99a 100644 --- a/packages/web/localizations/de.json +++ b/packages/web/localizations/de.json @@ -1274,6 +1274,9 @@ "tradeFee": "Handelsgebühr", "receiveAtLeast": "Erhalten Sie mindestens", "payAtMost": "Bezahlen Sie höchstens", + "previewAssetsEnabled": "Vorschau von Assets aktiviert", + "previewAssetsDisabled": "Vorschau von Assets deaktiviert", + "previewAssetsEnabledForSession": "Vorschau von Assets für diese Sitzung aktiviert. Um sie zu deaktivieren, öffnen Sie eine neue Registerkarte oder hängen Sie `show_preview_assets=false` an.", "alloyedAssets": { "title": "Erkannte Varianten", "caption": "Verabschieden Sie sich von all den verwirrenden Asset-Varianten. Begrüßen Sie ein nahtloseres Erlebnis mit Osmosis.", diff --git a/packages/web/localizations/en.json b/packages/web/localizations/en.json index c84e3fe493..76bd54a901 100644 --- a/packages/web/localizations/en.json +++ b/packages/web/localizations/en.json @@ -1274,6 +1274,9 @@ "tradeFee": "Trade fee", "receiveAtLeast": "Receive at least", "payAtMost": "Sell at most", + "previewAssetsEnabled": "Preview assets enabled", + "previewAssetsDisabled": "Preview assets disabled", + "previewAssetsEnabledForSession": "Preview assets enabled for this session. To disable open a new tab, or append `show_preview_assets=false`.", "alloyedAssets": { "title": "Variants Detected", "caption": "Say goodbye to all those confusing asset variants. Say hello to a more seamless experience on Osmosis.", diff --git a/packages/web/localizations/es.json b/packages/web/localizations/es.json index 75c02e5354..048148c21f 100644 --- a/packages/web/localizations/es.json +++ b/packages/web/localizations/es.json @@ -1274,6 +1274,9 @@ "tradeFee": "Tarifa de comercio", "receiveAtLeast": "Recibir al menos", "payAtMost": "Pagar como máximo", + "previewAssetsEnabled": "Vista previa de activos habilitada", + "previewAssetsDisabled": "Vista previa de activos deshabilitada", + "previewAssetsEnabledForSession": "Obtenga una vista previa de los activos habilitados para esta sesión. Para deshabilitarlos, abra una nueva pestaña o agregue `show_preview_assets=false`.", "alloyedAssets": { "title": "Variantes detectadas", "caption": "Dile adiós a todas esas variantes de activos confusas. Saluda a una experiencia más fluida en Osmosis.", diff --git a/packages/web/localizations/fa.json b/packages/web/localizations/fa.json index dbe7342deb..33eed3172e 100644 --- a/packages/web/localizations/fa.json +++ b/packages/web/localizations/fa.json @@ -1274,6 +1274,9 @@ "tradeFee": "کارمزد تجارت", "receiveAtLeast": "حداقل دریافت کنید", "payAtMost": "حداکثر پرداخت کنید", + "previewAssetsEnabled": "پیش‌نمایش دارایی‌ها فعال شد", + "previewAssetsDisabled": "پیش‌نمایش دارایی‌ها غیرفعال شد", + "previewAssetsEnabledForSession": "پیش‌نمایش دارایی‌های فعال برای این جلسه. برای غیرفعال کردن، یک برگه جدید باز کنید یا «show_preview_assets=false» را اضافه کنید.", "alloyedAssets": { "title": "انواع مختلف شناسایی شد", "caption": "با همه آن گونه های دارایی گیج کننده خداحافظی کنید. به تجربه یکپارچه تر در اسموز سلام کنید.", diff --git a/packages/web/localizations/fr.json b/packages/web/localizations/fr.json index cba27845a4..9debead1e0 100644 --- a/packages/web/localizations/fr.json +++ b/packages/web/localizations/fr.json @@ -1274,6 +1274,9 @@ "tradeFee": "Frais de transaction", "receiveAtLeast": "Recevez au moins", "payAtMost": "Payer au maximum", + "previewAssetsEnabled": "Aperçu des ressources activé", + "previewAssetsDisabled": "Aperçu des ressources désactivé", + "previewAssetsEnabledForSession": "Les ressources d'aperçu sont activées pour cette session. Pour désactiver, ouvrez un nouvel onglet ou ajoutez `show_preview_assets=false`.", "alloyedAssets": { "title": "Variantes détectées", "caption": "Dites adieu à toutes ces variantes d'actifs déroutantes. Dites bonjour à une expérience plus fluide sur Osmosis.", diff --git a/packages/web/localizations/gu.json b/packages/web/localizations/gu.json index a4af86e0d6..0c55483f47 100644 --- a/packages/web/localizations/gu.json +++ b/packages/web/localizations/gu.json @@ -1274,6 +1274,9 @@ "tradeFee": "વેપાર ફી", "receiveAtLeast": "ઓછામાં ઓછું પ્રાપ્ત કરો", "payAtMost": "વધુમાં વધુ ચૂકવણી કરો", + "previewAssetsEnabled": "પૂર્વાવલોકન સંપત્તિ સક્ષમ", + "previewAssetsDisabled": "પૂર્વાવલોકન સંપત્તિ અક્ષમ છે", + "previewAssetsEnabledForSession": "આ સત્ર માટે પૂર્વાવલોકન સંપત્તિઓ સક્ષમ છે. નિષ્ક્રિય કરવા માટે નવી ટેબ ખોલો અથવા `શો_પ્રિવ્યુ_એસેટ્સ=ફોલ` ઉમેરો.", "alloyedAssets": { "title": "વેરિઅન્ટ્સ મળી આવ્યા", "caption": "તે બધા મૂંઝવણભર્યા એસેટ વેરિઅન્ટ્સને ગુડબાય કહો. ઓસ્મોસિસ પર વધુ સીમલેસ અનુભવ માટે હેલો કહો.", diff --git a/packages/web/localizations/hi.json b/packages/web/localizations/hi.json index 9d266595cb..a9d8c1d0fd 100644 --- a/packages/web/localizations/hi.json +++ b/packages/web/localizations/hi.json @@ -1274,6 +1274,9 @@ "tradeFee": "व्यापार शुल्क", "receiveAtLeast": "कम से कम प्राप्त करें", "payAtMost": "अधिकतम भुगतान करें", + "previewAssetsEnabled": "संपत्तियों का पूर्वावलोकन सक्षम किया गया", + "previewAssetsDisabled": "संपत्तियों का पूर्वावलोकन अक्षम किया गया", + "previewAssetsEnabledForSession": "इस सत्र के लिए पूर्वावलोकन संपत्ति सक्षम है। अक्षम करने के लिए एक नया टैब खोलें, या `show_preview_assets=false` जोड़ें।", "alloyedAssets": { "title": "पता लगाए गए वेरिएंट", "caption": "उन सभी भ्रामक परिसंपत्ति प्रकारों को अलविदा कहें। ओस्मोसिस पर अधिक सहज अनुभव का स्वागत करें।", diff --git a/packages/web/localizations/ja.json b/packages/web/localizations/ja.json index 0255e1b91f..764bd43837 100644 --- a/packages/web/localizations/ja.json +++ b/packages/web/localizations/ja.json @@ -1274,6 +1274,9 @@ "tradeFee": "取引手数料", "receiveAtLeast": "少なくとも受け取る", "payAtMost": "最大で支払う", + "previewAssetsEnabled": "プレビューアセットが有効", + "previewAssetsDisabled": "プレビューアセットが無効になっています", + "previewAssetsEnabledForSession": "このセッションではプレビュー アセットが有効になっています。無効にするには、新しいタブを開くか、`show_preview_assets=false` を追加します。", "alloyedAssets": { "title": "検出された変異体", "caption": "混乱を招くアセットバリアントとはお別れです。Osmosis のよりシームレスなエクスペリエンスをお楽しみください。", diff --git a/packages/web/localizations/ko.json b/packages/web/localizations/ko.json index f9d2ba1e61..d965e27530 100644 --- a/packages/web/localizations/ko.json +++ b/packages/web/localizations/ko.json @@ -1274,6 +1274,9 @@ "tradeFee": "거래 수수료", "receiveAtLeast": "최소한 받다", "payAtMost": "최대 지불", + "previewAssetsEnabled": "미리보기 자산 활성화됨", + "previewAssetsDisabled": "미리보기 자산 비활성화", + "previewAssetsEnabledForSession": "이 세션에서 미리보기 자산이 활성화되었습니다. 비활성화하려면 새 탭을 열거나 `show_preview_assets=false`를 추가합니다.", "alloyedAssets": { "title": "변종 감지됨", "caption": "혼란스러운 자산 변형에 작별 인사를 전하세요. Osmosis에서 더욱 매끄러운 경험을 만나보세요.", diff --git a/packages/web/localizations/pl.json b/packages/web/localizations/pl.json index 38789efd54..8992b8ad2b 100644 --- a/packages/web/localizations/pl.json +++ b/packages/web/localizations/pl.json @@ -1274,6 +1274,9 @@ "tradeFee": "Opłata za handel", "receiveAtLeast": "Otrzymaj co najmniej", "payAtMost": "Zapłać maksymalnie", + "previewAssetsEnabled": "Podgląd zasobów włączony", + "previewAssetsDisabled": "Podgląd zasobów wyłączony", + "previewAssetsEnabledForSession": "Podgląd zasobów włączonych dla tej sesji. Aby wyłączyć, otwórz nową kartę lub dołącz `show_preview_assets=false`.", "alloyedAssets": { "title": "Wykryto warianty", "caption": "Pożegnaj się ze wszystkimi tymi mylącymi wariantami aktywów. Przywitaj się z bardziej płynnym doświadczeniem w Osmosis.", diff --git a/packages/web/localizations/pt-br.json b/packages/web/localizations/pt-br.json index ac10bd7b80..8613046c51 100644 --- a/packages/web/localizations/pt-br.json +++ b/packages/web/localizations/pt-br.json @@ -1274,6 +1274,9 @@ "tradeFee": "Taxa de negociação", "receiveAtLeast": "Receba pelo menos", "payAtMost": "Pague no máximo", + "previewAssetsEnabled": "Visualizar ativos habilitados", + "previewAssetsDisabled": "Visualizar ativos desabilitados", + "previewAssetsEnabledForSession": "Visualizar ativos habilitados para esta sessão. Para desabilitar, abra uma nova aba ou anexe `show_preview_assets=false`.", "alloyedAssets": { "title": "Variantes Detectadas", "caption": "Diga adeus a todas essas variantes de ativos confusas. Diga olá a uma experiência mais integrada no Osmosis.", diff --git a/packages/web/localizations/ro.json b/packages/web/localizations/ro.json index 372c44323a..b63e0818dc 100644 --- a/packages/web/localizations/ro.json +++ b/packages/web/localizations/ro.json @@ -1274,6 +1274,9 @@ "tradeFee": "Comision comercială", "receiveAtLeast": "Primește cel puțin", "payAtMost": "Plătește cel mult", + "previewAssetsEnabled": "Previzualizarea materialelor este activată", + "previewAssetsDisabled": "Previzualizarea materialelor a fost dezactivată", + "previewAssetsEnabledForSession": "Previzualizează materialele activate pentru această sesiune. Pentru a dezactiva, deschideți o filă nouă sau adăugați `show_preview_assets=false`.", "alloyedAssets": { "title": "Variante detectate", "caption": "Spune-ți adio tuturor acelor variante de active confuze. Salutați-vă la o experiență mai simplă pe Osmoză.", diff --git a/packages/web/localizations/ru.json b/packages/web/localizations/ru.json index f3348da53d..0faace8611 100644 --- a/packages/web/localizations/ru.json +++ b/packages/web/localizations/ru.json @@ -1274,6 +1274,9 @@ "tradeFee": "Торговый сбор", "receiveAtLeast": "Получите по крайней мере", "payAtMost": "Платить максимум", + "previewAssetsEnabled": "Предварительный просмотр активов включен", + "previewAssetsDisabled": "Предварительный просмотр активов отключен", + "previewAssetsEnabledForSession": "Предварительный просмотр активов включен для этого сеанса. Чтобы отключить, откройте новую вкладку или добавьте `show_preview_assets=false`.", "alloyedAssets": { "title": "Обнаруженные варианты", "caption": "Попрощайтесь со всеми этими запутанными вариантами активов. Поприветствуйте более плавный опыт на Osmosis.", diff --git a/packages/web/localizations/tr.json b/packages/web/localizations/tr.json index 4f8a934847..1dfea31066 100644 --- a/packages/web/localizations/tr.json +++ b/packages/web/localizations/tr.json @@ -1274,6 +1274,9 @@ "tradeFee": "Ticaret ücreti", "receiveAtLeast": "En azından al", "payAtMost": "En fazla öde", + "previewAssetsEnabled": "Önizleme varlıkları etkinleştirildi", + "previewAssetsDisabled": "Önizleme varlıkları devre dışı bırakıldı", + "previewAssetsEnabledForSession": "Bu oturum için önizleme varlıkları etkinleştirildi. Devre dışı bırakmak için yeni bir sekme açın veya `show_preview_assets=false` ekleyin.", "alloyedAssets": { "title": "Varyantlar Tespit Edildi", "caption": "Tüm bu kafa karıştırıcı varlık varyantlarına elveda deyin. Osmosis'te daha sorunsuz bir deneyime merhaba deyin.", diff --git a/packages/web/localizations/zh-cn.json b/packages/web/localizations/zh-cn.json index 12a30123b5..1bf7a0d50b 100644 --- a/packages/web/localizations/zh-cn.json +++ b/packages/web/localizations/zh-cn.json @@ -1274,6 +1274,9 @@ "tradeFee": "交易费", "receiveAtLeast": "至少收到", "payAtMost": "最多支付", + "previewAssetsEnabled": "已启用预览资产", + "previewAssetsDisabled": "已禁用预览资源", + "previewAssetsEnabledForSession": "已为本次会话启用预览资产。要禁用,请打开新选项卡,或附加“show_preview_assets=false”。", "alloyedAssets": { "title": "检测到的变体", "caption": "告别所有那些令人困惑的资产变体。迎接 Osmosis 上更加无缝的体验。", diff --git a/packages/web/localizations/zh-hk.json b/packages/web/localizations/zh-hk.json index 97a23f4661..dc1c560571 100644 --- a/packages/web/localizations/zh-hk.json +++ b/packages/web/localizations/zh-hk.json @@ -1274,6 +1274,9 @@ "tradeFee": "交易費", "receiveAtLeast": "至少收到", "payAtMost": "最多付錢", + "previewAssetsEnabled": "啟用預覽資源", + "previewAssetsDisabled": "預覽資源已停用", + "previewAssetsEnabledForSession": "預覽為此會話啟用的資產。若要停用開啟新選項卡,或附加「show_preview_assets=false」。", "alloyedAssets": { "title": "偵測到變體", "caption": "告別所有那些令人困惑的資產變體。迎接更無縫的 Osmosis 體驗。", diff --git a/packages/web/localizations/zh-tw.json b/packages/web/localizations/zh-tw.json index 6e74901ea3..e5a9654e9d 100644 --- a/packages/web/localizations/zh-tw.json +++ b/packages/web/localizations/zh-tw.json @@ -1274,6 +1274,9 @@ "tradeFee": "交易費", "receiveAtLeast": "至少收到", "payAtMost": "最多付錢", + "previewAssetsEnabled": "啟用預覽資產", + "previewAssetsDisabled": "預覽資源已停用", + "previewAssetsEnabledForSession": "預覽為此會話啟用的資產。若要停用開啟新選項卡,或附加「show_preview_assets=false」。", "alloyedAssets": { "title": "偵測到變體", "caption": "告別所有那些令人困惑的資產變體。迎接更無縫的 Osmosis 體驗。",