blob: 572e1fc460762d05be4aec10c8961fa46ebc700d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import {
getSelectedToken,
getGasTotal,
getTokenBalance,
getSendFromBalance,
} from '../../../send.selectors.js'
import { getMaxModeOn } from '../send-amount-row.selectors.js'
import { calcMaxAmount } from './amount-max-button.utils.js'
import {
updateSendAmount,
setMaxModeTo,
} from '../../../actions'
import AmountMaxButton from './amount-max-button.component'
export default connect(mapStateToProps, mapDispatchToProps)(SendToRow)
function mapStateToProps (state) {
return {
selectedToken: getSelectedToken(state),
maxModeOn: getMaxModeOn(state),
gasTotal: getGasTotal(state),
tokenBalance: getTokenBalance(state),
balance: getSendFromBalance(state),
}
}
function mapDispatchToProps (dispatch) {
return {
setAmountToMax: maxAmountDataObject => {
updateSendErrors({ amount: null })
updateSendAmount(calcMaxAmount(maxAmountDataObject))
}
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
}
}
|