feat: yield liquid staking fixes and improvements#11782
feat: yield liquid staking fixes and improvements#11782gomesalexandre wants to merge 18 commits intodevelopfrom
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 <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>
📝 WalkthroughWalkthroughAdds 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 Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
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>
8d0442f to
808a613
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
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.
…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>
Description
Issue (if applicable)
Risk
Medium risk. Changes touch yield transaction flows (claim for withdrawable balances) and display logic for deposit-related screens.
Testing
Engineering
/yield/ethereum-eth-lido-stakingwith an address that has a completed unstake (withdrawable balance). Verify:Operations
Verify yield positions display correctly and enter/exit/claim flows work end-to-end in a preview environment.
Screenshots (if applicable)
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.