2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
2022-08-02 23:56:02 +02:00
|
|
|
import { compose } from 'redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
|
|
|
import {
|
|
|
|
showModal,
|
|
|
|
setAccountLabel,
|
|
|
|
hideModal,
|
|
|
|
} from '../../../../store/actions';
|
2020-05-04 21:06:28 +02:00
|
|
|
import {
|
|
|
|
getSelectedIdentity,
|
|
|
|
getRpcPrefsForCurrentProvider,
|
2021-03-10 18:21:52 +01:00
|
|
|
getCurrentChainId,
|
2021-12-16 11:41:55 +01:00
|
|
|
getMetaMaskAccountsOrdered,
|
2022-08-02 23:56:02 +02:00
|
|
|
getBlockExplorerLinkText,
|
2021-02-04 19:15:23 +01:00
|
|
|
} from '../../../../selectors';
|
|
|
|
import AccountDetailsModal from './account-details-modal.component';
|
2019-06-27 17:03:18 +02:00
|
|
|
|
|
|
|
const mapStateToProps = (state) => {
|
|
|
|
return {
|
2021-03-10 18:21:52 +01:00
|
|
|
chainId: getCurrentChainId(state),
|
2019-06-27 17:03:18 +02:00
|
|
|
selectedIdentity: getSelectedIdentity(state),
|
|
|
|
keyrings: state.metamask.keyrings,
|
|
|
|
rpcPrefs: getRpcPrefsForCurrentProvider(state),
|
2021-12-16 11:41:55 +01:00
|
|
|
accounts: getMetaMaskAccountsOrdered(state),
|
2022-08-02 23:56:02 +02:00
|
|
|
blockExplorerLinkText: getBlockExplorerLinkText(state, true),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2019-06-27 17:03:18 +02:00
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => {
|
|
|
|
return {
|
2020-11-03 00:41:28 +01:00
|
|
|
showExportPrivateKeyModal: () =>
|
|
|
|
dispatch(showModal({ name: 'EXPORT_PRIVATE_KEY' })),
|
|
|
|
setAccountLabel: (address, label) =>
|
|
|
|
dispatch(setAccountLabel(address, label)),
|
2022-08-02 23:56:02 +02:00
|
|
|
hideModal: () => {
|
|
|
|
dispatch(hideModal());
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2019-06-27 17:03:18 +02:00
|
|
|
|
2022-08-02 23:56:02 +02:00
|
|
|
export default compose(
|
|
|
|
withRouter,
|
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2021-02-04 19:15:23 +01:00
|
|
|
)(AccountDetailsModal);
|