mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
`withRouter` has been removed from any components that were not using any of the three props injected by `withRouter`: `history`, `location`, and `match`. `compose` is a no-op when called upon a single component, so it has been removed in all such cases.
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
import { connect } from 'react-redux'
|
|
import SignatureRequest from './signature-request.component'
|
|
import { goHome } from '../../../store/actions'
|
|
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'
|
|
import {
|
|
getSelectedAccount,
|
|
getCurrentAccountWithSendEtherInfo,
|
|
getSelectedAddress,
|
|
accountsWithSendEtherInfoSelector,
|
|
conversionRateSelector,
|
|
} from '../../../selectors/selectors.js'
|
|
|
|
function mapStateToProps (state) {
|
|
return {
|
|
balance: getSelectedAccount(state).balance,
|
|
selectedAccount: getCurrentAccountWithSendEtherInfo(state),
|
|
selectedAddress: getSelectedAddress(state),
|
|
accounts: accountsWithSendEtherInfoSelector(state),
|
|
conversionRate: conversionRateSelector(state),
|
|
}
|
|
}
|
|
|
|
function mapDispatchToProps (dispatch) {
|
|
return {
|
|
goHome: () => dispatch(goHome()),
|
|
clearConfirmTransaction: () => dispatch(clearConfirmTransaction()),
|
|
}
|
|
}
|
|
|
|
function mergeProps (stateProps, dispatchProps, ownProps) {
|
|
const {
|
|
signPersonalMessage,
|
|
signTypedMessage,
|
|
cancelPersonalMessage,
|
|
cancelTypedMessage,
|
|
signMessage,
|
|
cancelMessage,
|
|
txData,
|
|
} = ownProps
|
|
|
|
const { type } = txData
|
|
|
|
let cancel
|
|
let sign
|
|
|
|
if (type === 'personal_sign') {
|
|
cancel = cancelPersonalMessage
|
|
sign = signPersonalMessage
|
|
} else if (type === 'eth_signTypedData') {
|
|
cancel = cancelTypedMessage
|
|
sign = signTypedMessage
|
|
} else if (type === 'eth_sign') {
|
|
cancel = cancelMessage
|
|
sign = signMessage
|
|
}
|
|
|
|
return {
|
|
...stateProps,
|
|
...dispatchProps,
|
|
...ownProps,
|
|
txData,
|
|
cancel,
|
|
sign,
|
|
}
|
|
}
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(SignatureRequest)
|