diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-09 04:26:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-09 04:26:12 +0800 |
commit | fbc2d5880f89550a3a31ae1c5d03e07f4c72e45b (patch) | |
tree | aa6ed73dcbcce3f6b2f17022f96cb040b18d23ef /ui/app/components/gas-customization/advanced-gas-inputs | |
parent | 1a4203a8c608c1ee9e13d4196f1ee0c6cac6886e (diff) | |
parent | 0972e23dcd9c15abe9a3229f9514b3b2f1ccd673 (diff) | |
download | tangerine-wallet-browser-fbc2d5880f89550a3a31ae1c5d03e07f4c72e45b.tar.gz tangerine-wallet-browser-fbc2d5880f89550a3a31ae1c5d03e07f4c72e45b.tar.zst tangerine-wallet-browser-fbc2d5880f89550a3a31ae1c5d03e07f4c72e45b.zip |
Merge pull request #6122 from whymarrh/fix-gas-editing
Fix advanced inline gas editing
Diffstat (limited to 'ui/app/components/gas-customization/advanced-gas-inputs')
-rw-r--r-- | ui/app/components/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/ui/app/components/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js b/ui/app/components/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js index 883d11c6d..a71d37b43 100644 --- a/ui/app/components/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js +++ b/ui/app/components/gas-customization/advanced-gas-inputs/advanced-gas-inputs.container.js @@ -1,7 +1,20 @@ import { connect } from 'react-redux' import { showModal } from '../../../actions' +import { + decGWEIToHexWEI, + decimalToHex, + hexWEIToDecGWEI, +} from '../../../helpers/conversions.util' import AdvancedGasInputs from './advanced-gas-inputs.component' +function convertGasPriceForInputs (gasPriceInHexWEI) { + return Number(hexWEIToDecGWEI(gasPriceInHexWEI)) +} + +function convertGasLimitForInputs (gasLimitInHexWEI) { + return parseInt(gasLimitInHexWEI, 16) +} + const mapDispatchToProps = dispatch => { return { showGasPriceInfoModal: modalName => dispatch(showModal({ name: 'GAS_PRICE_INFO_MODAL' })), @@ -9,4 +22,17 @@ const mapDispatchToProps = dispatch => { } } -export default connect(null, mapDispatchToProps)(AdvancedGasInputs) +const mergeProps = (stateProps, dispatchProps, ownProps) => { + const {customGasPrice, customGasLimit, updateCustomGasPrice, updateCustomGasLimit} = ownProps + return { + ...stateProps, + ...dispatchProps, + ...ownProps, + customGasPrice: convertGasPriceForInputs(customGasPrice), + customGasLimit: convertGasLimitForInputs(customGasLimit), + updateCustomGasPrice: (price) => updateCustomGasPrice(decGWEIToHexWEI(price)), + updateCustomGasLimit: (limit) => updateCustomGasLimit(decimalToHex(limit)), + } +} + +export default connect(null, mapDispatchToProps, mergeProps)(AdvancedGasInputs) |