Custom tokens show 0 balance after import
- Dominant language
- TypeScript
- Stars
- 413
- Forks
- 308
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 253
Description
## Bug description
In MetaMask wallet after the token is added the balance is shown as 0 even tho the ''Add token" pop-up shows correct amount.
After some debuging I noticed that problematic tokens have `"aggregators": ["Dynamic"]` set and they always get zero balance in `AccoutntsApiBalanceFetcher.fetch` because API didn't return any value for them.
I opened #7879 which fixes it by calling RPC callback but noticed that this may not be the best solution since the callback is called for 0 balance tokens where some of those could be returned 0 from API and some zero filled and that potentially the fetch should handle this differently so I open this issue to spark a discussion on this bug.
## Steps to reproduce
Add any token to wallet which has `"aggregators": ["Dynamic"]` to wallet
## Screenshots of this problem
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with AccountsApiBalanceFetcher.fetch and reproduce the issue using a token whose aggregators value is ["Dynamic"]. Read issue #7879 and trace how API responses and the RPC callback handle zero balances. Done means the fetch path distinguishes an API-returned zero from a missing value and displays the correct imported-token balance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100