Skip to content

feat: yield liquid staking fixes and improvements#11782

Open
gomesalexandre wants to merge 18 commits intodevelopfrom
feat_yield_full_toggle_3
Open

feat: yield liquid staking fixes and improvements#11782
gomesalexandre wants to merge 18 commits intodevelopfrom
feat_yield_full_toggle_3

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Jan 27, 2026

Description

  • Fix deposit-related displays — use inputToken symbol instead of staking token for deposit amounts, available balance, and success screens (e.g. show "ETH" not "stETH" for Lido deposits)
  • Claim withdrawable balances — adds Claim button for completed unstakes (e.g. Lido CLAIM_UNSTAKED) that previously had no action button despite showing a "READY" badge. Fixes untranslated "Claim_unstaked" button text and incorrect "Unstake ETH" step title (now "Claim ETH")

Issue (if applicable)

Risk

Medium risk. Changes touch yield transaction flows (claim for withdrawable balances) and display logic for deposit-related screens.

Yield claim flow (CLAIM_UNSTAKED), yield enter/exit modal display

Testing

Engineering

  1. Withdrawable claim flow: Navigate to /yield/ethereum-eth-lido-staking with an address that has a completed unstake (withdrawable balance). Verify:
    • Withdrawable section shows "READY" badge AND a green "Claim" button
    • Clicking "Claim" opens the yield modal with correct amount and "Ready to claim" label (not "Claimable rewards")
    • Transaction step shows "Claim ETH" (not "Unstake ETH" or "Claim_unstaked")
    • Claim flow completes successfully
  2. Cosmos staking claim: Verify claiming staking rewards still works — should show "Claimable rewards" label and purple Claim button
  3. Deposit flow: Verify enter/exit modals show the correct input token symbol (e.g. "ETH" not "stETH" for Lido)

Operations

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

Verify yield positions display correctly and enter/exit/claim flows work end-to-end in a preview environment.

Screenshots (if applicable)

  • develop vs. this diff for stETH - note correct ETH as underlying asset, and "Claim" button for "Withdrawable" row
Screenshot 2026-01-26 at 20 03 06
  • Unstake Claim simulation
Screenshot 2026-01-26 at 20 03 26

Summary by CodeRabbit

  • New Features

    • Claim flow extended to consider withdrawable balances and show a "Ready to claim" state.
    • Transaction titles now better handle unstaked-claim actions for clearer activity labels.
  • Bug Fixes

    • Token symbol display now prefers input token symbols where available.
    • Claimable amounts and display logic refined to consider multiple balance sources for accuracy.

✏️ Tip: You can customize this high-level summary in your review settings.

gomesalexandre and others added 11 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 <noreply@anthropic.com>
Links were navigating to /yields/${yieldId} which resulted in 404s.
The correct route is /yield/${yieldId} (singular).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

📝 Walkthrough

Walkthrough

Adds support for claiming rewards from withdrawable balances, prefers input token symbols for display across Yields UI, extends transaction label mapping and title formatting to handle new tx types, and adds a new translation key readyToClaim.

Changes

