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, COLORS, FONT_WEIGHT, TYPOGRAPHY, } from '../../../../helpers/constants/design-system'; function SignatureRequestData({ data }) { const identities = useSelector(getMemoizedMetaMaskIdentities); return ( {Object.entries(data).map(([label, value], i) => ( {label.charAt(0).toUpperCase() + label.slice(1)}:{' '} {typeof value === 'object' && value !== null ? ( ) : ( {isValidHexAddress(value, { mixedCaseUseChecksum: true, }) ? (
) : ( `${value}` )} )} ))} ); } SignatureRequestData.propTypes = { data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]).isRequired, }; export default memo(SignatureRequestData, (prevProps, nextProps) => { return isEqual(prevProps.data, nextProps.data); });