diff options
author | Thomas Huang <tmashuang@users.noreply.github.com> | 2019-06-05 05:55:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-05 05:55:56 +0800 |
commit | be911711942914e7f6df535afff1a3ee87e23b6f (patch) | |
tree | bbd890e0a6a1bd72d2560e734ce66ed42a294722 /ui/app/helpers/utils/conversions.util.js | |
parent | 3d7bdd6ecb5e8e17cb8ccf83f56ad389971332c1 (diff) | |
parent | 28e030a11d75df81e16f3ebf726bfc59fcee679e (diff) | |
download | tangerine-wallet-browser-be911711942914e7f6df535afff1a3ee87e23b6f.tar tangerine-wallet-browser-be911711942914e7f6df535afff1a3ee87e23b6f.tar.gz tangerine-wallet-browser-be911711942914e7f6df535afff1a3ee87e23b6f.tar.bz2 tangerine-wallet-browser-be911711942914e7f6df535afff1a3ee87e23b6f.tar.lz tangerine-wallet-browser-be911711942914e7f6df535afff1a3ee87e23b6f.tar.xz tangerine-wallet-browser-be911711942914e7f6df535afff1a3ee87e23b6f.tar.zst tangerine-wallet-browser-be911711942914e7f6df535afff1a3ee87e23b6f.zip |
Merge pull request #6683 from MetaMask/develop
Merge dev to master
Diffstat (limited to 'ui/app/helpers/utils/conversions.util.js')
-rw-r--r-- | ui/app/helpers/utils/conversions.util.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/ui/app/helpers/utils/conversions.util.js b/ui/app/helpers/utils/conversions.util.js index b4ec50626..5e1c21ff7 100644 --- a/ui/app/helpers/utils/conversions.util.js +++ b/ui/app/helpers/utils/conversions.util.js @@ -1,6 +1,6 @@ import ethUtil from 'ethereumjs-util' import { ETH, GWEI, WEI } from '../constants/common' -import { conversionUtil, addCurrencies } from './conversion-util' +import { conversionUtil, addCurrencies, subtractCurrencies } from './conversion-util' export function bnToHex (inputBn) { return ethUtil.addHexPrefix(inputBn.toString(16)) @@ -92,6 +92,15 @@ export function addHexWEIsToDec (aHexWEI, bHexWEI) { }) } +export function subtractHexWEIsToDec (aHexWEI, bHexWEI) { + return subtractCurrencies(aHexWEI, bHexWEI, { + aBase: 16, + bBase: 16, + fromDenomination: 'WEI', + numberOfDecimals: 6, + }) +} + export function decEthToConvertedCurrency (ethTotal, convertedCurrency, conversionRate) { return conversionUtil(ethTotal, { fromNumericBase: 'dec', |