Skip to content

feat(assets-controller): add transient per-account loading state for user-visible fetches - #10230

Merged
Kriys94 merged 33 commits into
mainfrom
feat/assets-transient-loading-state
Oct 12, 2026
Merged

Kriys94 merged 33 commits into
mainfrom
feat/assets-transient-loading-state

Conversation

@Prithpal-Sooriya

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

Copy link
Copy Markdown
Contributor

Explanation

This is an explicit 1-time loading state the assets controller can track to assist our UX design.
1-time as once balances are fetched for an account, we never reset this loading state.
We can revisit if we want more loading resets, but this is to assist out startup/onboarding logic.

Extension Showcase: https://www.loom.com/share/5f6c2e507e4e4b2c8e715a44b7bca8e3

References

No Jira ticket is linked to this change.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Additive, non-persisted UI state around existing getAssets force-fetch paths; behavior is covered by new unit and integration tests with no auth or balance logic changes.

Overview
Adds a transient, non-persisted assetsLoadingStatus map on AssetsController so the UI can tell when an account’s balances are being fetched for the first user-visible load.

getAssets is wrapped with a @trackAssetsLoading decorator: on calls with forceUpdate: true, accounts with no prior status flip to loading and always settle to loaded (success or failure). Already-settled accounts are not re-marked on later refreshes (account switch queue, unlock, forced refresh). Cache-only getAssets calls and empty account lists are ignored.

New selectors (getAccountLoadingStatus, isAccountGroupLoading, getIsAssetsLoadingForSelectedAccountGroup, etc.) and AssetsLoadingStatus are exported from the package. State metadata marks the field UI-visible but not persisted. Tests cover the decorator, selectors, and controller lifecycle paths.

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

…user-visible fetches

Add a non-persisted 'assetsLoadingStatus' state map
(Record<AccountId, 'accountSwitch' | 'unlock'>) that is populated while
getAssets runs for user-visible moments and cleared when the fetch
settles. Only the two user-action fetch sites (account group change,
unlock/startup refresh) pass the new optional 'trigger' option, so
background fetches (polling, price/tx/currency refreshes) never flap the
indicator. The field is marked persist: false, so no migration is needed.

Also export selectors (getAccountLoadingStatus, isAccountLoading,
getAccountsLoadingStatus, isAnyAccountLoading) for the UX layer.

getAssets is refactored into a thin lifecycle wrapper around the
extracted #getAssetsInternal pipeline (body unchanged), and
tempHealAssetsInfoMetadata is made generic over the state slice so its
return type stays assignable to the widened controller state.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread packages/assets-controller/src/types.ts Resolved
Comment thread packages/assets-controller/src/types.ts Resolved
Comment thread packages/assets-controller/CHANGELOG.md Resolved

@Prithpal-Sooriya Prithpal-Sooriya left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look through self-review comments

…, fix queued-switch gap

- Replace the trigger union with a simple 'loading' | 'loaded' status,
  set before acquiring the refresh mutex so queued switches are marked
  immediately, and settled to 'loaded' when the fetch finishes
- Move the lifecycle into the account-switch and unlock handlers; revert
  getAssets to its original form (no trigger option), keeping the
  generated action-types file unchanged
- Trim comments and shorten the changelog entry

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…sh settle

Track a per-account token when the loading marker is set; only the
invocation that owns the token settles it to 'loaded'. An older refresh
finishing while a newer queued refresh owns the marker now leaves it
'loading' instead of clobbering it to 'loaded'.
Per review feedback, mark the assets loading status inside getAssets
itself using a trackAssetsLoading method decorator instead of in the
startup-refresh and account-group-change handlers, keeping the token
ownership logic so an older overlapping fetch cannot clobber a newer
fetch's loading marker.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5355bd1. Configure here.

