@metamask-previews/assets-controller 10.1.0-preview-34f2bcbf7 → 10.1.0-preview-186382c0a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/AssetsController.cjs +2 -1
  3. package/dist/AssetsController.cjs.map +1 -1
  4. package/dist/AssetsController.d.cts +14 -1
  5. package/dist/AssetsController.d.cts.map +1 -1
  6. package/dist/AssetsController.d.mts +14 -1
  7. package/dist/AssetsController.d.mts.map +1 -1
  8. package/dist/AssetsController.mjs +2 -1
  9. package/dist/AssetsController.mjs.map +1 -1
  10. package/dist/data-sources/AccountsApiDataSource.cjs +6 -4
  11. package/dist/data-sources/AccountsApiDataSource.cjs.map +1 -1
  12. package/dist/data-sources/AccountsApiDataSource.mjs +6 -4
  13. package/dist/data-sources/AccountsApiDataSource.mjs.map +1 -1
  14. package/dist/data-sources/BackendWebsocketDataSource.cjs +98 -38
  15. package/dist/data-sources/BackendWebsocketDataSource.cjs.map +1 -1
  16. package/dist/data-sources/BackendWebsocketDataSource.d.cts +8 -0
  17. package/dist/data-sources/BackendWebsocketDataSource.d.cts.map +1 -1
  18. package/dist/data-sources/BackendWebsocketDataSource.d.mts +8 -0
  19. package/dist/data-sources/BackendWebsocketDataSource.d.mts.map +1 -1
  20. package/dist/data-sources/BackendWebsocketDataSource.mjs +98 -38
  21. package/dist/data-sources/BackendWebsocketDataSource.mjs.map +1 -1
  22. package/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs +54 -13
  23. package/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs.map +1 -1
  24. package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.cts.map +1 -1
  25. package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.mts.map +1 -1
  26. package/dist/data-sources/evm-rpc-services/clients/MulticallClient.mjs +54 -13
  27. package/dist/data-sources/evm-rpc-services/clients/MulticallClient.mjs.map +1 -1
  28. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,8 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add `webSocketEnabledNamespaces` constructor option to gate non-EVM account-activity balances (e.g. Solana) behind a feature flag ([#9430](https://github.com/MetaMask/core/pull/9430))
13
+ - The getter returns the non-EVM CAIP namespaces (e.g. `['solana']`, and later `['solana', 'bip122']` for Tron) served over WebSocket. EVM (`eip155`) is always served over WebSocket.
14
+ - For each enabled namespace (while the WebSocket is connected), `BackendWebsocketDataSource` claims that namespace's chains and streams real-time balances for them; disabled namespaces are left unclaimed and unsubscribed so the `SnapDataSource` serves them.
15
+ - When the WebSocket is down, those chains are released, so the `SnapDataSource` takes over as a fallback.
16
+ - When a chain (or a whole non-EVM namespace, e.g. Solana) is reported down via `system-notifications`, it is excluded from the WebSocket source's claimable chains and automatically falls back to the `SnapDataSource` until it recovers.
17
+ - Defaults to none (`() => []`; EVM only).
18
+
10
19
  ### Changed
11
20
 
21
+ - `AccountsApiDataSource` now documents that it serves EVM chains only; non-EVM chains (e.g. Solana) are served by the WebSocket source when enabled, otherwise by the Snap source ([#9430](https://github.com/MetaMask/core/pull/9430))
22
+ - `MulticallClient` memoizes `balanceOf` and `getEthBalance` call encodings per account address when building multicall batches, reducing redundant ABI encoding for wallets with many tokens ([#9425](https://github.com/MetaMask/core/pull/9425))
12
23
  - Bump `@metamask/transaction-controller` from `^68.2.2` to `^68.3.0` ([#9421](https://github.com/MetaMask/core/pull/9421))
13
24
  - Bump `@metamask/keyring-api` from `^23.3.0` to `^23.5.0` ([#9390](https://github.com/MetaMask/core/pull/9390))
14
25
  - Bump `@metamask/keyring-snap-client` from `^9.0.2` to `^9.2.0` ([#9390](https://github.com/MetaMask/core/pull/9390))
@@ -260,7 +260,7 @@ function mergeAccountBalances(previousBalances, accountBalances, customAssetIds,
260
260
  * - The controller does NOT manage polling - it simply receives pushed updates
261
261
  */
262
262
  class AssetsController extends base_controller_1.BaseController {
263
- constructor({ messenger, state = {}, defaultUpdateInterval = DEFAULT_POLLING_INTERVAL_MS, isEnabled = () => true, isBasicFunctionality, subscribeToBasicFunctionalityChange, queryApiClient, rpcDataSourceConfig, trace, captureException, accountsApiDataSourceConfig, priceDataSourceConfig, stakedBalanceDataSourceConfig, isOnboarded, tempMigrateAssetsInfoMetadataAssets3346, }) {
263
+ constructor({ messenger, state = {}, defaultUpdateInterval = DEFAULT_POLLING_INTERVAL_MS, isEnabled = () => true, isBasicFunctionality, subscribeToBasicFunctionalityChange, webSocketEnabledNamespaces, queryApiClient, rpcDataSourceConfig, trace, captureException, accountsApiDataSourceConfig, priceDataSourceConfig, stakedBalanceDataSourceConfig, isOnboarded, tempMigrateAssetsInfoMetadataAssets3346, }) {
264
264
  super({
265
265
  name: CONTROLLER_NAME,
266
266
  messenger,
@@ -353,6 +353,7 @@ class AssetsController extends base_controller_1.BaseController {
353
353
  queryApiClient,
354
354
  onActiveChainsUpdated: __classPrivateFieldGet(this, _AssetsController_onActiveChainsUpdated, "f"),
355
355
  getAssetType: (assetId) => __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_getAssetType).call(this, assetId),
356
+ getWebSocketEnabledNamespaces: webSocketEnabledNamespaces ?? (() => []),
356
357
  }), "f");
357
358
  __classPrivateFieldSet(this, _AssetsController_accountsApiDataSource, new AccountsApiDataSource_1.AccountsApiDataSource({
358
359
  queryApiClient,