1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-02 06:07:06 +01:00
metamask-extension/ui/pages/send/send-content/send-gas-row/send-gas-row.container.js

51 lines
1.3 KiB
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2018-04-11 16:21:54 +02:00
import {
getGasPrice,
getGasLimit,
gasFeeIsInError,
getGasInputMode,
updateGasPrice,
updateGasLimit,
isSendStateInitialized,
getIsBalanceInsufficient,
getMinimumGasLimitForSend,
} from '../../../../ducks/send';
import {
setCustomGasPrice,
setCustomGasLimit,
} from '../../../../ducks/gas/gas.duck';
import { hexToDecimal } from '../../../../../shared/modules/conversion.utils';
import SendGasRow from './send-gas-row.component';
2018-04-11 16:21:54 +02:00
export default connect(mapStateToProps, mapDispatchToProps)(SendGasRow);
2018-04-11 16:21:54 +02:00
2020-11-03 00:41:28 +01:00
function mapStateToProps(state) {
const gasPrice = getGasPrice(state);
const gasLimit = getGasLimit(state);
const minimumGasLimit = getMinimumGasLimitForSend(state);
2018-04-11 16:21:54 +02:00
return {
minimumGasLimit: hexToDecimal(minimumGasLimit),
2018-06-29 19:19:40 +02:00
gasFeeError: gasFeeIsInError(state),
gasLoadingError: isSendStateInitialized(state),
gasInputMode: getGasInputMode(state),
2019-02-08 14:50:25 +01:00
gasPrice,
gasLimit,
insufficientBalance: getIsBalanceInsufficient(state),
};
2018-04-11 16:21:54 +02:00
}
2020-11-03 00:41:28 +01:00
function mapDispatchToProps(dispatch) {
2018-04-11 16:21:54 +02:00
return {
updateGasPrice: (gasPrice) => {
dispatch(updateGasPrice(gasPrice));
dispatch(setCustomGasPrice(gasPrice));
},
updateGasLimit: (newLimit) => {
dispatch(updateGasLimit(newLimit));
dispatch(setCustomGasLimit(newLimit));
},
};
}