A Metamask fork with Infura removed and default networks editable
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.
ciphermask/ui/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.container.js

40 lines
1.2 KiB

import { connect } from 'react-redux';
7 years ago
import {
getGasTotal,
getSendToken,
7 years ago
getSendFromBalance,
getTokenBalance,
getSendMaxModeState,
getBasicGasEstimateLoadingStatus,
} from '../../../../../selectors';
import { updateSendAmount, setMaxModeTo } from '../../../../../store/actions';
import { updateSendErrors } from '../../../../../ducks/send/send.duck';
import { calcMaxAmount } from './amount-max-button.utils';
import AmountMaxButton from './amount-max-button.component';
7 years ago
export default connect(mapStateToProps, mapDispatchToProps)(AmountMaxButton);
7 years ago
function mapStateToProps(state) {
7 years ago
return {
balance: getSendFromBalance(state),
buttonDataLoading: getBasicGasEstimateLoadingStatus(state),
7 years ago
gasTotal: getGasTotal(state),
maxModeOn: getSendMaxModeState(state),
sendToken: getSendToken(state),
7 years ago
tokenBalance: getTokenBalance(state),
};
7 years ago
}
function mapDispatchToProps(dispatch) {
7 years ago
return {
setAmountToMax: (maxAmountDataObject) => {
dispatch(updateSendErrors({ amount: null }));
dispatch(updateSendAmount(calcMaxAmount(maxAmountDataObject)));
},
clearMaxAmount: () => {
dispatch(updateSendAmount('0'));
},
setMaxModeTo: (bool) => dispatch(setMaxModeTo(bool)),
};
}