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 {
|
|
|
|
getIsAssetSendable,
|
|
|
|
getIsBalanceInsufficient,
|
|
|
|
getSendTo,
|
2021-11-03 20:03:54 +01:00
|
|
|
getSendAsset,
|
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);
|
2019-07-31 21:56:44 +02:00
|
|
|
return {
|
2021-06-23 23:35:25 +02:00
|
|
|
isAssetSendable: getIsAssetSendable(state),
|
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),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-07-31 21:56:44 +02:00
|
|
|
}
|
|
|
|
|
2021-12-01 18:22:08 +01:00
|
|
|
export default connect(mapStateToProps)(SendContent);
|