diff --git a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx index 3ba1e783870..6951e5b401d 100644 --- a/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx +++ b/src/components/MultiHopTrade/components/MultiHopTradeConfirm/components/ApprovalStep.tsx @@ -6,9 +6,10 @@ import { FaInfoCircle, FaThumbsUp } from 'react-icons/fa' import { useTranslate } from 'react-polyglot' import { MiddleEllipsis } from 'components/MiddleEllipsis/MiddleEllipsis' import { Row } from 'components/Row/Row' -import { RawText, Text } from 'components/Text' +import { Text } from 'components/Text' import { useLocaleFormatter } from 'hooks/useLocaleFormatter/useLocaleFormatter' import { useToggle } from 'hooks/useToggle/useToggle' +import { getTxLink } from 'lib/getTxLink' import { fromBaseUnit } from 'lib/math' import type { TradeQuoteStep } from 'lib/swapper/types' import { selectFeeAssetById } from 'state/slices/selectors' @@ -93,22 +94,38 @@ export const ApprovalStep = ({ const translate = useTranslate() - const txLink = useMemo(() => { + const description = useMemo(() => { + if (!txHash) { + return translate('trade.approvalGasFee', { fee: approvalNetworkFeeCryptoFormatted }) + } + + const href = getTxLink({ + name: tradeQuoteStep.source, + defaultExplorerBaseUrl: tradeQuoteStep.sellAsset.explorerTxLink, + tradeId: txHash, + }) + return ( - - + + ) - }, [txHash]) + }, [ + approvalNetworkFeeCryptoFormatted, + tradeQuoteStep.sellAsset.explorerTxLink, + tradeQuoteStep.source, + translate, + txHash, + ]) const leftIcon = useMemo(() => , []) const content = useMemo( - () => ( - - {txHash ? ( - TX: {txHash} - ) : ( + () => + txHash ? ( + <> + ) : ( + @@ -149,9 +166,8 @@ export const ApprovalStep = ({ {translate('common.approve')} - )} - - ), + + ), [ handleSignAllowanceApproval, hopExecutionState, @@ -166,11 +182,7 @@ export const ApprovalStep = ({ return ( {`${sellAmountCryptoFormatted}.${sellChainSymbol} -> ${buyAmountCryptoFormatted}.${buyChainSymbol}`} - {txHash !== undefined && TX: {txHash}} {txLink && ( - - - TX ID - - {txHash} - - - + + + )} )