Skip to content

Commit

Permalink
Merge pull request #3950 from osmosis-labs/stage
Browse files Browse the repository at this point in the history
Publish stage
  • Loading branch information
JoseRFelix authored Nov 14, 2024
2 parents 07f0b75 + dba7d07 commit dc6063b
Show file tree
Hide file tree
Showing 20 changed files with 129 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/web/e2e/tests/stables.wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
9 changes: 4 additions & 5 deletions packages/web/e2e/tests/trade.wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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();
Expand Down
77 changes: 73 additions & 4 deletions packages/web/hooks/use-show-preview-assets.ts
Original file line number Diff line number Diff line change
@@ -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<PreviewAssetsState>()(
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<boolean>(
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,
};
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "کارمزد تجارت",
"receiveAtLeast": "حداقل دریافت کنید",
"payAtMost": "حداکثر پرداخت کنید",
"previewAssetsEnabled": "پیش‌نمایش دارایی‌ها فعال شد",
"previewAssetsDisabled": "پیش‌نمایش دارایی‌ها غیرفعال شد",
"previewAssetsEnabledForSession": "پیش‌نمایش دارایی‌های فعال برای این جلسه. برای غیرفعال کردن، یک برگه جدید باز کنید یا «show_preview_assets=false» را اضافه کنید.",
"alloyedAssets": {
"title": "انواع مختلف شناسایی شد",
"caption": "با همه آن گونه های دارایی گیج کننده خداحافظی کنید. به تجربه یکپارچه تر در اسموز سلام کنید.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "વેપાર ફી",
"receiveAtLeast": "ઓછામાં ઓછું પ્રાપ્ત કરો",
"payAtMost": "વધુમાં વધુ ચૂકવણી કરો",
"previewAssetsEnabled": "પૂર્વાવલોકન સંપત્તિ સક્ષમ",
"previewAssetsDisabled": "પૂર્વાવલોકન સંપત્તિ અક્ષમ છે",
"previewAssetsEnabledForSession": "આ સત્ર માટે પૂર્વાવલોકન સંપત્તિઓ સક્ષમ છે. નિષ્ક્રિય કરવા માટે નવી ટેબ ખોલો અથવા `શો_પ્રિવ્યુ_એસેટ્સ=ફોલ` ઉમેરો.",
"alloyedAssets": {
"title": "વેરિઅન્ટ્સ મળી આવ્યા",
"caption": "તે બધા મૂંઝવણભર્યા એસેટ વેરિઅન્ટ્સને ગુડબાય કહો. ઓસ્મોસિસ પર વધુ સીમલેસ અનુભવ માટે હેલો કહો.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "व्यापार शुल्क",
"receiveAtLeast": "कम से कम प्राप्त करें",
"payAtMost": "अधिकतम भुगतान करें",
"previewAssetsEnabled": "संपत्तियों का पूर्वावलोकन सक्षम किया गया",
"previewAssetsDisabled": "संपत्तियों का पूर्वावलोकन अक्षम किया गया",
"previewAssetsEnabledForSession": "इस सत्र के लिए पूर्वावलोकन संपत्ति सक्षम है। अक्षम करने के लिए एक नया टैब खोलें, या `show_preview_assets=false` जोड़ें।",
"alloyedAssets": {
"title": "पता लगाए गए वेरिएंट",
"caption": "उन सभी भ्रामक परिसंपत्ति प्रकारों को अलविदा कहें। ओस्मोसिस पर अधिक सहज अनुभव का स्वागत करें।",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "取引手数料",
"receiveAtLeast": "少なくとも受け取る",
"payAtMost": "最大で支払う",
"previewAssetsEnabled": "プレビューアセットが有効",
"previewAssetsDisabled": "プレビューアセットが無効になっています",
"previewAssetsEnabledForSession": "このセッションではプレビュー アセットが有効になっています。無効にするには、新しいタブを開くか、`show_preview_assets=false` を追加します。",
"alloyedAssets": {
"title": "検出された変異体",
"caption": "混乱を招くアセットバリアントとはお別れです。Osmosis のよりシームレスなエクスペリエンスをお楽しみください。",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "거래 수수료",
"receiveAtLeast": "최소한 받다",
"payAtMost": "최대 지불",
"previewAssetsEnabled": "미리보기 자산 활성화됨",
"previewAssetsDisabled": "미리보기 자산 비활성화",
"previewAssetsEnabledForSession": "이 세션에서 미리보기 자산이 활성화되었습니다. 비활성화하려면 새 탭을 열거나 `show_preview_assets=false`를 추가합니다.",
"alloyedAssets": {
"title": "변종 감지됨",
"caption": "혼란스러운 자산 변형에 작별 인사를 전하세요. Osmosis에서 더욱 매끄러운 경험을 만나보세요.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -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ă.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "Торговый сбор",
"receiveAtLeast": "Получите по крайней мере",
"payAtMost": "Платить максимум",
"previewAssetsEnabled": "Предварительный просмотр активов включен",
"previewAssetsDisabled": "Предварительный просмотр активов отключен",
"previewAssetsEnabledForSession": "Предварительный просмотр активов включен для этого сеанса. Чтобы отключить, откройте новую вкладку или добавьте `show_preview_assets=false`.",
"alloyedAssets": {
"title": "Обнаруженные варианты",
"caption": "Попрощайтесь со всеми этими запутанными вариантами активов. Поприветствуйте более плавный опыт на Osmosis.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "交易费",
"receiveAtLeast": "至少收到",
"payAtMost": "最多支付",
"previewAssetsEnabled": "已启用预览资产",
"previewAssetsDisabled": "已禁用预览资源",
"previewAssetsEnabledForSession": "已为本次会话启用预览资产。要禁用,请打开新选项卡,或附加“show_preview_assets=false”。",
"alloyedAssets": {
"title": "检测到的变体",
"caption": "告别所有那些令人困惑的资产变体。迎接 Osmosis 上更加无缝的体验。",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/zh-hk.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "交易費",
"receiveAtLeast": "至少收到",
"payAtMost": "最多付錢",
"previewAssetsEnabled": "啟用預覽資源",
"previewAssetsDisabled": "預覽資源已停用",
"previewAssetsEnabledForSession": "預覽為此會話啟用的資產。若要停用開啟新選項卡,或附加「show_preview_assets=false」。",
"alloyedAssets": {
"title": "偵測到變體",
"caption": "告別所有那些令人困惑的資產變體。迎接更無縫的 Osmosis 體驗。",
Expand Down
3 changes: 3 additions & 0 deletions packages/web/localizations/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,9 @@
"tradeFee": "交易費",
"receiveAtLeast": "至少收到",
"payAtMost": "最多付錢",
"previewAssetsEnabled": "啟用預覽資產",
"previewAssetsDisabled": "預覽資源已停用",
"previewAssetsEnabledForSession": "預覽為此會話啟用的資產。若要停用開啟新選項卡,或附加「show_preview_assets=false」。",
"alloyedAssets": {
"title": "偵測到變體",
"caption": "告別所有那些令人困惑的資產變體。迎接更無縫的 Osmosis 體驗。",
Expand Down

0 comments on commit dc6063b

Please sign in to comment.