Skip to content

[pull] main from MetaMask:main#311

Merged
pull[bot] merged 1 commit into
dmrazzy:mainfrom
MetaMask:main
Sep 1, 2025
Merged

[pull] main from MetaMask:main#311
pull[bot] merged 1 commit into
dmrazzy:mainfrom
MetaMask:main

Conversation

@pull

@pull pull Bot commented Sep 1, 2025

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.3)

Can you help keep this open source service alive? 💖 Please sponsor : )

## Explanation

### Problem
The `AccountTrackerController` contained a custom
`AccountTrackerRpcBalanceFetcher` class that duplicated functionality
already available in the existing `RpcBalanceFetcher` from
`rpc-balance-fetcher.ts`. This created unnecessary code duplication and
maintenance overhead.

### Solution
- **Removed** the redundant `AccountTrackerRpcBalanceFetcher` class
(lines 63-273)
- **Created** a helper function `createAccountTrackerRpcBalanceFetcher`
that configures the existing `RpcBalanceFetcher` to:
  - Fetch only native balances (ZERO_ADDRESS tokens) 
- Optionally include staked balances when `includeStakedAssets` is
enabled
  - Filter out unwanted token balances using an empty tokens state
- **Updated** the constructor to use the new helper function instead of
the custom class


<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
@pull pull Bot locked and limited conversation to collaborators Sep 1, 2025
@pull pull Bot added the ⤵️ pull label Sep 1, 2025
@pull pull Bot merged commit 06aa0e7 into dmrazzy:main Sep 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant