Skip to content

Commit

Permalink
fix: testnet explorer url
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Oct 20, 2024
1 parent c1582f9 commit 133a067
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
10 changes: 10 additions & 0 deletions apps/renderer/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
}
}
6 changes: 3 additions & 3 deletions apps/renderer/src/modules/power/my-wallet-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -66,7 +66,7 @@ export const MyWalletSection = () => {
<a
className="underline"
target="_blank"
href="https://scan.rss3.io/token/0xE06Af68F0c9e819513a6CD083EF6848E76C28CD8"
href={`${getBlockchainExplorerUrl()}/token/0xE06Af68F0c9e819513a6CD083EF6848E76C28CD8`}
rel="noreferrer noopener"
/>
),
Expand All @@ -76,7 +76,7 @@ export const MyWalletSection = () => {
<SettingSectionTitle margin="compact" title={t("wallet.address.title")} />
<div className="group flex items-center gap-2 text-sm">
<a
href={`https://scan.rss3.io/address/${myWallet.address}`}
href={`${getBlockchainExplorerUrl()}/address/${myWallet.address}`}
target="_blank"
className="underline"
>
Expand Down
6 changes: 3 additions & 3 deletions apps/renderer/src/modules/power/transaction-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -103,7 +103,7 @@ export const TransactionsSection: Component = ({ className }) => {
<TooltipTrigger>
<a
target="_blank"
href={`https://scan.rss3.io/tx/${row.hash}`}
href={`${getBlockchainExplorerUrl()}/tx/${row.hash}`}
className="underline"
>
{row.hash.slice(0, 10)}...
Expand All @@ -122,7 +122,7 @@ export const TransactionsSection: Component = ({ className }) => {
{!!transactions.data?.length && (
<a
className="my-2 w-full text-sm text-zinc-400 underline"
href={`https://scan.rss3.io/address/${myWallet.address}`}
href={`${getBlockchainExplorerUrl()}/address/${myWallet.address}`}
target="_blank"
>
{t("wallet.transactions.more")}
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/hono.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4454,6 +4454,7 @@ declare const _routes: hono_hono_base.HonoBase<Env, {
INVITATION_INTERVAL_DAYS: number;
INVITATION_PRICE: number;
DAILY_POWER_SUPPLY: number;
IS_RSS3_TESTNET: boolean;
};
};
outputFormat: "json" | "text";
Expand Down

0 comments on commit 133a067

Please sign in to comment.