From 418926ffdfabe8aaefbba5abbf44ebbfd838bbfc Mon Sep 17 00:00:00 2001 From: Alexander Tseung Date: Thu, 5 Apr 2018 01:04:12 -0700 Subject: [PATCH] Fix populating txParams with undefined data --- app/scripts/lib/tx-state-manager.js | 4 ++++ ui/app/send-v2.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js index 2ab24d6a0..d8ea17400 100644 --- a/app/scripts/lib/tx-state-manager.js +++ b/app/scripts/lib/tx-state-manager.js @@ -108,6 +108,10 @@ module.exports = class TransactionStateManager extends EventEmitter { updateTx (txMeta, note) { // validate txParams if (txMeta.txParams) { + if (typeof txMeta.txParams.data === 'undefined') { + delete txMeta.txParams.data + } + this.validateTxParams(txMeta.txParams) } diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index c3b81da5b..094743ff0 100644 --- a/ui/app/send-v2.js +++ b/ui/app/send-v2.js @@ -576,12 +576,17 @@ SendTransactionScreen.prototype.getEditedTx = function () { data, }) } else { - const data = unapprovedTxs[editingTransactionId].txParams.data + const { data } = unapprovedTxs[editingTransactionId].txParams + Object.assign(editingTx.txParams, { value: ethUtil.addHexPrefix(amount), to: ethUtil.addHexPrefix(to), data, }) + + if (typeof editingTx.txParams.data === 'undefined') { + delete editingTx.txParams.data + } } return editingTx