aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/tx-utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib/tx-utils.js')
-rw-r--r--app/scripts/lib/tx-utils.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/scripts/lib/tx-utils.js b/app/scripts/lib/tx-utils.js
index 149d93102..4e780fcc0 100644
--- a/app/scripts/lib/tx-utils.js
+++ b/app/scripts/lib/tx-utils.js
@@ -118,6 +118,15 @@ module.exports = class txProviderUtils {
}
}
+ sufficientBalance (tx, hexBalance) {
+ const balance = hexToBn(hexBalance)
+ const value = hexToBn(tx.value)
+ const gasLimit = hexToBn(tx.gas)
+ const gasPrice = hexToBn(tx.gasPrice)
+
+ const maxCost = value.add(gasLimit.mul(gasPrice))
+ return balance.gte(maxCost)
+ }
}