Skip to content

docs(assets-controller): correct raw-vs-converted balance comments - #10469

Merged
Kriys94 merged 4 commits into
mainfrom
feature/use-memory-update-co-cgn
Sep 25, 2026
Merged

Kriys94 merged 4 commits into
mainfrom
feature/use-memory-update-co-cgn

Conversation

@Prithpal-Sooriya

@Prithpal-Sooriya Prithpal-Sooriya commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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:

/** Raw balance amount as string (e.g., "1000000000" for 1000 USDC) */
amount: string;


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.

Reviewed by Cursor Bugbot for commit abdcbbc. Bugbot is set up for automated code reviews on this repo. Configure here.

Stored balances are converted (human-readable), not raw. Update the
FungibleAssetBalance.amount JSDoc and README comments/examples that
implied raw amounts.
@Prithpal-Sooriya
Prithpal-Sooriya requested a review from a team as a code owner September 25, 2026 11:56
@Kriys94
Kriys94 added this pull request to the merge queue Sep 25, 2026
Merged via the queue into main with commit d646d88 Sep 25, 2026
54 of 55 checks passed
@Kriys94
Kriys94 deleted the feature/use-memory-update-co-cgn branch September 25, 2026 14:04
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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants