|
|
@ -13,6 +13,7 @@ const TokenMenuDropdown = require('./dropdowns/token-menu-dropdown.js') |
|
|
|
function mapStateToProps (state) { |
|
|
|
function mapStateToProps (state) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
network: state.metamask.network, |
|
|
|
network: state.metamask.network, |
|
|
|
|
|
|
|
currentCurrency: state.metamask.currentCurrency, |
|
|
|
selectedTokenAddress: state.metamask.selectedTokenAddress, |
|
|
|
selectedTokenAddress: state.metamask.selectedTokenAddress, |
|
|
|
userAddress: selectors.getSelectedAddress(state), |
|
|
|
userAddress: selectors.getSelectedAddress(state), |
|
|
|
tokenExchangeRates: state.metamask.tokenExchangeRates, |
|
|
|
tokenExchangeRates: state.metamask.tokenExchangeRates, |
|
|
@ -63,18 +64,19 @@ TokenCell.prototype.render = function () { |
|
|
|
ethToUSDRate, |
|
|
|
ethToUSDRate, |
|
|
|
hideSidebar, |
|
|
|
hideSidebar, |
|
|
|
sidebarOpen, |
|
|
|
sidebarOpen, |
|
|
|
|
|
|
|
currentCurrency, |
|
|
|
// userAddress,
|
|
|
|
// userAddress,
|
|
|
|
} = props |
|
|
|
} = props |
|
|
|
|
|
|
|
|
|
|
|
const pair = `${symbol.toLowerCase()}_eth`; |
|
|
|
const pair = `${symbol.toLowerCase()}_eth`; |
|
|
|
|
|
|
|
|
|
|
|
let currentTokenToEthRate; |
|
|
|
let currentTokenToEthRate; |
|
|
|
let currentTokenInUSD; |
|
|
|
let currentTokenInFiat; |
|
|
|
let formattedUSD = '' |
|
|
|
let formattedUSD = '' |
|
|
|
|
|
|
|
|
|
|
|
if (tokenExchangeRates[pair]) { |
|
|
|
if (tokenExchangeRates[pair]) { |
|
|
|
currentTokenToEthRate = tokenExchangeRates[pair].rate; |
|
|
|
currentTokenToEthRate = tokenExchangeRates[pair].rate; |
|
|
|
currentTokenInUSD = conversionUtil(string, { |
|
|
|
currentTokenInFiat = conversionUtil(string, { |
|
|
|
fromNumericBase: 'dec', |
|
|
|
fromNumericBase: 'dec', |
|
|
|
fromCurrency: symbol, |
|
|
|
fromCurrency: symbol, |
|
|
|
toCurrency: 'USD', |
|
|
|
toCurrency: 'USD', |
|
|
@ -82,7 +84,7 @@ TokenCell.prototype.render = function () { |
|
|
|
conversionRate: currentTokenToEthRate, |
|
|
|
conversionRate: currentTokenToEthRate, |
|
|
|
ethToUSDRate, |
|
|
|
ethToUSDRate, |
|
|
|
}) |
|
|
|
}) |
|
|
|
formattedUSD = `$${currentTokenInUSD} USD`; |
|
|
|
formattedUSD = `${currentTokenInFiat} ${currentCurrency.toUpperCase()}`; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|