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.
62 lines
1.6 KiB
62 lines
1.6 KiB
import { connect } from 'react-redux'
|
|
import { compose } from 'recompose'
|
|
import { withRouter } from 'react-router-dom'
|
|
import {
|
|
toggleAccountMenu,
|
|
showAccountDetail,
|
|
hideSidebar,
|
|
lockMetamask,
|
|
hideWarning,
|
|
showConfigPage,
|
|
showInfoPage,
|
|
showModal,
|
|
} from '../../actions'
|
|
import { getMetaMaskAccounts } from '../../selectors'
|
|
import AccountMenu from './account-menu.component'
|
|
|
|
function mapStateToProps (state) {
|
|
const { metamask: { selectedAddress, isAccountMenuOpen, keyrings, identities } } = state
|
|
|
|
return {
|
|
selectedAddress,
|
|
isAccountMenuOpen,
|
|
keyrings,
|
|
identities,
|
|
accounts: getMetaMaskAccounts(state),
|
|
}
|
|
}
|
|
|
|
function mapDispatchToProps (dispatch) {
|
|
return {
|
|
toggleAccountMenu: () => dispatch(toggleAccountMenu()),
|
|
showAccountDetail: address => {
|
|
dispatch(showAccountDetail(address))
|
|
dispatch(hideSidebar())
|
|
dispatch(toggleAccountMenu())
|
|
},
|
|
lockMetamask: () => {
|
|
dispatch(lockMetamask())
|
|
dispatch(hideWarning())
|
|
dispatch(hideSidebar())
|
|
dispatch(toggleAccountMenu())
|
|
},
|
|
showConfigPage: () => {
|
|
dispatch(showConfigPage())
|
|
dispatch(hideSidebar())
|
|
dispatch(toggleAccountMenu())
|
|
},
|
|
showInfoPage: () => {
|
|
dispatch(showInfoPage())
|
|
dispatch(hideSidebar())
|
|
dispatch(toggleAccountMenu())
|
|
},
|
|
showRemoveAccountConfirmationModal: identity => {
|
|
return dispatch(showModal({ name: 'CONFIRM_REMOVE_ACCOUNT', identity }))
|
|
},
|
|
}
|
|
}
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
)(AccountMenu)
|
|
|