diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-07-31 13:03:20 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-08-24 07:44:44 +0800 |
commit | 5ee40675b9f986a9ff2e5d15a271d7de2145d0e9 (patch) | |
tree | 80f4b3e0a88a5621724a05efeb320596e0bcedad /ui/app/helpers/conversions.util.js | |
parent | d733bd34fbd356bca640b3a50582208c0284be40 (diff) | |
download | tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar.gz tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar.bz2 tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar.lz tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar.xz tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.tar.zst tangerine-wallet-browser-5ee40675b9f986a9ff2e5d15a271d7de2145d0e9.zip |
Refactor transactions list views. Add redesign components
Diffstat (limited to 'ui/app/helpers/conversions.util.js')
-rw-r--r-- | ui/app/helpers/conversions.util.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/ui/app/helpers/conversions.util.js b/ui/app/helpers/conversions.util.js new file mode 100644 index 000000000..1dec216fa --- /dev/null +++ b/ui/app/helpers/conversions.util.js @@ -0,0 +1,37 @@ +import { conversionUtil } from '../conversion-util' + +export function hexToDecimal (hexValue) { + return conversionUtil(hexValue, { + fromNumericBase: 'hex', + toNumericBase: 'dec', + }) +} + +export function getEthFromWeiHex ({ + value, + conversionRate, +}) { + return getValueFromWeiHex({ + value, + conversionRate, + toCurrency: 'ETH', + numberOfDecimals: 6, + }) +} + +export function getValueFromWeiHex ({ + value, + toCurrency, + conversionRate, + numberOfDecimals, +}) { + return conversionUtil(value, { + fromNumericBase: 'hex', + toNumericBase: 'dec', + fromCurrency: 'ETH', + toCurrency, + numberOfDecimals, + fromDenomination: 'WEI', + conversionRate, + }) +} |