1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix edit to field bug. (#2738)

This commit is contained in:
Dan J Miller 2017-12-13 02:54:41 -03:30 committed by Alexander Tseung
parent 68ef52e183
commit 339eb7d1a6

View File

@ -67,15 +67,15 @@ function mapDispatchToProps (dispatch, ownProps) {
const { txParams, id } = txMeta const { txParams, id } = txMeta
const tokenData = txParams.data && abiDecoder.decodeMethod(txParams.data) const tokenData = txParams.data && abiDecoder.decodeMethod(txParams.data)
const { params = [] } = tokenData const { params = [] } = tokenData
const { value } = params[1] || {} const { value: to } = params[0] || {}
const amount = conversionUtil(value, { const { value: tokenAmountInDec } = params[1] || {}
const tokenAmountInHex = conversionUtil(tokenAmountInDec, {
fromNumericBase: 'dec', fromNumericBase: 'dec',
toNumericBase: 'hex', toNumericBase: 'hex',
}) })
const { const {
gas: gasLimit, gas: gasLimit,
gasPrice, gasPrice,
to,
} = txParams } = txParams
dispatch(actions.setSelectedToken(address)) dispatch(actions.setSelectedToken(address))
dispatch(actions.updateSend({ dispatch(actions.updateSend({
@ -83,7 +83,7 @@ function mapDispatchToProps (dispatch, ownProps) {
gasPrice, gasPrice,
gasTotal: null, gasTotal: null,
to, to,
amount, amount: tokenAmountInHex,
errors: { to: null, amount: null }, errors: { to: null, amount: null },
editingTransactionId: id, editingTransactionId: id,
})) }))
@ -446,10 +446,11 @@ ConfirmSendToken.prototype.gatherTxMeta = function () {
amount, amount,
gasLimit: gas, gasLimit: gas,
gasPrice, gasPrice,
to,
}, },
} = props } = props
const { txParams: { from, to } } = txData const { txParams: { from, to: tokenAddress } } = txData
const tokenParams = { const tokenParams = {
from: ethUtil.addHexPrefix(from), from: ethUtil.addHexPrefix(from),
@ -465,7 +466,7 @@ ConfirmSendToken.prototype.gatherTxMeta = function () {
txData.txParams = { txData.txParams = {
...tokenParams, ...tokenParams,
to: ethUtil.addHexPrefix(to), to: ethUtil.addHexPrefix(tokenAddress),
memo: memo && ethUtil.addHexPrefix(memo), memo: memo && ethUtil.addHexPrefix(memo),
data, data,
} }