mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 10:30:04 +01:00
09512c7148
* Show fiat on confirm screen on multilayer-fee network * Disable gas editing on optimism * Fix send max mode on optimism * Represent layer 2 gas fee as a single value * Hide gas fee edit UI on optimism * Improvement multilayer-fee-message styling * Lint fix * Fix locales * Remove unnecessary code change Co-authored-by: David Walsh <davidwalsh83@gmail.com>
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import {
|
|
decGWEIToHexWEI,
|
|
decimalToHex,
|
|
hexWEIToDecGWEI,
|
|
} from '../../../../helpers/utils/conversions.util';
|
|
import { getNetworkSupportsSettingGasFees } from '../../../../selectors/selectors';
|
|
import { MIN_GAS_LIMIT_DEC } from '../../../../pages/send/send.constants';
|
|
import AdvancedGasInputs from './advanced-gas-inputs.component';
|
|
|
|
function convertGasPriceForInputs(gasPriceInHexWEI) {
|
|
return Number(hexWEIToDecGWEI(gasPriceInHexWEI));
|
|
}
|
|
|
|
function convertGasLimitForInputs(gasLimitInHexWEI) {
|
|
return parseInt(gasLimitInHexWEI, 16) || 0;
|
|
}
|
|
|
|
function convertMinimumGasLimitForInputs(minimumGasLimit = MIN_GAS_LIMIT_DEC) {
|
|
return parseInt(minimumGasLimit, 10);
|
|
}
|
|
|
|
function mapStateToProps(state) {
|
|
return {
|
|
networkSupportsSettingGasFees: getNetworkSupportsSettingGasFees(state),
|
|
};
|
|
}
|
|
|
|
function mergeProps(stateProps, dispatchProps, ownProps) {
|
|
const {
|
|
customGasPrice,
|
|
customGasLimit,
|
|
updateCustomGasPrice,
|
|
updateCustomGasLimit,
|
|
minimumGasLimit,
|
|
} = ownProps;
|
|
return {
|
|
...ownProps,
|
|
...stateProps,
|
|
...dispatchProps,
|
|
customGasPrice: convertGasPriceForInputs(customGasPrice),
|
|
customGasLimit: convertGasLimitForInputs(customGasLimit),
|
|
minimumGasLimit: convertMinimumGasLimitForInputs(minimumGasLimit),
|
|
updateCustomGasPrice: (price) =>
|
|
updateCustomGasPrice(decGWEIToHexWEI(price)),
|
|
updateCustomGasLimit: (limit) => updateCustomGasLimit(decimalToHex(limit)),
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps, null, mergeProps)(AdvancedGasInputs);
|