aboutsummaryrefslogblamecommitdiffstats
path: root/ui/app/selectors/tokens.js
blob: 47b6e0192b0292f63280e205642a7fce35c15efa (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                                        
import { createSelector } from 'reselect'

export const selectedTokenAddressSelector = state => state.metamask.selectedTokenAddress
export const tokenSelector = state => state.metamask.tokens
export const selectedTokenSelector = createSelector(
  tokenSelector,
  selectedTokenAddressSelector,
  (tokens = [], selectedTokenAddress = '') => {
    return tokens.find(({ address }) => address === selectedTokenAddress)
  }
)