From ce04e8aace4079a837a3ffc7aee2fa03c93124d7 Mon Sep 17 00:00:00 2001 From: tomjeatt <40243778+tomjeatt@users.noreply.github.com> Date: Wed, 10 Jul 2024 13:32:55 +0100 Subject: [PATCH] exclude USDC.wh from foreign assets (#1643) * fix: exclude USDC.wh from foreign assets * chore: consistent naming --- src/hooks/api/use-get-currencies.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/hooks/api/use-get-currencies.tsx b/src/hooks/api/use-get-currencies.tsx index c3b6af3f7b..f003ed84cb 100644 --- a/src/hooks/api/use-get-currencies.tsx +++ b/src/hooks/api/use-get-currencies.tsx @@ -5,6 +5,10 @@ import { useQuery, UseQueryResult } from 'react-query'; import { CurrencySquidFormat } from '@/types/currency'; import { NATIVE_CURRENCIES } from '@/utils/constants/currency'; +enum ExcludedForeignCurrencies { + USDC_WH = 'USDC.wh' +} + type UseGetCurrenciesResult = UseQueryResult> & { getCurrencyFromTicker: (ticker: string) => CurrencyExt; getForeignCurrencyFromId: (id: number) => CurrencyExt; @@ -18,7 +22,12 @@ const getCurrencies = async (): Promise> => { window.bridge.loans.getLendTokens(), window.bridge.amm.getLpTokens() ]); - return [...NATIVE_CURRENCIES, ...foreignCurrencies, ...lendCurrencies, ...lpTokens]; + + const filteredForeignCurrencies = foreignCurrencies.filter( + (currency) => !Object.values(ExcludedForeignCurrencies).includes(currency.ticker as ExcludedForeignCurrencies) + ); + + return [...NATIVE_CURRENCIES, ...filteredForeignCurrencies, ...lendCurrencies, ...lpTokens]; }; // Returns all currencies, both native and foreign and helping utils to get CurrencyExt object.