1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-24 02:58:09 +01:00
metamask-extension/ui/app/selectors/tokens.js

12 lines
426 B
JavaScript
Raw Normal View History

import { createSelector } from 'reselect'
2020-02-15 21:34:12 +01:00
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)
}
)