2021-02-04 19:15:23 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-11-03 00:41:28 +01:00
|
|
|
import {
|
|
|
|
buyEth,
|
|
|
|
hideModal,
|
|
|
|
showModal,
|
|
|
|
hideWarning,
|
2021-02-04 19:15:23 +01:00
|
|
|
} from '../../../../store/actions';
|
2021-03-12 23:23:26 +01:00
|
|
|
import {
|
|
|
|
getIsTestnet,
|
|
|
|
getIsMainnet,
|
|
|
|
getCurrentChainId,
|
|
|
|
getSelectedAddress,
|
2022-01-28 14:46:26 +01:00
|
|
|
getIsBuyableTransakChain,
|
2022-03-21 10:26:52 +01:00
|
|
|
getIsBuyableMoonPayChain,
|
2022-05-13 01:27:49 +02:00
|
|
|
getIsBuyableCoinbasePayChain,
|
2021-03-12 23:23:26 +01:00
|
|
|
} from '../../../../selectors/selectors';
|
2021-02-04 19:15:23 +01:00
|
|
|
import DepositEtherModal from './deposit-ether-modal.component';
|
2019-11-27 17:14:02 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function mapStateToProps(state) {
|
2019-11-27 17:14:02 +01:00
|
|
|
return {
|
2021-03-12 23:23:26 +01:00
|
|
|
chainId: getCurrentChainId(state),
|
2021-02-16 16:31:16 +01:00
|
|
|
isTestnet: getIsTestnet(state),
|
|
|
|
isMainnet: getIsMainnet(state),
|
2021-03-12 23:23:26 +01:00
|
|
|
address: getSelectedAddress(state),
|
2022-01-28 14:46:26 +01:00
|
|
|
isBuyableTransakChain: getIsBuyableTransakChain(state),
|
2022-03-21 10:26:52 +01:00
|
|
|
isBuyableMoonPayChain: getIsBuyableMoonPayChain(state),
|
2022-05-13 01:27:49 +02:00
|
|
|
isBuyableCoinbasePayChain: getIsBuyableCoinbasePayChain(state),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-27 17:14:02 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
function mapDispatchToProps(dispatch) {
|
2019-11-27 17:14:02 +01:00
|
|
|
return {
|
|
|
|
toWyre: (address) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(buyEth({ service: 'wyre', address }));
|
2019-11-27 17:14:02 +01:00
|
|
|
},
|
2022-01-28 14:46:26 +01:00
|
|
|
toTransak: (address, chainId) => {
|
|
|
|
dispatch(buyEth({ service: 'transak', address, chainId }));
|
2021-06-25 15:10:24 +02:00
|
|
|
},
|
2022-03-21 10:26:52 +01:00
|
|
|
toMoonPay: (address, chainId) => {
|
|
|
|
dispatch(buyEth({ service: 'moonpay', address, chainId }));
|
|
|
|
},
|
2022-05-13 01:27:49 +02:00
|
|
|
toCoinbasePay: (address, chainId) => {
|
|
|
|
dispatch(buyEth({ service: 'coinbase', address, chainId }));
|
|
|
|
},
|
2019-11-27 17:14:02 +01:00
|
|
|
hideModal: () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(hideModal());
|
2019-11-27 17:14:02 +01:00
|
|
|
},
|
|
|
|
hideWarning: () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(hideWarning());
|
2019-11-27 17:14:02 +01:00
|
|
|
},
|
|
|
|
showAccountDetailModal: () => {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
|
2019-11-27 17:14:02 +01:00
|
|
|
},
|
2021-03-12 23:23:26 +01:00
|
|
|
toFaucet: (chainId) => dispatch(buyEth({ chainId })),
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-27 17:14:02 +01:00
|
|
|
}
|
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(DepositEtherModal);
|