mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Adds revert feature to customize gas modal.
This commit is contained in:
parent
3d8182f5d5
commit
f89b766534
@ -58,10 +58,7 @@ function mapDispatchToProps (dispatch) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inherits(CustomizeGasModal, Component)
|
function getOriginalState(props) {
|
||||||
function CustomizeGasModal (props) {
|
|
||||||
Component.call(this)
|
|
||||||
|
|
||||||
const gasPrice = props.gasPrice || MIN_GAS_PRICE_DEC
|
const gasPrice = props.gasPrice || MIN_GAS_PRICE_DEC
|
||||||
const gasLimit = props.gasLimit || MIN_GAS_LIMIT_DEC
|
const gasLimit = props.gasLimit || MIN_GAS_LIMIT_DEC
|
||||||
|
|
||||||
@ -71,7 +68,7 @@ function CustomizeGasModal (props) {
|
|||||||
multiplierBase: 16,
|
multiplierBase: 16,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.state = {
|
return {
|
||||||
gasPrice,
|
gasPrice,
|
||||||
gasLimit,
|
gasLimit,
|
||||||
gasTotal,
|
gasTotal,
|
||||||
@ -79,6 +76,13 @@ function CustomizeGasModal (props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inherits(CustomizeGasModal, Component)
|
||||||
|
function CustomizeGasModal (props) {
|
||||||
|
Component.call(this)
|
||||||
|
|
||||||
|
this.state = getOriginalState(props)
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = connect(mapStateToProps, mapDispatchToProps)(CustomizeGasModal)
|
module.exports = connect(mapStateToProps, mapDispatchToProps)(CustomizeGasModal)
|
||||||
|
|
||||||
CustomizeGasModal.prototype.save = function (gasPrice, gasLimit, gasTotal) {
|
CustomizeGasModal.prototype.save = function (gasPrice, gasLimit, gasTotal) {
|
||||||
@ -95,6 +99,10 @@ CustomizeGasModal.prototype.save = function (gasPrice, gasLimit, gasTotal) {
|
|||||||
hideModal()
|
hideModal()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CustomizeGasModal.prototype.revert = function () {
|
||||||
|
this.setState(getOriginalState(this.props))
|
||||||
|
}
|
||||||
|
|
||||||
CustomizeGasModal.prototype.validate = function ({ gasTotal, gasLimit }) {
|
CustomizeGasModal.prototype.validate = function ({ gasTotal, gasLimit }) {
|
||||||
const {
|
const {
|
||||||
amount,
|
amount,
|
||||||
@ -241,9 +249,8 @@ CustomizeGasModal.prototype.render = function () {
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
h('div.send-v2__customize-gas__revert', {
|
h('div.send-v2__customize-gas__revert', {
|
||||||
// onClick: () => console.log('Revert'),
|
onClick: () => this.revert(),
|
||||||
}, ['']),
|
}, ['Revert']),
|
||||||
// }, ['Revert']),
|
|
||||||
|
|
||||||
h('div.send-v2__customize-gas__buttons', [
|
h('div.send-v2__customize-gas__buttons', [
|
||||||
h('div.send-v2__customize-gas__cancel', {
|
h('div.send-v2__customize-gas__cancel', {
|
||||||
|
@ -404,13 +404,7 @@ async-each@^1.0.0:
|
|||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
|
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
|
||||||
|
|
||||||
async-eventemitter@^0.2.2:
|
async-eventemitter@^0.2.2, async-eventemitter@ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c:
|
||||||
version "0.2.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.3.tgz#f79f480dfda6645a97bd6142c017150d63b4e70e"
|
|
||||||
dependencies:
|
|
||||||
async "^2.4.0"
|
|
||||||
|
|
||||||
async-eventemitter@ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c:
|
|
||||||
version "0.2.3"
|
version "0.2.3"
|
||||||
resolved "https://codeload.github.com/ahultgren/async-eventemitter/tar.gz/fa06e39e56786ba541c180061dbf2c0a5bbf951c"
|
resolved "https://codeload.github.com/ahultgren/async-eventemitter/tar.gz/fa06e39e56786ba541c180061dbf2c0a5bbf951c"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
Reference in New Issue
Block a user