A Metamask fork with Infura removed and default networks editable
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.
ciphermask/ui/pages/send/send-content/send-gas-row/send-gas-row.container.js

51 lines
1.3 KiB

import { connect } from 'react-redux';
7 years ago
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/lib/metamask-controller-utils';
import SendGasRow from './send-gas-row.component';
7 years ago
export default connect(mapStateToProps, mapDispatchToProps)(SendGasRow);
7 years ago
function mapStateToProps(state) {
const gasPrice = getGasPrice(state);
const gasLimit = getGasLimit(state);
const minimumGasLimit = getMinimumGasLimitForSend(state);
7 years ago
return {
minimumGasLimit: hexToDecimal(minimumGasLimit),
gasFeeError: gasFeeIsInError(state),
gasLoadingError: isSendStateInitialized(state),
gasInputMode: getGasInputMode(state),
gasPrice,
gasLimit,
insufficientBalance: getIsBalanceInsufficient(state),
};
7 years ago
}
function mapDispatchToProps(dispatch) {
7 years ago
return {
updateGasPrice: (gasPrice) => {
dispatch(updateGasPrice(gasPrice));
dispatch(setCustomGasPrice(gasPrice));
},
updateGasLimit: (newLimit) => {
dispatch(updateGasLimit(newLimit));
dispatch(setCustomGasLimit(newLimit));
},
};
}