1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00

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

This commit is contained in:
kumavis 2018-01-02 14:22:44 -08:00 committed by GitHub
parent 9940ea71df
commit 3f6cef0b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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`)
}
}