Skip to content

fix: yield withdraw polishes#11784

Merged
gomesalexandre merged 24 commits intodevelopfrom
feat_yield_unstaking_polish
Feb 10, 2026
Merged

fix: yield withdraw polishes#11784
gomesalexandre merged 24 commits intodevelopfrom
feat_yield_unstaking_polish

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Jan 27, 2026

Description

Spotted those when once again testing the feature with akschual funds as a user and this didn't look right:

  • Information overload when withdrawing, i.e doesn't make sense to see APY, est. yearly returns, or interest accrual explainers when withdrawing - did keep the immediate/delayed exit explainer as it does make absolute sense for withdraws
  • Also noticed a bug when all is currently being unstaked (e.g for ATOM, but really for any with delayed unstaked that need to be finalized): able to click unstake but shouldn't be able to, as there's nothing to unstake

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.

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

No protocol/transaction changes. Affects yield position card UI and withdraw/exit modal explainers.

Testing

Engineering

  • Navigate to a yield position with all balance in exiting/pending state (e.g. ATOM staking)
  • Confirm Unstake button is disabled with tooltip: "No active balance available to unstake."
  • Confirm Unstake button is enabled when there IS active staked balance
  • Open withdraw/exit modal and confirm APY, est. yearly returns, and interest accrual explainers are hidden
  • Confirm the immediate/delayed exit explainer still shows in withdraw modal
  • Open deposit/enter modal and confirm all explainers still show as before

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

Screenshots (if applicable)

Screenshot 2026-01-26 at 21 01 15 Screenshot 2026-01-26 at 21 05 14 Screenshot 2026-01-26 at 21 18 45 image

Summary by CodeRabbit

  • New Features

    • Added context-aware yield transaction explanations that adapt based on enter/exit actions.
    • Enhanced tooltip messaging when exit actions are unavailable due to insufficient balance.
  • UI/UX Improvements

    • Optimized display of APY and earnings estimates during yield entry.
    • Improved clarity on disabled state reasons for exit functionality.

gomesalexandre and others added 15 commits January 26, 2026 12:34
…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]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

This PR introduces an action prop to the YieldExplainers component to enable filtering of explainers based on relevance to specific yield operations ('enter', 'exit', 'claim'). The action prop is threaded through yield-related components, a relevance field is added to explainer items for filtering, the exit button in YieldPositionCard gains tooltip logic for disabled states, and a new translation key is added.

Changes

Cohort / File(s) Summary
Translation Addition
src/assets/translations/en/main.json
Added new translation entry noActiveBalanceToExit with message for unstaking scenarios.
YieldExplainers Core
src/pages/Yields/components/YieldExplainers.tsx
Added action prop and relevance field to ExplainerItem type; implemented filtering logic to display explainers matching action relevance ('enter', 'exit', 'both'); updated component memoization dependencies.
YieldExplainers Usage
src/pages/Yields/components/YieldForm.tsx, src/pages/Yields/components/YieldEnterModal.tsx, src/components/MultiHopTrade/components/Earn/EarnConfirm.tsx
Passed action prop to YieldExplainers invocations; in YieldForm, added conditional rendering for APY and earnings blocks when action === 'enter' and restructured stat layout from Box to VStack.
Exit Button Enhancement
src/pages/Yields/components/YieldPositionCard.tsx
Wrapped exit action button with Tooltip; added computed isExitDisabled and exitDisabledTitle based on yield status and active balance; preserves enter action flow unchanged.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • 0xApotheosis

Poem

🐰 A rabbit hops through yields with care,
Filtering explainers here and there,
Enter, exit, claim—each path so clear,
With relevance whispers, no more fear! 🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fix: yield withdraw polishes' is related to the changeset, which makes UI improvements to yield position cards and withdraw/exit modals, but 'polishes' is vague and doesn't clearly convey the main changes (filtering explainers by action, disabling unstake button without balance). Consider a more specific title like 'fix: filter yield explainers by action and disable unstake without balance' to better describe the key changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat_yield_unstaking_polish

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gomesalexandre gomesalexandre marked this pull request as ready for review January 27, 2026 07:26
@gomesalexandre gomesalexandre requested a review from a team as a code owner January 27, 2026 07:26
gomesalexandre and others added 6 commits January 27, 2026 13:06
…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]>
Base automatically changed from feat_yield_full_toggle_3 to develop February 10, 2026 14:51
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator

@NeOMakinG NeOMakinG left a comment

Choose a reason for hiding this comment

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

@gomesalexandre gomesalexandre changed the title feat: yield withdraw polishes fix: yield underlying/asset + nonce fixes Feb 10, 2026
@gomesalexandre gomesalexandre changed the title fix: yield underlying/asset + nonce fixes fix: yield withdraw polishes Feb 10, 2026
@gomesalexandre gomesalexandre enabled auto-merge (squash) February 10, 2026 21:42
@gomesalexandre gomesalexandre merged commit 20c6d9d into develop Feb 10, 2026
4 checks passed
@gomesalexandre gomesalexandre deleted the feat_yield_unstaking_polish branch February 10, 2026 22:04
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.

2 participants