2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
2019-07-31 21:56:44 +02:00
|
|
|
import {
|
2020-03-06 22:34:56 +01:00
|
|
|
accountsWithSendEtherInfoSelector,
|
2019-08-14 01:13:05 +02:00
|
|
|
getAddressBookEntry,
|
2021-04-28 20:02:01 +02:00
|
|
|
getIsEthGasPriceFetched,
|
|
|
|
getNoGasPriceFetched,
|
2021-09-30 13:57:59 +02:00
|
|
|
checkNetworkOrAccountNotSupports1559,
|
2021-02-04 19:15:23 +01:00
|
|
|
} from '../../../selectors';
|
2021-10-29 17:45:50 +02:00
|
|
|
import {
|
|
|
|
getIsBalanceInsufficient,
|
|
|
|
getSendTo,
|
2021-11-03 20:03:54 +01:00
|
|
|
getSendAsset,
|
2022-01-19 19:42:41 +01:00
|
|
|
getAssetError,
|
2022-07-14 00:15:38 +02:00
|
|
|
getRecipient,
|
|
|
|
acknowledgeRecipientWarning,
|
|
|
|
getRecipientWarningAcknowledgement,
|
2021-10-29 17:45:50 +02:00
|
|
|
} from '../../../ducks/send';
|
2021-06-23 23:35:25 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
import SendContent from './send-content.component';
|
2019-07-31 21:56:44 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function mapStateToProps(state) {
|
2021-02-04 19:15:23 +01:00
|
|
|
const ownedAccounts = accountsWithSendEtherInfoSelector(state);
|
|
|
|
const to = getSendTo(state);
|
2022-07-14 00:15:38 +02:00
|
|
|
const recipient = getRecipient(state);
|
|
|
|
const recipientWarningAcknowledged = getRecipientWarningAcknowledgement(
|
|
|
|
state,
|
|
|
|
);
|
2019-07-31 21:56:44 +02:00
|
|
|
return {
|
2020-11-03 00:41:28 +01:00
|
|
|
isOwnedAccount: Boolean(
|
|
|
|
ownedAccounts.find(
|
|
|
|
({ address }) => address.toLowerCase() === to.toLowerCase(),
|
|
|
|
),
|
|
|
|
),
|
2019-08-14 01:13:05 +02:00
|
|
|
contact: getAddressBookEntry(state, to),
|
2021-04-28 20:02:01 +02:00
|
|
|
isEthGasPrice: getIsEthGasPriceFetched(state),
|
|
|
|
noGasPrice: getNoGasPriceFetched(state),
|
2021-06-23 23:35:25 +02:00
|
|
|
to,
|
2021-09-30 13:57:59 +02:00
|
|
|
networkOrAccountNotSupports1559: checkNetworkOrAccountNotSupports1559(
|
|
|
|
state,
|
|
|
|
),
|
2021-10-29 17:45:50 +02:00
|
|
|
getIsBalanceInsufficient: getIsBalanceInsufficient(state),
|
2021-11-03 20:03:54 +01:00
|
|
|
asset: getSendAsset(state),
|
2022-01-19 19:42:41 +01:00
|
|
|
assetError: getAssetError(state),
|
2022-07-14 00:15:38 +02:00
|
|
|
recipient,
|
|
|
|
recipientWarningAcknowledged,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-07-31 21:56:44 +02:00
|
|
|
}
|
|
|
|
|
2022-07-14 00:15:38 +02:00
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return {
|
|
|
|
acknowledgeRecipientWarning: () => dispatch(acknowledgeRecipientWarning()),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(SendContent);
|