Skip to content

New Staking and Governance banners and modals#4470

Merged
Nebyt merged 33 commits intodevelopfrom
feat/YW-224/new-banners
Dec 22, 2025
Merged

New Staking and Governance banners and modals#4470
Nebyt merged 33 commits intodevelopfrom
feat/YW-224/new-banners

Conversation

@SorinC6
Copy link
Contributor

@SorinC6 SorinC6 commented Dec 17, 2025

tasks:


Note

Adds a new Rewards banner and governance-required modals, enables one-step stake+DRep delegation via remote config, integrates Tx Review provider, and updates routing/sidebar for the staking revamp.

  • Banners and Promotion:
    • Add new Rewards banner (UI/components/Banners/RewardsBanner.tsx) and queue logic (useBannersQueue) gated by governance status and remote config.
    • Extend base banner (BaseBanner) with noClose and customButton. Show banner via BannerVisibilityManager.
  • Delegation Flow:
    • New DelegateButton supports delegating to a stake pool and DRep in one step (reads poolId/poolName/drepId from remote config) and opens Tx Review.
    • Add createPoolOrDrepDelegationTransaction in DelegationStore to handle pool/DRep or both.
    • Update SeizaFetcherSection, WalletDelegationBanner to use the new flow and prompt governance if needed.
  • Governance Modals:
    • Add GovernanceRequiredForRewards and StakeWithdrawUpdates modals with illustration; block withdraw/undelegate if not participating (WithdrawButton, UndelegateButton).
  • Routing/Providers:
    • Wrap wallet subpages with ReviewTxProvider. Introduce StakingAndGovernancePagesWrapper to share GovernanceContextProvider and currency.
    • Update push notification redirection to ROUTES.STAKING_REVAMP.ROOT; make staking revamp sidebar entry visible for selected wallets.
    • Minor nav behavior: preserve transactions route with newWallet query on wallet switch.
  • Config/Types/Strings:
    • Extend remote config (YoroiRemoteConfig) with banners.earnRewardsWithYoroi.
    • Add new i18n strings (banners and governance copy) and delegateVoting label for Tx Review.
    • Add large illustration GovUpdatesIlustration.

Written by Cursor Bugbot for commit 0c3a933. This will update automatically on new commits. Configure here.

@SorinC6 SorinC6 marked this pull request as draft December 17, 2025 23:18
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing useCallback dependency causes stale closure

The resolveBanner callback uses showRewardBanner at line 11, but showRewardBanner is not included in the useCallback dependencies array. This causes a stale closure issue where changes to showRewardBanner won't trigger a new callback instance, potentially leading to the wrong banner being displayed based on outdated state.

packages/yoroi-extension/app/UI/common/hooks/useBannersQueue.tsx#L27-L28

return null;
}, [bannersRemoteConfig, walletBalance]);

Fix in Cursor Fix in Web


@Nebyt Nebyt added this to the 5.20.0 milestone Dec 18, 2025
@SorinC6 SorinC6 marked this pull request as ready for review December 18, 2025 13:32
Copy link
Contributor Author

@SorinC6 SorinC6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/check

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing dependency in useCallback causes stale closure

The resolveBanner useCallback uses showRewardBanner in its body (line 11) but doesn't include it in the dependency array. This causes a stale closure where the callback may evaluate the reward banner condition using an outdated value of showRewardBanner, potentially showing or hiding the banner incorrectly when the user's delegation or governance status changes.

packages/yoroi-extension/app/UI/common/hooks/useBannersQueue.tsx#L27-L28

return null;
}, [bannersRemoteConfig, walletBalance]);

Fix in Cursor Fix in Web


Base automatically changed from chore/YW-174/staking-revamp to develop December 18, 2025 14:17
@Nebyt Nebyt requested a review from zuzunker December 19, 2025 15:21
Nebyt
Nebyt previously approved these changes Dec 22, 2025
<OperationsDetails
avatarGenerated={avatarGenerated}
poolName={selectedPool?.info?.name}
website={selectedPool.info?.homepage}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing null check causes potential TypeError on pool info

In the new onDelegateAndStake function, the expression selectedPool.info?.homepage uses optional chaining on homepage but not on selectedPool. If getLocalPoolInfo returns null or undefined, accessing .info will throw a TypeError before the ?.homepage check is reached. Line 76 correctly uses selectedPool?.info?.name, but line 77 is inconsistent and unsafe.

Fix in Cursor Fix in Web

label={rewardsButton}
disabled={false}
poolID={yoroiPoolID || ''}
poolName={yoroiPoolName || ''}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty pool ID passed to delegation on mainnet

RewardsBanner passes poolID={yoroiPoolID || ''} which converts undefined remote config values to empty strings. In DelegateButton, the expression isTestnet ? (poolID ?? fallback) : poolID only uses nullish coalescing (??) for testnet, which doesn't catch empty strings. On mainnet, if the remote config lacks poolId, an empty string is passed to createDelegationTransaction, which will likely fail. The || operator in RewardsBanner and ?? operator in DelegateButton handle edge cases inconsistently.

Additional Locations (1)

Fix in Cursor Fix in Web

@Nebyt Nebyt merged commit aa4469a into develop Dec 22, 2025
29 of 33 checks passed
@Nebyt Nebyt deleted the feat/YW-224/new-banners branch December 22, 2025 14:06
@zuzunker zuzunker mentioned this pull request Dec 22, 2025
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants