diff options
author | Dan Finlay <542863+danfinlay@users.noreply.github.com> | 2018-04-17 07:49:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-17 07:49:53 +0800 |
commit | e4eb69dcc290a7e7eb27cab7ec57a8097345d81e (patch) | |
tree | c3c3b50de25ba7aafe6c58a426f0ba6212d63b71 /ui/app/components/token-cell.js | |
parent | 6a7fd3c774f50954050d651f7e6b8ff325ce2940 (diff) | |
parent | 06689765146c3ca88fc206d93387b05e1db3b81c (diff) | |
download | dexon-wallet-e4eb69dcc290a7e7eb27cab7ec57a8097345d81e.tar.gz dexon-wallet-e4eb69dcc290a7e7eb27cab7ec57a8097345d81e.tar.zst dexon-wallet-e4eb69dcc290a7e7eb27cab7ec57a8097345d81e.zip |
Merge pull request #3982 from MetaMask/i3981-contract-rates
Fetch token prices based on contract address
Diffstat (limited to 'ui/app/components/token-cell.js')
-rw-r--r-- | ui/app/components/token-cell.js | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/ui/app/components/token-cell.js b/ui/app/components/token-cell.js index 0332fde8..c84117d8 100644 --- a/ui/app/components/token-cell.js +++ b/ui/app/components/token-cell.js @@ -16,7 +16,7 @@ function mapStateToProps (state) { currentCurrency: state.metamask.currentCurrency, selectedTokenAddress: state.metamask.selectedTokenAddress, userAddress: selectors.getSelectedAddress(state), - tokenExchangeRates: state.metamask.tokenExchangeRates, + contractExchangeRates: state.metamask.contractExchangeRates, conversionRate: state.metamask.conversionRate, sidebarOpen: state.appState.sidebarOpen, } @@ -25,7 +25,6 @@ function mapStateToProps (state) { function mapDispatchToProps (dispatch) { return { setSelectedToken: address => dispatch(actions.setSelectedToken(address)), - updateTokenExchangeRate: token => dispatch(actions.updateTokenExchangeRate(token)), hideSidebar: () => dispatch(actions.hideSidebar()), } } @@ -41,15 +40,6 @@ function TokenCell () { } } -TokenCell.prototype.componentWillMount = function () { - const { - updateTokenExchangeRate, - symbol, - } = this.props - - updateTokenExchangeRate(symbol) -} - TokenCell.prototype.render = function () { const { tokenMenuOpen } = this.state const props = this.props @@ -60,7 +50,7 @@ TokenCell.prototype.render = function () { network, setSelectedToken, selectedTokenAddress, - tokenExchangeRates, + contractExchangeRates, conversionRate, hideSidebar, sidebarOpen, @@ -68,15 +58,13 @@ TokenCell.prototype.render = function () { // userAddress, } = props - const pair = `${symbol.toLowerCase()}_eth` - let currentTokenToFiatRate let currentTokenInFiat let formattedFiat = '' - if (tokenExchangeRates[pair]) { + if (contractExchangeRates[address]) { currentTokenToFiatRate = multiplyCurrencies( - tokenExchangeRates[pair].rate, + contractExchangeRates[address], conversionRate ) currentTokenInFiat = conversionUtil(string, { |