From aac5d8e29c965ec49a37583657dbfdc8b956424d Mon Sep 17 00:00:00 2001 From: FazioNico Date: Wed, 26 Jun 2024 08:49:12 +0200 Subject: [PATCH] fix: handle unexisting fungible info --- src/components/ui/WalletTxEntity.tsx | 10 +++++----- src/containers/desktop/TokenDetailDesktopContainer.tsx | 2 +- src/containers/mobile/TokenDetailMobileContainer.tsx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/ui/WalletTxEntity.tsx b/src/components/ui/WalletTxEntity.tsx index 0e4a6994..dd5d4fe1 100644 --- a/src/components/ui/WalletTxEntity.tsx +++ b/src/components/ui/WalletTxEntity.tsx @@ -144,7 +144,7 @@ export function WalletTxEntity(props: { tx: TxInterface }) { onError={(event) => { ( event.target as any - ).src = `https://images.placeholders.dev/?width=42&height=42&text=${action1.fungible_info.symbol}&bgColor=%23cccccc&textColor=%23182449`; + ).src = `https://images.placeholders.dev/?width=42&height=42&text=${action1?.fungible_info?.symbol}&bgColor=%23cccccc&textColor=%23182449`; }} /> @@ -155,7 +155,7 @@ export function WalletTxEntity(props: { tx: TxInterface }) { (action1 as Transfer).direction === 'in' ? '+ ' : '- ' )} {action1.quantity.float.toFixed(3) + ' '} - {action1.fungible_info.symbol} + {action1?.fungible_info?.symbol} {tx.attributes.operation_type !== 'approve' && (
{currencyFormat.format((action1 as Transfer).value)} @@ -173,14 +173,14 @@ export function WalletTxEntity(props: { tx: TxInterface }) { }}> {tx.relationships.chain.data.id} { ( event.target as any - ).src = `https://images.placeholders.dev/?width=42&height=42&text=${action2.fungible_info.symbol}&bgColor=%23cccccc&textColor=%23182449`; + ).src = `https://images.placeholders.dev/?width=42&height=42&text=${action2?.fungible_info?.symbol}&bgColor=%23cccccc&textColor=%23182449`; }} /> @@ -188,7 +188,7 @@ export function WalletTxEntity(props: { tx: TxInterface }) {

{(action2 as Transfer).direction === 'in' ? '+ ' : '- '} {action2.quantity.float.toFixed(3) + ' '} - {action2.fungible_info.symbol} + {action2?.fungible_info?.symbol}
{currencyFormat.format((action2 as Transfer).value)}
diff --git a/src/containers/desktop/TokenDetailDesktopContainer.tsx b/src/containers/desktop/TokenDetailDesktopContainer.tsx index bb111a1e..4a056c23 100644 --- a/src/containers/desktop/TokenDetailDesktopContainer.tsx +++ b/src/containers/desktop/TokenDetailDesktopContainer.tsx @@ -91,7 +91,7 @@ export const TokenDetailDesktopContainer = (props: { const filteredTxs = txs.filter((tx) => { return tx.attributes.transfers.some((transfer) => { - return transfer.fungible_info.symbol === data.symbol; + return transfer?.fungible_info?.symbol === data.symbol; }); }); diff --git a/src/containers/mobile/TokenDetailMobileContainer.tsx b/src/containers/mobile/TokenDetailMobileContainer.tsx index b872baa3..f455b11a 100644 --- a/src/containers/mobile/TokenDetailMobileContainer.tsx +++ b/src/containers/mobile/TokenDetailMobileContainer.tsx @@ -80,7 +80,7 @@ export const TokenDetailMobileContainer = (props: { const filteredTxs = txs.filter((tx) => { return tx.attributes.transfers.some((transfer) => { - return transfer.fungible_info.symbol === data.symbol; + return transfer?.fungible_info?.symbol === data.symbol; }); });