diff options
-rw-r--r-- | ui/app/components/pending-tx-details.js | 7 | ||||
-rw-r--r-- | ui/app/conf-tx.js | 14 |
2 files changed, 20 insertions, 1 deletions
diff --git a/ui/app/components/pending-tx-details.js b/ui/app/components/pending-tx-details.js index 778651d61..1e6299902 100644 --- a/ui/app/components/pending-tx-details.js +++ b/ui/app/components/pending-tx-details.js @@ -253,6 +253,13 @@ PTXP.componentDidUpdate = function (prevProps, prevState) { state.gasPrice !== prevState.gasPrice)) { log.debug(`recalculating gas since prev state change: ${JSON.stringify({ prevState, state })}`) this.calculateGas() + + // Otherwise this was a recalculation, + // so we should inform the parent: + } else { + if (this.props.onTxChange) { + this.props.onTxChange(this.gatherParams) + } } } diff --git a/ui/app/conf-tx.js b/ui/app/conf-tx.js index cd4bef2b9..9741d5f32 100644 --- a/ui/app/conf-tx.js +++ b/ui/app/conf-tx.js @@ -104,6 +104,8 @@ ConfirmTxScreen.prototype.render = function () { accounts: props.accounts, identities: props.identities, insufficientBalance: this.checkBalanceAgainstTx(txData), + // State actions + onTxChange: this.updateTxCache.bind(this), // Actions buyEth: this.buyEth.bind(this, txParams.from || props.selectedAddress), sendTransaction: this.sendTransaction.bind(this, txData), @@ -159,9 +161,19 @@ ConfirmTxScreen.prototype.buyEth = function (address, event) { this.props.dispatch(actions.buyEthView(address)) } +// Allows the detail view to update the gas calculations, +// for manual gas controls. +ConfirmTxScreen.prototype.onTxChange = function (txData) { + this.setState({ txData }) +} + +// Must default to any local state txData, +// to allow manual override of gas calculations. ConfirmTxScreen.prototype.sendTransaction = function (txData, event) { event.stopPropagation() - this.props.dispatch(actions.sendTx(txData)) + const state = this.state || {} + const txMeta = state.txData + this.props.dispatch(actions.sendTx(txMeta || txData)) } ConfirmTxScreen.prototype.cancelTransaction = function (txData, event) { |