You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
47 lines
1.4 KiB
7 years ago
|
import { connect } from 'react-redux'
|
||
7 years ago
|
import {
|
||
7 years ago
|
accountsWithSendEtherInfoSelector,
|
||
7 years ago
|
getConversionRate,
|
||
7 years ago
|
getSelectedTokenContract,
|
||
7 years ago
|
getSendFromObject,
|
||
7 years ago
|
} from '../../send.selectors.js'
|
||
7 years ago
|
import {
|
||
|
getFromDropdownOpen,
|
||
|
} from './send-from-row.selectors.js'
|
||
7 years ago
|
import { calcTokenBalance } from '../../send.utils.js'
|
||
7 years ago
|
import {
|
||
|
updateSendFrom,
|
||
7 years ago
|
setSendTokenBalance,
|
||
7 years ago
|
} from '../../../../actions'
|
||
7 years ago
|
import {
|
||
|
closeFromDropdown,
|
||
7 years ago
|
openFromDropdown,
|
||
7 years ago
|
} from '../../../../ducks/send.duck'
|
||
7 years ago
|
import SendFromRow from './send-from-row.component'
|
||
|
|
||
|
export default connect(mapStateToProps, mapDispatchToProps)(SendFromRow)
|
||
|
|
||
|
function mapStateToProps (state) {
|
||
|
return {
|
||
7 years ago
|
conversionRate: getConversionRate(state),
|
||
7 years ago
|
from: getSendFromObject(state),
|
||
7 years ago
|
fromAccounts: accountsWithSendEtherInfoSelector(state),
|
||
|
fromDropdownOpen: getFromDropdownOpen(state),
|
||
|
tokenContract: getSelectedTokenContract(state),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function mapDispatchToProps (dispatch) {
|
||
|
return {
|
||
7 years ago
|
closeFromDropdown: () => dispatch(closeFromDropdown()),
|
||
|
openFromDropdown: () => dispatch(openFromDropdown()),
|
||
|
updateSendFrom: newFrom => dispatch(updateSendFrom(newFrom)),
|
||
7 years ago
|
setSendTokenBalance: (usersToken, selectedToken) => {
|
||
7 years ago
|
if (!usersToken) return
|
||
|
|
||
7 years ago
|
const tokenBalance = calcTokenBalance({ usersToken, selectedToken })
|
||
7 years ago
|
dispatch(setSendTokenBalance(tokenBalance))
|
||
7 years ago
|
},
|
||
|
}
|
||
|
}
|