diff options
Diffstat (limited to 'ui/app/selectors.js')
-rw-r--r-- | ui/app/selectors.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ui/app/selectors.js b/ui/app/selectors.js index 4ff3e33f2..400f5cd45 100644 --- a/ui/app/selectors.js +++ b/ui/app/selectors.js @@ -4,6 +4,7 @@ const selectors = { getSelectedAddress, getSelectedIdentity, getSelectedAccount, + getSelectedToken, conversionRateSelector, transactionsSelector, } @@ -31,6 +32,14 @@ function getSelectedAccount (state) { return accounts[selectedAddress] } +function getSelectedToken (state) { + const tokens = state.metamask.tokens || [] + const selectedTokenAddress = state.metamask.selectedTokenAddress + const selectedToken = tokens.filter(({ address }) => address === selectedTokenAddress)[0] + + return selectedToken || null +} + function conversionRateSelector (state) { return state.metamask.conversionRate } |