diff --git a/app/components/UI/Tokens/index.js b/app/components/UI/Tokens/index.js index 684b142fbc7..68c3ef69599 100644 --- a/app/components/UI/Tokens/index.js +++ b/app/components/UI/Tokens/index.js @@ -11,6 +11,7 @@ import { renderFromTokenMinimalUnit, balanceToFiat } from '../../../util/number' import Engine from '../../../core/Engine'; import AssetElement from '../AssetElement'; import FadeIn from 'react-native-fade-in-image'; +import { toChecksumAddress } from 'ethereumjs-util'; const styles = StyleSheet.create({ wrapper: { @@ -129,18 +130,17 @@ export default class Tokens extends PureComponent { renderItem = item => { const { conversionRate, currentCurrency, tokenBalances, tokenExchangeRates } = this.props; - const logo = item.logo || ((contractMap[item.address] && contractMap[item.address].logo) || undefined); - const exchangeRate = item.address in tokenExchangeRates ? tokenExchangeRates[item.address] : undefined; + const itemAddress = (item.address && toChecksumAddress(item.address)) || undefined; + const logo = item.logo || ((contractMap[itemAddress] && contractMap[itemAddress].logo) || undefined); + const exchangeRate = itemAddress in tokenExchangeRates ? tokenExchangeRates[itemAddress] : undefined; const balance = item.balance || - (item.address in tokenBalances - ? renderFromTokenMinimalUnit(tokenBalances[item.address], item.decimals) - : 0); + (itemAddress in tokenBalances ? renderFromTokenMinimalUnit(tokenBalances[itemAddress], item.decimals) : 0); const balanceFiat = item.balanceFiat || balanceToFiat(balance, conversionRate, exchangeRate, currentCurrency); item = { ...item, ...{ logo, balance, balanceFiat } }; return ( { this.setState({ refreshing: true }); - const { AssetsDetectionController, AccountTrackerController } = Engine.context; - const actions = [AssetsDetectionController.detectAssets(), AccountTrackerController.refresh()]; + const { + AssetsDetectionController, + AccountTrackerController, + CurrencyRateController, + TokenRatesController + } = Engine.context; + const actions = [ + AssetsDetectionController.detectAssets(), + AccountTrackerController.refresh(), + CurrencyRateController.poll(), + TokenRatesController.poll() + ]; await Promise.all(actions); this.setState({ refreshing: false }); }; @@ -150,6 +160,7 @@ class Wallet extends Component { navigation, showAlert } = this.props; + let balance = 0; let assets = tokens; if (accounts[selectedAddress]) { diff --git a/package-lock.json b/package-lock.json index d1e028db938..f766bd4c46d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5435,9 +5435,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "electron-to-chromium": { - "version": "1.3.122", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.122.tgz", - "integrity": "sha512-3RKoIyCN4DhP2dsmleuFvpJAIDOseWH88wFYBzb22CSwoFDSWRc4UAMfrtc9h8nBdJjTNIN3rogChgOy6eFInw==" + "version": "1.3.124", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.124.tgz", + "integrity": "sha512-glecGr/kFdfeXUHOHAWvGcXrxNU+1wSO/t5B23tT1dtlvYB26GY8aHzZSWD7HqhqC800Lr+w/hQul6C5AF542w==" }, "elegant-spinner": { "version": "1.0.1", @@ -7990,9 +7990,9 @@ } }, "gaba": { - "version": "1.0.0-beta.69", - "resolved": "https://registry.npmjs.org/gaba/-/gaba-1.0.0-beta.69.tgz", - "integrity": "sha512-YdCE6nBCqD9Au833aj7Hm/0a+NHjRrltb9vq8jTEVOsZ3w5Bep/C3GZeCzF/cQZFLHpNym6obFednZLj0KQkGw==", + "version": "1.0.0-beta.70", + "resolved": "https://registry.npmjs.org/gaba/-/gaba-1.0.0-beta.70.tgz", + "integrity": "sha512-gBEkxnLSixTb17Th5e/avPxIrFe96/wuCWFEthrBSJtDFhVAWwU2V+cfK+PPD4aAh+UjkWpoRCCre9fh6kUntg==", "requires": { "await-semaphore": "^0.1.3", "eth-contract-metadata": "github:MetaMask/eth-contract-metadata#faa4f56fb17b3ae8579df68708be59d617732f31", diff --git a/package.json b/package.json index 5759c2c95d4..ce35a4f6ed3 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "ethjs-unit": "0.1.6", "events": "3.0.0", "fuse.js": "3.4.4", - "gaba": "1.0.0-beta.69", + "gaba": "1.0.0-beta.70", "https-browserify": "0.0.1", "jsc-android": "236355.1.1", "multihashes": "0.4.14",