1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 20:57:12 +01:00
metamask-extension/ui/app/components/send/send-content/send-amount-row/send-amount-row.container.js

55 lines
1.6 KiB
JavaScript
Raw Normal View History

2018-04-26 18:38:38 +02:00
import { connect } from 'react-redux'
2018-04-07 00:29:51 +02:00
import {
getAmountConversionRate,
getConversionRate,
2018-06-23 00:05:50 +02:00
getCurrentCurrency,
2018-04-07 00:29:51 +02:00
getGasTotal,
getPrimaryCurrency,
getSelectedToken,
getSendAmount,
2018-04-11 16:21:54 +02:00
getSendFromBalance,
getTokenBalance,
} from '../../send.selectors'
2018-04-07 00:29:51 +02:00
import {
sendAmountIsInError,
} from './send-amount-row.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,
updateSendAmount,
2018-04-26 18:38:38 +02:00
} from '../../../../actions'
import {
updateSendErrors,
} from '../../../../ducks/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),
amountConversionRate: getAmountConversionRate(state),
2018-04-26 18:38:38 +02:00
balance: getSendFromBalance(state),
conversionRate: getConversionRate(state),
2018-06-23 00:05:50 +02:00
convertedCurrency: getCurrentCurrency(state),
gasTotal: getGasTotal(state),
inError: sendAmountIsInError(state),
primaryCurrency: getPrimaryCurrency(state),
selectedToken: getSelectedToken(state),
tokenBalance: getTokenBalance(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 {
setMaxModeTo: bool => dispatch(setMaxModeTo(bool)),
updateSendAmount: newAmount => dispatch(updateSendAmount(newAmount)),
2018-06-29 19:19:40 +02:00
updateGasFeeError: (amountDataObject) => {
dispatch(updateSendErrors(getGasFeeErrorObject(amountDataObject)))
},
2018-04-11 16:21:54 +02:00
updateSendAmountError: (amountDataObject) => {
dispatch(updateSendErrors(getAmountErrorObject(amountDataObject)))
},
}
}