diff options
author | Kevin Serrano <kevin.serrano@consensys.net> | 2017-05-18 05:18:01 +0800 |
---|---|---|
committer | Kevin Serrano <kevin.serrano@consensys.net> | 2017-05-18 05:18:01 +0800 |
commit | 717db41d0b7bcd7b6f88a5c460aa4dcbc5828116 (patch) | |
tree | f43143b1b6e1e5f37871230cb780477061aa3422 /ui/app/components | |
parent | c6715dc2dd2cb3c5b8e664a9300b989d4f696c9c (diff) | |
download | tangerine-wallet-browser-717db41d0b7bcd7b6f88a5c460aa4dcbc5828116.tar tangerine-wallet-browser-717db41d0b7bcd7b6f88a5c460aa4dcbc5828116.tar.gz tangerine-wallet-browser-717db41d0b7bcd7b6f88a5c460aa4dcbc5828116.tar.bz2 tangerine-wallet-browser-717db41d0b7bcd7b6f88a5c460aa4dcbc5828116.tar.lz tangerine-wallet-browser-717db41d0b7bcd7b6f88a5c460aa4dcbc5828116.tar.xz tangerine-wallet-browser-717db41d0b7bcd7b6f88a5c460aa4dcbc5828116.tar.zst tangerine-wallet-browser-717db41d0b7bcd7b6f88a5c460aa4dcbc5828116.zip |
Modify test, replace clone package.
Diffstat (limited to 'ui/app/components')
-rw-r--r-- | ui/app/components/pending-tx.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/ui/app/components/pending-tx.js b/ui/app/components/pending-tx.js index 37a3a3bf3..5b238187c 100644 --- a/ui/app/components/pending-tx.js +++ b/ui/app/components/pending-tx.js @@ -2,6 +2,7 @@ const Component = require('react').Component const h = require('react-hyperscript') const inherits = require('util').inherits const actions = require('../actions') +const clone = require('clone') const ethUtil = require('ethereumjs-util') const BN = ethUtil.BN @@ -347,14 +348,14 @@ PendingTx.prototype.gasPriceChanged = function (newBN) { log.info(`Gas price changed to: ${newBN.toString(10)}`) const txMeta = this.gatherTxMeta() txMeta.txParams.gasPrice = '0x' + newBN.toString('hex') - this.setState({ txData: cloneObj(txMeta) }) + this.setState({ txData: clone(txMeta) }) } PendingTx.prototype.gasLimitChanged = function (newBN) { log.info(`Gas limit changed to ${newBN.toString(10)}`) const txMeta = this.gatherTxMeta() txMeta.txParams.gas = '0x' + newBN.toString('hex') - this.setState({ txData: cloneObj(txMeta) }) + this.setState({ txData: clone(txMeta) }) } PendingTx.prototype.resetGasFields = function () { @@ -405,7 +406,7 @@ PendingTx.prototype.gatherTxMeta = function () { log.debug(`pending-tx gatherTxMeta`) const props = this.props const state = this.state - const txData = cloneObj(state.txData) || cloneObj(props.txData) + const txData = clone(state.txData) || clone(props.txData) log.debug(`UI has defaulted to tx meta ${JSON.stringify(txData)}`) return txData @@ -435,7 +436,3 @@ function forwardCarrat () { }) ) } - -function cloneObj (obj) { - return JSON.parse(JSON.stringify(obj)) -} |