mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-24 19:10:22 +01:00
b3d78ed8a1
Revert accidentally changed constants. Require defaults in ens-input, gas-fee-display and confirm screens.
94 lines
2.5 KiB
JavaScript
94 lines
2.5 KiB
JavaScript
import { connect } from 'react-redux'
|
|
import SendEther from './send.component'
|
|
import { withRouter } from 'react-router-dom'
|
|
import { compose } from 'recompose'
|
|
import {
|
|
getAmountConversionRate,
|
|
getBlockGasLimit,
|
|
getConversionRate,
|
|
getCurrentNetwork,
|
|
getGasLimit,
|
|
getGasPrice,
|
|
getGasTotal,
|
|
getPrimaryCurrency,
|
|
getRecentBlocks,
|
|
getSelectedAddress,
|
|
getSelectedToken,
|
|
getSelectedTokenContract,
|
|
getSelectedTokenToFiatRate,
|
|
getSendAmount,
|
|
getSendEditingTransactionId,
|
|
getSendFromObject,
|
|
getSendTo,
|
|
getTokenBalance,
|
|
} from './send.selectors'
|
|
import {
|
|
updateSendTokenBalance,
|
|
updateGasData,
|
|
setGasTotal,
|
|
} from '../../actions'
|
|
import {
|
|
resetSendState,
|
|
updateSendErrors,
|
|
} from '../../ducks/send.duck'
|
|
import {
|
|
calcGasTotal,
|
|
} from './send.utils.js'
|
|
|
|
module.exports = compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
)(SendEther)
|
|
|
|
function mapStateToProps (state) {
|
|
return {
|
|
amount: getSendAmount(state),
|
|
amountConversionRate: getAmountConversionRate(state),
|
|
blockGasLimit: getBlockGasLimit(state),
|
|
conversionRate: getConversionRate(state),
|
|
editingTransactionId: getSendEditingTransactionId(state),
|
|
from: getSendFromObject(state),
|
|
gasLimit: getGasLimit(state),
|
|
gasPrice: getGasPrice(state),
|
|
gasTotal: getGasTotal(state),
|
|
network: getCurrentNetwork(state),
|
|
primaryCurrency: getPrimaryCurrency(state),
|
|
recentBlocks: getRecentBlocks(state),
|
|
selectedAddress: getSelectedAddress(state),
|
|
selectedToken: getSelectedToken(state),
|
|
to: getSendTo(state),
|
|
tokenBalance: getTokenBalance(state),
|
|
tokenContract: getSelectedTokenContract(state),
|
|
tokenToFiatRate: getSelectedTokenToFiatRate(state),
|
|
}
|
|
}
|
|
|
|
function mapDispatchToProps (dispatch) {
|
|
return {
|
|
updateAndSetGasTotal: ({
|
|
blockGasLimit,
|
|
editingTransactionId,
|
|
gasLimit,
|
|
gasPrice,
|
|
recentBlocks,
|
|
selectedAddress,
|
|
selectedToken,
|
|
to,
|
|
value,
|
|
}) => {
|
|
!editingTransactionId
|
|
? dispatch(updateGasData({ recentBlocks, selectedAddress, selectedToken, blockGasLimit, to, value }))
|
|
: dispatch(setGasTotal(calcGasTotal(gasLimit, gasPrice)))
|
|
},
|
|
updateSendTokenBalance: ({ selectedToken, tokenContract, address }) => {
|
|
dispatch(updateSendTokenBalance({
|
|
selectedToken,
|
|
tokenContract,
|
|
address,
|
|
}))
|
|
},
|
|
updateSendErrors: newError => dispatch(updateSendErrors(newError)),
|
|
resetSendState: () => dispatch(resetSendState()),
|
|
}
|
|
}
|