aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
authorfrankiebee <frankie.diamond@gmail.com>2017-09-14 05:27:27 +0800
committerfrankiebee <frankie.diamond@gmail.com>2017-09-14 05:27:27 +0800
commit77a48fb0b16d7415377b02a3b7d383c9ef86fcb6 (patch)
tree50807d974aed0f8867739f1ace2c0f1f01ee1dad /app/scripts/lib
parent59909601b887b2ed8473bea5a28b852668b2804e (diff)
downloadtangerine-wallet-browser-77a48fb0b16d7415377b02a3b7d383c9ef86fcb6.tar
tangerine-wallet-browser-77a48fb0b16d7415377b02a3b7d383c9ef86fcb6.tar.gz
tangerine-wallet-browser-77a48fb0b16d7415377b02a3b7d383c9ef86fcb6.tar.bz2
tangerine-wallet-browser-77a48fb0b16d7415377b02a3b7d383c9ef86fcb6.tar.lz
tangerine-wallet-browser-77a48fb0b16d7415377b02a3b7d383c9ef86fcb6.tar.xz
tangerine-wallet-browser-77a48fb0b16d7415377b02a3b7d383c9ef86fcb6.tar.zst
tangerine-wallet-browser-77a48fb0b16d7415377b02a3b7d383c9ef86fcb6.zip
ensure that values written to txParams are hex strings
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/tx-state-manager.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/scripts/lib/tx-state-manager.js b/app/scripts/lib/tx-state-manager.js
index 843592504..82c0b6131 100644
--- a/app/scripts/lib/tx-state-manager.js
+++ b/app/scripts/lib/tx-state-manager.js
@@ -1,6 +1,7 @@
const extend = require('xtend')
const EventEmitter = require('events')
const ObservableStore = require('obs-store')
+const ethUtil = require('ethereumjs-util')
const txStateHistoryHelper = require('./tx-state-history-helper')
module.exports = class TransactionStateManger extends EventEmitter {
@@ -82,6 +83,14 @@ module.exports = class TransactionStateManger extends EventEmitter {
}
updateTx (txMeta) {
+ if (txMeta.txParams) {
+ Object.keys(txMeta.txParams).forEach((key) => {
+ let value = txMeta.txParams[key]
+ if (typeof value !== 'string') console.error(`${key}: ${value} in txParams is not a string`)
+ if (!ethUtil.isHexPrefixed(value)) console.error('is not hex prefixed, anything on txParams must be hex prefixed')
+ })
+ }
+
// create txMeta snapshot for history
const currentState = txStateHistoryHelper.snapshotFromTxMeta(txMeta)
// recover previous tx state obj