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 } 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 }) { // eslint-disable-next-line prefer-destructuring const EIP_1559_V2 = process.env.EIP_1559_V2; const t = useI18nContext(); const { gasLimit, estimateUsed, maxFeePerGas, maxPriorityFeePerGas, transaction, } = useGasFeeContext(); const { openModal } = useTransactionModalContext(); if (EIP_1559_V2 && estimateUsed) { return (
{estimateUsed === 'custom' && onEdit && ( )} {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, };