tx-gas-utils - tx-param-validation - use more intuitive check

feature/default_network_editable
kumavis 7 years ago committed by GitHub
parent 9940ea71df
commit 3f6cef0b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/scripts/lib/tx-gas-utils.js

@ -83,11 +83,11 @@ module.exports = class txProvideUtil {
async validateTxParams (txParams) { async validateTxParams (txParams) {
if ('value' in txParams) { if ('value' in txParams) {
const value = txParams.value.toString() 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.`) 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`) throw new Error(`Invalid transaction value of ${txParams.value} number must be in wei`)
} }
} }

Loading…
Cancel
Save