From 3f6cef0b3f56edc8cc0b66403f23ae216de7bcfa Mon Sep 17 00:00:00 2001 From: kumavis Date: Tue, 2 Jan 2018 14:22:44 -0800 Subject: tx-gas-utils - tx-param-validation - use more intuitive check --- app/scripts/lib/tx-gas-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/scripts/lib/tx-gas-utils.js b/app/scripts/lib/tx-gas-utils.js index c00323a64..bc891fc07 100644 --- a/app/scripts/lib/tx-gas-utils.js +++ b/app/scripts/lib/tx-gas-utils.js @@ -83,11 +83,11 @@ module.exports = class txProvideUtil { async validateTxParams (txParams) { if ('value' in txParams) { const value = txParams.value.toString() - if (value.indexOf('-') === 0) { + if (value.includes('-')) { throw new Error(`Invalid transaction value of ${txParams.value} not a positive number.`) } - if (value.indexOf('.') >= 0) { + if (value.includes('.')) { throw new Error(`Invalid transaction value of ${txParams.value} number must be in wei`) } } -- cgit v1.2.3