Skip to content

Commit cc5ac8c

Browse files
committed
normalize etherscan links
1 parent 094371c commit cc5ac8c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

app/[locale]/10years/_components/CurrentTorchHolderCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import Curved10YearsText from "./10y.svg"
1919

2020
import {
2121
formatAddress,
22+
getAddressEtherscanUrl,
2223
getBlockieImage,
2324
type TorchHolderMetadata,
2425
} from "@/lib/torch"
@@ -88,7 +89,7 @@ const CurrentTorchHolderCard = ({
8889
{/* Verify onchain link */}
8990
<BaseLink
9091
className="mt-2 text-xs"
91-
href={`https://sepolia.etherscan.io/address/${currentHolder.address}`}
92+
href={getAddressEtherscanUrl(currentHolder.address)}
9293
>
9394
View on Etherscan
9495
</BaseLink>

app/[locale]/10years/_components/TorchHistoryCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Tag } from "@/components/ui/tag"
1111

1212
import { cn } from "@/lib/utils/cn"
1313

14-
import { formatDate, getEtherscanUrl } from "@/lib/torch"
14+
import { formatDate, getTxEtherscanUrl } from "@/lib/torch"
1515

1616
interface TorchHistoryCardProps {
1717
name: string
@@ -76,7 +76,7 @@ const TorchHistoryCard: React.FC<TorchHistoryCardProps> = ({
7676
From {formatDate(from)} to {formatDate(to)}
7777
</div>
7878
<BaseLink
79-
href={getEtherscanUrl(transactionHash)}
79+
href={getTxEtherscanUrl(transactionHash)}
8080
className="text-xs"
8181
>
8282
View on Etherscan

src/lib/torch/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ export const formatDate = (timestamp: number) => {
205205
return `${month} ${day}, ${time}`
206206
}
207207

208-
export const getEtherscanUrl = (txHash: string) => {
208+
export const getTxEtherscanUrl = (txHash: string) => {
209209
return `https://etherscan.io/tx/${txHash}`
210210
}
211+
212+
export const getAddressEtherscanUrl = (address: string) => {
213+
return `https://etherscan.io/address/${address}`
214+
}

0 commit comments

Comments
 (0)