aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-28 09:08:04 +0800
committerDan <danjm.com@gmail.com>2018-03-28 09:08:04 +0800
commit8e6ab7df052a5ca43b15edc9c308c626bb23e64c (patch)
treedf9ef6f3952eec8a68fa25d2620d7f248d57693a /ui/app/components/send
parentb6b18339e2de92afd2fb5364ec5bc4c29b4d10a3 (diff)
downloadtangerine-wallet-browser-8e6ab7df052a5ca43b15edc9c308c626bb23e64c.tar
tangerine-wallet-browser-8e6ab7df052a5ca43b15edc9c308c626bb23e64c.tar.gz
tangerine-wallet-browser-8e6ab7df052a5ca43b15edc9c308c626bb23e64c.tar.bz2
tangerine-wallet-browser-8e6ab7df052a5ca43b15edc9c308c626bb23e64c.tar.lz
tangerine-wallet-browser-8e6ab7df052a5ca43b15edc9c308c626bb23e64c.tar.xz
tangerine-wallet-browser-8e6ab7df052a5ca43b15edc9c308c626bb23e64c.tar.zst
tangerine-wallet-browser-8e6ab7df052a5ca43b15edc9c308c626bb23e64c.zip
Checking for sufficient balance in confirm ether screen; includes error messages for user.
Diffstat (limited to 'ui/app/components/send')
-rw-r--r--ui/app/components/send/send-utils.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/ui/app/components/send/send-utils.js b/ui/app/components/send/send-utils.js
index d8211930d..71bfb2668 100644
--- a/ui/app/components/send/send-utils.js
+++ b/ui/app/components/send/send-utils.js
@@ -2,6 +2,7 @@ const {
addCurrencies,
conversionUtil,
conversionGTE,
+ multiplyCurrencies,
} = require('../../conversion-util')
const {
calcTokenAmount,
@@ -31,7 +32,7 @@ function isBalanceSufficient ({
{
value: totalAmount,
fromNumericBase: 'hex',
- conversionRate: amountConversionRate,
+ conversionRate: amountConversionRate || conversionRate,
fromCurrency: primaryCurrency,
},
)
@@ -62,7 +63,16 @@ function isTokenBalanceSufficient ({
return tokenBalanceIsSufficient
}
+function getGasTotal (gasLimit, gasPrice) {
+ return multiplyCurrencies(gasLimit, gasPrice, {
+ toNumericBase: 'hex',
+ multiplicandBase: 16,
+ multiplierBase: 16,
+ })
+}
+
module.exports = {
+ getGasTotal,
isBalanceSufficient,
isTokenBalanceSufficient,
}