mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
tx-gas-utils - tx-param-validation - use more intuitive check
This commit is contained in:
parent
9940ea71df
commit
3f6cef0b3f
@ -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`)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user