2018-04-26 18:38:38 +02:00
|
|
|
import { connect } from 'react-redux'
|
2018-04-07 00:29:51 +02:00
|
|
|
import {
|
2018-04-27 02:38:14 +02:00
|
|
|
getConversionRate,
|
2018-04-07 00:29:51 +02:00
|
|
|
getGasTotal,
|
2018-04-27 21:03:00 +02:00
|
|
|
getPrimaryCurrency,
|
2020-05-29 19:46:10 +02:00
|
|
|
getSendToken,
|
2018-04-27 02:38:14 +02:00
|
|
|
getSendAmount,
|
2018-04-11 16:21:54 +02:00
|
|
|
getSendFromBalance,
|
2018-04-27 02:38:14 +02:00
|
|
|
getTokenBalance,
|
2020-03-11 21:13:48 +01:00
|
|
|
getSendMaxModeState,
|
2018-04-27 02:38:14 +02:00
|
|
|
sendAmountIsInError,
|
2020-05-04 21:06:28 +02:00
|
|
|
} from '../../../../selectors'
|
2018-06-29 19:19:40 +02:00
|
|
|
import { getAmountErrorObject, getGasFeeErrorObject } from '../../send.utils'
|
2018-04-07 00:29:51 +02:00
|
|
|
import {
|
2018-04-11 16:21:54 +02:00
|
|
|
setMaxModeTo,
|
2018-04-27 02:38:14 +02:00
|
|
|
updateSendAmount,
|
2019-04-17 21:15:13 +02:00
|
|
|
} from '../../../../store/actions'
|
2018-04-27 21:03:00 +02:00
|
|
|
import {
|
|
|
|
updateSendErrors,
|
2019-04-17 21:15:13 +02:00
|
|
|
} from '../../../../ducks/send/send.duck'
|
2018-04-11 16:21:54 +02:00
|
|
|
import SendAmountRow from './send-amount-row.component'
|
2018-04-07 00:29:51 +02:00
|
|
|
|
2018-04-26 18:38:38 +02:00
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(SendAmountRow)
|
2018-04-07 00:29:51 +02:00
|
|
|
|
|
|
|
function mapStateToProps (state) {
|
2018-04-26 18:38:38 +02:00
|
|
|
return {
|
|
|
|
amount: getSendAmount(state),
|
|
|
|
balance: getSendFromBalance(state),
|
|
|
|
conversionRate: getConversionRate(state),
|
2018-04-27 02:38:14 +02:00
|
|
|
gasTotal: getGasTotal(state),
|
|
|
|
inError: sendAmountIsInError(state),
|
|
|
|
primaryCurrency: getPrimaryCurrency(state),
|
2020-05-29 19:46:10 +02:00
|
|
|
sendToken: getSendToken(state),
|
2018-04-27 02:38:14 +02:00
|
|
|
tokenBalance: getTokenBalance(state),
|
2020-03-11 21:13:48 +01:00
|
|
|
maxModeOn: getSendMaxModeState(state),
|
2018-04-26 18:38:38 +02:00
|
|
|
}
|
2018-04-07 00:29:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps (dispatch) {
|
2018-04-11 16:21:54 +02:00
|
|
|
return {
|
2020-02-15 21:34:12 +01:00
|
|
|
setMaxModeTo: (bool) => dispatch(setMaxModeTo(bool)),
|
|
|
|
updateSendAmount: (newAmount) => dispatch(updateSendAmount(newAmount)),
|
2018-06-29 19:19:40 +02:00
|
|
|
updateGasFeeError: (amountDataObject) => {
|
2018-11-20 01:06:34 +01:00
|
|
|
dispatch(updateSendErrors(getGasFeeErrorObject(amountDataObject)))
|
2018-06-29 19:19:40 +02:00
|
|
|
},
|
2018-04-11 16:21:54 +02:00
|
|
|
updateSendAmountError: (amountDataObject) => {
|
2018-11-20 01:06:34 +01:00
|
|
|
dispatch(updateSendErrors(getAmountErrorObject(amountDataObject)))
|
2018-04-11 16:21:54 +02:00
|
|
|
},
|
|
|
|
}
|
2018-04-27 02:38:14 +02:00
|
|
|
}
|