docs(assets-controller): correct raw-vs-converted balance comments - #10469
Merged
Merged
Conversation
Stored balances are converted (human-readable), not raw. Update the FungibleAssetBalance.amount JSDoc and README comments/examples that implied raw amounts.
Kriys94
approved these changes
Sep 25, 2026
Prithpal-Sooriya
added a commit
that referenced
this pull request
Sep 25, 2026
Resolve conflicts by adopting main's implementation changes from #9651 and #10469 (constructor-injected state/visibility, removal of the unprocessedCustomAssets mechanism, full-chain RPC recovery on v6) while keeping the PR's integration test coverage: the v5 suites keep their existing structure, and the two new v6 suites are adapted to main's data-source/pipeline API. Co-Authored-By: Claude <noreply@anthropic.com>
FrederikBolding
pushed a commit
that referenced
this pull request
Sep 28, 2026
…10469) ## Description The `FungibleAssetBalance.amount` JSDoc and several README comments/examples claimed stored balances are **raw** amounts (e.g. `"1000000000"` for 1000 USDC). In reality every data source converts balances to human-readable amounts before they reach controller state (`RpcDataSource#convertToHumanReadable`, `AccountActivityDataSource`), so state stores **converted** balances. ## Changes - `packages/assets-controller/src/types.ts`: `FungibleAssetBalance.amount` JSDoc now says converted, with a converted example. - `packages/assets-controller/src/README.md`: fixed the `getAssetsBalance` return-type comment, the "Get raw ETH balance" example comment, and swapped raw wei values in the state/`assetsUpdate`/`balanceChanged` examples for converted ones. Docs-only change; no behavior change, no changelog entry (labeled `no-changelog`). Reference: https://github.com/MetaMask/core/blob/3e55a8d0930a3008d79f985bda6066de61ab1164/packages/assets-controller/src/types.ts#L277-L278 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Comment and example-only changes; no production code paths or balance handling logic are modified. > > **Overview** > Aligns **assets-controller** docs with how balances actually land in state: **`FungibleAssetBalance.amount`** and the README now describe **human-readable (converted) amounts**, not on-chain smallest units. > > Updates include the **`FungibleAssetBalance.amount`** JSDoc in `types.ts`, plus README fixes for state shape, **`getAssetsBalance`** return types, **`assetsUpdate`** examples, and **`balanceChanged`** event payloads (e.g. `"1"` / `"2"` instead of wei-style strings). **No runtime or API behavior changes**—documentation only. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit abdcbbc. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
FungibleAssetBalance.amountJSDoc and several README comments/examples claimed stored balances are raw amounts (e.g."1000000000"for 1000 USDC). In reality every data source converts balances to human-readable amounts before they reach controller state (RpcDataSource#convertToHumanReadable,AccountActivityDataSource), so state stores converted balances.Changes
packages/assets-controller/src/types.ts:FungibleAssetBalance.amountJSDoc now says converted, with a converted example.packages/assets-controller/src/README.md: fixed thegetAssetsBalancereturn-type comment, the "Get raw ETH balance" example comment, and swapped raw wei values in the state/assetsUpdate/balanceChangedexamples for converted ones.Docs-only change; no behavior change, no changelog entry (labeled
no-changelog).Reference:
core/packages/assets-controller/src/types.ts
Lines 277 to 278 in 3e55a8d
Note
Low Risk
Comment and example-only changes; no production code paths or balance handling logic are modified.
Overview
Aligns assets-controller docs with how balances actually land in state:
FungibleAssetBalance.amountand the README now describe human-readable (converted) amounts, not on-chain smallest units.Updates include the
FungibleAssetBalance.amountJSDoc intypes.ts, plus README fixes for state shape,getAssetsBalancereturn types,assetsUpdateexamples, andbalanceChangedevent payloads (e.g."1"/"2"instead of wei-style strings). No runtime or API behavior changes—documentation only.Reviewed by Cursor Bugbot for commit abdcbbc. Bugbot is set up for automated code reviews on this repo. Configure here.