All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Bump
@metamask/profile-sync-controllerfrom^27.1.0to^28.0.0(#8162)
- Add
includeAggregatorsoption toV3AssetsQueryOptionsso the tokens v3 assets API can be called withincludeAggregators: trueto return DEX/aggregator integrations in the response (#8021) - Add
includeTokenSecurityDataoption tofetchV3TrendingTokensandgetV3TrendingTokensQueryOptionsto request token security data from the API (#8106) - Export new types
TokenSecurityData,TokenSecurityFeature,TokenSecurityHolder,TokenSecurityMarket,TokenSecurityFees,TokenSecurityFinancialStats, andTokenSecurityMetadata(#8106) - Add
getV4MultiAccountTransactionsInfiniteQueryOptionsfor paginated transaction queries withuseInfiniteQuery(#8002)
- Bump
@metamask/accounts-controllerfrom^36.0.0to^37.0.0(#7996), (#8140) - Bump
@metamask/controller-utilsfrom^11.18.0to^11.19.0(#7995)
- Add
ApiPlatformClientServiceto exposeApiPlatformClientvia the messenger without a controller (#7928)- Consumers call
messenger.call('ApiPlatformClientService:getApiPlatformClient')to obtain the shared client for accounts, prices, token, and tokens APIs
- Consumers call
- Export TanStack Query options for all API endpoints via
get*QueryOptionshelpers (#7928)- Each fetch method (e.g.
fetchV5MultiAccountBalances) has a correspondingget*QueryOptions(e.g.getV5MultiAccountBalancesQueryOptions) returning the same options object used internally - Enables reuse with
useQuery,useInfiniteQuery,useSuspenseQuery, and other TanStack Query APIs
- Each fetch method (e.g.
- Extend
FetchOptionsto allow TanStack Query options (e.g.select,initialPageParam,retry,initialData) to be passed through toget*QueryOptionsand merged into the returned query options- Export
getQueryOptionsOverrideshelper for strippingqueryKey/queryFnfrom options when merging - All API clients (accounts, prices, token, tokens) merge user overrides first, then apply
staleTime/gcTimedefaults so cache timing is consistent and extra options (e.g.select) are preserved
- Export
- BREAKING: Merge
fetchV2BalancesWithOptionsintofetchV2Balances(#7928)fetchV2Balances(address, queryOptions?, options?)now accepts the full query options:networks,filterSupportedTokens,includeTokenAddresses,includeStakedAssetsgetV2BalancesQueryOptionsaccepts the same full query options for use with TanStack QueryfetchV2BalancesWithOptionsandgetV2BalancesWithOptionsQueryOptionshave been removed; usefetchV2BalancesandgetV2BalancesQueryOptionswith the desired options instead
- BREAKING: Align v4 multi-account transactions with API (#7928)
- First parameter renamed from
accountIdstoaccountAddressesinfetchV4MultiAccountTransactionsandgetV4MultiAccountTransactionsQueryOptions - Query options now include:
startTimestamp,endTimestamp,limit,after,before,maxLogsPerTx,langin addition tonetworks,cursor,sortDirection,includeLogs,includeTxMetadata includeValueTransfershas been removed from the options (not in API spec)
- First parameter renamed from
- Accounts, prices, and tokens clients:
fetch*andget*QueryOptionsnow short-circuit on empty required inputs (e.g. empty address, empty account IDs or asset lists) and return empty results without calling the API (#7928)
- Bump
@metamask/accounts-controllerfrom^35.0.2to^36.0.0(#7897) - Bump
@metamask/profile-sync-controllerfrom^27.0.0to^27.1.0(#7849)
- Add
ApiPlatformClientfor unified access to MetaMask backend APIs with TanStack Query caching (#7658, #7735, #7686)- Automatic request deduplication and intelligent caching
- Automatic retries with exponential backoff for transient failures
- Support for Accounts API, Price API, Token API, and Tokens API endpoints
- Export helper functions
shouldRetryandcalculateRetryDelayfor custom retry logic - Export API types for external consumers
- Upgrade
@metamask/utilsfrom^11.8.1to^11.9.0(#7511) - Move peer dependencies for controller and service packages to direct dependencies (#7209, #7604, #7642, #7713)
- The dependencies moved are:
@metamask/accounts-controller(^35.0.2)@metamask/keyring-controller(^25.1.0)
- In clients, it is now possible for multiple versions of these packages to exist in the dependency tree.
- For example, this scenario would be valid: a client relies on
@metamask/controller-a1.0.0 and@metamask/controller-b1.0.0, and@metamask/controller-bdepends on@metamask/controller-a1.1.0.
- For example, this scenario would be valid: a client relies on
- Note, however, that the versions specified in the client's
package.jsonalways "win", and you are expected to keep them up to date so as not to break controller and service intercommunication.
- The dependencies moved are:
- Bump
@metamask/controller-utilsfrom^11.16.0to^11.18.0(#7534, #7583)
- Bump
@metamask/profile-sync-controllerfrom^26.0.0to^27.0.0(#7202) - Bump
@metamask/controller-utilsfrom^11.15.0to^11.16.0(#7202) - BREAKING: Bump
@metamask/keyring-controllerfrom^24.0.0to^25.0.0(#7202) - BREAKING: Bump
@metamask/accounts-controllerfrom^34.0.0to^35.0.0(#7202)
- Improve WebSocket connection lifecycle tracing in
BackendWebSocketService(#7101)- WebSocket connection duration is now properly reflected in trace span duration instead of only in custom data
- Trace all disconnections (both manual and unexpected) to provide complete connection lifecycle visibility in traces
- Omit
connectionDuration_msfrom disconnection traces when connection never established (onClose without onOpen)
- Update
BackendWebSocketServicedefault exponential backoff options for reconnection (#7101)- Increase default
reconnectDelayfrom 500 milliseconds to 10 seconds - Increase default
maxReconnectDelayfrom 30 seconds to 60 seconds
- Increase default
- Simplify WebSocket disconnection code in
BackendWebSocketService(#7101)- Centralize all disconnection logic in
ws.onclosehandler for single source of truth - Centralize all state changes within
#establishConnectionmethod - state transitions only occur inonopen(CONNECTING → CONNECTED) andonclose(any state → DISCONNECTED) - Add
MANUAL_DISCONNECT_CODE(4999) andMANUAL_DISCONNECT_REASONconstants to distinguish manual from unexpected disconnects
- Centralize all disconnection logic in
- Bump
@ts-bridge/clifrom^0.6.1to^0.6.4(#7039)
- Remove
BackendWebSocketService Channel Messagetrace as it provided no useful performance insights (#7101)
- BREAKING: Use new
Messengerfrom@metamask/messenger(#6823)- Previously,
AccountActivityServiceandBackendWebSocketServiceaccepted aRestrictedMessengerinstance from@metamask/base-controller.
- Previously,
- BREAKING: Metadata property
anonymousrenamed toincludeInDebugSnapshot(#6823) - BREAKING: Bump
@metamask/accounts-controllerfrom^33.0.0to^34.0.0(#6962) - BREAKING: Bump
@metamask/keyring-controllerfrom^23.0.0to^24.0.0(#6962) - Bump
@metamask/profile-sync-controllerfrom^25.1.2to^26.0.0(#6962)
- BREAKING: Remove exported type aliases and constants that were specific to controller messenger integration (#6823)
- Removed type exports:
BackendWebSocketServiceAllowedActions,BackendWebSocketServiceAllowedEvents,AccountActivityServiceAllowedActions,AccountActivityServiceAllowedEvents - Removed constant exports:
ACCOUNT_ACTIVITY_SERVICE_ALLOWED_ACTIONS,ACCOUNT_ACTIVITY_SERVICE_ALLOWED_EVENTS - These types and constants were internal implementation details that should not have been exposed. Consumers should use the service-specific messenger types directly.
- Removed type exports:
- Bump
@metamask/profile-sync-controllerfrom^25.1.1to^25.1.2(#6940)
- Add
forceReconnection()method toBackendWebSocketServicefor controlled subscription state cleanup (#6861)- Performs a controlled disconnect-then-reconnect sequence with exponential backoff
- Useful for recovering from subscription/unsubscription issues and cleaning up orphaned subscriptions
- Add
BackendWebSocketService:forceReconnectionmessenger action
- Add stable connection timer to prevent rapid reconnection loops (#6861)
- Connection must stay stable for 10 seconds before resetting reconnect attempts
- Prevents issues when server accepts connection then immediately closes it
- Bump
@metamask/base-controllerfrom^8.4.1to^8.4.2(#6917) - Update
AccountActivityServiceto use newforceReconnection()method instead of manually calling disconnect/connect (#6861) - BREAKING: Update allowed actions for
AccountActivityServicemessenger: removeBackendWebSocketService:disconnect, addBackendWebSocketService:forceReconnection(#6861) - Improve reconnection scheduling in
BackendWebSocketServiceto be idempotent (#6861)- Prevents duplicate reconnection timers and inflated attempt counters
- Scheduler checks if reconnect is already scheduled before creating new timer
- Improve error handling in
BackendWebSocketService.connect()(#6861)- Always schedule reconnect on connection failure (exponential backoff prevents aggressive retries)
- Remove redundant schedule calls from error paths
- Update
BackendWebSocketService.disconnect()to reset reconnect attempts counter (#6861) - Update
BackendWebSocketService.disconnect()return type fromPromise<void>tovoid(#6861) - Improve logging throughout
BackendWebSocketServicefor better debugging (#6861)
- Fix potential race condition in
BackendWebSocketService.connect()that could bypass exponential backoff when reconnect is already scheduled (#6861) - Fix memory leak from orphaned timers when multiple reconnects are scheduled (#6861)
- Fix issue where reconnect attempts counter could grow unnecessarily with duplicate scheduled reconnects (#6861)
- Add optional
traceFnparameter toAccountActivityServiceconstructor for performance tracing integration (#6842)- Enables tracing of transaction message receipt with elapsed time from transaction timestamp to message arrival
- Trace captures
chain,status, andelapsed_msfor monitoring transaction delivery latency
- Fix race condition in
BackendWebSocketService.connect()that could create multiple concurrent WebSocket connections when called simultaneously from multiple event sources (e.g.,KeyringController:unlock,AuthenticationController:stateChange, andMetaMaskController.isClientOpen) (#6842)- Connection promise is now set synchronously before any async operations to prevent duplicate connections
- BREAKING: Add required argument
channelTypetoBackendWebSocketService.subscribemethod (#6819)- Add
channelTypeto argument of theBackendWebSocketService:subscribemessenger action - Add
channelTypetoWebSocketSubscriptiontype
- Add
- BREAKING: Update
Assettype definition: add requireddecimalsfield for proper token amount formatting (#6819) - Add optional
traceFnparameter toBackendWebSocketServiceconstructor for performance tracing integration (e.g., Sentry) (#6819)- Enables tracing of WebSocket operations including connect, disconnect methods
- Trace function receives operation metadata and callback to wrap for performance monitoring
- Add optional
timestampproperty toServerNotificationMessageandSystemNoticationDatatypes (#6819) - Add optional
timestampproperty toAccountActivityService:statusChangedevent and corresponding event type (#6819)
- BREAKING: Update
BackendWebSocketServiceto automatically manage WebSocket connections based on wallet lock state (#6819)KeyringController:lockandKeyringController:unlockare now required events in theBackendWebSocketServicemessenger
- BREAKING: Update
Transactiontype definition: renamehashfield toidfor consistency with backend API (#6819) - BREAKING: Add peer dependency on
@metamask/keyring-controller(^23.0.0) (#6819) - Update
BackendWebSocketServiceto simplify reconnection logic: auto-reconnect on any unexpected disconnect (not just code 1000), stay disconnected when manually disconnecting viadisconnect(#6819) - Improve error handling in
BackendWebSocketService.connect()to properly rethrow errors to callers (#6819) - Update
AccountActivityServiceto replace API-based chain support detection with system notification-driven chain tracking (#6819)- Instead of hardcoding a list of supported chains, assume that the backend has the list
- When receiving a system notification, capture the backend-tracked status of each chain instead of assuming it is up or down
- Flush all tracked chains as 'down' on disconnect/error (instead of using hardcoded list)
- Update documentation in
README.mdto reflect new connection management model and chain tracking behavior (#6819)- Add "WebSocket Connection Management" section explaining connection requirements and behavior
- Update sequence diagram to show system notification-driven chain status flow
- Update key flow characteristics to reflect internal chain tracking mechanism
- BREAKING: Remove
getSupportedChainsmethod fromAccountActivityService(#6819)
- Bump
@metamask/base-controllerfrom^8.4.0to^8.4.1(#6807) - Bump
@metamask/controller-utilsfrom^11.14.0to^11.14.1(#6807) - Bump
@metamask/profile-sync-controllerfrom^25.1.0to^25.1.1(#6810)
- Initial release of
@metamask/core-backendpackage - Core backend services for MetaMask serving as the data layer between Backend services and Frontend applications (#6722) - BackendWebSocketService - WebSocket client providing authenticated real-time data delivery with:
- Connection management and automatic reconnection with exponential backoff
- Message routing and subscription management
- Authentication integration with
AuthenticationController - Type-safe messenger-based API for controller integration
- AccountActivityService - High-level service for monitoring account activity with:
- Real-time account activity monitoring via WebSocket subscriptions
- Balance update notifications for integration with
TokenBalancesController - Chain status change notifications for dynamic polling coordination
- Account subscription management with automatic cleanup
- Type definitions - Comprehensive TypeScript types for transactions, balances, WebSocket messages, and service configurations
- Logging infrastructure - Structured logging with module-specific loggers for debugging and monitoring