Skip to content

feat: display 5 year projected balance on money account deposit page#29607

Merged
jpuri merged 5 commits into
mainfrom
money_acc_project_balance
May 5, 2026
Merged

feat: display 5 year projected balance on money account deposit page#29607
jpuri merged 5 commits into
mainfrom
money_acc_project_balance

Conversation

@jpuri

@jpuri jpuri commented May 1, 2026

Copy link
Copy Markdown
Contributor

Description

Show 5 year projected balane on money account deposit page.

Changelog

CHANGELOG entry:

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/CONF-1296

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Screenshot 2026-05-01 at 5 54 30 PM

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk UI-only change that adds a derived display value based on APY; main risk is incorrect math/formatting or missing APY data causing the line to disappear.

Overview
Shows a projected 5-year balance line on the custom amount confirmation when the transaction type is moneyAccountDeposit, replacing the usual PayTokenAmount display in that case.

Adds a new ProjectedFiveYearBalance component that pulls vault APY via useMoneyAccountBalance, computes 5-year compounding with BigNumber, formats via useFiatFormatter, and safely returns null for loading/invalid inputs; includes unit tests and a new i18n string confirm.custom_amount.projected_five_year_balance.

Reviewed by Cursor Bugbot for commit 8c256e1. Bugbot is set up for automated code reviews on this repo. Configure here.

@jpuri jpuri requested a review from a team as a code owner May 1, 2026 12:29
@jpuri jpuri added team-confirmations Push issues to confirmations team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels May 1, 2026
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@jpuri jpuri enabled auto-merge May 1, 2026 12:30
@github-actions github-actions Bot added the size-S label May 1, 2026
@github-actions github-actions Bot added size-M and removed size-S labels May 1, 2026
@jpuri jpuri added this pull request to the merge queue May 5, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 5, 2026
@jpuri jpuri enabled auto-merge May 5, 2026 08:27

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3bd747c. Configure here.


const growthFactor = new BigNumber(1).plus(
new BigNumber(apy).dividedBy(100),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

APY treated as percentage but API returns decimal

High Severity

vaultApyQuery.data?.apy returns a decimal (e.g., 0.05 for 5%), as confirmed by every other consumer in the codebase and the hook's own apyPercent = rawApy * 100 conversion. The component divides this decimal by 100 again via dividedBy(100), producing a growth factor of ~1.0005 instead of ~1.05. The projected balance will display virtually no growth in production. The tests pass only because they incorrectly mock apy as 5 (percentage) instead of the real 0.05 (decimal).

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3bd747c. Configure here.

@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeMoney, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes introduce a new ProjectedFiveYearBalance component that displays a projected 5-year balance in the confirmation flow for Money Account Deposit transactions. Key findings:

  1. New component (projected-five-year-balance.tsx): Calculates projected balance using APY from useMoneyAccountBalance hook and renders it in the confirmation UI. Only shown when isMoneyAccountDeposit is true.

  2. Modified custom-amount-info.tsx: Conditionally renders ProjectedFiveYearBalance instead of PayTokenAmount for money account deposit transactions. This is a conditional branch change in the confirmation info component.

  3. Localization: Added projected_five_year_balance string key.

  4. Scope: Changes are gated behind isMoneyAccountDeposit transaction type check, so they only affect the MetaMask Card/Money deposit confirmation flow.

Tag selection rationale:

  • SmokeMoney: Directly covers MetaMask Card and fiat flows including Add Funds (Deposit path), which is exactly where this new component appears.
  • SmokeConfirmations: Required per SmokeMoney tag description ("When selecting SmokeMoney for Card Add Funds or similar flows that execute swaps, also select SmokeConfirmations"). The new component is embedded in the confirmation screen (CustomAmountInfoconfirm-component.tsx), so confirmation tests should validate the new UI renders correctly.

Other tags (SmokeStake, SmokeSwap, SmokePerps) are not affected as the change is specifically gated to money account deposit transaction type.

Performance Test Selection:
The changes introduce a simple UI component (ProjectedFiveYearBalance) that performs a basic BigNumber calculation and renders two Text elements. This is not a performance-sensitive change - it doesn't affect list rendering, app startup, login flows, or any heavy data loading. The component is conditionally rendered only for money account deposit transactions and uses already-loaded APY data from an existing hook. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 5, 2026

Copy link
Copy Markdown

@jpuri jpuri added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 576ce80 May 5, 2026
113 of 135 checks passed
@jpuri jpuri deleted the money_acc_project_balance branch May 5, 2026 10:49
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.77.0 Issue or pull request that will be included in release 7.77.0 size-M team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants