fix(suite): pushy ada staking top banner only for fb pools

This commit is contained in:
tomasklim
2025-11-29 16:47:53 +01:00
committed by Tomas Klima
parent 359291162e
commit fbd746576a
3 changed files with 18 additions and 6 deletions

View File

@@ -4,13 +4,12 @@ import styled from 'styled-components';
import { selectBannerMessage } from '@suite-common/message-system';
import {
selectCardanoPoolsInfo,
selectIsDeviceBackupRequired,
selectIsDeviceBackupUnfinished,
selectSelectedDevice,
selectVisibleDeviceAccounts,
} from '@suite-common/wallet-core';
import { isCardanoStakedOutsideEverstake } from '@suite-common/wallet-utils';
import { isCardanoStakedWithFiveBinaries } from '@suite-common/wallet-utils';
import { isWeb } from '@trezor/env-utils';
import { spacingsPx } from '@trezor/theme';
@@ -61,7 +60,6 @@ export const SuiteBanners = ({ isOnboarding, fill }: SuiteBannersProps) => {
const isDeviceBackupRequired = useSelector(selectIsDeviceBackupRequired);
const transport = useSelector(state => state.suite.transport);
const accounts = useSelector(selectVisibleDeviceAccounts);
const cardanoStakingPools = useSelector(selectCardanoPoolsInfo);
const { localNetworkAccessPermission } = useLocalNetworkAccessPermission();
// The dismissal doesn't need to outlive the session. Use local state.
@@ -116,9 +114,7 @@ export const SuiteBanners = ({ isOnboarding, fill }: SuiteBannersProps) => {
} else if (bridge?.outdated) {
banner = <BridgeDeprecated />;
priority = 30;
} else if (
accounts.some(account => isCardanoStakedOutsideEverstake(account, cardanoStakingPools))
) {
} else if (accounts.some(account => isCardanoStakedWithFiveBinaries(account))) {
banner = <CardanoOutdatedStakingBanner />;
priority = 20;
}

View File

@@ -28,3 +28,11 @@ export const CARDANO_EVERSTAKE_DREP = {
export const CARDANO_POOL_SATURATION_SAFE_THRESHOLD = 80; // in percentage
export const MIN_CARDANO_AMOUNT_FOR_SEND = new BigNumber(1_000_000);
export const FIVE_BINARIES_POOLS = [
'pool1k2qhlrrweu8fecd4hx4hn22lv00nrd3rjdxj6durax7m78q7ynu',
'pool1nhhsh9yhlrvj9e3nce0zpx0xm2xlt6tx7gqakhr6hjc8wy84sat',
'pool1z5rt6kn6yvuczj44qla73mfyln9l55lw0jkz6x4kjw00u32zec3',
'pool1398lzhvtaa0hgz305d2jz4urfkwkkt66yv476wqe6att2f7dphh',
'pool1z9m2kxeat06t30yf6ar7sqpert0cjdgxzcv2dv36dcwcqcqtgk4',
];

View File

@@ -4,6 +4,7 @@ import { NetworkSymbol, getNetworkFeatures } from '@suite-common/wallet-config';
import {
CARDANO_EVERSTAKE_STAKING_POOL,
CARDANO_POOL_SATURATION_SAFE_THRESHOLD,
FIVE_BINARIES_POOLS,
} from '@suite-common/wallet-constants';
import {
Account,
@@ -68,6 +69,13 @@ export const isCardanoStakedOutsideEverstake = (
return cardanoStakingPools.every(pool => pool.id !== accountPoolId);
};
export const isCardanoStakedWithFiveBinaries = (account: Account) => {
const accountPoolId = getAccountPoolId(account);
if (!accountPoolId) return false;
return FIVE_BINARIES_POOLS.includes(accountPoolId);
};
export const poolBech32ToHex = (poolId: string): string => {
const decoded = bech32.decode(poolId);
const bytes = bech32.fromWords(decoded.words);