From 25e39ea689660781f4e56fd2d676fd0d2ed2e1ab Mon Sep 17 00:00:00 2001 From: kevin <35275952+kaladinlight@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:37:48 -0600 Subject: [PATCH] fix: use txid for tx link (#7484) --- src/hooks/useTxDetails/useTxDetails.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/hooks/useTxDetails/useTxDetails.ts b/src/hooks/useTxDetails/useTxDetails.ts index 161761b11e2..47b53d0b46f 100644 --- a/src/hooks/useTxDetails/useTxDetails.ts +++ b/src/hooks/useTxDetails/useTxDetails.ts @@ -106,30 +106,28 @@ export const useTxDetails = (txId: string): TxDetails => { const tx = useAppSelector((state: ReduxState) => selectTxById(state, txId)) const assets = useAppSelector(selectAssets) - const transfers = useMemo(() => { - if (!tx) return [] - return getTransfers(tx, assets) - }, [tx, assets]) + // This should never happen, but if it does we should not continue + if (!tx) throw Error('Transaction not found') + + const transfers = useMemo(() => getTransfers(tx, assets), [tx, assets]) const fee = useMemo(() => { if (!tx?.fee) return + return { ...tx.fee, asset: assets[tx.fee.assetId] ?? defaultAsset, } }, [tx?.fee, assets]) - const feeAsset = useAppSelector(state => selectFeeAssetByChainId(state, tx?.chainId ?? '')) + const feeAsset = useAppSelector(state => selectFeeAssetByChainId(state, tx.chainId)) const txLink = getTxLink({ - name: tx?.trade?.dexName, + name: tx.trade?.dexName, defaultExplorerBaseUrl: feeAsset?.explorerTxLink ?? '', - txId, + txId: tx.txid, }) - // This should never happen, but if it does we should not continue - if (!tx) throw Error('Transaction not found') - return { tx, fee,