diff --git a/suite-native/accounts/src/components/AccountSectionTitle.tsx b/suite-native/accounts/src/components/AccountSectionTitle.tsx index 0275d65b27b..6c7ef6f73fa 100644 --- a/suite-native/accounts/src/components/AccountSectionTitle.tsx +++ b/suite-native/accounts/src/components/AccountSectionTitle.tsx @@ -10,6 +10,7 @@ import { selectFiatCurrencyCode } from '@suite-native/settings'; import { NativeStakingRootState, selectAccountCryptoBalanceWithStaking, + doesCoinSupportStaking, } from '@suite-native/staking'; type AccountSectionTitleProps = { @@ -27,10 +28,11 @@ export const AccountSectionTitle: React.FC = ({ const cryptoBalanceWithStaking = useSelector((state: NativeStakingRootState) => selectAccountCryptoBalanceWithStaking(state, account.key), ); + const shouldIncludeStaking = doesCoinSupportStaking(account.symbol); const fiatBalance = useMemo( - () => getAccountFiatBalance({ account, localCurrency, rates }), - [account, localCurrency, rates], + () => getAccountFiatBalance({ account, localCurrency, rates, shouldIncludeStaking }), + [account, localCurrency, rates, shouldIncludeStaking], ); return ( diff --git a/suite-native/accounts/src/selectors.ts b/suite-native/accounts/src/selectors.ts index fd21a28ef80..108a7bcf8a1 100644 --- a/suite-native/accounts/src/selectors.ts +++ b/suite-native/accounts/src/selectors.ts @@ -30,6 +30,7 @@ import { SettingsSliceRootState, selectFiatCurrencyCode } from '@suite-native/se import { isCoinWithTokens } from '@suite-native/tokens'; import type { StaticSessionId } from '@trezor/connect'; import { createWeakMapSelector } from '@suite-common/redux-utils'; +import { doesCoinSupportStaking } from '@suite-native/staking'; import { AccountSelectBottomSheetSection, GroupedByTypeAccounts } from './types'; import { @@ -85,6 +86,7 @@ export const selectAccountFiatBalance = (state: NativeAccountsRootState, account const fiatRates = selectCurrentFiatRates(state); const account = selectAccountByKey(state, accountKey); const localCurrency = selectFiatCurrencyCode(state); + const shouldIncludeStaking = !!account && doesCoinSupportStaking(account.symbol); if (!account) { return '0'; @@ -94,6 +96,7 @@ export const selectAccountFiatBalance = (state: NativeAccountsRootState, account account, rates: fiatRates, localCurrency, + shouldIncludeStaking, }); return totalBalance; @@ -104,12 +107,12 @@ export const getAccountListSections = ( tokenDefinitions: SimpleTokenStructure | undefined, ) => { const sections: AccountSelectBottomSheetSection[] = []; - const canHasTokens = isCoinWithTokens(account.symbol); + const tokens = filterKnownTokens(tokenDefinitions, account.symbol, account.tokens ?? []); const hasAnyKnownTokens = canHasTokens && !!tokens.length; const stakingBalance = getAccountTotalStakingBalance(account) ?? '0'; - const hasStaking = stakingBalance !== '0'; + const hasStaking = doesCoinSupportStaking(account.symbol) && stakingBalance !== '0'; if (canHasTokens) { sections.push({ diff --git a/suite-native/assets/src/assetsSelectors.ts b/suite-native/assets/src/assetsSelectors.ts index 794da13fe9b..3a998c9dcdc 100644 --- a/suite-native/assets/src/assetsSelectors.ts +++ b/suite-native/assets/src/assetsSelectors.ts @@ -21,7 +21,11 @@ import { getAccountFiatBalance } from '@suite-common/wallet-utils'; import { getAccountListSections } from '@suite-native/accounts'; import { sortAccountsByNetworksAndAccountTypes } from '@suite-native/accounts/src/utils'; import { selectFiatCurrencyCode, SettingsSliceRootState } from '@suite-native/settings'; -import { getAccountCryptoBalanceWithStaking, NativeStakingRootState } from '@suite-native/staking'; +import { + doesCoinSupportStaking, + getAccountCryptoBalanceWithStaking, + NativeStakingRootState, +} from '@suite-native/staking'; export interface AssetType { symbol: NetworkSymbol; @@ -102,10 +106,13 @@ const selectDeviceAssetsWithBalances = createMemoizedSelector( ], (accounts, deviceNetworksWithAssets, fiatCurrencyCode, rates) => { const accountsWithFiatBalance = accounts.map(account => { + const shouldIncludeStaking = doesCoinSupportStaking(account.symbol); + const fiatValue = getAccountFiatBalance({ account, localCurrency: fiatCurrencyCode, rates, + shouldIncludeStaking, }); return {