-
Variants Detected
+
{t("alloyedAssets.title")}
- Say goodbye to all those confusing asset variants. Say hello to a more
- seamless experience on Osmosis.
+ {t("alloyedAssets.caption")}
- Remind me later
+
+ {t("alloyedAssets.remindMeLater")}
+
@@ -277,10 +270,10 @@ export const AlloyedAssetsToast: FunctionComponent
= ({
onClick={onDismiss}
className="!border !border-osmoverse-alpha-700 !text-wosmongton-200"
>
- Dismiss
+ {t("alloyedAssets.dismiss")}
diff --git a/packages/web/components/alert/tx-event-toast.ts b/packages/web/components/alert/tx-event-toast.ts
index ec719b640b..e2d82e2d85 100644
--- a/packages/web/components/alert/tx-event-toast.ts
+++ b/packages/web/components/alert/tx-event-toast.ts
@@ -28,9 +28,8 @@ export function toastOnBroadcastFailed(
displayToast(
{
- titleTranslationKey: "transactionFailed",
- captionTranslationKey:
- prettifyTxError(caption, getChain(chainId).currencies) ?? caption,
+ titleTranslationKey: "alloyedAssets.title",
+ captionTranslationKey: "alloyedAssets.caption",
},
ToastType.ERROR
);
diff --git a/packages/web/localizations/de.json b/packages/web/localizations/de.json
index 32d787b425..41ef0a6b22 100644
--- a/packages/web/localizations/de.json
+++ b/packages/web/localizations/de.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Handelsgebühr",
"receiveAtLeast": "Erhalten Sie mindestens",
- "payAtMost": "Bezahlen Sie höchstens"
+ "payAtMost": "Bezahlen Sie höchstens",
+ "alloyedAssets": {
+ "remindMeLater": "Später erinnern",
+ "dismiss": "Zurückweisen",
+ "convert": "Konvertieren"
+ }
}
diff --git a/packages/web/localizations/en.json b/packages/web/localizations/en.json
index 14ab8d21cd..947fea2b7d 100644
--- a/packages/web/localizations/en.json
+++ b/packages/web/localizations/en.json
@@ -1235,5 +1235,12 @@
},
"tradeFee": "Trade fee",
"receiveAtLeast": "Receive at least",
- "payAtMost": "Sell at most"
+ "payAtMost": "Sell at most",
+ "alloyedAssets": {
+ "title": "Variants Detected",
+ "caption": "Say goodbye to all those confusing asset variants. Say hello to a more seamless experience on Osmosis.",
+ "remindMeLater": "Remind me later",
+ "dismiss": "Dismiss",
+ "convert": "Convert"
+ }
}
diff --git a/packages/web/localizations/es.json b/packages/web/localizations/es.json
index 9802a4c2b7..762e732c10 100644
--- a/packages/web/localizations/es.json
+++ b/packages/web/localizations/es.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Tarifa de comercio",
"receiveAtLeast": "Recibir al menos",
- "payAtMost": "Pagar como máximo"
+ "payAtMost": "Pagar como máximo",
+ "alloyedAssets": {
+ "remindMeLater": "Recuérdamelo más tarde",
+ "dismiss": "Despedir",
+ "convert": "Convertir"
+ }
}
diff --git a/packages/web/localizations/fa.json b/packages/web/localizations/fa.json
index 365ffea45e..94a42e9d29 100644
--- a/packages/web/localizations/fa.json
+++ b/packages/web/localizations/fa.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "کارمزد تجارت",
"receiveAtLeast": "حداقل دریافت کنید",
- "payAtMost": "حداکثر پرداخت کنید"
+ "payAtMost": "حداکثر پرداخت کنید",
+ "alloyedAssets": {
+ "remindMeLater": "بعدا به من یادآوری کن",
+ "dismiss": "رد کردن",
+ "convert": "تبدیل کنید"
+ }
}
diff --git a/packages/web/localizations/fr.json b/packages/web/localizations/fr.json
index 71e3760eda..e41c75b52d 100644
--- a/packages/web/localizations/fr.json
+++ b/packages/web/localizations/fr.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Frais de transaction",
"receiveAtLeast": "Recevez au moins",
- "payAtMost": "Payer au maximum"
+ "payAtMost": "Payer au maximum",
+ "alloyedAssets": {
+ "remindMeLater": "Rappelle-moi plus tard",
+ "dismiss": "Rejeter",
+ "convert": "Convertir"
+ }
}
diff --git a/packages/web/localizations/gu.json b/packages/web/localizations/gu.json
index bd06fafcd2..0de145f2c2 100644
--- a/packages/web/localizations/gu.json
+++ b/packages/web/localizations/gu.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "વેપાર ફી",
"receiveAtLeast": "ઓછામાં ઓછું પ્રાપ્ત કરો",
- "payAtMost": "વધુમાં વધુ ચૂકવણી કરો"
+ "payAtMost": "વધુમાં વધુ ચૂકવણી કરો",
+ "alloyedAssets": {
+ "remindMeLater": "મને પછીથી યાદ કરાવો",
+ "dismiss": "કાઢી નાખો",
+ "convert": "કન્વર્ટ કરો"
+ }
}
diff --git a/packages/web/localizations/hi.json b/packages/web/localizations/hi.json
index 6861129826..4dfa7e5176 100644
--- a/packages/web/localizations/hi.json
+++ b/packages/web/localizations/hi.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "व्यापार शुल्क",
"receiveAtLeast": "कम से कम प्राप्त करें",
- "payAtMost": "अधिकतम भुगतान करें"
+ "payAtMost": "अधिकतम भुगतान करें",
+ "alloyedAssets": {
+ "remindMeLater": "बाद में याद दिलाना",
+ "dismiss": "नकार देना",
+ "convert": "बदलना"
+ }
}
diff --git a/packages/web/localizations/ja.json b/packages/web/localizations/ja.json
index 33f33aabf2..8c0d224c01 100644
--- a/packages/web/localizations/ja.json
+++ b/packages/web/localizations/ja.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "取引手数料",
"receiveAtLeast": "少なくとも受け取る",
- "payAtMost": "最大で支払う"
+ "payAtMost": "最大で支払う",
+ "alloyedAssets": {
+ "remindMeLater": "後で通知する",
+ "dismiss": "却下する",
+ "convert": "変換する"
+ }
}
diff --git a/packages/web/localizations/ko.json b/packages/web/localizations/ko.json
index 2535346f0e..9d08c7ddaa 100644
--- a/packages/web/localizations/ko.json
+++ b/packages/web/localizations/ko.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "거래 수수료",
"receiveAtLeast": "최소한 받다",
- "payAtMost": "최대 지불"
+ "payAtMost": "최대 지불",
+ "alloyedAssets": {
+ "remindMeLater": "나중에 다시 알려주세요",
+ "dismiss": "해고하다",
+ "convert": "전환하다"
+ }
}
diff --git a/packages/web/localizations/pl.json b/packages/web/localizations/pl.json
index db87dd8de0..2ddd187516 100644
--- a/packages/web/localizations/pl.json
+++ b/packages/web/localizations/pl.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Opłata za handel",
"receiveAtLeast": "Otrzymaj co najmniej",
- "payAtMost": "Zapłać maksymalnie"
+ "payAtMost": "Zapłać maksymalnie",
+ "alloyedAssets": {
+ "remindMeLater": "Przypomnij mi później",
+ "dismiss": "Odrzucać",
+ "convert": "Konwertować"
+ }
}
diff --git a/packages/web/localizations/pt-br.json b/packages/web/localizations/pt-br.json
index 567ed05e30..3eec656ed7 100644
--- a/packages/web/localizations/pt-br.json
+++ b/packages/web/localizations/pt-br.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Taxa de negociação",
"receiveAtLeast": "Receba pelo menos",
- "payAtMost": "Pague no máximo"
+ "payAtMost": "Pague no máximo",
+ "alloyedAssets": {
+ "remindMeLater": "Lembre-me mais tarde",
+ "dismiss": "Liberar",
+ "convert": "Converter"
+ }
}
diff --git a/packages/web/localizations/ro.json b/packages/web/localizations/ro.json
index 45e5284ebe..5ac8dfe681 100644
--- a/packages/web/localizations/ro.json
+++ b/packages/web/localizations/ro.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Comision comercială",
"receiveAtLeast": "Primește cel puțin",
- "payAtMost": "Plătește cel mult"
+ "payAtMost": "Plătește cel mult",
+ "alloyedAssets": {
+ "remindMeLater": "Amintește-mi mai târziu",
+ "dismiss": "Respingeți",
+ "convert": "Convertit"
+ }
}
diff --git a/packages/web/localizations/ru.json b/packages/web/localizations/ru.json
index 6025673e23..06385c376d 100644
--- a/packages/web/localizations/ru.json
+++ b/packages/web/localizations/ru.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Торговый сбор",
"receiveAtLeast": "Получите по крайней мере",
- "payAtMost": "Платить максимум"
+ "payAtMost": "Платить максимум",
+ "alloyedAssets": {
+ "remindMeLater": "Напомнить мне позже",
+ "dismiss": "Увольнять",
+ "convert": "Конвертировать"
+ }
}
diff --git a/packages/web/localizations/tr.json b/packages/web/localizations/tr.json
index 78a5c41bac..babe4f3088 100644
--- a/packages/web/localizations/tr.json
+++ b/packages/web/localizations/tr.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "Ticaret ücreti",
"receiveAtLeast": "En azından al",
- "payAtMost": "En fazla öde"
+ "payAtMost": "En fazla öde",
+ "alloyedAssets": {
+ "remindMeLater": "Daha sonra hatırlat bana",
+ "dismiss": "Azletmek",
+ "convert": "Dönüştürmek"
+ }
}
diff --git a/packages/web/localizations/zh-cn.json b/packages/web/localizations/zh-cn.json
index 91ead71235..ab81dcda6b 100644
--- a/packages/web/localizations/zh-cn.json
+++ b/packages/web/localizations/zh-cn.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "交易费",
"receiveAtLeast": "至少收到",
- "payAtMost": "最多支付"
+ "payAtMost": "最多支付",
+ "alloyedAssets": {
+ "remindMeLater": "稍后提醒我",
+ "dismiss": "解雇",
+ "convert": "转变"
+ }
}
diff --git a/packages/web/localizations/zh-hk.json b/packages/web/localizations/zh-hk.json
index 5f319aa7c3..c8614f3c64 100644
--- a/packages/web/localizations/zh-hk.json
+++ b/packages/web/localizations/zh-hk.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "交易費",
"receiveAtLeast": "至少收到",
- "payAtMost": "最多付錢"
+ "payAtMost": "最多付錢",
+ "alloyedAssets": {
+ "remindMeLater": "稍後提醒我",
+ "dismiss": "解僱",
+ "convert": "轉變"
+ }
}
diff --git a/packages/web/localizations/zh-tw.json b/packages/web/localizations/zh-tw.json
index 74744e7c56..59dfe869ed 100644
--- a/packages/web/localizations/zh-tw.json
+++ b/packages/web/localizations/zh-tw.json
@@ -1235,5 +1235,10 @@
},
"tradeFee": "交易費",
"receiveAtLeast": "至少收到",
- "payAtMost": "最多付錢"
+ "payAtMost": "最多付錢",
+ "alloyedAssets": {
+ "remindMeLater": "稍後提醒我",
+ "dismiss": "解僱",
+ "convert": "轉變"
+ }
}
diff --git a/packages/web/public/icons/sprite.svg b/packages/web/public/icons/sprite.svg
index 2cba044d6a..71a0f6bdac 100644
--- a/packages/web/public/icons/sprite.svg
+++ b/packages/web/public/icons/sprite.svg
@@ -164,6 +164,10 @@
+
+
+
+
-
-
-
@@ -1617,7 +1618,7 @@
-
+
@@ -1695,14 +1696,7 @@
-
-
-
-
-
-
-
-
+
From 59ee4e347266334c6310760d10e459805fd8cded Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Fri, 4 Oct 2024 13:57:31 -0700
Subject: [PATCH 05/16] feat(getHasAssetVariants): add query to fetch and
calculate if user has asset variants
---
.../queries/complex/portfolio/allocation.ts | 35 +++++++++++++
packages/trpc/src/portfolio.ts | 16 +++++-
packages/web/components/alert/toast.tsx | 18 +++++--
.../web/components/alert/tx-event-toast.ts | 5 +-
packages/web/components/layouts/main.tsx | 52 +++++++++++++------
5 files changed, 102 insertions(+), 24 deletions(-)
diff --git a/packages/server/src/queries/complex/portfolio/allocation.ts b/packages/server/src/queries/complex/portfolio/allocation.ts
index 5d2bd4cf12..c006626b63 100644
--- a/packages/server/src/queries/complex/portfolio/allocation.ts
+++ b/packages/server/src/queries/complex/portfolio/allocation.ts
@@ -173,3 +173,38 @@ export async function getAllocation({
totalCap,
};
}
+
+export async function getHasAssetVariants({
+ address,
+ assetLists,
+}: {
+ address: string;
+ assetLists: AssetList[];
+}): Promise<{ hasAssetVariants: boolean }> {
+ const data = await queryAllocation({
+ address,
+ });
+
+ // Extract all denom from account_coins_result in user-balances
+ const allAssets =
+ data?.categories?.["user-balances"]?.account_coins_result?.map(
+ (result) => result.coin.denom
+ ) ?? [];
+
+ console.log("allAssets", allAssets);
+
+ const assetListAssets = assetLists.flatMap((list) => list.assets);
+
+ const hasAssetVariants = allAssets.some((coinMinimalDenom) => {
+ const matchingAsset = assetListAssets.find(
+ (assetListAsset) => coinMinimalDenom === assetListAsset.coinMinimalDenom
+ );
+
+ return (
+ matchingAsset &&
+ matchingAsset.coinMinimalDenom !== matchingAsset.variantGroupKey
+ );
+ });
+
+ return { hasAssetVariants };
+}
diff --git a/packages/trpc/src/portfolio.ts b/packages/trpc/src/portfolio.ts
index 868baede4d..dc7ffbb9fb 100644
--- a/packages/trpc/src/portfolio.ts
+++ b/packages/trpc/src/portfolio.ts
@@ -1,5 +1,5 @@
import { getPortfolioOverTime } from "@osmosis-labs/server";
-import { getAllocation } from "@osmosis-labs/server";
+import { getAllocation, getHasAssetVariants } from "@osmosis-labs/server";
import { ChartPortfolioOverTimeResponse } from "@osmosis-labs/server/src/queries/complex/portfolio/portfolio";
import { z } from "zod";
@@ -37,4 +37,18 @@ export const portfolioRouter = createTRPCRouter({
});
return res;
}),
+
+ getHasAssetVariants: publicProcedure
+ .input(
+ z.object({
+ address: z.string(),
+ })
+ )
+ .query(async ({ input: { address }, ctx }) => {
+ const res = await getHasAssetVariants({
+ address,
+ assetLists: ctx.assetLists,
+ });
+ return res;
+ }),
});
diff --git a/packages/web/components/alert/toast.tsx b/packages/web/components/alert/toast.tsx
index 5bf66947f5..a1d8d27f02 100644
--- a/packages/web/components/alert/toast.tsx
+++ b/packages/web/components/alert/toast.tsx
@@ -208,7 +208,11 @@ const OneClickTradingToast: FunctionComponent
= ({
);
-export const AlloyedAssetsToast = () => {
+export const AlloyedAssetsToast: FunctionComponent