aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send_/send-content/send-amount-row/send-amount-row.container.js
blob: 098855a022d479e8ff79d685ad6ddb7ab020ba42 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
import {
  getSelectedToken,
  getPrimaryCurrency,
  getAmountConversionRate,
  getConvertedCurrency,
  getSendAmount,
  getGasTotal,
  getSelectedBalance,
  getTokenBalance,
  getSendFromBalance,
} from '../../send.selectors.js'
import {
  getMaxModeOn,
  sendAmountIsInError,
} from './send-amount-row.selectors.js'
import { getAmountErrorObject } from './send-amount-row.utils.js'
import {
  updateSendAmount,
  setMaxModeTo,
} from '../../../actions'
import SendAmountRow from './send-amount-row.component'

export default connect(mapStateToProps, mapDispatchToProps)(SendToRow)

function mapStateToProps (state) {
updateSendTo
return {
  selectedToken: getSelectedToken(state),
  primaryCurrency: getPrimaryCurrency(state),
  convertedCurrency: getConvertedCurrency(state),
  amountConversionRate: getAmountConversionRate(state),
  inError: sendAmountIsInError(state),
  amount: getSendAmount(state),
  maxModeOn: getMaxModeOn(state),
  gasTotal: getGasTotal(state),
  tokenBalance: getTokenBalance(state),
  balance: getSendFromBalance(state),
}
}

function mapDispatchToProps (dispatch) {
  return {
    updateSendAmountError: (amountDataObject) => {
        dispatch(updateSendErrors(getAmountErrorObject(amountDataObject)))
    },
    updateSendAmount: newAmount => dispatch(updateSendAmount(newAmount)),
    setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
  }
}