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.
37 lines
1.0 KiB
37 lines
1.0 KiB
4 years ago
|
import { connect } from 'react-redux';
|
||
6 years ago
|
import {
|
||
|
decGWEIToHexWEI,
|
||
|
decimalToHex,
|
||
|
hexWEIToDecGWEI,
|
||
4 years ago
|
} from '../../../../helpers/utils/conversions.util';
|
||
|
import AdvancedGasInputs from './advanced-gas-inputs.component';
|
||
6 years ago
|
|
||
4 years ago
|
function convertGasPriceForInputs(gasPriceInHexWEI) {
|
||
4 years ago
|
return Number(hexWEIToDecGWEI(gasPriceInHexWEI));
|
||
6 years ago
|
}
|
||
|
|
||
4 years ago
|
function convertGasLimitForInputs(gasLimitInHexWEI) {
|
||
4 years ago
|
return parseInt(gasLimitInHexWEI, 16) || 0;
|
||
6 years ago
|
}
|
||
|
|
||
|
const mergeProps = (stateProps, dispatchProps, ownProps) => {
|
||
4 years ago
|
const {
|
||
|
customGasPrice,
|
||
|
customGasLimit,
|
||
|
updateCustomGasPrice,
|
||
|
updateCustomGasLimit,
|
||
4 years ago
|
} = ownProps;
|
||
6 years ago
|
return {
|
||
5 years ago
|
...ownProps,
|
||
6 years ago
|
...stateProps,
|
||
|
...dispatchProps,
|
||
|
customGasPrice: convertGasPriceForInputs(customGasPrice),
|
||
|
customGasLimit: convertGasLimitForInputs(customGasLimit),
|
||
4 years ago
|
updateCustomGasPrice: (price) =>
|
||
|
updateCustomGasPrice(decGWEIToHexWEI(price)),
|
||
6 years ago
|
updateCustomGasLimit: (limit) => updateCustomGasLimit(decimalToHex(limit)),
|
||
4 years ago
|
};
|
||
|
};
|
||
6 years ago
|
|
||
4 years ago
|
export default connect(null, null, mergeProps)(AdvancedGasInputs);
|