Skip to content

Commit

Permalink
exclude USDC.wh from foreign assets (#1643)
Browse files Browse the repository at this point in the history
* fix: exclude USDC.wh from foreign assets

* chore: consistent naming
  • Loading branch information
tomjeatt authored Jul 10, 2024
1 parent 58d0cc5 commit ce04e8a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/hooks/api/use-get-currencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Array<CurrencyExt>> & {
getCurrencyFromTicker: (ticker: string) => CurrencyExt;
getForeignCurrencyFromId: (id: number) => CurrencyExt;
Expand All @@ -18,7 +22,12 @@ const getCurrencies = async (): Promise<Array<CurrencyExt>> => {
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.
Expand Down

0 comments on commit ce04e8a

Please sign in to comment.