Skip to content

fix(widget): correct yield-bearing reward token labels#536

Merged
petar-omni merged 1 commit into
mainfrom
fix/eng-3374-yield-bearing-token-label
Jun 16, 2026
Merged

fix(widget): correct yield-bearing reward token labels#536
petar-omni merged 1 commit into
mainfrom
fix/eng-3374-yield-bearing-token-label

Conversation

@petar-omni

@petar-omni petar-omni commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Reward token labels now intelligently display a "(yield-bearing)" indicator for tokens with yield-bearing properties based on on-chain characteristics, helping users easily identify special token types.
    • Added comprehensive English and French language support for yield-bearing reward token labels across all dashboard sections, ensuring better accessibility for international users.
  • Fixes ENG-3374
  • Label reward tokens as yield-bearing from a generic distinct output token + price-per-share predicate
  • Stop using rewardClaiming to infer yield-bearing token mechanics and remove PPS-bearing copy

Label reward tokens as yield-bearing only when a distinct output token has a valid

price-per-share state.

This avoids treating automatic reward claiming as a token mechanic and removes the

PPS-bearing UI copy.
@changeset-bot

changeset-bot Bot commented Jun 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c019919

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a domain helper hasYieldBearingOutputToken that validates a positive pricePerShare and a distinct output token, then rewires formatRewardTokenLabel to accept a translation function and return an i18n label when the condition holds. English and French translation keys are added, and both dashboard models are updated to pass t to the formatter.

Changes

Yield-bearing reward token label

Layer / File(s) Summary
Domain helper: hasYieldBearingOutputToken
packages/widget/src/domain/types/yields.ts
Introduces hasPositivePricePerShare to validate pricePerShareState.price is finite and > 0, and exports hasYieldBearingOutputToken combining that check with output-token presence.
i18n-aware formatter, translations, and call-site wiring
packages/widget/src/pages-dashboard/overview/earn-details/earn-details-formatters.ts, packages/widget/src/pages-dashboard/overview/earn-details/earn-details-model.tsx, packages/widget/src/pages-dashboard/position-details/position-details-model.tsx, packages/widget/src/translation/English/translations.json, packages/widget/src/translation/French/translations.json
formatRewardTokenLabel gains a TFunction parameter and returns t("dashboard.earn_details.yield_bearing_reward_token", {symbol}) when hasYieldBearingOutputToken is true; both dashboard models pass t to the formatter; English and French translation keys are added.
Tests for reward-token label behavior
packages/widget/tests/pages-dashboard/earn-details-model.test.tsx, packages/widget/tests/pages-dashboard/position-details-model.test.tsx
Test t helpers updated for interpolation options; four new test cases assert the label is plain without pricePerShareState and includes "(yield-bearing)" when it is present with a distinct output token.

Sequence Diagram(s)

sequenceDiagram
  participant Model as Dashboard Model
  participant Formatter as formatRewardTokenLabel
  participant Helper as hasYieldBearingOutputToken
  participant i18n as TFunction

  Model->>Formatter: (yieldDto, t)
  Formatter->>Helper: hasYieldBearingOutputToken(yieldDto)
  Helper-->>Formatter: boolean
  alt true
    Formatter->>i18n: t("yield_bearing_reward_token", {symbol: outputToken.symbol})
    i18n-->>Formatter: "TOKEN (yield-bearing)"
  else false
    Formatter-->>Model: outputToken.symbol or token.symbol
  end
  Formatter-->>Model: reward token label
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Philippoes
  • 0xYoki
  • xhakti
  • dnehl

Poem

🐇 A yield-bearing token needs a name so grand,
So I checked the price-per-share — it was as planned!
With a t() function woven into the chain,
French and English labels bloomed like spring rain.
Now the dashboard shows what the numbers really mean —
The fluffiest formatter the widget's ever seen! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The pull request description is minimal and lacks detail. While it mentions the issue fixed and general changes, it does not follow the provided template structure with 'Added' and 'Changed' sections. Expand the description to follow the template structure with clear 'Added' and 'Changed' sections detailing the new functionality and modifications made.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: correcting how yield-bearing reward token labels work, which is the core focus across multiple files in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/eng-3374-yield-bearing-token-label

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

@aws-amplify-eu-central-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-536.df4xyoi0xyeak.amplifyapp.com

@aws-amplify-eu-central-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-536.d2ribjy8evqo6h.amplifyapp.com

@petar-omni petar-omni merged commit de4ec12 into main Jun 16, 2026
8 checks passed
@petar-omni petar-omni deleted the fix/eng-3374-yield-bearing-token-label branch June 16, 2026 13:18
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.

4 participants