diff --git a/ui/pages/bridge/transaction-details/bridge-activity-item-tx-segments.tsx b/ui/pages/bridge/transaction-details/bridge-activity-item-tx-segments.tsx index 5712bc32c7e5..a5764e250636 100644 --- a/ui/pages/bridge/transaction-details/bridge-activity-item-tx-segments.tsx +++ b/ui/pages/bridge/transaction-details/bridge-activity-item-tx-segments.tsx @@ -17,10 +17,6 @@ import { FlexDirection, TextColor, } from '../../../helpers/constants/design-system'; -import { - TransactionMeta, - TransactionStatus, -} from '@metamask/transaction-controller'; import Segment from './segment'; const getTxIndex = ( diff --git a/ui/pages/bridge/transaction-details/bridge-step-description.tsx b/ui/pages/bridge/transaction-details/bridge-step-description.tsx index 75660d85d026..2678c6e4d162 100644 --- a/ui/pages/bridge/transaction-details/bridge-step-description.tsx +++ b/ui/pages/bridge/transaction-details/bridge-step-description.tsx @@ -1,11 +1,5 @@ import * as React from 'react'; import { NetworkConfiguration } from '@metamask/network-controller'; -import { BridgeHistoryItem } from '../../../../shared/types/bridge-status'; -import { Step } from '../../../../shared/types/bridge-status'; -import { ActionTypes } from '../../../../shared/types/bridge-status'; -import { StatusTypes } from '../../../../shared/types/bridge-status'; -import { Box, Text } from '../../../components/component-library'; -import { Numeric } from '../../../../shared/modules/Numeric'; import { Hex } from '@metamask/utils'; import { TransactionMeta, @@ -31,6 +25,11 @@ import { useI18nContext } from '../../../hooks/useI18nContext'; * bridge actions will have step.srcChainId !== step.destChainId * We cannot infer the status of the bridge action since 2 different chains are involved * The best we can do is the bridgeHistoryItem.estimatedProcessingTimeInSeconds + * + * @param t + * @param stepStatus + * @param step + * @param networkConfigurationsByChainId */ const getBridgeActionText = ( t: Function, @@ -65,6 +64,10 @@ const getBridgeActionStatus = (bridgeHistoryItem: BridgeHistoryItem) => { * EITHER the quote.srcChainId or the quote.destChainId * Despite not having any actual timestamp,we can infer the status of the swap action * based on the status of the source chain tx if srcChainId and destChainId are the same* + * + * @param bridgeHistoryItem + * @param step + * @param srcChainTxMeta */ const getSwapActionStatus = ( bridgeHistoryItem: BridgeHistoryItem, @@ -77,21 +80,20 @@ const getSwapActionStatus = ( if (isSrcAndDestChainSame && isSwapOnSrcChain) { // if the swap action is on the src chain (i.e. step.srcChainId === step.destChainId === bridgeHistoryItem.quote.srcChainId), - //we check the source chain tx status, since we know when it's confirmed + // we check the source chain tx status, since we know when it's confirmed const isSrcChainTxConfirmed = srcChainTxMeta?.status === TransactionStatus.confirmed; return isSrcChainTxConfirmed ? StatusTypes.COMPLETE : StatusTypes.PENDING; - } else { - // if the swap action is on the dest chain, we check the bridgeHistoryItem.status, - // since we don't know when the dest tx is confirmed - if (srcChainTxMeta?.status === TransactionStatus.confirmed) { - return bridgeHistoryItem.status ? bridgeHistoryItem.status.status : null; - } - - // If the source chain tx is not confirmed, we know the swap hasn't started - // use null to represent this as we don't have an equivalent in StatusTypes - return null; } + // if the swap action is on the dest chain, we check the bridgeHistoryItem.status, + // since we don't know when the dest tx is confirmed + if (srcChainTxMeta?.status === TransactionStatus.confirmed) { + return bridgeHistoryItem.status ? bridgeHistoryItem.status.status : null; + } + + // If the source chain tx is not confirmed, we know the swap hasn't started + // use null to represent this as we don't have an equivalent in StatusTypes + return null; }; const getSwapActionText = (