Cohort / File(s) Summary
Translations
src/assets/translations/en/main.json
Added assets.otherYields.readyToClaim string ("Ready to claim").
Core utils
src/lib/yieldxyz/utils.ts
Added CLAIM_UNSTAKED to TX_TYPE_TO_LABELS; formatYieldTxTitle now accepts optional txType?: string and returns label via TX_TYPE_TO_LABELS when available, falling back to existing title-based logic.
Transaction flow hook
src/pages/Yields/hooks/useYieldTransactionFlow.ts
Passes tx.type into formatYieldTxTitle, includes type on generated TransactionStep objects, and updates dispatch metadata to use the extended title format.
Claim logic & UI
src/pages/Yields/components/YieldForm.tsx, src/pages/Yields/components/YieldPositionCard.tsx
Added withdrawableBalance as a fallback claim source; introduced isWithdrawableClaim, withdrawableClaimAction; updated claim button rendering and claimability checks to consider withdrawable balances and pending actions.
Available / Deposit UI
src/pages/Yields/components/YieldAvailableToDeposit.tsx
Centralized inputTokenSymbol (fallback to primary token symbol) for tooltips, fiat/crypto displays, asset lookups, and translations.
Display & sorting updates
src/pages/Yields/YieldDetail.tsx, src/pages/Yields/components/YieldHero.tsx, src/pages/Yields/YieldsList.tsx
Prefer yieldItem.inputTokens[0]?.symbol over yieldItem.token.symbol for rendered symbols, sorting, and pool column accessor with fallback to primary token symbol.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant UI as Yield UI (Form/Card)
  participant Hook as useYieldTransactionFlow
  participant Utils as formatYieldTxTitle
  participant Dispatcher as Dispatch / Transaction Builder
  participant Chain as Blockchain / Wallet

  User->>UI: Click "Claim" (withdrawable or claimable)
  UI->>Hook: build transaction steps (includes tx.type)
  Hook->>Utils: formatYieldTxTitle(title, assetSymbol, labelKey, tx.type)
  Utils-->>Hook: resolved title/label
  Hook->>Dispatcher: dispatch transaction steps (with type metadata)
  Dispatcher->>Chain: submit transaction
  Chain-->>Dispatcher: tx result
  Dispatcher-->>UI: update status
  UI-->>User: show confirmation/status
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • premiumjibles
  • 0xApotheosis

Poem

🐇 I nibble code and hop with glee,
Withdrawable rewards now call to me.
Input symbols shine, transactions align,
Ready to claim — a carrot-shaped sign! 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: fixes and improvements to yield liquid staking functionality, including deposit display corrections and a new claim flow for withdrawable balances.
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_full_toggle_3

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 changed the base branch from develop to feat_yield_full_toggle_2 January 27, 2026 06:06
@gomesalexandre gomesalexandre marked this pull request as ready for review January 27, 2026 06:06
@gomesalexandre gomesalexandre requested a review from a team as a code owner January 27, 2026 06:06
gomesalexandre and others added 2 commits January 26, 2026 20:13
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 <noreply@anthropic.com>
…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 <noreply@anthropic.com>
@gomesalexandre gomesalexandre force-pushed the feat_yield_full_toggle_3 branch from 8d0442f to 808a613 Compare January 27, 2026 06:14
@gomesalexandre gomesalexandre changed the base branch from feat_yield_full_toggle_2 to feat_yield_full_toggle_1 January 27, 2026 06:14
Base automatically changed from feat_yield_full_toggle_1 to develop January 27, 2026 22:34
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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: 2

🤖 Fix all issues with AI agents
In `@src/pages/Yields/components/YieldAvailableToDeposit.tsx`:
- Around line 50-54: The current extraction of inputToken fields loses previous
fallbacks: ensure inputTokenSymbol, inputTokenAssetId and inputTokenPrecision
fall back to yieldItem.token values when inputToken is missing or lacks
decimals; specifically update the logic around inputToken (used in this
component) so inputTokenSymbol = inputToken?.symbol ?? yieldItem.token.symbol,
inputTokenAssetId = inputToken?.assetId ?? yieldItem.token.assetId (not an empty
string), and inputTokenPrecision = inputToken?.decimals ??
yieldItem.token.decimals so the card does not return null or query with an empty
assetId when inputTokens[0] is absent.

In `@src/pages/Yields/components/YieldForm.tsx`:
- Around line 118-141: claimableAmount/claimableToken are always taken from
claimableBalance even when the actual claim action (claimAction) comes from
withdrawableBalance; update the logic so when isWithdrawableClaim is true you
pick token and aggregatedAmount from withdrawableBalance instead of
claimableBalance. Specifically modify the definitions of claimableToken and
claimableAmount to conditionally select from withdrawableBalance when
isWithdrawableClaim is true, and ensure any related useMemo dependencies include
isWithdrawableClaim and claimAction (or
claimableClaimAction/withdrawableBalance) so values update correctly; reference
claimableToken, claimableAmount, isWithdrawableClaim, claimableBalance,
withdrawableBalance, claimAction and claimableClaimAction when making the
change.

gomesalexandre and others added 4 commits January 28, 2026 19:24
…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 <noreply@anthropic.com>
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.

1 participant