aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/send/send-utils.js
diff options
context:
space:
mode:
authorJenny Pollack <jennypollack3@gmail.com>2018-06-08 05:10:56 +0800
committerJenny Pollack <jennypollack3@gmail.com>2018-06-08 05:10:56 +0800
commite7c2710a55a49b8a266fa61cfed1caecc2623de7 (patch)
treec8553c02b63b10626ef561ca0bfe26c560b295d6 /ui/app/components/send/send-utils.js
parentfd8bcc9cb1b9f9c1cc5ef48eda4952182b23e499 (diff)
parentc0d2dab28b4083ee3ef65b6b561e28c811c6773d (diff)
downloadtangerine-wallet-browser-e7c2710a55a49b8a266fa61cfed1caecc2623de7.tar
tangerine-wallet-browser-e7c2710a55a49b8a266fa61cfed1caecc2623de7.tar.gz
tangerine-wallet-browser-e7c2710a55a49b8a266fa61cfed1caecc2623de7.tar.bz2
tangerine-wallet-browser-e7c2710a55a49b8a266fa61cfed1caecc2623de7.tar.lz
tangerine-wallet-browser-e7c2710a55a49b8a266fa61cfed1caecc2623de7.tar.xz
tangerine-wallet-browser-e7c2710a55a49b8a266fa61cfed1caecc2623de7.tar.zst
tangerine-wallet-browser-e7c2710a55a49b8a266fa61cfed1caecc2623de7.zip
Merge branch 'develop' into save-brave
Diffstat (limited to 'ui/app/components/send/send-utils.js')
-rw-r--r--ui/app/components/send/send-utils.js78
1 files changed, 0 insertions, 78 deletions
diff --git a/ui/app/components/send/send-utils.js b/ui/app/components/send/send-utils.js
deleted file mode 100644
index 71bfb2668..000000000
--- a/ui/app/components/send/send-utils.js
+++ /dev/null
@@ -1,78 +0,0 @@
-const {
- addCurrencies,
- conversionUtil,
- conversionGTE,
- multiplyCurrencies,
-} = require('../../conversion-util')
-const {
- calcTokenAmount,
-} = require('../../token-util')
-
-function isBalanceSufficient ({
- amount = '0x0',
- gasTotal = '0x0',
- balance,
- primaryCurrency,
- amountConversionRate,
- conversionRate,
-}) {
- const totalAmount = addCurrencies(amount, gasTotal, {
- aBase: 16,
- bBase: 16,
- toNumericBase: 'hex',
- })
-
- const balanceIsSufficient = conversionGTE(
- {
- value: balance,
- fromNumericBase: 'hex',
- fromCurrency: primaryCurrency,
- conversionRate,
- },
- {
- value: totalAmount,
- fromNumericBase: 'hex',
- conversionRate: amountConversionRate || conversionRate,
- fromCurrency: primaryCurrency,
- },
- )
-
- return balanceIsSufficient
-}
-
-function isTokenBalanceSufficient ({
- amount = '0x0',
- tokenBalance,
- decimals,
-}) {
- const amountInDec = conversionUtil(amount, {
- fromNumericBase: 'hex',
- })
-
- const tokenBalanceIsSufficient = conversionGTE(
- {
- value: tokenBalance,
- fromNumericBase: 'dec',
- },
- {
- value: calcTokenAmount(amountInDec, decimals),
- fromNumericBase: 'dec',
- },
- )
-
- return tokenBalanceIsSufficient
-}
-
-function getGasTotal (gasLimit, gasPrice) {
- return multiplyCurrencies(gasLimit, gasPrice, {
- toNumericBase: 'hex',
- multiplicandBase: 16,
- multiplierBase: 16,
- })
-}
-
-module.exports = {
- getGasTotal,
- isBalanceSufficient,
- isTokenBalanceSufficient,
-}