|
|
@ -46,6 +46,9 @@ const toBigNumber = { |
|
|
|
const toNormalizedDenomination = { |
|
|
|
const toNormalizedDenomination = { |
|
|
|
WEI: bigNumber => bigNumber.div(BIG_NUMBER_WEI_MULTIPLIER) |
|
|
|
WEI: bigNumber => bigNumber.div(BIG_NUMBER_WEI_MULTIPLIER) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const toSpecifiedDenomination = { |
|
|
|
|
|
|
|
WEI: bigNumber => bigNumber.times(BIG_NUMBER_WEI_MULTIPLIER) |
|
|
|
|
|
|
|
} |
|
|
|
const baseChange = { |
|
|
|
const baseChange = { |
|
|
|
hex: n => n.toString(16), |
|
|
|
hex: n => n.toString(16), |
|
|
|
dec: n => n.toString(10), |
|
|
|
dec: n => n.toString(10), |
|
|
@ -80,6 +83,7 @@ const whenPropApplySetterMap = (prop, setterMap) => whenPredSetWithPropAndSetter |
|
|
|
const converter = R.pipe( |
|
|
|
const converter = R.pipe( |
|
|
|
whenPropApplySetterMap('fromNumericBase', toBigNumber), |
|
|
|
whenPropApplySetterMap('fromNumericBase', toBigNumber), |
|
|
|
whenPropApplySetterMap('fromDenomination', toNormalizedDenomination), |
|
|
|
whenPropApplySetterMap('fromDenomination', toNormalizedDenomination), |
|
|
|
|
|
|
|
whenPropApplySetterMap('toDenomination', toSpecifiedDenomination), |
|
|
|
whenPredSetWithPropAndSetter(fromAndToCurrencyPropsNotEqual, 'conversionRate', convert), |
|
|
|
whenPredSetWithPropAndSetter(fromAndToCurrencyPropsNotEqual, 'conversionRate', convert), |
|
|
|
whenPredSetWithPropAndSetter(R.prop('ethToUSDRate'), 'ethToUSDRate', convert), |
|
|
|
whenPredSetWithPropAndSetter(R.prop('ethToUSDRate'), 'ethToUSDRate', convert), |
|
|
|
whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round), |
|
|
|
whenPredSetWithPropAndSetter(R.prop('numberOfDecimals'), 'numberOfDecimals', round), |
|
|
@ -93,6 +97,7 @@ const conversionUtil = (value, { |
|
|
|
fromNumericBase, |
|
|
|
fromNumericBase, |
|
|
|
toNumericBase, |
|
|
|
toNumericBase, |
|
|
|
fromDenomination, |
|
|
|
fromDenomination, |
|
|
|
|
|
|
|
toDenomination, |
|
|
|
numberOfDecimals, |
|
|
|
numberOfDecimals, |
|
|
|
conversionRate, |
|
|
|
conversionRate, |
|
|
|
ethToUSDRate, |
|
|
|
ethToUSDRate, |
|
|
@ -102,6 +107,7 @@ const conversionUtil = (value, { |
|
|
|
fromNumericBase, |
|
|
|
fromNumericBase, |
|
|
|
toNumericBase, |
|
|
|
toNumericBase, |
|
|
|
fromDenomination, |
|
|
|
fromDenomination, |
|
|
|
|
|
|
|
toDenomination, |
|
|
|
numberOfDecimals, |
|
|
|
numberOfDecimals, |
|
|
|
conversionRate, |
|
|
|
conversionRate, |
|
|
|
ethToUSDRate, |
|
|
|
ethToUSDRate, |
|
|
|