1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 23:58:06 +01:00
metamask-extension/ui/components/app/transaction-list-item-details/transaction-list-item-details.container.js
Vladimir Saric 42be5a07d7
Replaced addresses by the address component on SignTypedData v4 signatures (#16018)
* Replaced addresses by the address component on SignTypedData v4 signatures

* Fixing signature-request e2e tests

* Modified scss file for signature-request message

* Using address component for rendering the addresses and bold label where hex address is not valid

* Modify the address component

* Added proper BEM syntax for class names and used Box and Typography

* FIxing e2e tests

* Commited requested changes from George and added storybook

* Review requested changes

* Created new component for rendering data in signature-request-message.js

* Fixing proper usage for getAccountName and getMetadataContractName selectors

* Fixing e2e tests
2022-11-10 06:58:34 -03:30

67 lines
2.0 KiB
JavaScript

import { connect } from 'react-redux';
import { compose } from 'redux';
import { withRouter } from 'react-router-dom';
import { tryReverseResolveAddress } from '../../../store/actions';
import {
getAddressBook,
getBlockExplorerLinkText,
getIsCustomNetwork,
getRpcPrefsForCurrentProvider,
getEnsResolutionByAddress,
getAccountName,
getMetadataContractName,
getMetaMaskIdentities,
} from '../../../selectors';
import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils';
import TransactionListItemDetails from './transaction-list-item-details.component';
const mapStateToProps = (state, ownProps) => {
const { recipientAddress, senderAddress } = ownProps;
let recipientEns;
if (recipientAddress) {
const address = toChecksumHexAddress(recipientAddress);
recipientEns = getEnsResolutionByAddress(state, address);
}
const addressBook = getAddressBook(state);
const identities = getMetaMaskIdentities(state);
const recipientName = getAccountName(identities, recipientAddress);
const recipientMetadataName = getMetadataContractName(
state,
recipientAddress,
);
const getNickName = (address) => {
const entry = addressBook.find((contact) => {
return address.toLowerCase() === contact.address.toLowerCase();
});
return (entry && entry.name) || '';
};
const rpcPrefs = getRpcPrefsForCurrentProvider(state);
const isCustomNetwork = getIsCustomNetwork(state);
return {
rpcPrefs,
recipientEns,
senderNickname: getNickName(senderAddress),
recipientNickname: recipientAddress ? getNickName(recipientAddress) : null,
isCustomNetwork,
blockExplorerLinkText: getBlockExplorerLinkText(state),
recipientName,
recipientMetadataName,
};
};
const mapDispatchToProps = (dispatch) => {
return {
tryReverseResolveAddress: (address) => {
return dispatch(tryReverseResolveAddress(address));
},
};
};
export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps),
)(TransactionListItemDetails);