Skip to content

Commit

Permalink
Filter out invalid txs
Browse files Browse the repository at this point in the history
Signed-off-by: Emre Bogazliyanlioglu <[email protected]>
  • Loading branch information
emreboga committed Feb 4, 2025
1 parent 5c3abc3 commit 05be131
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion wormhole-connect/src/views/v2/TxHistory/Widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTheme } from '@mui/material';
import Typography from '@mui/material/Typography';
import { makeStyles } from 'tss-react/mui';

import config from 'config';
import { TransactionLocal } from 'config/types';
import WidgetItem from 'views/v2/TxHistory/Widget/Item';
import { getTxsFromLocalStorage } from 'utils/inProgressTxCache';
Expand Down Expand Up @@ -43,7 +44,14 @@ const TxHistoryWidget = () => {

useEffect(() => {
// Get all in-progress transactions from localStorage
setTransactions(getTxsFromLocalStorage());
const txs = getTxsFromLocalStorage();

// Filter out the ones with unknown token configs
const verifiedTxs = txs?.filter(
(tx) => tx?.txDetails?.token && config.tokens.get(tx?.txDetails?.token),
);

setTransactions(verifiedTxs);
}, []);

if (!transactions || transactions.length === 0) {
Expand Down

0 comments on commit 05be131

Please sign in to comment.