1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 11:01:41 +01:00
metamask-extension/ui/app/components/send_/send-content/send-to-row/send-to-row.container.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-04-26 18:38:38 +02:00
import { connect } from 'react-redux'
2018-04-07 00:29:51 +02:00
import {
getCurrentNetwork,
getSendTo,
2018-04-26 18:38:38 +02:00
getSendToAccounts,
2018-04-07 00:29:51 +02:00
} from '../../send.selectors.js'
import {
getToDropdownOpen,
sendToIsInError,
} from './send-to-row.selectors.js'
import { getToErrorObject } from './send-to-row.utils.js'
import {
updateSendTo,
2018-04-26 18:38:38 +02:00
} from '../../../../actions'
2018-04-07 00:29:51 +02:00
import {
updateSendErrors,
openToDropdown,
closeToDropdown,
2018-04-26 18:38:38 +02:00
} from '../../../../ducks/send'
2018-04-07 00:29:51 +02:00
import SendToRow from './send-to-row.component'
export default connect(mapStateToProps, mapDispatchToProps)(SendToRow)
function mapStateToProps (state) {
return {
inError: sendToIsInError(state),
network: getCurrentNetwork(state),
2018-04-07 00:29:51 +02:00
to: getSendTo(state),
toAccounts: getSendToAccounts(state),
toDropdownOpen: getToDropdownOpen(state),
}
}
function mapDispatchToProps (dispatch) {
return {
closeToDropdown: () => dispatch(closeToDropdown()),
openToDropdown: () => dispatch(openToDropdown()),
updateSendTo: (to, nickname) => dispatch(updateSendTo(to, nickname)),
2018-04-07 00:29:51 +02:00
updateSendToError: (to) => {
dispatch(updateSendErrors(getToErrorObject(to)))
},
}
}