Skip to content

Commit 74b5895

Browse files
authoredFeb 27, 2025··
Add chain explorer txn link to txn history (#3316)
1 parent 78de537 commit 74b5895

File tree

1 file changed

+12
-1
lines changed
  • wormhole-connect/src/views/v2/TxHistory/Item

1 file changed

+12
-1
lines changed
 

‎wormhole-connect/src/views/v2/TxHistory/Item/index.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ import config from 'config';
1212
import AssetBadge from 'components/AssetBadge';
1313
import {
1414
calculateUSDPrice,
15+
getExplorerUrl,
1516
getUSDFormat,
1617
millisToRelativeTime,
1718
trimTxHash,
1819
} from 'utils';
1920

2021
import type { Transaction } from 'config/types';
2122
import { useTokens } from 'contexts/TokensContext';
23+
import ExplorerLink from 'components/ExplorerLink';
2224

2325
const useStyles = makeStyles()((theme: any) => ({
2426
container: {
@@ -177,6 +179,15 @@ const TxHistoryItem = (props: Props) => {
177179
return `${dateTimeFormat.format(senderDate)}`;
178180
}, [senderTimestamp]);
179181

182+
const chainExplorerLink = useMemo(() => {
183+
return (
184+
<ExplorerLink
185+
url={getExplorerUrl(fromChain, txHash, 'tx')}
186+
text={trimTxHash(txHash, 4, 4)}
187+
/>
188+
);
189+
}, [fromChain, txHash]);
190+
180191
return (
181192
<div className={classes.container}>
182193
<Card className={classes.card}>
@@ -194,7 +205,7 @@ const TxHistoryItem = (props: Props) => {
194205
color={theme.palette.text.secondary}
195206
display="flex"
196207
>
197-
<span>{`Transaction #${trimTxHash(txHash, 4, 4)}`}</span>
208+
<span>Transaction #{chainExplorerLink}</span>
198209
<span>{transactionDateTime}</span>
199210
</Typography>
200211
}

0 commit comments

Comments
 (0)
Please sign in to comment.