1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-24 12:23:39 +02:00
metamask-extension/ui/app/pages/send/send-content/send-amount-row/amount-max-button/amount-max-button.container.js
Whymarrh Whitby c1e3c229bc
Fix import/order issues (#9239)
See [`import/order`](https://eslint.org/docs/rules/import/order) for more information.

This change enables `import/order` and fixes the issues raised by the rule.
2020-08-18 16:48:25 -02:30

46 lines
1.2 KiB
JavaScript

import { connect } from 'react-redux'
import {
getGasTotal,
getSendToken,
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'
export default connect(mapStateToProps, mapDispatchToProps)(AmountMaxButton)
function mapStateToProps (state) {
return {
balance: getSendFromBalance(state),
buttonDataLoading: getBasicGasEstimateLoadingStatus(state),
gasTotal: getGasTotal(state),
maxModeOn: getSendMaxModeState(state),
sendToken: getSendToken(state),
tokenBalance: getTokenBalance(state),
}
}
function mapDispatchToProps (dispatch) {
return {
setAmountToMax: (maxAmountDataObject) => {
dispatch(updateSendErrors({ amount: null }))
dispatch(updateSendAmount(calcMaxAmount(maxAmountDataObject)))
},
clearMaxAmount: () => {
dispatch(updateSendAmount('0'))
},
setMaxModeTo: (bool) => dispatch(setMaxModeTo(bool)),
}
}