Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add chain explorer txn link to txn history #3316

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion wormhole-connect/src/views/v2/TxHistory/Item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ import config from 'config';
import AssetBadge from 'components/AssetBadge';
import {
calculateUSDPrice,
getExplorerUrl,
getUSDFormat,
millisToRelativeTime,
trimTxHash,
} from 'utils';

import type { Transaction } from 'config/types';
import { useTokens } from 'contexts/TokensContext';
import ExplorerLink from 'components/ExplorerLink';

const useStyles = makeStyles()((theme: any) => ({
container: {
Expand Down Expand Up @@ -176,6 +178,15 @@ const TxHistoryItem = (props: Props) => {
return `${dateTimeFormat.format(senderDate)}`;
}, [senderTimestamp]);

const chainExplorerLink = useMemo(() => {
return (
<ExplorerLink
url={getExplorerUrl(fromChain, txHash, 'tx')}
text={trimTxHash(txHash, 4, 4)}
/>
);
}, [fromChain, txHash]);

return (
<div className={classes.container}>
<Card className={classes.card}>
Expand All @@ -193,7 +204,7 @@ const TxHistoryItem = (props: Props) => {
color={theme.palette.text.secondary}
display="flex"
>
<span>{`Transaction #${trimTxHash(txHash, 4, 4)}`}</span>
<span>Transaction #{chainExplorerLink}</span>
<span>{transactionDateTime}</span>
</Typography>
}
Expand Down
Loading