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/pages/confirm-transaction-base | |
parent | 57d458233b189e6752acacbaed97e8fce092b95e (diff) | |
download | tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar.gz tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.tar.zst tangerine-wallet-browser-57ead4914f6f9fd1fe47b865559e4908a36f6a8a.zip |
Fix inline advanced gas editing
Diffstat (limited to 'ui/app/components/pages/confirm-transaction-base')
-rw-r--r-- | ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js | 18 | ||||
-rw-r--r-- | ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js | 19 |
2 files changed, 11 insertions, 26 deletions
diff --git a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js index 8d404aaca..d99f03308 100644 --- a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.component.js @@ -58,6 +58,8 @@ export default class ConfirmTransactionBase extends Component { txData: PropTypes.object, unapprovedTxCount: PropTypes.number, currentNetworkUnapprovedTxs: PropTypes.object, + updateGasAndCalculate: PropTypes.func, + customGas: PropTypes.object, // Component props action: PropTypes.string, contentComponent: PropTypes.node, @@ -83,10 +85,7 @@ export default class ConfirmTransactionBase extends Component { valid: PropTypes.bool, warning: PropTypes.string, advancedInlineGasShown: PropTypes.bool, - gasPrice: PropTypes.number, - gasLimit: PropTypes.number, insufficientBalance: PropTypes.bool, - convertThenUpdateGasAndCalculate: PropTypes.func, } state = { @@ -172,10 +171,9 @@ export default class ConfirmTransactionBase extends Component { hexTransactionTotal, hideDetails, advancedInlineGasShown, - gasPrice, - gasLimit, + customGas, insufficientBalance, - convertThenUpdateGasAndCalculate, + updateGasAndCalculate, } = this.props if (hideDetails) { @@ -195,10 +193,10 @@ export default class ConfirmTransactionBase extends Component { /> {advancedInlineGasShown ? <AdvancedGasInputs - updateCustomGasPrice={newGasPrice => convertThenUpdateGasAndCalculate({ gasPrice: newGasPrice, gasLimit })} - updateCustomGasLimit={newGasLimit => convertThenUpdateGasAndCalculate({ gasLimit: newGasLimit, gasPrice })} - customGasPrice={gasPrice} - customGasLimit={gasLimit} + updateCustomGasPrice={newGasPrice => updateGasAndCalculate({ ...customGas, gasPrice: newGasPrice })} + updateCustomGasLimit={newGasLimit => updateGasAndCalculate({ ...customGas, gasLimit: newGasLimit })} + customGasPrice={customGas.gasPrice} + customGasLimit={customGas.gasLimit} insufficientBalance={insufficientBalance} customPriceIsSafe={true} isSpeedUp={false} diff --git a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js index 98cde4b03..2ecbe4a64 100644 --- a/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js +++ b/ui/app/components/pages/confirm-transaction-base/confirm-transaction-base.container.js @@ -14,12 +14,6 @@ import { GAS_LIMIT_TOO_LOW_ERROR_KEY, } from '../../../constants/error-keys' import { getHexGasTotal } from '../../../helpers/confirm-transaction/util' -import { - convertGasPriceForInputs, - convertGasLimitForInputs, - decimalToHex, - decGWEIToHexWEI, -} from '../../../helpers/conversions.util' import { isBalanceSufficient, calcGasTotal } from '../../send/send.utils' import { conversionGreaterThan } from '../../../conversion-util' import { MIN_GAS_LIMIT_DEC } from '../../send/send.constants' @@ -132,12 +126,10 @@ const mapStateToProps = (state, props) => { unapprovedTxCount, currentNetworkUnapprovedTxs, customGas: { - gasLimit: customGasLimit || gasPrice, - gasPrice: customGasPrice || gasLimit, + gasLimit: customGasLimit || gasLimit, + gasPrice: customGasPrice || gasPrice, }, advancedInlineGasShown: getAdvancedInlineGasShown(state), - gasPrice: convertGasPriceForInputs(gasPrice), - gasLimit: convertGasLimitForInputs(gasLimit), insufficientBalance, } } @@ -155,12 +147,6 @@ const mapDispatchToProps = dispatch => { updateGasAndCalculate: ({ gasLimit, gasPrice }) => { return dispatch(updateGasAndCalculate({ gasLimit, gasPrice })) }, - convertThenUpdateGasAndCalculate: ({ gasLimit, gasPrice }) => { - return dispatch(updateGasAndCalculate({ - gasLimit: decimalToHex(gasLimit), - gasPrice: decGWEIToHexWEI(gasPrice), - })) - }, showRejectTransactionsConfirmationModal: ({ onSubmit, unapprovedTxCount }) => { return dispatch(showModal({ name: 'REJECT_TRANSACTIONS', onSubmit, unapprovedTxCount })) }, @@ -235,6 +221,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { validate: validateEditGas, }), cancelAllTransactions: () => dispatchCancelAllTransactions(valuesFor(unapprovedTxs)), + updateGasAndCalculate, } } |