-
-
-
-
{title[status]}
- {tokenConversion && (
-
- {displayFiatPrice(tokenConversion.tokenIn?.value, "", t)}{" "}
- {tokenConversion.tokenOut.amount.denom}{" "}
- {" "}
- {tokenConversion.tokenIn.amount.denom}
-
- )}
-
- {tokenConversion && (
-
- {formatPretty(tokenConversion.tokenOut.amount, {
- maxDecimals: 6,
- })}
-
-
- )}
-
-
- {caption &&
{caption}
}
- {tokenConversion && (
-
-
-
-
-
- )}
- {transfer && (
-
-
-
- {formatPretty(transfer.amount, { maxDecimals: 6 })}
-
- {transfer.value && (
-
- {transfer.direction === "withdraw" ? "-" : "+"}{" "}
- {transfer.value.symbol}
- {Number(transfer.value.toDec().abs().toString()).toFixed(2)}
-
- )}
-
- )}
+ const leftComponent = tokenConversion ? (
+
+ {displayFiatPrice(tokenConversion.tokenIn?.value, "", t)}{" "}
+ {tokenConversion.tokenOut.amount.denom}{" "}
+ {" "}
+ {tokenConversion.tokenIn.amount.denom}
+ ) : null;
+
+ const rightComponent = tokenConversion ? (
+
+
+
+
+
+ ) : null;
+
+ return (
+
);
};
From be567eb99546bc10534f1231a89701b80588326c Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Wed, 7 Aug 2024 15:35:58 -0700
Subject: [PATCH 14/21] Update types
---
.../web/components/transactions/use-recent-transfers.ts | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/packages/web/components/transactions/use-recent-transfers.ts b/packages/web/components/transactions/use-recent-transfers.ts
index 4b4e0b222d..79bf0dde3f 100644
--- a/packages/web/components/transactions/use-recent-transfers.ts
+++ b/packages/web/components/transactions/use-recent-transfers.ts
@@ -18,8 +18,8 @@ export type RecentTransfer = {
reason?: TransferFailureReason;
status: TransferStatus;
isWithdraw: boolean;
- toChainId?: string;
- fromChainId?: string;
+ toChainId?: string | number;
+ fromChainId?: string | number;
};
const osmosisChainId = ChainList[0].chain_id;
@@ -32,11 +32,6 @@ export function useRecentTransfers(address?: string): RecentTransfer[] {
return [];
}
- console.log(
- "transferHistoryStore .getHistoriesByAccount(address): ",
- transferHistoryStore.getHistoriesByAccount(address)
- );
-
// reconcile histories from IBC and non-IBC history stores
return transferHistoryStore
.getHistoriesByAccount(address)
From eadf88ef1e66b0a8e89fdc08f4517113c84434a4 Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Wed, 7 Aug 2024 17:16:39 -0700
Subject: [PATCH 15/21] Add fetch network details
---
packages/trpc/src/chains.ts | 76 ++++++++++++++++++-
packages/utils/src/bitcoin.ts | 1 +
packages/utils/src/solana.ts | 1 +
.../recent-activity-transaction-row.tsx | 22 +++---
.../transactions/use-recent-transfers.ts | 9 +++
5 files changed, 98 insertions(+), 11 deletions(-)
diff --git a/packages/trpc/src/chains.ts b/packages/trpc/src/chains.ts
index 717928e648..41e11c954e 100644
--- a/packages/trpc/src/chains.ts
+++ b/packages/trpc/src/chains.ts
@@ -1,5 +1,9 @@
import { getChain } from "@osmosis-labs/server";
-import { EthereumChainInfo } from "@osmosis-labs/utils";
+import {
+ BitcoinChainInfo,
+ EthereumChainInfo,
+ SolanaChainInfo,
+} from "@osmosis-labs/utils";
import { z } from "zod";
import { createTRPCRouter, publicProcedure } from "./api";
@@ -27,4 +31,74 @@ export const chainsRouter = createTRPCRouter({
.query(({ input: { chainId } }) =>
Object.values(EthereumChainInfo).find((chain) => chain.id === chainId)
),
+ getChainDisplayInfo: publicProcedure
+ .input(
+ z.object({
+ chainId: z.union([z.string(), z.number()]),
+ })
+ )
+ .query(
+ ({
+ input: { chainId },
+ ctx,
+ }):
+ | {
+ chainId: string | number;
+ prettyName: string;
+ relativeLogoUrl?: string;
+ color?: string;
+ }
+ | undefined => {
+ // cosmos chains
+ try {
+ const cosmosChain = getChain({
+ ...ctx,
+ chainNameOrId: String(chainId),
+ });
+
+ return {
+ chainId: cosmosChain.chain_id,
+ prettyName: cosmosChain.pretty_name,
+ relativeLogoUrl: cosmosChain?.logoURIs?.svg,
+ color: cosmosChain?.logoURIs?.theme?.background_color_hex,
+ };
+ } catch (error) {
+ // if cosmos chain is undefined, check evm chains
+ const evmChain = Object.values(EthereumChainInfo).find(
+ (chain) => chain.id === chainId
+ );
+
+ if (evmChain) {
+ return {
+ chainId: evmChain.id,
+ prettyName: evmChain.chainName,
+ relativeLogoUrl: evmChain.relativeLogoUrl,
+ color: evmChain.color,
+ };
+ }
+
+ const bitcoinChain =
+ BitcoinChainInfo.chainId === chainId ? BitcoinChainInfo : undefined;
+ if (bitcoinChain) {
+ return {
+ chainId: bitcoinChain.chainId,
+ prettyName: bitcoinChain.prettyName,
+ relativeLogoUrl: bitcoinChain.relativeLogoUrl,
+ color: bitcoinChain.color,
+ };
+ }
+
+ const solanaChain =
+ SolanaChainInfo.chainId === chainId ? SolanaChainInfo : undefined;
+ if (solanaChain) {
+ return {
+ chainId: solanaChain.chainId,
+ prettyName: solanaChain.prettyName,
+ relativeLogoUrl: solanaChain.relativeLogoUrl,
+ color: solanaChain.color,
+ };
+ }
+ }
+ }
+ ),
});
diff --git a/packages/utils/src/bitcoin.ts b/packages/utils/src/bitcoin.ts
index d66e0a8239..7a0920e56d 100644
--- a/packages/utils/src/bitcoin.ts
+++ b/packages/utils/src/bitcoin.ts
@@ -3,4 +3,5 @@ export const BitcoinChainInfo = {
chainId: "bitcoin",
chainName: "Bitcoin",
color: "#F7931A",
+ relativeLogoUrl: "/networks/bitcoin.svg",
};
diff --git a/packages/utils/src/solana.ts b/packages/utils/src/solana.ts
index f41193e9c1..d0a79dfc5e 100644
--- a/packages/utils/src/solana.ts
+++ b/packages/utils/src/solana.ts
@@ -3,4 +3,5 @@ export const SolanaChainInfo = {
chainId: "solana",
chainName: "Solana",
color: "#9945FF",
+ relativeLogoUrl: "/networks/solana.svg",
};
diff --git a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
index 7acc5cc130..57d12499c4 100644
--- a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
+++ b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
@@ -33,8 +33,8 @@ interface Activity {
amount: CoinPretty;
value?: PricePretty;
};
- toChainId?: string;
- fromChainId?: string;
+ toChainId?: string | number;
+ fromChainId?: string | number;
}
export const RecentActivityRow: FunctionComponent<{
@@ -64,21 +64,23 @@ export const TransferRow: FunctionComponent
= ({
const findChainNameOrId =
transfer?.direction === "withdraw" ? toChainId : fromChainId;
- const { data: chainData } = api.edge.chains.getChain.useQuery(
+ const { data: chainData } = api.edge.chains.getChainDisplayInfo.useQuery(
{
- findChainNameOrId: findChainNameOrId || "",
+ chainId: "bitcoin",
},
{
- useErrorBoundary: true,
+ useErrorBoundary: false,
}
);
+ // console.log("chainDataEVM: ", chainDataEVM);
+
const text = transfer?.direction === "withdraw" ? "to" : "from";
const leftComponent = transfer ? (
{formatPretty(transfer.amount, { maxDecimals: 6 })} {text}{" "}
- {chainData?.pretty_name}
+ {chainData?.prettyName}
) : null;
@@ -99,18 +101,18 @@ export const TransferRow: FunctionComponent = ({
className="my-[8px] mx-[4px] text-osmoverse-500"
/>
>
) : (
<>
Date: Wed, 7 Aug 2024 17:59:43 -0700
Subject: [PATCH 16/21] Clean up chain id
---
.../recent-activity-transaction-row.tsx | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
index 57d12499c4..064bdd0a7d 100644
--- a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
+++ b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
@@ -61,20 +61,18 @@ export const TransferRow: FunctionComponent = ({
toChainId,
fromChainId,
}) => {
- const findChainNameOrId =
- transfer?.direction === "withdraw" ? toChainId : fromChainId;
+ const chainId =
+ (transfer?.direction === "withdraw" ? toChainId : fromChainId) || "";
const { data: chainData } = api.edge.chains.getChainDisplayInfo.useQuery(
{
- chainId: "bitcoin",
+ chainId,
},
{
useErrorBoundary: false,
}
);
- // console.log("chainDataEVM: ", chainDataEVM);
-
const text = transfer?.direction === "withdraw" ? "to" : "from";
const leftComponent = transfer ? (
@@ -102,7 +100,7 @@ export const TransferRow: FunctionComponent = ({
/>
@@ -111,7 +109,7 @@ export const TransferRow: FunctionComponent = ({
<>
From da506503635b3065c3c47fcc32fd7c07f2522886 Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Wed, 7 Aug 2024 18:01:23 -0700
Subject: [PATCH 17/21] add en translation
---
.../recent-activity/recent-activity-transaction-row.tsx | 7 ++++++-
.../transactions/recent-activity/recent-activity.tsx | 2 --
packages/web/localizations/en.json | 4 +++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
index 064bdd0a7d..58c9af4e37 100644
--- a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
+++ b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
@@ -61,6 +61,8 @@ export const TransferRow: FunctionComponent = ({
toChainId,
fromChainId,
}) => {
+ const { t } = useTranslation();
+
const chainId =
(transfer?.direction === "withdraw" ? toChainId : fromChainId) || "";
@@ -73,7 +75,10 @@ export const TransferRow: FunctionComponent = ({
}
);
- const text = transfer?.direction === "withdraw" ? "to" : "from";
+ const text =
+ transfer?.direction === "withdraw"
+ ? t("portfolio.to")
+ : t("portfolio.from");
const leftComponent = transfer ? (
diff --git a/packages/web/components/transactions/recent-activity/recent-activity.tsx b/packages/web/components/transactions/recent-activity/recent-activity.tsx
index f2b2c1bb75..edd753fdf4 100644
--- a/packages/web/components/transactions/recent-activity/recent-activity.tsx
+++ b/packages/web/components/transactions/recent-activity/recent-activity.tsx
@@ -53,8 +53,6 @@ export const RecentActivity: FunctionComponent = observer(() => {
const recentTransfers = useRecentTransfers(wallet?.address);
- console.log("Recent Transfers: ", recentTransfers);
-
const { data: transactionsData, isFetching: isGetTransactionsFetching } =
api.edge.transactions.getTransactions.useQuery(
{
diff --git a/packages/web/localizations/en.json b/packages/web/localizations/en.json
index 1cccae2951..9d8a432a2e 100644
--- a/packages/web/localizations/en.json
+++ b/packages/web/localizations/en.json
@@ -328,7 +328,9 @@
"all": "All",
"assets": "Assets",
"recentActivity": "Recent activity",
- "seeAll": "See all"
+ "seeAll": "See all",
+ "to": "to",
+ "from": "from"
},
"buyTokens": "Buy tokens",
"components": {
From 62bef53d163e82a99bc2b86b3dd23e37ab3b04c0 Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Wed, 7 Aug 2024 18:06:46 -0700
Subject: [PATCH 18/21] Clean up
---
.../recent-activity-transaction-row.tsx | 77 ++++++++-----------
1 file changed, 30 insertions(+), 47 deletions(-)
diff --git a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
index 58c9af4e37..ae306225f0 100644
--- a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
+++ b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
@@ -87,59 +87,42 @@ export const TransferRow: FunctionComponent
= ({
) : null;
- const rightComponent =
- transfer?.direction === "withdraw" ? (
- <>
-
-
-
- >
- ) : (
- <>
-
-
-
- >
- );
+ const rightComponent = [
+ ,
+ ,
+ ,
+ ];
+
+ const orderedRightComponent =
+ transfer?.direction === "withdraw"
+ ? rightComponent
+ : rightComponent.reverse();
return (
{orderedRightComponent}>}
/>
);
};
From 58455556302857c8cb836c9734bd44e5206dee98 Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Wed, 7 Aug 2024 18:09:24 -0700
Subject: [PATCH 19/21] Fix button
---
packages/trpc/src/chains.ts | 2 ++
.../components/transactions/recent-activity/recent-activity.tsx | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/packages/trpc/src/chains.ts b/packages/trpc/src/chains.ts
index 41e11c954e..6b4038bb38 100644
--- a/packages/trpc/src/chains.ts
+++ b/packages/trpc/src/chains.ts
@@ -98,6 +98,8 @@ export const chainsRouter = createTRPCRouter({
color: solanaChain.color,
};
}
+
+ throw new Error(`Chain with ID ${chainId} not found`);
}
}
),
diff --git a/packages/web/components/transactions/recent-activity/recent-activity.tsx b/packages/web/components/transactions/recent-activity/recent-activity.tsx
index edd753fdf4..a42d98aa61 100644
--- a/packages/web/components/transactions/recent-activity/recent-activity.tsx
+++ b/packages/web/components/transactions/recent-activity/recent-activity.tsx
@@ -109,7 +109,7 @@ export const RecentActivity: FunctionComponent = observer(() => {
className="text-osmoverse-400"
label={t("portfolio.seeAll")}
ariaLabel={t("portfolio.seeAll")}
- size="sm"
+ size="md"
/>
From 49619b1c34ea497973c2899bfcee90c0498fd403 Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Wed, 7 Aug 2024 18:12:15 -0700
Subject: [PATCH 20/21] Remove logs
---
.../web/components/transactions/use-recent-transfers.ts | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/packages/web/components/transactions/use-recent-transfers.ts b/packages/web/components/transactions/use-recent-transfers.ts
index fa6ad09155..79bf0dde3f 100644
--- a/packages/web/components/transactions/use-recent-transfers.ts
+++ b/packages/web/components/transactions/use-recent-transfers.ts
@@ -32,15 +32,6 @@ export function useRecentTransfers(address?: string): RecentTransfer[] {
return [];
}
- console.log(
- "Transfer History Store: ",
- transferHistoryStore.getHistoriesByAccount(address)
- );
- console.log(
- "IBC Transfer History Store: ",
- ibcTransferHistoryStore.getHistoriesAndUncommitedHistoriesByAccount(address)
- );
-
// reconcile histories from IBC and non-IBC history stores
return transferHistoryStore
.getHistoriesByAccount(address)
From b2348e59d6d0e329bf6edbc867ca0d237f824ca6 Mon Sep 17 00:00:00 2001
From: Matt Upham <30577966+mattupham@users.noreply.github.com>
Date: Wed, 7 Aug 2024 18:15:19 -0700
Subject: [PATCH 21/21] Update recent activity
---
.../recent-activity-transaction-row.tsx | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
index ae306225f0..645c476378 100644
--- a/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
+++ b/packages/web/components/transactions/recent-activity/recent-activity-transaction-row.tsx
@@ -87,7 +87,7 @@ export const TransferRow: FunctionComponent
= ({
) : null;
- const rightComponent = [
+ const rightComponentList = [