From 8ae5dfe16fc4a6a3ec0f633a473a56ec660f10f6 Mon Sep 17 00:00:00 2001 From: Prithpal Sooriya Date: Fri, 25 Sep 2026 12:56:39 +0100 Subject: [PATCH 1/3] docs(assets-controller): correct raw-vs-converted balance comments Stored balances are converted (human-readable), not raw. Update the FungibleAssetBalance.amount JSDoc and README comments/examples that implied raw amounts. --- packages/assets-controller/src/README.md | 14 +++++++------- packages/assets-controller/src/types.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/assets-controller/src/README.md b/packages/assets-controller/src/README.md index ad3f0e5d254..33535f73a5f 100644 --- a/packages/assets-controller/src/README.md +++ b/packages/assets-controller/src/README.md @@ -299,8 +299,8 @@ destroy() // Per-account balances assetsBalance: { "account-uuid-1": { - "eip155:1/slip44:60": { amount: "1000000000000000000" }, - "eip155:1/erc20:0xA0b8...": { amount: "1000000" }, + "eip155:1/slip44:60": { amount: "1" }, + "eip155:1/erc20:0xA0b8...": { amount: "1" }, }, "account-uuid-2": { ... }, }, @@ -411,7 +411,7 @@ const balances = await messenger.call( Record>; interface AssetBalance { - amount: string; // Raw amount as string (e.g., "1000000000000000000" for 1 ETH) + amount: string; // Converted amount (e.g., "1" for 1 ETH) } ``` @@ -427,7 +427,7 @@ const balances = await messenger.call( }, ); -// Get raw ETH balance +// Get ETH balance const ethBalance = balances[accountId]['eip155:1/slip44:60'].amount; ``` @@ -536,7 +536,7 @@ await messenger.call( { assetsBalance: { 'account-uuid-1': { - 'eip155:1/slip44:60': { amount: '1000000000000000000' }, + 'eip155:1/slip44:60': { amount: '1' }, }, }, }, @@ -589,8 +589,8 @@ messenger.subscribe('AssetsController:balanceChanged', (event) => { { accountId: AccountId; // Account UUID assetId: Caip19AssetId; // "eip155:1/slip44:60" - previousAmount: string; // "1000000000000000000" - newAmount: string; // "2000000000000000000" + previousAmount: string; // "1" + newAmount: string; // "2" } ``` diff --git a/packages/assets-controller/src/types.ts b/packages/assets-controller/src/types.ts index a1c7bd80d28..788bdade47d 100644 --- a/packages/assets-controller/src/types.ts +++ b/packages/assets-controller/src/types.ts @@ -274,7 +274,7 @@ export type AssetPrice = FungibleAssetPrice | NFTAssetPrice; * Balance data for fungible tokens (native, ERC20, SPL). */ export type FungibleAssetBalance = { - /** Raw balance amount as string (e.g., "1000000000" for 1000 USDC) */ + /** Converted balance amount (e.g., "1000" for 1000 USDC) */ amount: string; /** * Network-specific balance fields, when the source provides them. Stellar From fc1d110b0061c9d7ea95c92fb2ee49418e36d991 Mon Sep 17 00:00:00 2001 From: Prithpal Sooriya Date: Fri, 25 Sep 2026 12:57:07 +0100 Subject: [PATCH 2/3] chore(assets-controller): add changelog entry for #10469 --- packages/assets-controller/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/assets-controller/CHANGELOG.md b/packages/assets-controller/CHANGELOG.md index 625b93a9305..b559a6c3225 100644 --- a/packages/assets-controller/CHANGELOG.md +++ b/packages/assets-controller/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Bump `@metamask/transaction-controller` from `^72.0.0` to `^72.0.1` ([#10462](https://github.com/MetaMask/core/pull/10462)) +### Fixed + +- Fixed outdated comments and README examples that described stored balances as raw rather than converted amounts ([#10469](https://github.com/MetaMask/core/pull/10469)) + ## [16.1.2] ### Changed From abdcbbc4799ecd88bbec2a156bfefb173094fd16 Mon Sep 17 00:00:00 2001 From: Prithpal Sooriya Date: Fri, 25 Sep 2026 13:59:07 +0100 Subject: [PATCH 3/3] chore(assets-controller): remove changelog entry for #10469 --- packages/assets-controller/CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/assets-controller/CHANGELOG.md b/packages/assets-controller/CHANGELOG.md index c20d4141605..5d8323aa3f5 100644 --- a/packages/assets-controller/CHANGELOG.md +++ b/packages/assets-controller/CHANGELOG.md @@ -26,7 +26,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Fixed outdated comments and README examples that described stored balances as raw rather than converted amounts ([#10469](https://github.com/MetaMask/core/pull/10469)) - Treat `assetsAccountsApiV6` as enabled when it is `true`, not a nested `{ value }` object ([#9651](https://github.com/MetaMask/core/pull/9651)) ## [16.1.2]