Skip to content

Commit c6cb918

Browse files
authored
feat: add not met pledge banner (#1949)
1 parent f5a549b commit c6cb918

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

packages/staking/src/features/overview/StakingNotificationBanners/StakingNotificationBanners.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ export const StakingNotificationBanners = ({ popupView, notifications }: Staking
4949
description={t('overview.banners.pendingPortfolioModification.message')}
5050
/>
5151
),
52+
pledgeNotMet: (
53+
<Banner
54+
popupView={popupView}
55+
withIcon
56+
customIcon={<WarningTriangleIcon />}
57+
message={t('overview.banners.pledgeNotMet.title')}
58+
description={t('overview.banners.pledgeNotMet.message')}
59+
onBannerClick={onPoolRetiredOrSaturatedBannerClick}
60+
/>
61+
),
5262
poolRetiredOrSaturated: (
5363
<Banner
5464
popupView={popupView}

packages/staking/src/features/overview/StakingNotificationBanners/getCurrentStakingNotifications.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { StakingNotificationType } from './types';
22
import type { AssetActivityListProps } from '@lace/core';
33
import { CurrentPortfolioStakePool, isPortfolioDrifted } from '../../store';
4-
import { hasPendingDelegationTransaction, hasSaturatedOrRetiredPools } from '../helpers';
4+
import { hasPendingDelegationTransaction, hasPledgeNotMetPools, hasSaturatedOrRetiredPools } from '../helpers';
55

66
type GetCurrentStakingNotificationsParams = {
77
walletActivities: AssetActivityListProps[];
@@ -21,5 +21,6 @@ export const getCurrentStakingNotifications = ({
2121
return [
2222
isPortfolioDrifted(currentPortfolio) ? 'portfolioDrifted' : undefined,
2323
hasSaturatedOrRetiredPools(currentPortfolio) ? 'poolRetiredOrSaturated' : undefined,
24+
hasPledgeNotMetPools(currentPortfolio) ? 'pledgeNotMet' : undefined,
2425
].filter(Boolean) as StakingNotificationType[];
2526
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export type StakingNotificationType =
22
| 'pendingFirstDelegation'
33
| 'pendingPortfolioModification'
4+
| 'pledgeNotMet'
45
| 'portfolioDrifted'
56
| 'poolRetiredOrSaturated';
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { CurrentPortfolioStakePool } from '../../store';
2+
3+
export const hasPledgeNotMetPools = (currentPortfolio: CurrentPortfolioStakePool[]) =>
4+
currentPortfolio.some(({ stakePool }) =>
5+
stakePool.metrics?.livePledge ? stakePool.metrics.livePledge < stakePool.pledge : false
6+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { hasMinimumFundsToDelegate } from './hasMinimumFundsToDelegate';
22
export { hasPendingDelegationTransaction } from './hasPendingDelegationTransaction';
3+
export { hasPledgeNotMetPools } from './hasPledgeNotMet';
34
export { mapPortfolioToDisplayData } from './mapPortfolioToDisplayData';
45
export { hasSaturatedOrRetiredPools } from './hasSaturatedOrRetiredPools';

packages/translation/src/lib/translations/staking/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@
168168
"overview.banners.pendingFirstDelegation.title": "Your staking transaction has been submitted",
169169
"overview.banners.pendingPortfolioModification.message": "In case of changing pools you will continue to receive rewards from your former stake pool(s) for two epochs",
170170
"overview.banners.pendingPortfolioModification.title": "You are modifying your staking portfolio",
171+
"overview.banners.pledgeNotMet.message": "Your stake in this pool is not earning rewards. Review and update your delegation",
172+
"overview.banners.pledgeNotMet.title": "Warning: Delegated pool pledge not met",
171173
"overview.banners.portfolioDrifted.message": "Make sure to rebalance your staking ratios if you want to match your preferences",
172174
"overview.banners.portfolioDrifted.title": "Your current delegation portfolio has shifted",
173175
"overview.banners.saturatedOrRetiredPool.message": "Please make sure to choose other pool(s) to avoid losing rewards",

0 commit comments

Comments
 (0)