fix: yield withdraw polishes#11784
Conversation
…letes After completing a yield enter transaction and navigating away (e.g., clicking "View position"), the user could previously go back to /earn/confirm which shouldn't be accessible anymore. Fixes: 1. Reorder guards - check for success state BEFORE checking for selectedYield, ensuring the success screen renders even if Redux state becomes undefined 2. Clear tradeEarnInput Redux state on unmount when in success state, preventing re-access via browser back button or navigation Co-Authored-By: Claude Opus 4.5 <[email protected]>
Links were navigating to /yields/${yieldId} which resulted in 404s.
The correct route is /yield/${yieldId} (singular).
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Moved success buttons from YieldSuccess body content to footerContent prop in EarnConfirm, matching the pattern used by input/confirm steps. Added showButtons prop to YieldSuccess for backwards compatibility. Co-Authored-By: Claude Opus 4.5 <[email protected]>
When fiat amount is zero, return empty string instead of '0.00' to trigger placeholder styling (greyed out) matching crypto mode behavior. Co-Authored-By: Claude Opus 4.5 <[email protected]>
For yields with a default validator (Cosmos ATOM, Solana SOL native staking), filter out positions from other validators in useAllYieldBalances query. This ensures only ShapeShift DAO positions show for Cosmos and only Figment positions show for Solana, hiding positions staked externally with other validators. Removed redundant validator-specific filtering from YieldsList.tsx since filtering now happens at the data layer. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Liquid staking yields (like ETH Lido) were missing the Provider row because they are classified as staking but have no validators. The condition now shows the provider when there's no validator metadata. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Document that PRs opened via CLI tools should always use the PULL_REQUEST_TEMPLATE.md as the base for the PR body. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Shows a loading spinner with tooltip when legacy positions are still loading, allowing the yield table to render immediately with yield.xyz data. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds getBestActionableYield utility that filters out disabled yields (enter disabled, under maintenance, deprecated) before selecting the highest APY option. Prevents showing CTAs for opportunities users can't act on. Co-Authored-By: Claude Opus 4.5 <[email protected]>
When DeFiEarn is rendered outside a YieldAccountProvider (like in the wallet drawer), the default accountNumber: 0 was incorrectly filtering to only Account #0's balances. Now falls through to enabledWalletAccountIds when no context is present, properly aggregating balances across all accounts. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Wrap DeFiEarn in memo to prevent unnecessary re-renders - Remove empty useEffect in YieldForm - Consolidate isStakingYieldType utility (remove redundant wrapper) - Extract CryptoAmountInput to shared component - Extract useYieldDisplayInfo hook from YieldsList - Move static searchIcon outside component - Fix highestAmountUsdValidator computed after validator filtering - Remove YIELD_IMPROVEMENTS.md dev notes file Co-Authored-By: Claude Opus 4.5 <[email protected]>
For liquid staking yields like Lido, the API returns token=stETH (receipt token) and inputTokens[0]=ETH (deposit token). The UI was incorrectly showing stETH in deposit contexts. Now uses inputTokens[0]?.symbol with fallback to token.symbol for deposit displays while keeping token.symbol for position/balance displays. Co-Authored-By: Claude Opus 4.5 <[email protected]>
…ction Withdrawable balances (e.g. Lido completed unstakes) include a CLAIM_UNSTAKED pending action but the UI only checked claimable balances for claim actions. This extends claim detection to also check withdrawable balances, adds a Claim button to the withdrawable section, fixes the "Claim_unstaked" untranslated button text, and uses tx.type for accurate step title resolution. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Hide APY and estimated yearly earnings when withdrawing since they're irrelevant for exit actions. Filter yield explainers by action relevance so exit modal only shows withdraw/unbonding info, not deposit info. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
📝 WalkthroughWalkthroughThis PR introduces an Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 4.5 <[email protected]>
…en fallbacks claimableToken/claimableAmount used ?? which didn't fall through when claimableBalance existed with aggregatedAmount '0'. Now uses bnOrZero check and respects isWithdrawableClaim. Also adds yieldItem.token fallbacks for assetId and decimals in YieldAvailableToDeposit. Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/pages/Yields/components/YieldExplainers.tsx`:
- Around line 76-90: The current action mapping in the YieldExplainers component
maps 'claim' into the 'exit' path causing claim flows to surface exit/unbonding
explainers; update the logic in YieldExplainers to handle 'claim' explicitly (or
narrow the YieldExplainersProps to exclude 'claim') — e.g., compute a distinct
actionRelevance for 'claim' and adjust the useMemo filter that calls
getYieldExplainers(selectedYield) so that when action === 'claim' it either
returns an empty array or filters for a 'claim' relevance value (and update
getYieldExplainers metadata if needed); reference YieldExplainers,
actionRelevance, selectedYield, and getYieldExplainers to locate and modify the
behavior.
Description
Spotted those when once again testing the feature with akschual funds as a user and this didn't look right:
This PR fixes both!
Issue (if applicable)
closes #
Risk
Low - UI-only changes: filtering explainers by action type and disabling unstake button when no active balance.
No protocol/transaction changes. Affects yield position card UI and withdraw/exit modal explainers.
Testing
Engineering
Operations
Screenshots (if applicable)
Summary by CodeRabbit
New Features
UI/UX Improvements