import React from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { Color, TextVariant, TEXT_TRANSFORM, } from '../../../helpers/constants/design-system'; import { getKnownMethodData } from '../../../selectors'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { useTransactionFunctionType } from '../../../hooks/useTransactionFunctionType'; import Box from '../../ui/box/box'; import Disclosure from '../../ui/disclosure'; import TransactionDecoding from '../transaction-decoding'; import { Text } from '../../component-library'; const ConfirmData = ({ txData, dataComponent }) => { const t = useI18nContext(); const { txParams = {} } = txData; const methodData = useSelector( (state) => getKnownMethodData(state, txParams.data) || {}, ); const { functionType } = useTransactionFunctionType(txData); if (dataComponent) { return dataComponent; } if (!txParams.data) { return null; } const { params } = methodData; const functionParams = params?.length ? `(${params.map(({ type }) => type).join(', ')})` : ''; return ( {`${t('functionType')}:`} {`${functionType} ${functionParams}`} ); }; ConfirmData.propTypes = { txData: PropTypes.object, dataComponent: PropTypes.element, }; export default ConfirmData;