Skip to content

fix(rewards): resolve Ondo position swap account picker missing balances for checksummed token addresses cp-7.74.0#29039

Merged
VGR-GIT merged 3 commits into
mainfrom
rwds-fix-multi-account-ondo-position-swap
Apr 20, 2026
Merged

fix(rewards): resolve Ondo position swap account picker missing balances for checksummed token addresses cp-7.74.0#29039
VGR-GIT merged 3 commits into
mainfrom
rwds-fix-multi-account-ondo-position-swap

Conversation

@VGR-GIT

@VGR-GIT VGR-GIT commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Description

The account picker opens when tapping a position and the token balance is either spread across multiple accounts, or held entirely on an account other than the currently active one. This lets the user select which account's balance they want to swap from.

Changelog

CHANGELOG entry: null

Screenshots/Recordings

What is opened if a position is spread around more than 1 account, or if the position is completely tied to another account different then the active one.

image

Note

Medium Risk
Touches balance lookup and account-group selection branching for the Ondo swap flow; errors could cause incorrect picker behavior or misreported balances, but the change is localized and covered by new regression tests.

Overview
Fixes Ondo portfolio swap balance detection by making allTokenBalances lookups case-insensitive (so EIP-55 checksummed token-address keys no longer read as zero), affecting both per-account filtering and per-group balance totals.

Updates the account-picker decision logic to only bypass the picker when the currently selected group is the sole group with balance (removing the implicit group-switch side effect), and simplifies the picker sheet header by dropping the incorrect total-balance label. Tests are updated/expanded to cover the checksummed-address regression, subscription filtering, and selected-group branching.

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

…ces for checksummed token addresses

Token addresses in allTokenBalances are stored in EIP-55 checksummed form,
but the lookup used a lowercased key — causing a case-sensitive miss. Switch
to a case-insensitive Object.entries find in both getAccountsWithBalance and
getGroupBalance. Also remove the stale selectedGroup dep from handleRowPress
and drop the incorrect total-balance label from the account picker sheet header.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@VGR-GIT VGR-GIT requested a review from a team as a code owner April 20, 2026 12:00
@github-actions

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.

@metamaskbotv2 metamaskbotv2 Bot added the team-rewards Rewards team label Apr 20, 2026
Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added size-M risk-low Low testing needed · Low bug introduction risk labels Apr 20, 2026
…ap picker

Re-introduce the subscription account guard in getAccountsWithBalance so only
accounts enrolled in the active subscription are eligible for the account
picker, regardless of whether they hold a token balance.

Co-authored-by: VGR-GIT <vangulckrik@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added risk-low Low testing needed · Low bug introduction risk and removed risk-low Low testing needed · Low bug introduction risk labels Apr 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The 3 changed files are all within the Rewards/Ondo campaign portfolio feature area:

  1. OndoPortfolio.tsx: Refactored account group selection logic - removed auto-switching via Engine.context.AccountTreeController.setSelectedAccountGroup(), changed to use selectSelectedAccountGroup instead of selectResolvedSelectedAccountGroup, fixed case-insensitive token address lookup, and changed to use selectInternalAccounts with filtering instead of selectInternalAccountByAddresses.

  2. OndoAccountPickerSheet.tsx: Simplified header - removed BigNumber total balance aggregation, now just shows token symbol.

  3. OndoPortfolio.test.tsx: Updated unit tests to match new behavior.

Why no E2E tags are needed:

  • No E2E test tags exist for the Rewards/Ondo campaign feature - confirmed by searching for rewards/ondo patterns in e2e test files (no matches found)
  • The changes are entirely self-contained within the Rewards feature area (app/components/UI/Rewards/)
  • No shared components are modified (no BrowserTab, TabBar, navigation, modals, confirmations, or controllers)
  • No Engine or controller changes that could cascade to other features
  • The changes are UI-level refactoring with improved account filtering logic and simplified display
  • The removed Engine.context.AccountTreeController.setSelectedAccountGroup() call is a behavioral change but only affects the Ondo campaign portfolio flow, which has no E2E coverage
  • Unit tests (OndoPortfolio.test.tsx) provide adequate coverage for the logic changes

Performance Test Selection:
The changes are UI-level refactoring within the Rewards/Ondo campaign portfolio feature. While there are minor logic changes (account filtering, balance lookup), these don't affect any performance-critical paths like app startup, account list rendering, login, or asset loading. The Rewards feature is not covered by any performance test tags.

View GitHub Actions results

@metamaskbotv2 metamaskbotv2 Bot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Apr 20, 2026
@sonarqubecloud

Copy link
Copy Markdown

@VGR-GIT VGR-GIT added regression-RC-7.74.0 Regression bug that was found in release candidate (RC) for release 7.74.0 labels Apr 20, 2026
@VGR-GIT VGR-GIT changed the title fix(rewards): resolve Ondo position swap account picker missing balances for checksummed token addresses fix(rewards): resolve Ondo position swap account picker missing balances for checksummed token addresses cp-7.74.0 Apr 20, 2026
@VGR-GIT VGR-GIT enabled auto-merge April 20, 2026 15:00
@VGR-GIT VGR-GIT added this pull request to the merge queue Apr 20, 2026
Merged via the queue into main with commit a669687 Apr 20, 2026
106 checks passed
@VGR-GIT VGR-GIT deleted the rwds-fix-multi-account-ondo-position-swap branch April 20, 2026 15:36
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.75.0 Issue or pull request that will be included in release 7.75.0 label Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template regression-RC-7.74.0 Regression bug that was found in release candidate (RC) for release 7.74.0 release-7.75.0 Issue or pull request that will be included in release 7.75.0 risk-low Low testing needed · Low bug introduction risk size-M team-rewards Rewards team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Ondo Rewards Campaign - Multi account position & tapping not triggering account sheet

2 participants