From 580d93188cb77cb4d4ce809b46dade8525efc380 Mon Sep 17 00:00:00 2001 From: Frankie Date: Fri, 13 Jan 2017 17:47:20 -0800 Subject: Satisfy review needs: removed unnecessary this.query = opts.query from constructor Created a tx error state for errors in approveTransaction validateTxParams has been moved to tx-utils removed "value" arg from _setTxStatus --- app/scripts/lib/tx-utils.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'app/scripts/lib') diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js index eba537d0a..5116cb93b 100644 --- a/app/scripts/lib/tx-utils.js +++ b/app/scripts/lib/tx-utils.js @@ -16,7 +16,7 @@ module.exports = class txProviderUtils { this.provider = provider this.query = new EthQuery(provider) } - + analyzeGasUsage (txData, cb) { var self = this this.query.getBlockByNumber('latest', true, (err, block) => { @@ -113,10 +113,20 @@ module.exports = class txProviderUtils { publishTransaction (rawTx, cb) { this.query.sendRawTransaction(rawTx, cb) } + + validateTxParams (txParams, cb) { + if (('value' in txParams) && txParams.value.indexOf('-') === 0) { + cb(new Error(`Invalid transaction value of ${txParams.value} not a positive number.`)) + } else { + cb() + } + } + + } // util function isUndef(value) { return value === undefined -} \ No newline at end of file +} -- cgit