import React, { memo } from 'react'; import { useSelector } from 'react-redux'; import { isEqual } from 'lodash'; import PropTypes from 'prop-types'; import { getMemoizedMetaMaskIdentities, getAccountName, } from '../../../../selectors'; import Address from '../../transaction-decoding/components/decoding/address'; import { isValidHexAddress, toChecksumHexAddress, } from '../../../../../shared/modules/hexstring-utils'; import Box from '../../../ui/box'; import Typography from '../../../ui/typography'; import { DISPLAY, FONT_WEIGHT, TypographyVariant, TextColor, } from '../../../../helpers/constants/design-system'; import { sanitizeString } from '../../../../helpers/utils/util'; function SignatureRequestData({ data }) { const identities = useSelector(getMemoizedMetaMaskIdentities); return ( {Object.entries(data).map(([label, { value, type }], i) => ( {sanitizeString(label.charAt(0).toUpperCase() + label.slice(1))}:{' '} {typeof value === 'object' && value !== null ? ( ) : ( {type === 'address' && isValidHexAddress(value, { mixedCaseUseChecksum: true, }) ? (
) : ( sanitizeString(`${value}`) )} )} ))} ); } SignatureRequestData.propTypes = { data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired, }; export default memo(SignatureRequestData, (prevProps, nextProps) => { return isEqual(prevProps.data, nextProps.data); });