aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-10-27 00:43:12 +0800
committerDan <danjm.com@gmail.com>2017-11-07 03:33:04 +0800
commit319779ab081f70343b5ef77531450878292a90d6 (patch)
tree807755a45b82e03d99cec6103cab50f1f57be7d3 /ui/app/conversion-util.js
parent67bdfe87e31e695f8c4beab1659a3a4b764ccf24 (diff)
downloadtangerine-wallet-browser-319779ab081f70343b5ef77531450878292a90d6.tar
tangerine-wallet-browser-319779ab081f70343b5ef77531450878292a90d6.tar.gz
tangerine-wallet-browser-319779ab081f70343b5ef77531450878292a90d6.tar.bz2
tangerine-wallet-browser-319779ab081f70343b5ef77531450878292a90d6.tar.lz
tangerine-wallet-browser-319779ab081f70343b5ef77531450878292a90d6.tar.xz
tangerine-wallet-browser-319779ab081f70343b5ef77531450878292a90d6.tar.zst
tangerine-wallet-browser-319779ab081f70343b5ef77531450878292a90d6.zip
Adds max amount feature for send-ether
Diffstat (limited to 'ui/app/conversion-util.js')
-rw-r--r--ui/app/conversion-util.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/ui/app/conversion-util.js b/ui/app/conversion-util.js
index 5eadbdb99..3786641fb 100644
--- a/ui/app/conversion-util.js
+++ b/ui/app/conversion-util.js
@@ -145,6 +145,20 @@ const addCurrencies = (a, b, options = {}) => {
})
}
+const subtractCurrencies = (a, b, options = {}) => {
+ const {
+ aBase,
+ bBase,
+ ...conversionOptions,
+ } = options
+ const value = (new BigNumber(a, aBase)).minus(b, bBase);
+
+ return converter({
+ value,
+ ...conversionOptions,
+ })
+}
+
const multiplyCurrencies = (a, b, options = {}) => {
const {
multiplicandBase,
@@ -203,4 +217,5 @@ module.exports = {
conversionGTE,
conversionLTE,
toNegative,
+ subtractCurrencies,
}