Skip to content

fix: yield correct symbol for approve rows + wait for on-chain complete before next tx#11823

Merged
premiumjibles merged 8 commits intodevelopfrom
fix/unstake-approval-label-steth
Feb 11, 2026
Merged

fix: yield correct symbol for approve rows + wait for on-chain complete before next tx#11823
premiumjibles merged 8 commits intodevelopfrom
fix/unstake-approval-label-steth

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Feb 10, 2026

Description

Two targeted fixes for the yield transaction flow:

  1. Show correct token in approval step labels — Approval steps on yield exit now show the actual receipt token being approved (rETH, stETH, sAVAX) instead of the native/underlying asset. Native assets like ETH/AVAX can't be ERC-20 approved — the approval always targets the receipt token contract. Confirmed via yield.xyz API responses:

    • rETH exit: APPROVAL tx targets 0xae78736C... (rETH contract) → "Approve rETH"
    • stETH exit: APPROVAL tx targets 0xae7ab965... (stETH contract) → "Approve stETH"
  2. Wait for on-chain receipt between multi-step yield transactions — For EVM chains, the hook now waits for the on-chain transaction receipt before polling for the next transaction step. This prevents race conditions where the API hasn't yet confirmed the previous step.

Issue (if applicable)

Risk

Low — UI label change for approval steps only, plus a timing fix for multi-step tx flows. No changes to transaction amounts or contract interactions.

Yield exit flows for liquid staking tokens (rETH, stETH, sAVAX) and multi-step EVM yield transactions.

Testing

Engineering

  1. yarn type-check passes
  2. yarn lint passes
  3. npx vitest run src/lib/yieldxyz/ — 99 tests pass
  4. rETH exit: Approval step should say "Approve rETH" (not "Approve ETH")
  5. stETH exit: Approval step should say "Approve stETH" (not "Approve ETH")
  6. Multi-step yield tx (e.g. rETH exit with Approve + Swap): Second step should only start after first tx is confirmed on-chain

Operations

  • Test rETH unstake — approval step shows "Approve rETH"
  • Test stETH unstake — approval step shows "Approve stETH"
  • Test multi-step yield transactions complete without errors

Screenshots (if applicable)

https://jam.dev/c/0345edfe-db55-4c71-91f3-d08296a08ce5
https://jam.dev/c/79d807e2-d5f5-4f57-a43d-418c77b97dea

Summary by CodeRabbit

Release Notes

  • New Features

    • Transaction symbols now resolve dynamically based on transaction type and action phase (exit/enter/manage) for improved accuracy in UI displays.
    • Enhanced multi-step transaction handling with explicit chain namespace support.
  • Tests

    • Added comprehensive test coverage for symbol resolution logic across multiple transaction scenarios and fallback cases.

gomesalexandre and others added 3 commits February 10, 2026 17:28
For exit actions on liquid staking yields (Lido stETH, Rocket Pool rETH,
etc.), the approval and unstake steps were incorrectly showing the input
token symbol (e.g., "Approve ETH") instead of the receipt/output token
(e.g., "Approve stETH"). This is because during unstaking, you approve
the receipt token for the withdrawal contract.

Adds resolveAssetSymbolForTx() to determine the correct display symbol
based on transaction type and action direction, and updates YieldForm,
YieldManager, and useYieldTransactionFlow to use it.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
After broadcasting the first tx in a multi-step flow (e.g., Approval →
Unstake), the code only waited for the yield.xyz API to acknowledge the
tx (status != Created), then immediately signed the next tx. Since the
chain nonce hadn't incremented yet (first tx still pending on-chain),
the second tx failed with "transaction replacement underpriced".

Add viem's waitForTransactionReceipt after broadcasting non-final EVM
transactions to ensure the chain nonce has incremented before proceeding
to the next step.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Move assertNever before first usage for top-to-bottom readability
- Use idiomatic `return assertNever()` pattern for exhaustive switch
- Fix outputTokenAsset selector to use outputTokenAssetId directly

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

A new utility function resolveAssetSymbolForTx determines which asset symbol to display for a transaction based on its type, action phase (enter/exit/manage), and available assets. The function is implemented in the utils module with comprehensive tests and integrated throughout the yield transaction flow hook for per-transaction symbol resolution.

Changes

