Skip to content

fix: cp-7.57.0 fix api fetcher balances#21014

Merged
salimtb merged 7 commits into
mainfrom
fix/fix-balances-for-account-api-fetcher
Oct 10, 2025
Merged

fix: cp-7.57.0 fix api fetcher balances#21014
salimtb merged 7 commits into
mainfrom
fix/fix-balances-for-account-api-fetcher

Conversation

@salimtb

@salimtb salimtb commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Description

The AccountsApiBalanceFetcher had a bug caused by address format incompatibility between controllers:

  • TokenBalancesController uses lowercase addresses for ERC20 tokens
  • AccountTrackerController uses checksum addresses for native tokens

The original code always checksummed all addresses, causing a wrong token balances state

core PR: MetaMask/core#6812

Changelog

CHANGELOG entry: fix balances issue update when api fetcher is used

Related issues

Fixes: #21030

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

Before

After

Pre-merge author checklist

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

Adjusts AccountsApiBalanceFetcher to use the correct account address format per token type and applies Yarn patches for @metamask/assets-controllers v78/v79.

  • Services:
    • dist/multi-chain-accounts-service/api-balance-fetcher.cjs:
      • Introduces finalAccount based on token type (zero address vs. others).
      • Uses finalAccount for nativeBalancesFromAPI keys and returned account field.
  • Build/Tooling:
    • Adds Yarn patches for @metamask/assets-controllers ^78.0.1 and ^79.0.0 in package.json and .yarn/patches/.
    • Updates yarn.lock to reference patched @metamask/assets-controllers 79.0.0.

Written by Cursor Bugbot for commit 3968057. This will update automatically on new commits. Configure here.

@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.

@salimtb salimtb force-pushed the fix/fix-balances-for-account-api-fetcher branch from dcab5a5 to f04b14d Compare October 10, 2025 09:14
@salimtb salimtb changed the title fix: fix api fetcher balances fix: cp-7.57.0 fix api fetcher balances Oct 10, 2025
@salimtb salimtb marked this pull request as ready for review October 10, 2025 09:33
@salimtb salimtb requested a review from a team as a code owner October 10, 2025 09:33
@salimtb salimtb added the QA Passed QA testing has been completed and passed label Oct 10, 2025

@Cal-L Cal-L 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.

Lgtm

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​assets-controllers@​79.0.0 ⏵ 79.0.1981009198 +1100

View full report

@sonarqubecloud

Copy link
Copy Markdown

@salimtb salimtb added this pull request to the merge queue Oct 10, 2025
Merged via the queue into main with commit 368c6ec Oct 10, 2025
87 of 88 checks passed
@salimtb salimtb deleted the fix/fix-balances-for-account-api-fetcher branch October 10, 2025 17:04
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 10, 2025
@metamaskbot metamaskbot added the release-7.58.0 Issue or pull request that will be included in release 7.58.0 label Oct 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed QA testing has been completed and passed release-7.58.0 Issue or pull request that will be included in release 7.58.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: balance api fetcher is broken

4 participants