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/app/components/send_/send-content/send-amount-row/amount-max-button/amount-max-button.container.js

39 lines
1.0 KiB

import { connect } from 'react-redux'
7 years ago
import {
getGasTotal,
getSelectedToken,
7 years ago
getSendFromBalance,
getTokenBalance,
7 years ago
} from '../../../send.selectors.js'
import { getMaxModeOn } from '../send-amount-row.selectors.js'
import { calcMaxAmount } from './amount-max-button.utils.js'
import {
updateSendAmount,
updateSendErrors,
7 years ago
setMaxModeTo,
} from '../../../actions'
import AmountMaxButton from './amount-max-button.component'
export default connect(mapStateToProps, mapDispatchToProps)(AmountMaxButton)
7 years ago
function mapStateToProps (state) {
return {
balance: getSendFromBalance(state),
7 years ago
gasTotal: getGasTotal(state),
maxModeOn: getMaxModeOn(state),
selectedToken: getSelectedToken(state),
7 years ago
tokenBalance: getTokenBalance(state),
}
}
function mapDispatchToProps (dispatch) {
return {
setAmountToMax: maxAmountDataObject => {
updateSendErrors({ amount: null })
updateSendAmount(calcMaxAmount(maxAmountDataObject))
},
7 years ago
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
}
}