Cohort / File(s) Summary
Symbol Resolution Logic
src/lib/yieldxyz/utils.ts, src/lib/yieldxyz/utils.test.ts
Introduced resolveAssetSymbolForTx function that selects asset symbols based on transaction type and action (returns output token for exit/APPROVAL operations, input token otherwise); added central assertNever helper; includes comprehensive test coverage for all symbol resolution scenarios and fallback behaviors.
Transaction Flow Integration
src/pages/Yields/hooks/useYieldTransactionFlow.ts
Integrated resolveAssetSymbolForTx into transaction flow hook with local resolveSymbolForTx wrapper; replaced static assetSymbol with dynamic symbol resolution in transaction step titles and messages; added EVM chain namespace detection for transaction receipt waiting on multi-step flows; updated effect dependencies to reference the new resolution helper.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • NeOMakinG

Poem

🐰✨ A symbol springs forth, context-aware and bright,
Resolving assets for each transaction's plight,
Exit or enter, the chain knows the way,
Per-transaction wisdom guides the display! 🎯

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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.
Title check ✅ Passed The title 'fix: yield correct symbol for approve rows + wait for on-chain complete before next tx' accurately and specifically summarizes both main changes: correcting approval symbol display and adding on-chain transaction confirmation waits.

✏️ 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 fix/unstake-approval-label-steth

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.

The yield.xyz API returns balances and expects amounts in the underlying/
input token (AVAX, ETH), not the receipt token (sAVAX, rETH). For
pricePerShare tokens where 1 receipt > 1 underlying, this caused a
visible amount mismatch. Separate display concerns: input area (icon,
symbol, precision, market data) uses input token, while button/title
text keeps receipt token to describe the user action.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@gomesalexandre gomesalexandre changed the title fix: yield unstake label + wait for on-chain receipt between multi-step txs fix: yield unstake label + amount denomination + wait for on-chain receipt Feb 10, 2026
The yield.xyz v1 API doesn't expose pricePerShareState, so
discriminate rebasing tokens (stETH/Lido) from pricePerShare tokens
(sAVAX, rETH, mETH) using providerId. Non-rebasing liquid staking
tokens now consistently show the underlying/input token (AVAX, ETH)
across the entire exit form, while rebasing tokens (stETH) correctly
show the receipt token in labels/headings.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@gomesalexandre gomesalexandre changed the title fix: yield unstake label + amount denomination + wait for on-chain receipt fix: use correct token denomination for yield exit forms Feb 10, 2026
gomesalexandre and others added 2 commits February 10, 2026 19:03
Approval steps on yield exit now show the actual receipt token being
approved (rETH, stETH, sAVAX) instead of the native asset. Native
assets like ETH/AVAX can't be ERC-20 approved — the approval always
targets the receipt token contract. Also reverts unnecessary
rebasing/pricePerShare display logic, keeping the changeset minimal.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@gomesalexandre gomesalexandre changed the title fix: use correct token denomination for yield exit forms fix: show correct token symbol for unstake approval labels Feb 10, 2026
@gomesalexandre gomesalexandre changed the title fix: show correct token symbol for unstake approval labels fix: correct approve symbol for unstake rows + wait for on-chain complete before next tx Feb 10, 2026
@gomesalexandre gomesalexandre marked this pull request as ready for review February 10, 2026 18:13
@gomesalexandre gomesalexandre requested a review from a team as a code owner February 10, 2026 18:13
@gomesalexandre gomesalexandre changed the title fix: correct approve symbol for unstake rows + wait for on-chain complete before next tx fix: yield correct symbok for approve rows + wait for on-chain complete before next tx Feb 10, 2026
@gomesalexandre gomesalexandre changed the title fix: yield correct symbok for approve rows + wait for on-chain complete before next tx fix: yield correct symbol for approve rows + wait for on-chain complete before next tx Feb 10, 2026
Copy link
Collaborator

@premiumjibles premiumjibles left a comment

Choose a reason for hiding this comment

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

Looks good 👌

@premiumjibles premiumjibles enabled auto-merge (squash) February 11, 2026 02:17
@premiumjibles premiumjibles merged commit 962e5aa into develop Feb 11, 2026
3 checks passed
@premiumjibles premiumjibles deleted the fix/unstake-approval-label-steth branch February 11, 2026 08:14
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