aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2018-03-16 01:41:55 +0800
committerfrankiebee <frankie.diamond@gmail.com>2018-03-16 01:41:55 +0800
commite51ba2e75c517d88f0e526eed613ef656af47293 (patch)
tree30f5decfb31f16db9e9d4e6ad46061be458268b3 /ui
parent74e9a5c49103709f02d3b123ce7e957bcea172c7 (diff)
parentb0122be3c960b68620c5769ca969db60e4a45351 (diff)
downloadtangerine-wallet-browser-e51ba2e75c517d88f0e526eed613ef656af47293.tar
tangerine-wallet-browser-e51ba2e75c517d88f0e526eed613ef656af47293.tar.gz
tangerine-wallet-browser-e51ba2e75c517d88f0e526eed613ef656af47293.tar.bz2
tangerine-wallet-browser-e51ba2e75c517d88f0e526eed613ef656af47293.tar.lz
tangerine-wallet-browser-e51ba2e75c517d88f0e526eed613ef656af47293.tar.xz
tangerine-wallet-browser-e51ba2e75c517d88f0e526eed613ef656af47293.tar.zst
tangerine-wallet-browser-e51ba2e75c517d88f0e526eed613ef656af47293.zip
Merge branch 'retry-tx-refractor' of https://github.com/MetaMask/metamask-extension into retry-tx-refractor
Diffstat (limited to 'ui')
-rw-r--r--ui/app/components/customize-gas-modal/index.js7
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js35
-rw-r--r--ui/app/components/pending-tx/confirm-send-token.js29
3 files changed, 49 insertions, 22 deletions
diff --git a/ui/app/components/customize-gas-modal/index.js b/ui/app/components/customize-gas-modal/index.js
index 291447bb4..d8384c19d 100644
--- a/ui/app/components/customize-gas-modal/index.js
+++ b/ui/app/components/customize-gas-modal/index.js
@@ -233,6 +233,7 @@ CustomizeGasModal.prototype.render = function () {
convertedGasPrice += convertedGasPrice.match(/[.]/) ? priceSigZeros : `${priceSigDec}${priceSigZeros}`
+ let newGasPrice = gasPrice
if (forceGasMin) {
const convertedMinPrice = conversionUtil(forceGasMin, {
fromNumericBase: 'hex',
@@ -242,6 +243,10 @@ CustomizeGasModal.prototype.render = function () {
{ value: convertedMinPrice, fromNumericBase: 'dec' },
{ value: convertedGasPrice, fromNumericBase: 'dec' }
)
+ newGasPrice = conversionMax(
+ { value: gasPrice, fromNumericBase: 'hex' },
+ { value: forceGasMin, fromNumericBase: 'hex' }
+ )
}
const convertedGasLimit = conversionUtil(gasLimit, {
@@ -302,7 +307,7 @@ CustomizeGasModal.prototype.render = function () {
}, [t('cancel')]),
h(`div.send-v2__customize-gas__save${error ? '__error' : ''}.allcaps`, {
- onClick: () => !error && this.save(gasPrice, gasLimit, gasTotal),
+ onClick: () => !error && this.save(newGasPrice, gasLimit, gasTotal),
}, [t('save')]),
]),
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index 6624a378d..a4763eab7 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -68,13 +68,11 @@ function mapDispatchToProps (dispatch) {
let forceGasMin
if (lastGasPrice) {
- const stripped = ethUtil.stripHexPrefix(lastGasPrice)
- forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(stripped, 1.1, {
+ forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
multiplicandBase: 16,
multiplierBase: 10,
toNumericBase: 'hex',
fromDenomination: 'WEI',
- toDenomination: 'GWEI',
}))
}
@@ -454,7 +452,7 @@ ConfirmSendEther.prototype.render = function () {
ConfirmSendEther.prototype.onSubmit = function (event) {
event.preventDefault()
- const txMeta = this.gatherTxMeta({ time: (new Date()).getTime() })
+ const txMeta = this.gatherTxMeta()
const valid = this.checkValidity()
this.setState({ valid, submitting: true })
@@ -489,21 +487,34 @@ ConfirmSendEther.prototype.getFormEl = function () {
}
// After a customizable state value has been updated,
-ConfirmSendEther.prototype.gatherTxMeta = function (opts) {
+ConfirmSendEther.prototype.gatherTxMeta = function () {
const props = this.props
const state = this.state
const txData = clone(state.txData) || clone(props.txData)
- if (txData.lastGasPrice) {
- const { gasPrice: sendGasPrice, gas: sendGasLimit } = props.send
- const { gasPrice: txGasPrice, gas: txGasLimit } = txData.txParams
-
- txData.txParams.gasPrice = sendGasPrice || txGasPrice
- txData.txParams.gas = sendGasLimit || txGasLimit
+ const { gasPrice: sendGasPrice, gas: sendGasLimit } = props.send
+ const {
+ lastGasPrice,
+ txParams: {
+ gasPrice: txGasPrice,
+ gas: txGasLimit,
+ },
+ } = txData
+
+ let forceGasMin
+ if (lastGasPrice) {
+ forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
+ multiplicandBase: 16,
+ multiplierBase: 10,
+ toNumericBase: 'hex',
+ }))
}
+ txData.txParams.gasPrice = sendGasPrice || forceGasMin || txGasPrice
+ txData.txParams.gas = sendGasLimit || txGasLimit
+
// log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)
- return Object.assign(txData, opts)
+ return txData
}
ConfirmSendEther.prototype.verifyGasParams = function () {
diff --git a/ui/app/components/pending-tx/confirm-send-token.js b/ui/app/components/pending-tx/confirm-send-token.js
index ac773b1d2..f1142b142 100644
--- a/ui/app/components/pending-tx/confirm-send-token.js
+++ b/ui/app/components/pending-tx/confirm-send-token.js
@@ -104,13 +104,11 @@ function mapDispatchToProps (dispatch, ownProps) {
let forceGasMin
if (lastGasPrice) {
- const stripped = ethUtil.stripHexPrefix(lastGasPrice)
- forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(stripped, 1.1, {
+ forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
multiplicandBase: 16,
multiplierBase: 10,
toNumericBase: 'hex',
fromDenomination: 'WEI',
- toDenomination: 'GWEI',
}))
}
@@ -487,14 +485,27 @@ ConfirmSendToken.prototype.gatherTxMeta = function () {
const state = this.state
const txData = clone(state.txData) || clone(props.txData)
- if (txData.lastGasPrice) {
- const { gasPrice: sendGasPrice, gas: sendGasLimit } = props.send
- const { gasPrice: txGasPrice, gas: txGasLimit } = txData.txParams
-
- txData.txParams.gasPrice = sendGasPrice || txGasPrice
- txData.txParams.gas = sendGasLimit || txGasLimit
+ const { gasPrice: sendGasPrice, gas: sendGasLimit } = props.send
+ const {
+ lastGasPrice,
+ txParams: {
+ gasPrice: txGasPrice,
+ gas: txGasLimit,
+ },
+ } = txData
+
+ let forceGasMin
+ if (lastGasPrice) {
+ forceGasMin = ethUtil.addHexPrefix(multiplyCurrencies(lastGasPrice, 1.1, {
+ multiplicandBase: 16,
+ multiplierBase: 10,
+ toNumericBase: 'hex',
+ }))
}
+ txData.txParams.gasPrice = sendGasPrice || forceGasMin || txGasPrice
+ txData.txParams.gas = sendGasLimit || txGasLimit
+
// log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)
return txData
}