You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.8 KiB
65 lines
1.8 KiB
4 years ago
|
import { connect } from 'react-redux';
|
||
|
import { compose } from 'redux';
|
||
|
import { withRouter } from 'react-router-dom';
|
||
5 years ago
|
|
||
|
import {
|
||
5 years ago
|
goHome,
|
||
|
encryptionPublicKeyMsg,
|
||
|
cancelEncryptionPublicKeyMsg,
|
||
4 years ago
|
} from '../../store/actions';
|
||
5 years ago
|
|
||
|
import {
|
||
5 years ago
|
conversionRateSelector,
|
||
4 years ago
|
unconfirmedTransactionsListSelector,
|
||
5 years ago
|
getTargetAccountWithSendEtherInfo,
|
||
4 years ago
|
} from '../../selectors';
|
||
5 years ago
|
|
||
4 years ago
|
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck';
|
||
|
import { getMostRecentOverviewPage } from '../../ducks/history/history';
|
||
|
import ConfirmEncryptionPublicKey from './confirm-encryption-public-key.component';
|
||
5 years ago
|
|
||
4 years ago
|
function mapStateToProps(state) {
|
||
4 years ago
|
const {
|
||
5 years ago
|
metamask: { domainMetadata = {} },
|
||
4 years ago
|
} = state;
|
||
5 years ago
|
|
||
4 years ago
|
const unconfirmedTransactions = unconfirmedTransactionsListSelector(state);
|
||
|
|
||
|
const txData = unconfirmedTransactions[0];
|
||
5 years ago
|
|
||
4 years ago
|
const { msgParams: from } = txData;
|
||
5 years ago
|
|
||
4 years ago
|
const fromAccount = getTargetAccountWithSendEtherInfo(state, from);
|
||
5 years ago
|
|
||
5 years ago
|
return {
|
||
4 years ago
|
txData,
|
||
|
domainMetadata,
|
||
5 years ago
|
fromAccount,
|
||
5 years ago
|
requester: null,
|
||
|
requesterAddress: null,
|
||
|
conversionRate: conversionRateSelector(state),
|
||
5 years ago
|
mostRecentOverviewPage: getMostRecentOverviewPage(state),
|
||
4 years ago
|
};
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
function mapDispatchToProps(dispatch) {
|
||
5 years ago
|
return {
|
||
|
goHome: () => dispatch(goHome()),
|
||
|
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
|
||
|
encryptionPublicKey: (msgData, event) => {
|
||
4 years ago
|
const params = { data: msgData.msgParams, metamaskId: msgData.id };
|
||
|
event.stopPropagation();
|
||
|
return dispatch(encryptionPublicKeyMsg(params));
|
||
5 years ago
|
},
|
||
|
cancelEncryptionPublicKey: (msgData, event) => {
|
||
4 years ago
|
event.stopPropagation();
|
||
|
return dispatch(cancelEncryptionPublicKeyMsg(msgData));
|
||
5 years ago
|
},
|
||
4 years ago
|
};
|
||
5 years ago
|
}
|
||
|
|
||
|
export default compose(
|
||
|
withRouter,
|
||
4 years ago
|
connect(mapStateToProps, mapDispatchToProps),
|
||
4 years ago
|
)(ConfirmEncryptionPublicKey);
|