Skip to content

Commit

Permalink
fix: use correct sent amount
Browse files Browse the repository at this point in the history
  • Loading branch information
infiniteflower committed Dec 2, 2024
1 parent fb1792e commit 12b61db
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions ui/pages/bridge/transaction-details/transaction-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
} from '../../../helpers/constants/design-system';
import { formatDate } from '../../../helpers/utils/util';
import { ConfirmInfoRowDivider as Divider } from '../../../components/app/confirm/info/row';
import { calcTokenAmount } from '../../../../shared/lib/transactions-controller-utils';
import { useI18nContext } from '../../../hooks/useI18nContext';
import { CHAIN_ID_TO_NETWORK_IMAGE_URL_MAP } from '../../../../shared/constants/network';
import { selectedAddressTxListSelector } from '../../../selectors';
Expand Down Expand Up @@ -66,32 +65,15 @@ const getBlockExplorerUrl = (
/**
* @param options0
* @param options0.bridgeHistoryItem
* @param options0.srcChainTxMeta
* @returns A string representing the bridge amount in decimal form
*/
const getBridgeAmount = ({
bridgeHistoryItem,
srcChainTxMeta,
}: {
bridgeHistoryItem?: BridgeHistoryItem;
srcChainTxMeta?: TransactionMeta;
}) => {
if (bridgeHistoryItem) {
return `${calcTokenAmount(
bridgeHistoryItem.quote.srcTokenAmount,
bridgeHistoryItem.quote.srcAsset.decimals,
).toFixed()} ${bridgeHistoryItem.quote.srcAsset.symbol}`;
}

if (
srcChainTxMeta &&
srcChainTxMeta.sourceTokenAmount &&
srcChainTxMeta.sourceTokenDecimals
) {
return `${calcTokenAmount(
srcChainTxMeta.sourceTokenAmount,
srcChainTxMeta.sourceTokenDecimals,
).toFixed()} ${srcChainTxMeta.sourceTokenSymbol}`;
return bridgeHistoryItem.pricingData?.amountSent;
}

return undefined;
Expand Down Expand Up @@ -158,7 +140,7 @@ const CrossChainSwapTxDetails = () => {
})
: undefined;

const bridgeAmount = getBridgeAmount({ bridgeHistoryItem, srcChainTxMeta });
const bridgeAmount = getBridgeAmount({ bridgeHistoryItem });

return (
<div className="bridge">
Expand Down

0 comments on commit 12b61db

Please sign in to comment.