1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-28 05:12:18 +01:00
metamask-extension/ui/app/components/send/send-content/send-from-row/send-from-row.container.js
Dan b3d78ed8a1 Remove send_ directory, revert to just having send
Revert accidentally changed constants.

Require defaults in ens-input, gas-fee-display and confirm screens.
2018-07-16 12:58:32 -02:30

47 lines
1.4 KiB
JavaScript

import { connect } from 'react-redux'
import {
accountsWithSendEtherInfoSelector,
getConversionRate,
getSelectedTokenContract,
getSendFromObject,
} from '../../send.selectors.js'
import {
getFromDropdownOpen,
} from './send-from-row.selectors.js'
import { calcTokenBalance } from '../../send.utils.js'
import {
updateSendFrom,
setSendTokenBalance,
} from '../../../../actions'
import {
closeFromDropdown,
openFromDropdown,
} from '../../../../ducks/send.duck'
import SendFromRow from './send-from-row.component'
export default connect(mapStateToProps, mapDispatchToProps)(SendFromRow)
function mapStateToProps (state) {
return {
conversionRate: getConversionRate(state),
from: getSendFromObject(state),
fromAccounts: accountsWithSendEtherInfoSelector(state),
fromDropdownOpen: getFromDropdownOpen(state),
tokenContract: getSelectedTokenContract(state),
}
}
function mapDispatchToProps (dispatch) {
return {
closeFromDropdown: () => dispatch(closeFromDropdown()),
openFromDropdown: () => dispatch(openFromDropdown()),
updateSendFrom: newFrom => dispatch(updateSendFrom(newFrom)),
setSendTokenBalance: (usersToken, selectedToken) => {
if (!usersToken) return
const tokenBalance = calcTokenBalance({ usersToken, selectedToken })
dispatch(setSendTokenBalance(tokenBalance))
},
}
}