Skip to content

Commit

Permalink
fixup! fix(suite-native): do not include solana staking in balance
Browse files Browse the repository at this point in the history
  • Loading branch information
PeKne committed Jan 23, 2025
1 parent 3b2b75a commit 0546e9d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions suite-native/device/src/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { selectFiatCurrencyCode, SettingsSliceRootState } from '@suite-native/se
import { BigNumber } from '@trezor/utils';
import { Account, RatesByKey } from '@suite-common/wallet-types';
import { FiatCurrencyCode } from '@suite-common/suite-config';
import { doesCoinSupportStaking } from '@suite-native/staking';

import { isFirmwareVersionSupported } from './utils';

Expand Down Expand Up @@ -74,8 +75,8 @@ export const selectDeviceError = (
return device?.error;
};

// FIXME: this function can be removed and substitued with @suite-common/wallet-utils/getTotalFiatBalance when Solana supports staking on mobile.
const getTotalFiatBalance = ({
// FIXME: this function can be removed and substituted with @suite-common/wallet-utils/getTotalFiatBalance when Solana supports staking on mobile.
const getTotalFiatBalanceNative = ({
deviceAccounts,
localCurrency,
rates,
Expand All @@ -91,7 +92,7 @@ const getTotalFiatBalance = ({
account: a,
localCurrency,
rates,
shouldIncludeStaking: a.networkType !== 'solana',
shouldIncludeStaking: doesCoinSupportStaking(a.symbol),
}) ?? '0';
instanceBalance = instanceBalance.plus(accountFiatBalance);
});
Expand All @@ -102,13 +103,13 @@ const getTotalFiatBalance = ({
export const selectSelectedDeviceTotalFiatBalance = createMemoizedSelector(
[selectDeviceAccounts, selectCurrentFiatRates, selectFiatCurrencyCode],
(deviceAccounts, rates, localCurrency) =>
getTotalFiatBalance({ deviceAccounts, localCurrency, rates }),
getTotalFiatBalanceNative({ deviceAccounts, localCurrency, rates }),
);

export const selectDeviceTotalFiatBalanceByDeviceState = createMemoizedSelector(
[selectAccountsByDeviceState, selectCurrentFiatRates, selectFiatCurrencyCode],
(deviceAccounts, rates, localCurrency) =>
getTotalFiatBalance({ deviceAccounts, localCurrency, rates }),
getTotalFiatBalanceNative({ deviceAccounts, localCurrency, rates }),
);

// Unique symbols for all accounts that are on view only devices (excluding portfolio tracker)
Expand Down

0 comments on commit 0546e9d

Please sign in to comment.