diff options
author | Dan Miller <danjm.com@gmail.com> | 2018-09-13 16:47:05 +0800 |
---|---|---|
committer | Dan Miller <danjm.com@gmail.com> | 2018-12-04 11:36:04 +0800 |
commit | 7de3f22d63748ed5a81e947755db056d4cdef3db (patch) | |
tree | 748482505ce65c3de4e71787d27b69d71156b522 /ui/app/helpers | |
parent | 6ada9b4a3c02014f8d00b1f45a149afbf47f700d (diff) | |
download | tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.gz tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.bz2 tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.lz tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.xz tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.tar.zst tangerine-wallet-browser-7de3f22d63748ed5a81e947755db056d4cdef3db.zip |
Connects remained of the gas customization component to redux.
Diffstat (limited to 'ui/app/helpers')
-rw-r--r-- | ui/app/helpers/conversions.util.js | 39 | ||||
-rw-r--r-- | ui/app/helpers/formatters.js | 3 |
2 files changed, 42 insertions, 0 deletions
diff --git a/ui/app/helpers/conversions.util.js b/ui/app/helpers/conversions.util.js index cb5e1b90b..d8e0d87fe 100644 --- a/ui/app/helpers/conversions.util.js +++ b/ui/app/helpers/conversions.util.js @@ -1,6 +1,7 @@ import ethUtil from 'ethereumjs-util' import { conversionUtil } from '../conversion-util' import { ETH, GWEI, WEI } from '../constants/common' +import { conversionUtil, addCurrencies } from '../conversion-util' export function bnToHex (inputBn) { return ethUtil.addHexPrefix(inputBn.toString(16)) @@ -82,3 +83,41 @@ export function getWeiHexFromDecimalValue ({ toDenomination: WEI, }) } + +export function addHexWEIsToDec (aHexWEI, bHexWEI) { + return addCurrencies(aHexWEI, bHexWEI, { + aBase: 16, + bBase: 16, + fromDenomination: 'WEI', + numberOfDecimals: 6, + }) +} + +export function decEthToConvertedCurrency (ethTotal, convertedCurrency, conversionRate) { + return conversionUtil(ethTotal, { + fromNumericBase: 'dec', + toNumericBase: 'dec', + fromCurrency: 'ETH', + toCurrency: convertedCurrency, + numberOfDecimals: 2, + conversionRate, + }) +} + +export function decGWEIToHexWEI (decGWEI) { + return conversionUtil(decGWEI, { + fromNumericBase: 'dec', + toNumericBase: 'hex', + fromDenomination: 'GWEI', + toDenomination: 'WEI', + }) +} + +export function hexWEIToDecGWEI (decGWEI) { + return conversionUtil(decGWEI, { + fromNumericBase: 'hex', + toNumericBase: 'dec', + fromDenomination: 'WEI', + toDenomination: 'GWEI', + }) +} diff --git a/ui/app/helpers/formatters.js b/ui/app/helpers/formatters.js new file mode 100644 index 000000000..106a2520d --- /dev/null +++ b/ui/app/helpers/formatters.js @@ -0,0 +1,3 @@ +export function formatETHFee (ethFee) { + return ethFee + ' ETH' +} |