import React from 'react'; import PropTypes from 'prop-types'; import { useGasFeeContext } from '../../../contexts/gasFee'; import { useTransactionModalContext } from '../../../contexts/transaction-modal'; import InfoTooltip from '../../ui/info-tooltip/info-tooltip'; import Typography from '../../ui/typography/typography'; import TransactionDetailItem from '../transaction-detail-item/transaction-detail-item.component'; import { COLORS, TYPOGRAPHY } from '../../../helpers/constants/design-system'; import { PRIORITY_LEVEL_ICON_MAP } from '../../../helpers/constants/gas'; import { useI18nContext } from '../../../hooks/useI18nContext'; export default function TransactionDetail({ rows = [], onEdit, userAcknowledgedGasMissing, }) { const t = useI18nContext(); const { gasLimit, hasSimulationError, estimateUsed, maxFeePerGas, maxPriorityFeePerGas, supportsEIP1559V2, transaction, } = useGasFeeContext(); const { openModal } = useTransactionModalContext(); if (supportsEIP1559V2 && estimateUsed) { const editEnabled = !hasSimulationError || userAcknowledgedGasMissing; if (!editEnabled) return null; return (
{estimateUsed === 'custom' && ( )} {estimateUsed === 'dappSuggested' && ( {t('dappSuggestedTooltip', [transaction.origin])} {t('maxBaseFee')} {maxFeePerGas} {t('maxPriorityFee')} {maxPriorityFeePerGas} {t('gasLimit')} {gasLimit}
} position="top" /> )}
{rows}
); } return (
{onEdit && (
)}
{rows}
); } TransactionDetail.propTypes = { rows: PropTypes.arrayOf(TransactionDetailItem).isRequired, onEdit: PropTypes.func, userAcknowledgedGasMissing: PropTypes.bool.isRequired, };