Per review feedback: base the decorator's controller type on the real
AssetsController (picking its state), store the loading ownership tokens
in the controller's non-persisted state instead of a module WeakMap, and
add isolated tests for the decorator. Calls that do not force an update
are cache reads and no longer mark the loading status.
@github-actions

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@11.0.0-preview-cecad39eb
@metamask-previews/accounts-controller@40.0.0-preview-cecad39eb
@metamask-previews/address-book-controller@8.0.0-preview-cecad39eb
@metamask-previews/advanced-chart-core@1.0.0-preview-cecad39eb
@metamask-previews/ai-controllers@2.0.0-preview-cecad39eb
@metamask-previews/analytics-controller@3.2.0-preview-cecad39eb
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-cecad39eb
@metamask-previews/announcement-controller@9.0.0-preview-cecad39eb
@metamask-previews/app-metadata-controller@3.0.0-preview-cecad39eb
@metamask-previews/approval-controller@10.0.0-preview-cecad39eb
@metamask-previews/assets-controller@17.0.0-preview-cecad39eb
@metamask-previews/assets-controllers@112.1.0-preview-cecad39eb
@metamask-previews/authenticated-user-storage@4.1.0-preview-cecad39eb
@metamask-previews/base-controller@10.0.0-preview-cecad39eb
@metamask-previews/base-data-service@2.1.0-preview-cecad39eb
@metamask-previews/bitcoin-regtest-up@2.0.0-preview-cecad39eb
@metamask-previews/bridge-controller@81.4.0-preview-cecad39eb
@metamask-previews/bridge-status-controller@76.3.3-preview-cecad39eb
@metamask-previews/build-utils@4.0.0-preview-cecad39eb
@metamask-previews/chain-agnostic-permission@2.0.0-preview-cecad39eb
@metamask-previews/chomp-api-service@6.0.1-preview-cecad39eb
@metamask-previews/claims-controller@1.0.2-preview-cecad39eb
@metamask-previews/client-controller@2.0.0-preview-cecad39eb
@metamask-previews/client-utils@3.0.3-preview-cecad39eb
@metamask-previews/compliance-controller@3.0.0-preview-cecad39eb
@metamask-previews/composable-controller@13.0.0-preview-cecad39eb
@metamask-previews/config-registry-controller@4.0.0-preview-cecad39eb
@metamask-previews/connectivity-controller@1.0.0-preview-cecad39eb
@metamask-previews/controller-utils@13.0.0-preview-cecad39eb
@metamask-previews/core-backend@11.0.0-preview-cecad39eb
@metamask-previews/cryptography@1.0.0-preview-cecad39eb
@metamask-previews/delegation-controller@4.0.0-preview-cecad39eb
@metamask-previews/earn-controller@13.0.2-preview-cecad39eb
@metamask-previews/eip-5792-middleware@4.0.1-preview-cecad39eb
@metamask-previews/eip-7702-internal-rpc-middleware@1.0.0-preview-cecad39eb
@metamask-previews/eip1193-permission-middleware@3.0.0-preview-cecad39eb
@metamask-previews/eth-block-tracker@16.0.0-preview-cecad39eb
@metamask-previews/eth-json-rpc-middleware@25.0.0-preview-cecad39eb
@metamask-previews/eth-json-rpc-provider@7.0.0-preview-cecad39eb
@metamask-previews/foundryup@2.0.0-preview-cecad39eb
@metamask-previews/gas-fee-controller@27.0.0-preview-cecad39eb
@metamask-previews/gator-permissions-controller@6.0.1-preview-cecad39eb
@metamask-previews/geolocation-controller@2.0.0-preview-cecad39eb
@metamask-previews/java-tron-up@2.0.0-preview-cecad39eb
@metamask-previews/json-rpc-engine@11.0.0-preview-cecad39eb
@metamask-previews/json-rpc-middleware-stream@9.0.0-preview-cecad39eb
@metamask-previews/keyring-controller@28.1.0-preview-cecad39eb
@metamask-previews/kyc-controller@0.6.0-preview-cecad39eb
@metamask-previews/local-node-utils@2.0.0-preview-cecad39eb
@metamask-previews/logging-controller@10.0.0-preview-cecad39eb
@metamask-previews/message-manager@15.0.0-preview-cecad39eb
@metamask-previews/messenger@3.0.0-preview-cecad39eb
@metamask-previews/messenger-cli@1.0.0-preview-cecad39eb
@metamask-previews/money-account-api-data-service@2.1.0-preview-cecad39eb
@metamask-previews/money-account-balance-service@3.1.2-preview-cecad39eb
@metamask-previews/money-account-controller@2.0.0-preview-cecad39eb
@metamask-previews/money-account-upgrade-controller@5.1.0-preview-cecad39eb
@metamask-previews/money-account-utils@2.1.0-preview-cecad39eb
@metamask-previews/multichain-account-service@14.1.0-preview-cecad39eb
@metamask-previews/multichain-api-middleware@5.0.0-preview-cecad39eb
@metamask-previews/multichain-network-controller@4.0.0-preview-cecad39eb
@metamask-previews/multichain-transactions-controller@8.0.0-preview-cecad39eb
@metamask-previews/name-controller@10.0.0-preview-cecad39eb
@metamask-previews/network-connection-banner-controller@1.0.0-preview-cecad39eb
@metamask-previews/network-controller@37.0.0-preview-cecad39eb
@metamask-previews/network-enablement-controller@7.0.1-preview-cecad39eb
@metamask-previews/notification-services-controller@29.0.2-preview-cecad39eb
@metamask-previews/passkey-controller@4.1.0-preview-cecad39eb
@metamask-previews/permission-controller@14.0.0-preview-cecad39eb
@metamask-previews/permission-log-controller@6.0.0-preview-cecad39eb
@metamask-previews/perps-controller@19.0.0-preview-cecad39eb
@metamask-previews/phishing-controller@18.2.0-preview-cecad39eb
@metamask-previews/platform-api-docs@0.2.1-preview-cecad39eb
@metamask-previews/polling-controller@17.0.0-preview-cecad39eb
@metamask-previews/preferences-controller@24.0.0-preview-cecad39eb
@metamask-previews/profile-controller@1.0.0-preview-cecad39eb
@metamask-previews/profile-metrics-controller@5.1.2-preview-cecad39eb
@metamask-previews/profile-sync-controller@33.0.0-preview-cecad39eb
@metamask-previews/ramps-controller@26.1.0-preview-cecad39eb
@metamask-previews/rate-limit-controller@8.0.0-preview-cecad39eb
@metamask-previews/react-data-query@2.0.0-preview-cecad39eb
@metamask-previews/remote-feature-flag-controller@7.0.0-preview-cecad39eb
@metamask-previews/sample-controllers@6.0.0-preview-cecad39eb
@metamask-previews/seedless-onboarding-controller@11.0.1-preview-cecad39eb
@metamask-previews/selected-network-controller@27.0.0-preview-cecad39eb
@metamask-previews/sentinel-api-service@2.0.0-preview-cecad39eb
@metamask-previews/shield-controller@7.0.3-preview-cecad39eb
@metamask-previews/signature-controller@40.0.0-preview-cecad39eb
@metamask-previews/smart-transactions-controller@27.0.3-preview-cecad39eb
@metamask-previews/snap-account-service@4.0.0-preview-cecad39eb
@metamask-previews/social-controllers@3.4.0-preview-cecad39eb
@metamask-previews/solana-test-validator-up@2.0.0-preview-cecad39eb
@metamask-previews/stellar-quickstart-up@0.0.0-preview-cecad39eb
@metamask-previews/storage-service@2.0.0-preview-cecad39eb
@metamask-previews/subscription-controller@11.0.0-preview-cecad39eb
@metamask-previews/transaction-controller@72.0.1-preview-cecad39eb
@metamask-previews/transaction-pay-controller@30.0.0-preview-cecad39eb
@metamask-previews/user-operation-controller@42.0.1-preview-cecad39eb
@metamask-previews/utils@12.0.0-preview-cecad39eb
@metamask-previews/wallet@15.1.0-preview-cecad39eb
@metamask-previews/wallet-cli@0.0.0-preview-cecad39eb

