aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/conversion-util.js
diff options
context:
space:
mode:
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,
}