refactor: migrate formatters to @metamask/client-utils - #33733
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
PR template — items to address before "Ready for review"Warnings — informational, address before merging:
See docs/readme/ready-for-review.md for the full Definition of Ready for Review. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Performance Test Selection: |
|



Description
Introduces
@metamask/client-utils— the shared package for activity-redesign code across MetaMask clients (formatters + transaction mappers) — and migrates the first consumer:useFormattersnow importscreateFormattersfrom@metamask/client-utilsinstead of@metamask/assets-controllers.Why: Extension has already migrated onto this package to reduce duplicated LOC (metamask-extension #44366, #44624). This PR is the mobile equivalent of extension #44624 and establishes the dependency so follow-up PRs can migrate the activity mappers
Notes for reviewers:
RangeErrorfallback for invalid currency codes);@metamask/client-utilsadditionally exposesformatDateTime,formatTokenAmount,formatPercentWithMinThreshold, andformatCompact.@metamask/transaction-controller: 69.0.0resolution flattens its transaction-controller requirement.useFormattersunit tests (18) and consumer suites (Assets Balance components, assets-list selector — 98 tests) pass unchanged.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-1164
Manual testing steps
Screenshots/Recordings
~Before
~After
~Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Low Risk
Import-path and dependency swap with intended identical formatter behavior; no auth or transaction logic changes in this diff.
Overview
Adds
@metamask/client-utilsand switchesuseFormatterssocreateFormattersis imported from that package instead of@metamask/assets-controllers, matching the extension’s shared activity/formatters stack.useFormattersstill memoizes formatters from the device locale viaI18n; only the dependency source changes.@metamask/assets-controllersremains in the app for other imports (e.g. IPFS helpers). Lockfile picks upclient-utilswith deduped transitive deps.Reviewed by Cursor Bugbot for commit 3d8cb1f. Bugbot is set up for automated code reviews on this repo. Configure here.