always show popular tokens in token select

This commit is contained in:
tjs 2022-08-31 11:06:49 -04:00
parent 44ae5bc6df
commit 9d7f8e5158
1 changed files with 7 additions and 15 deletions

View File

@ -64,7 +64,7 @@ const TokenItem = ({
)
}
const popularTokenSymbols = ['USDC', 'SOL', 'USDT', 'MNGO', 'BTC', 'ETH']
const popularTokenSymbols = ['USDC', 'SOL', 'USDT', 'MNGO', 'BTC']
const SwapFormTokenList = ({
onClose,
@ -84,20 +84,12 @@ const SwapFormTokenList = ({
const outputBank = mangoStore((s) => s.swap.outputBank)
const popularTokens = useMemo(() => {
return walletTokens?.length
? tokens.filter((token) => {
const walletMints = walletTokens.map((tok) => tok.mint.toString())
return !token?.name || !token?.symbol
? false
: popularTokenSymbols.includes(token.symbol) &&
walletMints.includes(token.address)
})
: tokens.filter((token) => {
return !token?.name || !token?.symbol
? false
: popularTokenSymbols.includes(token.symbol)
})
}, [walletTokens, tokens])
return tokens.filter((token) => {
return !token?.name || !token?.symbol
? false
: popularTokenSymbols.includes(token.symbol)
})
}, [tokens])
useEffect(() => {
function onEscape(e: any) {