diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-02-28 10:33:33 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-02-28 10:33:33 +0800 |
commit | 3ddfdfff98806065291bb39f31d73879aa4939e8 (patch) | |
tree | bcd44c662a60d043b7c278608574caac70d65587 /ui/app | |
parent | 2e80e8f722e60573764cddfea0b66739626f717a (diff) | |
download | tangerine-wallet-browser-3ddfdfff98806065291bb39f31d73879aa4939e8.tar tangerine-wallet-browser-3ddfdfff98806065291bb39f31d73879aa4939e8.tar.gz tangerine-wallet-browser-3ddfdfff98806065291bb39f31d73879aa4939e8.tar.bz2 tangerine-wallet-browser-3ddfdfff98806065291bb39f31d73879aa4939e8.tar.lz tangerine-wallet-browser-3ddfdfff98806065291bb39f31d73879aa4939e8.tar.xz tangerine-wallet-browser-3ddfdfff98806065291bb39f31d73879aa4939e8.tar.zst tangerine-wallet-browser-3ddfdfff98806065291bb39f31d73879aa4939e8.zip |
Emit updated tx values on accept click
Diffstat (limited to 'ui/app')
-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) { |