@Kriys94

Kriys94 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

LGTM. I think that would be a nice first phase improvement for the user.
I think that would be nice if we do a phase 2 where:

  • We "TanStackify" getAssets. We would be able to re-use basic features like dedup. We can also offer to the UI every time we are syncing the balances (not only just once). And more importantly we can also display failures or partial failures to the user.

@Kriys94
Kriys94 added this pull request to the merge queue Oct 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 6, 2026
@Kriys94

Kriys94 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@metamaskbot publish-preview

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@11.0.0-preview-260a6054e
@metamask-previews/accounts-controller@40.0.0-preview-260a6054e
@metamask-previews/address-book-controller@8.0.0-preview-260a6054e
@metamask-previews/advanced-chart-core@1.0.0-preview-260a6054e
@metamask-previews/ai-controllers@2.0.0-preview-260a6054e
@metamask-previews/analytics-controller@3.2.0-preview-260a6054e
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-260a6054e
@metamask-previews/announcement-controller@9.0.0-preview-260a6054e
@metamask-previews/app-metadata-controller@3.0.0-preview-260a6054e
@metamask-previews/approval-controller@10.0.0-preview-260a6054e
@metamask-previews/assets-controller@17.0.0-preview-260a6054e
@metamask-previews/assets-controllers@112.1.0-preview-260a6054e
@metamask-previews/authenticated-user-storage@4.1.0-preview-260a6054e
@metamask-previews/base-controller@10.0.0-preview-260a6054e
@metamask-previews/base-data-service@2.1.0-preview-260a6054e
@metamask-previews/bitcoin-regtest-up@2.0.0-preview-260a6054e
@metamask-previews/bridge-controller@81.4.0-preview-260a6054e
@metamask-previews/bridge-status-controller@76.3.3-preview-260a6054e
@metamask-previews/build-utils@4.0.0-preview-260a6054e
@metamask-previews/chain-agnostic-permission@2.0.0-preview-260a6054e
@metamask-previews/chomp-api-service@6.0.1-preview-260a6054e
@metamask-previews/claims-controller@1.0.2-preview-260a6054e
@metamask-previews/client-controller@2.0.0-preview-260a6054e
@metamask-previews/client-utils@3.0.3-preview-260a6054e
@metamask-previews/compliance-controller@3.0.0-preview-260a6054e
@metamask-previews/composable-controller@13.0.0-preview-260a6054e
@metamask-previews/config-registry-controller@4.0.0-preview-260a6054e
@metamask-previews/connectivity-controller@1.0.0-preview-260a6054e
@metamask-previews/controller-utils@13.0.0-preview-260a6054e
@metamask-previews/core-backend@11.0.0-preview-260a6054e
@metamask-previews/cryptography@1.0.0-preview-260a6054e
@metamask-previews/delegation-controller@4.0.0-preview-260a6054e
@metamask-previews/earn-controller@13.0.2-preview-260a6054e
@metamask-previews/eip-5792-middleware@4.0.1-preview-260a6054e
@metamask-previews/eip-7702-internal-rpc-middleware@1.0.0-preview-260a6054e
@metamask-previews/eip1193-permission-middleware@3.0.0-preview-260a6054e
@metamask-previews/eth-block-tracker@16.0.0-preview-260a6054e
@metamask-previews/eth-json-rpc-middleware@25.0.0-preview-260a6054e
@metamask-previews/eth-json-rpc-provider@7.0.0-preview-260a6054e
@metamask-previews/foundryup@2.0.0-preview-260a6054e
@metamask-previews/gas-fee-controller@27.0.0-preview-260a6054e
@metamask-previews/gator-permissions-controller@6.0.1-preview-260a6054e
@metamask-previews/geolocation-controller@2.0.0-preview-260a6054e
@metamask-previews/java-tron-up@2.0.0-preview-260a6054e
@metamask-previews/json-rpc-engine@11.0.0-preview-260a6054e
@metamask-previews/json-rpc-middleware-stream@9.0.0-preview-260a6054e
@metamask-previews/keyring-controller@28.1.0-preview-260a6054e
@metamask-previews/kyc-controller@0.6.0-preview-260a6054e
@metamask-previews/local-node-utils@2.0.0-preview-260a6054e
@metamask-previews/logging-controller@10.0.0-preview-260a6054e
@metamask-previews/message-manager@15.0.0-preview-260a6054e
@metamask-previews/messenger@3.0.0-preview-260a6054e
@metamask-previews/messenger-cli@1.0.0-preview-260a6054e
@metamask-previews/money-account-api-data-service@2.1.0-preview-260a6054e
@metamask-previews/money-account-balance-service@3.1.2-preview-260a6054e
@metamask-previews/money-account-controller@2.0.0-preview-260a6054e
@metamask-previews/money-account-upgrade-controller@5.1.0-preview-260a6054e
@metamask-previews/money-account-utils@2.1.0-preview-260a6054e
@metamask-previews/multichain-account-service@14.1.0-preview-260a6054e
@metamask-previews/multichain-api-middleware@5.0.0-preview-260a6054e
@metamask-previews/multichain-network-controller@4.0.0-preview-260a6054e
@metamask-previews/multichain-transactions-controller@8.0.0-preview-260a6054e
@metamask-previews/name-controller@10.0.0-preview-260a6054e
@metamask-previews/network-connection-banner-controller@1.0.0-preview-260a6054e
@metamask-previews/network-controller@37.0.0-preview-260a6054e
@metamask-previews/network-enablement-controller@7.0.1-preview-260a6054e
@metamask-previews/notification-services-controller@29.0.2-preview-260a6054e
@metamask-previews/passkey-controller@4.1.0-preview-260a6054e
@metamask-previews/permission-controller@14.0.0-preview-260a6054e
@metamask-previews/permission-log-controller@6.0.0-preview-260a6054e
@metamask-previews/perps-controller@19.0.0-preview-260a6054e
@metamask-previews/phishing-controller@18.2.0-preview-260a6054e
@metamask-previews/platform-api-docs@0.2.1-preview-260a6054e
@metamask-previews/polling-controller@17.0.0-preview-260a6054e
@metamask-previews/preferences-controller@24.0.0-preview-260a6054e
@metamask-previews/profile-controller@1.0.0-preview-260a6054e
@metamask-previews/profile-metrics-controller@5.1.2-preview-260a6054e
@metamask-previews/profile-sync-controller@33.0.0-preview-260a6054e
@metamask-previews/ramps-controller@26.1.0-preview-260a6054e
@metamask-previews/rate-limit-controller@8.0.0-preview-260a6054e
@metamask-previews/react-data-query@2.0.0-preview-260a6054e
@metamask-previews/remote-feature-flag-controller@7.0.0-preview-260a6054e
@metamask-previews/sample-controllers@6.0.0-preview-260a6054e
@metamask-previews/seedless-onboarding-controller@11.0.1-preview-260a6054e
@metamask-previews/selected-network-controller@27.0.0-preview-260a6054e
@metamask-previews/sentinel-api-service@2.0.0-preview-260a6054e
@metamask-previews/shield-controller@7.0.3-preview-260a6054e
@metamask-previews/signature-controller@40.0.0-preview-260a6054e
@metamask-previews/smart-transactions-controller@27.0.3-preview-260a6054e
@metamask-previews/snap-account-service@4.0.0-preview-260a6054e
@metamask-previews/social-controllers@3.4.0-preview-260a6054e
@metamask-previews/solana-test-validator-up@2.0.0-preview-260a6054e
@metamask-previews/stellar-quickstart-up@0.0.0-preview-260a6054e
@metamask-previews/storage-service@2.0.0-preview-260a6054e
@metamask-previews/subscription-controller@11.0.0-preview-260a6054e
@metamask-previews/transaction-controller@72.0.1-preview-260a6054e
@metamask-previews/transaction-pay-controller@30.0.0-preview-260a6054e
@metamask-previews/user-operation-controller@42.0.1-preview-260a6054e
@metamask-previews/utils@12.0.0-preview-260a6054e
@metamask-previews/wallet@15.1.0-preview-260a6054e
@metamask-previews/wallet-cli@0.0.0-preview-260a6054e

