MetaMask / MetaMask/core

Account Tracker Controller subscribe MultichainNetworkController:didChange

Open
#5,377 0 comments 0 reactions 0 assignees View on GitHub
team-mobile-platform
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

At AccountTrackerController we do save the newly added chain IDs in the accountsByChainId, but through a pooling mechanism in mobile, or an event in Engine.

We should add a subscription in the AccountsTrackerController instead to immediately add the chainId (I think even with 0 balance), so we don't have that state out of sync for briefs moments.

The reason for this is because when we add a newly network on ramps and switch to it, since the balance was not there, we were seeing a crash: https://github.com/MetaMask/metamask-mobile/pull/13307#discussion_r1964184480

The thoughts if this is a viable solution for this issue are highly appreciated!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing AccountTrackerController/AccountsTrackerController and the MultichainNetworkController:didChange entry point, then compare the mobile pooling mechanism with the Engine event path. Done means newly added chain IDs appear immediately in accountsByChainId, including zero-balance chains, without the reported switch-to-new-network crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.