aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pending-tx/confirm-send-ether.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/components/pending-tx/confirm-send-ether.js')
-rw-r--r--ui/app/components/pending-tx/confirm-send-ether.js54
1 files changed, 49 insertions, 5 deletions
diff --git a/ui/app/components/pending-tx/confirm-send-ether.js b/ui/app/components/pending-tx/confirm-send-ether.js
index d12bc499b..1264da153 100644
--- a/ui/app/components/pending-tx/confirm-send-ether.js
+++ b/ui/app/components/pending-tx/confirm-send-ether.js
@@ -19,6 +19,7 @@ function mapStateToProps (state) {
conversionRate,
identities,
currentCurrency,
+ send,
} = state.metamask
const accounts = state.metamask.accounts
const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0]
@@ -27,12 +28,32 @@ function mapStateToProps (state) {
identities,
selectedAddress,
currentCurrency,
+ send,
}
}
function mapDispatchToProps (dispatch) {
return {
- backToAccountDetail: address => dispatch(actions.backToAccountDetail(address)),
+ clearSend: () => dispatch(actions.clearSend()),
+ editTransaction: txMeta => {
+ const { id, txParams } = txMeta
+ const {
+ gas: gasLimit,
+ gasPrice,
+ to,
+ value: amount,
+ } = txParams
+ dispatch(actions.updateSend({
+ gasLimit,
+ gasPrice,
+ gasTotal: null,
+ to,
+ amount,
+ errors: { to: null, amount: null },
+ editingTransactionId: id,
+ }))
+ dispatch(actions.showSendPage())
+ },
cancelTransaction: ({ id }) => dispatch(actions.cancelTx({ id })),
}
}
@@ -157,7 +178,7 @@ ConfirmSendEther.prototype.getData = function () {
}
ConfirmSendEther.prototype.render = function () {
- const { backToAccountDetail, selectedAddress, currentCurrency } = this.props
+ const { editTransaction, currentCurrency, clearSend } = this.props
const txMeta = this.gatherTxMeta()
const txParams = txMeta.txParams || {}
@@ -199,8 +220,8 @@ ConfirmSendEther.prototype.render = function () {
h('div.confirm-screen-wrapper.flex-column.flex-grow', [
h('h3.flex-center.confirm-screen-header', [
h('button.confirm-screen-back-button', {
- onClick: () => backToAccountDetail(selectedAddress),
- }, 'BACK'),
+ onClick: () => editTransaction(txMeta),
+ }, 'EDIT'),
h('div.confirm-screen-title', 'Confirm Transaction'),
h('div.confirm-screen-header-tip'),
]),
@@ -371,7 +392,10 @@ ConfirmSendEther.prototype.render = function () {
}, [
// Cancel Button
h('div.cancel.btn-light.confirm-screen-cancel-button', {
- onClick: (event) => this.cancel(event, txMeta),
+ onClick: (event) => {
+ clearSend()
+ this.cancel(event, txMeta)
+ },
}, 'CANCEL'),
// Accept Button
@@ -421,6 +445,26 @@ ConfirmSendEther.prototype.gatherTxMeta = function () {
const state = this.state
const txData = clone(state.txData) || clone(props.txData)
+ if (props.send.editingTransactionId) {
+ const {
+ send: {
+ memo,
+ amount: value,
+ gasLimit: gas,
+ gasPrice,
+ },
+ } = props
+ const { txParams: { from, to } } = txData
+ txData.txParams = {
+ from: ethUtil.addHexPrefix(from),
+ to: ethUtil.addHexPrefix(to),
+ memo: memo && ethUtil.addHexPrefix(memo),
+ value: ethUtil.addHexPrefix(value),
+ gas: ethUtil.addHexPrefix(gas),
+ gasPrice: ethUtil.addHexPrefix(gasPrice),
+ }
+ }
+
// log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`)
return txData
}