mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add reset button to reset gas fields.
This commit is contained in:
parent
af66e2b9ac
commit
a600ccd4f8
@ -12,7 +12,6 @@ const addressSummary = util.addressSummary
|
|||||||
const nameForAddress = require('../../lib/contract-namer')
|
const nameForAddress = require('../../lib/contract-namer')
|
||||||
const HexInput = require('./hex-as-decimal-input')
|
const HexInput = require('./hex-as-decimal-input')
|
||||||
|
|
||||||
|
|
||||||
module.exports = PendingTxDetails
|
module.exports = PendingTxDetails
|
||||||
|
|
||||||
inherits(PendingTxDetails, Component)
|
inherits(PendingTxDetails, Component)
|
||||||
@ -35,8 +34,8 @@ PTXP.render = function () {
|
|||||||
|
|
||||||
const gas = state.gas || txParams.gas
|
const gas = state.gas || txParams.gas
|
||||||
const gasPrice = state.gasPrice || txData.gasPrice
|
const gasPrice = state.gasPrice || txData.gasPrice
|
||||||
const gasDefault = gas
|
const gasDefault = txParams.gas
|
||||||
const gasPriceDefault = gasPrice
|
const gasPriceDefault = txData.gasPrice
|
||||||
|
|
||||||
var txFee = state.txFee || txData.txFee || ''
|
var txFee = state.txFee || txData.txFee || ''
|
||||||
var maxCost = state.maxCost || txData.maxCost || ''
|
var maxCost = state.maxCost || txData.maxCost || ''
|
||||||
@ -301,6 +300,15 @@ PTXP.calculateGas = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PTXP.resetGasFields = function () {
|
||||||
|
log.debug(`pending-tx-details#resetGasFields`)
|
||||||
|
const txData = this.props.txData
|
||||||
|
this.setState({
|
||||||
|
gas: txData.txParams.gas,
|
||||||
|
gasPrice: txData.gasPrice,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// After a customizable state value has been updated,
|
// After a customizable state value has been updated,
|
||||||
PTXP.gatherParams = function () {
|
PTXP.gatherParams = function () {
|
||||||
log.debug(`pending-tx-details#gatherParams`)
|
log.debug(`pending-tx-details#gatherParams`)
|
||||||
|
@ -2,6 +2,7 @@ const Component = require('react').Component
|
|||||||
const h = require('react-hyperscript')
|
const h = require('react-hyperscript')
|
||||||
const inherits = require('util').inherits
|
const inherits = require('util').inherits
|
||||||
const PendingTxDetails = require('./pending-tx-details')
|
const PendingTxDetails = require('./pending-tx-details')
|
||||||
|
const extend = require('xtend')
|
||||||
|
|
||||||
module.exports = PendingTx
|
module.exports = PendingTx
|
||||||
|
|
||||||
@ -12,6 +13,7 @@ function PendingTx () {
|
|||||||
|
|
||||||
PendingTx.prototype.render = function () {
|
PendingTx.prototype.render = function () {
|
||||||
const props = this.props
|
const props = this.props
|
||||||
|
const newProps = extend(props, {ref: 'details'})
|
||||||
const txData = props.txData
|
const txData = props.txData
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -21,7 +23,7 @@ PendingTx.prototype.render = function () {
|
|||||||
}, [
|
}, [
|
||||||
|
|
||||||
// tx info
|
// tx info
|
||||||
h(PendingTxDetails, props),
|
h(PendingTxDetails, newProps),
|
||||||
|
|
||||||
h('style', `
|
h('style', `
|
||||||
.conf-buttons button {
|
.conf-buttons button {
|
||||||
@ -71,6 +73,12 @@ PendingTx.prototype.render = function () {
|
|||||||
h('button.cancel.btn-red', {
|
h('button.cancel.btn-red', {
|
||||||
onClick: props.cancelTransaction,
|
onClick: props.cancelTransaction,
|
||||||
}, 'Reject'),
|
}, 'Reject'),
|
||||||
|
|
||||||
|
h('button', {
|
||||||
|
onClick: () => {
|
||||||
|
this.refs.details.resetGasFields()
|
||||||
|
},
|
||||||
|
}, 'Reset'),
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user