2020-02-19 19:24:16 +01:00
|
|
|
import { connect } from 'react-redux'
|
2020-02-24 23:58:26 +01:00
|
|
|
import { compose } from 'redux'
|
2020-02-19 19:24:16 +01:00
|
|
|
import { withRouter } from 'react-router-dom'
|
|
|
|
|
|
|
|
import {
|
2020-03-06 22:34:56 +01:00
|
|
|
goHome,
|
|
|
|
encryptionPublicKeyMsg,
|
|
|
|
cancelEncryptionPublicKeyMsg,
|
|
|
|
} from '../../store/actions'
|
|
|
|
|
|
|
|
import {
|
2020-02-19 19:24:16 +01:00
|
|
|
conversionRateSelector,
|
2020-03-06 22:34:56 +01:00
|
|
|
getTargetAccountWithSendEtherInfo,
|
2020-05-02 21:41:17 +02:00
|
|
|
} from '../../selectors'
|
2020-03-06 22:34:56 +01:00
|
|
|
|
2020-02-19 19:24:16 +01:00
|
|
|
import { clearConfirmTransaction } from '../../ducks/confirm-transaction/confirm-transaction.duck'
|
|
|
|
import ConfirmEncryptionPublicKey from './confirm-encryption-public-key.component'
|
|
|
|
|
|
|
|
function mapStateToProps (state) {
|
|
|
|
const { confirmTransaction,
|
|
|
|
metamask: { domainMetadata = {} },
|
|
|
|
} = state
|
|
|
|
|
|
|
|
const {
|
|
|
|
txData = {},
|
|
|
|
} = confirmTransaction
|
|
|
|
|
2020-03-06 22:34:56 +01:00
|
|
|
const { msgParams: from } = txData
|
|
|
|
|
|
|
|
const fromAccount = getTargetAccountWithSendEtherInfo(state, from)
|
|
|
|
|
2020-02-19 19:24:16 +01:00
|
|
|
return {
|
|
|
|
txData: txData,
|
|
|
|
domainMetadata: domainMetadata,
|
2020-03-06 22:34:56 +01:00
|
|
|
fromAccount,
|
2020-02-19 19:24:16 +01:00
|
|
|
requester: null,
|
|
|
|
requesterAddress: null,
|
|
|
|
conversionRate: conversionRateSelector(state),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps (dispatch) {
|
|
|
|
return {
|
|
|
|
goHome: () => dispatch(goHome()),
|
|
|
|
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
|
|
|
|
encryptionPublicKey: (msgData, event) => {
|
|
|
|
const params = { data: msgData.msgParams, metamaskId: msgData.id }
|
|
|
|
event.stopPropagation()
|
|
|
|
return dispatch(encryptionPublicKeyMsg(params))
|
|
|
|
},
|
|
|
|
cancelEncryptionPublicKey: (msgData, event) => {
|
|
|
|
event.stopPropagation()
|
|
|
|
return dispatch(cancelEncryptionPublicKeyMsg(msgData))
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
|
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
|
|
)(ConfirmEncryptionPublicKey)
|