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.
44 lines
1.2 KiB
44 lines
1.2 KiB
import { connect } from 'react-redux'
|
|
import {
|
|
accountsWithSendEtherInfoSelector,
|
|
getSendEnsResolution,
|
|
getSendEnsResolutionError,
|
|
} from '../../send.selectors.js'
|
|
import {
|
|
getAddressBook,
|
|
getAddressBookEntry,
|
|
} from '../../../../selectors/selectors'
|
|
import {
|
|
updateSendTo,
|
|
} from '../../../../store/actions'
|
|
import AddRecipient from './add-recipient.component'
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(AddRecipient)
|
|
|
|
function mapStateToProps (state) {
|
|
const ensResolution = getSendEnsResolution(state)
|
|
|
|
let addressBookEntryName = ''
|
|
if (ensResolution) {
|
|
const addressBookEntry = getAddressBookEntry(state, ensResolution) || {}
|
|
addressBookEntryName = addressBookEntry.name
|
|
}
|
|
|
|
const addressBook = getAddressBook(state)
|
|
|
|
return {
|
|
ownedAccounts: accountsWithSendEtherInfoSelector(state),
|
|
addressBook,
|
|
ensResolution,
|
|
addressBookEntryName,
|
|
ensResolutionError: getSendEnsResolutionError(state),
|
|
contacts: addressBook.filter(({ name }) => !!name),
|
|
nonContacts: addressBook.filter(({ name }) => !name),
|
|
}
|
|
}
|
|
|
|
function mapDispatchToProps (dispatch) {
|
|
return {
|
|
updateSendTo: (to, nickname) => dispatch(updateSendTo(to, nickname)),
|
|
}
|
|
}
|
|
|