@Kriys94 Kriys94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently the idea was not to have this state only for 1 time but everytime that we sync state

Kriys94
Kriys94 previously approved these changes Oct 12, 2026

@Kriys94 Kriys94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good to merge this first

@Kriys94
Kriys94 disabled auto-merge October 12, 2026 08:57
@Kriys94
Kriys94 added this pull request to the merge queue Oct 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 12, 2026
@Kriys94
Kriys94 force-pushed the feat/assets-transient-loading-state branch from 140c26d to 4be3bec Compare October 12, 2026 11:50
@Kriys94
Kriys94 added this pull request to the merge queue Oct 12, 2026
Merged via the queue into main with commit edcea69 Oct 12, 2026
346 checks passed
Poovarasan-Sandhanam pushed a commit to Poovarasan-Sandhanam/metamask-mobile that referenced this pull request Oct 19, 2026
<!--
Please submit this PR as a draft initially.

Do not mark it as "Ready for review" until this PR meets the canonical
Definition of Ready For Review in `docs/readme/ready-for-review.md`.

In short: the template must be materially complete (not just section
titles
present), all status checks must be currently passing, and the only
expected
follow-up commits must be reviewer-driven.
-->
<!--
mms-check directive vocabulary — read by
.github/scripts/shared/pr-template-checks.ts
at module load to build the validation plan. Directives are invisible in
rendered
markdown and must NOT be removed or edited without updating the
validator registry.

  type=text           Section must contain non-placeholder prose.
  type=changelog      Section must have a valid CHANGELOG entry: line.
