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.
56 lines
1.3 KiB
56 lines
1.3 KiB
4 years ago
|
import { connect } from 'react-redux';
|
||
5 years ago
|
import {
|
||
|
getSendTo,
|
||
5 years ago
|
accountsWithSendEtherInfoSelector,
|
||
5 years ago
|
getAddressBookEntry,
|
||
4 years ago
|
getIsEthGasPriceFetched,
|
||
|
getNoGasPriceFetched,
|
||
4 years ago
|
} from '../../../selectors';
|
||
5 years ago
|
|
||
4 years ago
|
import * as actions from '../../../store/actions';
|
||
|
import SendContent from './send-content.component';
|
||
5 years ago
|
|
||
4 years ago
|
function mapStateToProps(state) {
|
||
4 years ago
|
const ownedAccounts = accountsWithSendEtherInfoSelector(state);
|
||
|
const to = getSendTo(state);
|
||
5 years ago
|
return {
|
||
4 years ago
|
isOwnedAccount: Boolean(
|
||
|
ownedAccounts.find(
|
||
|
({ address }) => address.toLowerCase() === to.toLowerCase(),
|
||
|
),
|
||
|
),
|
||
5 years ago
|
contact: getAddressBookEntry(state, to),
|
||
|
to,
|
||
4 years ago
|
isEthGasPrice: getIsEthGasPriceFetched(state),
|
||
|
noGasPrice: getNoGasPriceFetched(state),
|
||
4 years ago
|
};
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
function mapDispatchToProps(dispatch) {
|
||
5 years ago
|
return {
|
||
4 years ago
|
showAddToAddressBookModal: (recipient) =>
|
||
|
dispatch(
|
||
|
actions.showModal({
|
||
|
name: 'ADD_TO_ADDRESSBOOK',
|
||
|
recipient,
|
||
|
}),
|
||
|
),
|
||
4 years ago
|
};
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
function mergeProps(stateProps, dispatchProps, ownProps) {
|
||
4 years ago
|
const { to, ...restStateProps } = stateProps;
|
||
5 years ago
|
return {
|
||
|
...ownProps,
|
||
5 years ago
|
...restStateProps,
|
||
4 years ago
|
showAddToAddressBookModal: () =>
|
||
|
dispatchProps.showAddToAddressBookModal(to),
|
||
4 years ago
|
};
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
export default connect(
|
||
|
mapStateToProps,
|
||
|
mapDispatchToProps,
|
||
|
mergeProps,
|
||
4 years ago
|
)(SendContent);
|