diff --git a/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx b/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx index 5276ba8e9ba..6ed18bca538 100644 --- a/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx +++ b/src/app/pages/fund/choose-asset-to-fund/choose-asset-to-fund.tsx @@ -1,12 +1,9 @@ import { useCallback, useMemo } from 'react'; import { Outlet, useNavigate } from 'react-router-dom'; -import { - AllTransferableCryptoAssetBalances, - BitcoinCryptoCurrencyAssetBalance, - StacksCryptoCurrencyAssetBalance, -} from '@shared/models/crypto-asset-balance.model'; +import { AllTransferableCryptoAssetBalances } from '@shared/models/crypto-asset-balance.model'; import { RouteUrls } from '@shared/route-urls'; +import { isDefined } from '@shared/utils'; import { useBtcCryptoCurrencyAssetBalance } from '@app/common/hooks/balance/btc/use-btc-crypto-currency-asset-balance'; import { useStxCryptoCurrencyAssetBalance } from '@app/common/hooks/balance/stx/use-stx-crypto-currency-asset-balance'; @@ -18,8 +15,6 @@ import { CryptoAssetList } from '@app/components/crypto-assets/choose-crypto-ass import { ModalHeader } from '@app/components/modal-header'; import { useCheckLedgerBlockchainAvailable } from '@app/store/accounts/blockchain/utils'; -type CryptoAssetBalance = BitcoinCryptoCurrencyAssetBalance | StacksCryptoCurrencyAssetBalance; - export function ChooseCryptoAssetToFund() { const btcCryptoCurrencyAssetBalance = useBtcCryptoCurrencyAssetBalance(); const stxCryptoCurrencyAssetBalance = useStxCryptoCurrencyAssetBalance(); @@ -36,14 +31,12 @@ export function ChooseCryptoAssetToFund() { const filteredCryptoAssetBalances = useMemo( () => - cryptoCurrencyAssetBalances - .filter((assetBalance): assetBalance is CryptoAssetBalance => assetBalance != null) - .filter(assetBalance => - whenWallet({ - ledger: checkBlockchainAvailable(assetBalance?.blockchain), - software: true, - }) - ), + cryptoCurrencyAssetBalances.filter(isDefined).filter(assetBalance => + whenWallet({ + ledger: checkBlockchainAvailable(assetBalance?.blockchain), + software: true, + }) + ), [cryptoCurrencyAssetBalances, checkBlockchainAvailable, whenWallet] );