diff options
author | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-07-17 06:50:26 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-07-18 20:28:12 +0800 |
commit | fb672e00df949da67266946d433c40cbbaf7d145 (patch) | |
tree | 9c050478dff5c87275ff311dc514e672d7502ee9 /ui/app/components/send/send-footer/send-footer.utils.js | |
parent | 9ea7411c063712825780110c10252155ccb61e44 (diff) | |
download | tangerine-wallet-browser-fb672e00df949da67266946d433c40cbbaf7d145.tar.gz tangerine-wallet-browser-fb672e00df949da67266946d433c40cbbaf7d145.tar.zst tangerine-wallet-browser-fb672e00df949da67266946d433c40cbbaf7d145.zip |
Send data along with other tx params
Diffstat (limited to 'ui/app/components/send/send-footer/send-footer.utils.js')
-rw-r--r-- | ui/app/components/send/send-footer/send-footer.utils.js | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/ui/app/components/send/send-footer/send-footer.utils.js b/ui/app/components/send/send-footer/send-footer.utils.js index 875e7d948..c75433e1d 100644 --- a/ui/app/components/send/send-footer/send-footer.utils.js +++ b/ui/app/components/send/send-footer/send-footer.utils.js @@ -8,8 +8,9 @@ function addHexPrefixToObjectValues (obj) { }, {}) } -function constructTxParams ({ selectedToken, to, amount, from, gas, gasPrice }) { +function constructTxParams ({ selectedToken, data, to, amount, from, gas, gasPrice }) { const txParams = { + data, from, value: '0', gas, @@ -28,6 +29,7 @@ function constructTxParams ({ selectedToken, to, amount, from, gas, gasPrice }) function constructUpdatedTx ({ amount, + data, editingTransactionId, from, gas, @@ -36,9 +38,21 @@ function constructUpdatedTx ({ to, unapprovedTxs, }) { + const unapprovedTx = unapprovedTxs[editingTransactionId] + const txParamsData = unapprovedTx.txParams.data ? unapprovedTx.txParams.data : data const editingTx = { - ...unapprovedTxs[editingTransactionId], - txParams: addHexPrefixToObjectValues({ from, gas, gasPrice }), + ...unapprovedTx, + txParams: Object.assign( + unapprovedTx.txParams, + addHexPrefixToObjectValues({ + data: txParamsData, + to, + from, + gas, + gasPrice, + value: amount, + }) + ), } if (selectedToken) { @@ -52,18 +66,10 @@ function constructUpdatedTx ({ to: selectedToken.address, data, })) - } else { - const { data } = unapprovedTxs[editingTransactionId].txParams - - Object.assign(editingTx.txParams, addHexPrefixToObjectValues({ - value: amount, - to, - data, - })) + } - if (typeof editingTx.txParams.data === 'undefined') { - delete editingTx.txParams.data - } + if (typeof editingTx.txParams.data === 'undefined') { + delete editingTx.txParams.data } return editingTx |