type=issue-link Section must have a Fixes:/Closes:/Refs: line with a
value.
type=manual-testing Section must have real testing steps or an explicit
N/A.
type=screenshot Section must have evidence (image/URL) or an explicit
N/A.
type=checklist Section must have all checkboxes consciously checked.
required=true|false Whether a missing/invalid section runs the validator
at all.
blocking=true|false Whether a failure of this check fails the CI
workflow.
Default: false — failures are shown as warnings in the sticky
                      comment but do not block the PR.

Sections without a directive are checked for structural presence only.
-->

## **Description**

<!-- mms-check: type=text required=true -->

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

Bumps `@metamask/assets-controller` from `^17.0.0` to `^19.0.0` and
`@metamask/core-backend` from `^11.0.0` to `^12.1.0` so Mobile matches
the released controller.

`assets-controller` 18.0.0 requires
`MultichainTransactionsController:transactionConfirmed` on the
messenger. This PR delegates that event so Snap keyring confirmations
refresh balances when Account Activity is unavailable
([core#10585](MetaMask/core#10585)).

`assets-controller` 19.0.0 requires `queryApiClient` on `RpcDataSource`
(already passed by assets-controller init) and adds the transient
`assetsLoadingStatus` state, which Mobile does not read
([core#10672](MetaMask/core#10672),
[core#10230](MetaMask/core#10230)).

The Price API `/v2/supportedNetworks` response now returns
`partialSupport` as `{ spotPricesV2, spotPricesV3 }` instead of a flat
array ([core#10582](MetaMask/core#10582)). The
native-asset pricing unit test and the default E2E price mock use that
shape.

The lockfile also resolves `@metamask/assets-controllers` to `112.1.2`
and `@metamask/keyring-snap-client` to `10.0.1`.

## **Changelog**

<!-- mms-check: type=changelog required=true blocking=true -->

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: null

## **Related issues**

<!-- mms-check: type=issue-link required=true -->

Fixes:

Refs: No mobile ticket. Adopts
[core#10585](MetaMask/core#10585),
[core#10582](MetaMask/core#10582),
[core#10672](MetaMask/core#10672), and
[core#10230](MetaMask/core#10230).

## **Manual testing steps**

<!-- mms-check: type=manual-testing required=true -->

```gherkin
Feature: Asset balances and prices after assets-controller 19

  Scenario: wallet home still shows balances and fiat prices
    Given the app is unlocked on a funded account with Ethereum and Solana enabled

    When the user opens the wallet home asset list
    Then native and token balances render
    And fiat prices render for supported networks

  Scenario: a confirmed Solana send refreshes the balance
    Given the user has a Solana account with a spendable balance

    When the user sends SOL and the transaction confirms
    Then the Solana balance updates without a manual pull-to-refresh
```

## **Screenshots/Recordings**

<!-- mms-check: type=screenshot required=true -->

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

N/A — dependency bump with no UI change.

### **After**

N/A — dependency bump with no UI change.

## **Pre-merge author checklist**

<!-- mms-check: type=checklist required=true -->

<!--
Every checklist item must be consciously assessed before marking this PR
as
"Ready for review". A checked box means you deliberately considered that
responsibility, not that you literally performed every action listed.

Unchecked boxes are ambiguous: they are not an implicit "N/A" and they
are not
a silent "skip". See `docs/readme/ready-for-review.md` for the full
checklist
semantics.
-->

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **Pre-merge reviewer checklist**

<!--
Reviewer checklist items follow the same semantics as the author
checklist: an
unchecked box is ambiguous, a checked box means the reviewer consciously
assessed that responsibility. See `docs/readme/ready-for-review.md`.
-->

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Dependency major bump on assets/balance and pricing paths; new post-tx
refresh hook may change when balances update for multichain/Snap flows.
>
> **Overview**
> Bumps **`@metamask/assets-controller`** to **19.0.0** and
**`@metamask/core-backend`** to **12.1.0**, with lockfile updates for
related MetaMask packages.
>
> **AssetsController messenger** now delegates
**`MultichainTransactionsController:transactionConfirmed`** so balances
can refresh after Snap keyring confirmations when Account Activity is
unavailable (core#10585), with a matching unit test.
>
> **Tests and API mocks** align with the price API’s new
**`partialSupport`** shape: an object with **`spotPricesV2`** and
**`spotPricesV3`** arrays instead of a flat array (unit test +
`price-apis` default mock).
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
da1f99d. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Poovarasan-Sandhanam pushed a commit to Poovarasan-Sandhanam/metamask-mobile that referenced this pull request Oct 19, 2026
)

## **Description**

<!-- mms-check: type=text required=true -->

The account-group balance skeleton used a local 8-second timer, an extra
balance refresh, and balance-change tracking to decide when the first
fetch had finished. AssetsController 19.0.0 now records that first
user-visible fetch in `assetsLoadingStatus`.

The balance and homepage token slice now follow
`getIsAssetsLoadingForSelectedAccountGroup`. The skeleton stays up while
that group is loading and clears when the fetch settles, including when
it fails. Later refreshes do not mark the group loading again.

## **Changelog**

<!-- mms-check: type=changelog required=true blocking=true -->

CHANGELOG entry: Updated the balance skeleton to follow the assets
loading state instead of a timer.

## **Related issues**

<!-- mms-check: type=issue-link required=true -->

Refs: MetaMask/core#10230

## **Manual testing steps**

<!-- mms-check: type=manual-testing required=true -->

```gherkin
Feature: account group balance loading

  Scenario: first balance fetch shows a skeleton until assets settle
    Given the selected account group has not loaded assets yet
    When the wallet home opens
    Then the balance shows a skeleton
    And the skeleton clears when the assets fetch settles

  Scenario: a later refresh does not return the skeleton
    Given the selected account group has already loaded assets
    When balances refresh in the background
    Then the balance stays visible
```

## **Screenshots/Recordings**

<!-- mms-check: type=screenshot required=true -->

### **Before**

N/A

### **After**


https://github.com/user-attachments/assets/56e0de11-9967-4be5-ae37-2487f83e953d



## **Pre-merge author checklist**

<!-- mms-check: type=checklist required=true -->

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - Ideally on a mid-range device; emulator is acceptable
- [x] I've tested with a power user scenario
- Use these [power-user
SRPs](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/edit-v2/401401446401?draftShareId=9d77e1e1-4bdc-4be1-9ebb-ccd916988d93)
to import wallets with many accounts and tokens
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
- See [`trace()`](/app/util/trace.ts) for usage and
[`addToken`](/app/components/Views/AddAsset/components/AddCustomToken/AddCustomToken.tsx#L274)
for an example

For performance guidelines and tooling, see the [Performance
Guide](https://consensyssoftware.atlassian.net/wiki/spaces/TL1/pages/400085549067/Performance+Guide+for+Engineers).

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

<!-- Generated with the help of the pr-description AI skill -->

Made with [Cursor](https://cursor.com)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Skeleton timing and loading UX now depend entirely on
AssetsController’s first-fetch loading flag; incorrect or missing
loading status could flash balances or stick on skeletons, but the
removed refresh side effect reduces duplicate fetch risk.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
52e91bd. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 14, 2026
… User Storage (MetaMask#10336)

## Explanation

Custom token changes made locally (`addCustomAsset`,
`removeCustomAsset`, `hideAsset`, `unhideAsset`) are now mirrored to
Authenticated User Storage (AUS) so that user asset intent follows the
account across clients.

- Adds a single shared `@syncAusUserAssets` method decorator
(`syncAusUserAssets.ts`) applied to the four custom-token mutation
methods. The mapping from method to AUS behavior is centralized in a
name-keyed config that fails fast (at class-definition time) if applied
to an unconfigured method.
- `addCustomAsset` → `importTokens`; `hideAsset` → `hideTokens` (each a
single high-level SDK call with the checksummed CAIP-19 id, preserving
the SDK's mutual-exclusivity semantics).
`removeCustomAsset`/`unhideAsset` → strip-only: read `getUserAssets`,
filter the id out of `importedAssets`/`hiddenAssets` respectively, and
`setUserAssets` the result (no write when the blob is null or the id is
already absent).
- The sync is fire-and-forget: it fires as soon as the local state
change is applied (before any post-mutation fetch settles), and AUS
failures are debug-logged and reported via `messenger.captureException`
(an `Error('Failed to sync user assets to AUS', { cause })`, matching
the account-tree-controller / DeFiPositionsControllerV2 pattern; a
throwing reporter is swallowed), never blocking or rolling back the
local change. A locally failing method never writes to AUS.
- Auto-graduation (which removes a custom asset when a metadata source
supplies it) is routed through a new `#removeCustomAssetInternal` so
graduation never records user intent in AUS.
- Adds `@metamask/authenticated-user-storage` as a dev dependency
(type-only usage) with project references, and registers the four AUS
action types on the controller messenger's allowed actions.

### Known limitations

- Syncs are serialized per controller instance (each AUS
read-modify-write starts only after the previous write has landed), so
near-simultaneous local changes no longer lose updates. Cross-device
writes are still last-write-wins: AUS has no ETag or revision check.
- Hide → unhide leaves an empty `importedAssets` list in the blob. This
is a product decision and is out of scope here.

## Adversarial review (adverse)

Final verdict (round 1/3): SHIP-WITH-CAVEATS (3/3 ship, 0/3 block)
Findings: 0 critical · 11 warning · 7 info. Fixed: none in this round.
The reviewed change is the per-instance sync serialization fix for
Bugbot's in-flight merge race. Declined as out of scope for that fix:
all 11 warnings. Each targets the PR's existing design or a product
decision, not the serialization change. They cover per-account vs
user-level removal (open decision), decorator vs explicit call,
async-method firing before settle, the AUS package as devDependency in
exported messenger types, consent/basic-functionality gating,
unwired-client error noise, and test-fixture fidelity. They are flagged
for the PR owner.
Reviewer: claude -p via adverse 0.2.1 (3 personas, 2 rounds).

## References

- Fixes
[ASSETS-3938](https://consensyssoftware.atlassian.net/browse/ASSETS-3938)
([parent
ASSETS-3854](https://consensyssoftware.atlassian.net/browse/ASSETS-3854))
- Builds on MetaMask#10233 (AUS user custom tokens, now merged to `main`).
- Follows the decorator precedent of MetaMask#10230 (`@trackAssetsLoading`).


[ASSETS-3938]:
https://consensyssoftware.atlassian.net/browse/ASSETS-3938?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes how user asset preferences are persisted to remote storage;
failures are non-blocking but cross-client sync correctness depends on
the new decorator and queue behavior.
> 
> **Overview**
> User-driven custom token changes in **AssetsController** now mirror to
Authenticated User Storage (AUS) so imported and hidden assets can
follow the user across clients.
> 
> A new **`@syncAusUserAssets`** decorator on `addCustomAsset`,
`removeCustomAsset`, `hideAsset`, and `unhideAsset` fires
**fire-and-forget** syncs as soon as local state is applied: adds/hides
call `importTokens` / `hideTokens` with normalized CAIP-19 ids;
removes/unhides **strip** the id from the stored blob via
`getUserAssets` → filter → `setUserAssets` (no write when the blob is
missing or the id is already absent). Syncs are **serialized per
controller** through a weak-map queue so overlapping read-modify-writes
do not race. AUS failures are logged and reported with
`captureException` and never roll back local state; validation failures
never touch AUS. **Auto-graduation** removal uses new
**`#removeCustomAssetInternal`** so automatic detection does not erase
user intent in AUS.
> 
> Wiring adds the four AUS messenger actions,
`@metamask/authenticated-user-storage` as a dev/type dependency,
changelog entry, and broad unit/integration tests for the decorator and
controller paths.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0ca2b9a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

## Video Walkthrough


https://github.com/user-attachments/assets/dad84f8d-f07a-439f-b9a2-53874e82e3f4

> 🤖 AI-generated walkthrough — script, animation, and voice made by an
agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants