diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-08 21:50:25 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2019-02-09 03:14:45 +0800 |
commit | 57ead4914f6f9fd1fe47b865559e4908a36f6a8a (patch) | |
tree | e9a8fedb5f7abd87e923726b070f92b9b792b4b0 /ui/app/components/gas-customization | |
parent | 57d458233b189e6752acacbaed97e8fce092b95e (diff) | |
download | tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar.gz tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar.bz2 tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar.lz tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar.xz tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar.zst tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.zip |
Fix inline advanced gas editing
Diffstat (limited to 'ui/app/components/gas-customization')
-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) |