diff options
author | HackyMiner <hackyminer@gmail.com> | 2018-10-26 16:26:43 +0800 |
---|---|---|
committer | Whymarrh Whitby <whymarrh.whitby@gmail.com> | 2018-10-26 16:26:43 +0800 |
commit | 54a8ade2669cb5f8f046509873bc2a9c25425847 (patch) | |
tree | aaf40ae8168848b89365647bb863d0c967932ef8 /ui/app/helpers | |
parent | eaca9a0e8a6a8e65a4dd099c8f860a9616b7360e (diff) | |
download | tangerine-wallet-browser-54a8ade2669cb5f8f046509873bc2a9c25425847.tar tangerine-wallet-browser-54a8ade2669cb5f8f046509873bc2a9c25425847.tar.gz tangerine-wallet-browser-54a8ade2669cb5f8f046509873bc2a9c25425847.tar.bz2 tangerine-wallet-browser-54a8ade2669cb5f8f046509873bc2a9c25425847.tar.lz tangerine-wallet-browser-54a8ade2669cb5f8f046509873bc2a9c25425847.tar.xz tangerine-wallet-browser-54a8ade2669cb5f8f046509873bc2a9c25425847.tar.zst tangerine-wallet-browser-54a8ade2669cb5f8f046509873bc2a9c25425847.zip |
Add support for RPC endpoints with custom chain IDs (#5134)
Diffstat (limited to 'ui/app/helpers')
-rw-r--r-- | ui/app/helpers/confirm-transaction/util.js | 8 | ||||
-rw-r--r-- | ui/app/helpers/conversions.util.js | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/ui/app/helpers/confirm-transaction/util.js b/ui/app/helpers/confirm-transaction/util.js index bcac22500..eb334a4b8 100644 --- a/ui/app/helpers/confirm-transaction/util.js +++ b/ui/app/helpers/confirm-transaction/util.js @@ -55,6 +55,7 @@ export function addFiat (...args) { export function getValueFromWeiHex ({ value, + fromCurrency = 'ETH', toCurrency, conversionRate, numberOfDecimals, @@ -63,7 +64,7 @@ export function getValueFromWeiHex ({ return conversionUtil(value, { fromNumericBase: 'hex', toNumericBase: 'dec', - fromCurrency: 'ETH', + fromCurrency, toCurrency, numberOfDecimals, fromDenomination: 'WEI', @@ -74,6 +75,7 @@ export function getValueFromWeiHex ({ export function getTransactionFee ({ value, + fromCurrency = 'ETH', toCurrency, conversionRate, numberOfDecimals, @@ -82,7 +84,7 @@ export function getTransactionFee ({ fromNumericBase: 'BN', toNumericBase: 'dec', fromDenomination: 'WEI', - fromCurrency: 'ETH', + fromCurrency, toCurrency, numberOfDecimals, conversionRate, @@ -99,6 +101,7 @@ export function formatCurrency (value, currencyCode) { export function convertTokenToFiat ({ value, + fromCurrency = 'ETH', toCurrency, conversionRate, contractExchangeRate, @@ -108,6 +111,7 @@ export function convertTokenToFiat ({ return conversionUtil(value, { fromNumericBase: 'dec', toNumericBase: 'dec', + fromCurrency, toCurrency, numberOfDecimals: 2, conversionRate: totalExchangeRate, diff --git a/ui/app/helpers/conversions.util.js b/ui/app/helpers/conversions.util.js index 777537e1e..cb5e1b90b 100644 --- a/ui/app/helpers/conversions.util.js +++ b/ui/app/helpers/conversions.util.js @@ -20,8 +20,8 @@ export function decimalToHex (decimal) { }) } -export function getEthConversionFromWeiHex ({ value, conversionRate, numberOfDecimals = 6 }) { - const denominations = [ETH, GWEI, WEI] +export function getEthConversionFromWeiHex ({ value, fromCurrency = ETH, conversionRate, numberOfDecimals = 6 }) { + const denominations = [fromCurrency, GWEI, WEI] let nonZeroDenomination @@ -29,7 +29,8 @@ export function getEthConversionFromWeiHex ({ value, conversionRate, numberOfDec const convertedValue = getValueFromWeiHex({ value, conversionRate, - toCurrency: ETH, + fromCurrency, + toCurrency: fromCurrency, numberOfDecimals, toDenomination: denominations[i], }) @@ -45,6 +46,7 @@ export function getEthConversionFromWeiHex ({ value, conversionRate, numberOfDec export function getValueFromWeiHex ({ value, + fromCurrency = ETH, toCurrency, conversionRate, numberOfDecimals, @@ -53,7 +55,7 @@ export function getValueFromWeiHex ({ return conversionUtil(value, { fromNumericBase: 'hex', toNumericBase: 'dec', - fromCurrency: ETH, + fromCurrency, toCurrency, numberOfDecimals, fromDenomination: WEI, |