From 133a0678406ec537c009be641d2a9b3b3bf57d6f Mon Sep 17 00:00:00 2001 From: DIYgod Date: Mon, 21 Oct 2024 03:54:36 +0800 Subject: [PATCH] fix: testnet explorer url --- apps/renderer/src/lib/utils.ts | 10 ++++++++++ .../src/modules/power/my-wallet-section/index.tsx | 6 +++--- .../src/modules/power/transaction-section/index.tsx | 6 +++--- packages/shared/src/hono.ts | 1 + 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/renderer/src/lib/utils.ts b/apps/renderer/src/lib/utils.ts index 64769e3958..d24ad59fbf 100644 --- a/apps/renderer/src/lib/utils.ts +++ b/apps/renderer/src/lib/utils.ts @@ -313,3 +313,13 @@ export const getLevelMultiplier = (level: number) => { return (poolMultiplier / rangeMultiplier).toFixed(0) } + +export const getBlockchainExplorerUrl = () => { + const serverConfigs = getServerConfigs() + + if (serverConfigs?.IS_RSS3_TESTNET) { + return `https://scan.testnet.rss3.io` + } else { + return `https://scan.rss3.io` + } +} diff --git a/apps/renderer/src/modules/power/my-wallet-section/index.tsx b/apps/renderer/src/modules/power/my-wallet-section/index.tsx index 2beda5ea29..c7f8db012d 100644 --- a/apps/renderer/src/modules/power/my-wallet-section/index.tsx +++ b/apps/renderer/src/modules/power/my-wallet-section/index.tsx @@ -8,7 +8,7 @@ import { Divider } from "~/components/ui/divider" import { LoadingWithIcon } from "~/components/ui/loading" import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "~/components/ui/tooltip" import { apiClient } from "~/lib/api-fetch" -import { cn } from "~/lib/utils" +import { cn, getBlockchainExplorerUrl } from "~/lib/utils" import { SettingSectionTitle } from "~/modules/settings/section" import { ActivityPoints } from "~/modules/wallet/activity-points" import { Balance } from "~/modules/wallet/balance" @@ -66,7 +66,7 @@ export const MyWalletSection = () => { ), @@ -76,7 +76,7 @@ export const MyWalletSection = () => {
diff --git a/apps/renderer/src/modules/power/transaction-section/index.tsx b/apps/renderer/src/modules/power/transaction-section/index.tsx index d25ad9f0f3..dda1695d2d 100644 --- a/apps/renderer/src/modules/power/transaction-section/index.tsx +++ b/apps/renderer/src/modules/power/transaction-section/index.tsx @@ -19,7 +19,7 @@ import { Tabs, TabsList, TabsTrigger } from "~/components/ui/tabs" import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "~/components/ui/tooltip" import { EllipsisHorizontalTextWithTooltip } from "~/components/ui/typography" import { replaceImgUrlIfNeed } from "~/lib/img-proxy" -import { cn } from "~/lib/utils" +import { cn, getBlockchainExplorerUrl } from "~/lib/utils" import { TransactionTypes } from "~/models/types" import { usePresentUserProfileModal } from "~/modules/profile/hooks" import { SettingSectionTitle } from "~/modules/settings/section" @@ -103,7 +103,7 @@ export const TransactionsSection: Component = ({ className }) => { {row.hash.slice(0, 10)}... @@ -122,7 +122,7 @@ export const TransactionsSection: Component = ({ className }) => { {!!transactions.data?.length && ( {t("wallet.transactions.more")} diff --git a/packages/shared/src/hono.ts b/packages/shared/src/hono.ts index c54b2498c3..8448dca6f1 100644 --- a/packages/shared/src/hono.ts +++ b/packages/shared/src/hono.ts @@ -4454,6 +4454,7 @@ declare const _routes: hono_hono_base.HonoBase