Skip to content

Commit

Permalink
fix: use txid for tx link (#7484)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladinlight committed Aug 5, 2024
1 parent 6bcf6b6 commit 25e39ea
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/hooks/useTxDetails/useTxDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 25e39ea

Please sign in to comment.