@metamask-previews/assets-controller 18.0.1-preview-44b7ded21 → 19.0.0-preview-2750df1dc

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.
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { SNAPS_ASSETS_MIGRATION_FLAG_KEYS, SNAPS_ASSETS_MIGRATION_NAMESPACES, Sn
6
6
  export type { SnapsAssetsMigrationNamespace } from './utils/snaps-assets-migration.js';
7
7
  export type { AssetsControllerState, AssetsControllerMessenger, AssetsControllerOptions, AssetsControllerGetStateAction, AssetsControllerActions, AssetsControllerStateChangeEvent, AssetsControllerBalanceChangedEvent, AssetsControllerPriceChangedEvent, AssetsControllerAssetsDetectedEvent, AssetsControllerEvents, } from './AssetsController.js';
8
8
  export type { AssetsControllerGetAssetsAction, AssetsControllerGetAssetsBalanceAction, AssetsControllerGetAssetMetadataAction, AssetsControllerGetAccountAssetByIDAction, AssetsControllerGetAccountAssetsByIDsAction, AssetsControllerGetAccountAssetsByScopeAction, AssetsControllerGetAssetsPriceAction, AssetsControllerAddCustomAssetAction, AssetsControllerRemoveCustomAssetAction, AssetsControllerGetCustomAssetsAction, AssetsControllerHideAssetAction, AssetsControllerUnhideAssetAction, AssetsControllerGetExchangeRatesForBridgeAction, AssetsControllerGetStateForTransactionPayAction, AssetsControllerSetSelectedCurrencyAction, } from './AssetsController-method-action-types.js';
9
- export type { Caip19AssetId, AccountId, ChainId, AssetType, TokenStandard, TokenFees, HoneypotStatus, StorageSlots, LocalizedDescription, BaseAssetMetadata, FungibleAssetMetadata, ERC721AssetMetadata, ERC1155AssetMetadata, AssetMetadata, BaseAssetPrice, FungibleAssetPrice, NFTAssetPrice, AssetPrice, FungibleAssetBalance, ERC721AssetBalance, ERC1155AssetBalance, AssetBalance, AccountWithSupportedChains, DataType, DataRequest, DataResponse, AssetsUpdateMode, Context, NextFunction, Middleware, AssetsDataSource, FetchContext, FetchNextFunction, FetchMiddleware, SubscriptionResponse, Asset, BalanceChangeEvent, PriceChangeEvent, MetadataChangeEvent, AssetsDetectedEvent, } from './types.js';
9
+ export type { Caip19AssetId, AccountId, ChainId, AssetType, TokenStandard, TokenFees, HoneypotStatus, StorageSlots, LocalizedDescription, BaseAssetMetadata, FungibleAssetMetadata, ERC721AssetMetadata, ERC1155AssetMetadata, AssetMetadata, BaseAssetPrice, FungibleAssetPrice, NFTAssetPrice, AssetPrice, FungibleAssetBalance, ERC721AssetBalance, ERC1155AssetBalance, AssetBalance, AccountWithSupportedChains, DataType, DataRequest, DataResponse, AssetsUpdateMode, AssetsLoadingStatus, Context, NextFunction, Middleware, AssetsDataSource, FetchContext, FetchNextFunction, FetchMiddleware, SubscriptionResponse, Asset, BalanceChangeEvent, PriceChangeEvent, MetadataChangeEvent, AssetsDetectedEvent, } from './types.js';
10
10
  export { AbstractDataSource } from './data-sources/index.js';
11
11
  export type { DataSourceState, SubscriptionRequest, } from './data-sources/index.js';
12
12
  export { AccountsApiDataSource } from './data-sources/index.js';
@@ -22,5 +22,6 @@ export type { CustomAssetGraduationMiddlewareOptions, DetectionMiddlewareOptions
22
22
  export { normalizeAssetId, formatExchangeRatesForBridge, formatStateForTransactionPay, } from './utils/index.js';
23
23
  export type { AccountForLegacyFormat, BridgeExchangeRatesFormat, FormatExchangeRatesForBridgeParams, FormatStateForTransactionPayParams, LegacyToken, TransactionPayLegacyFormat, } from './utils/index.js';
24
24
  export { calculateBalanceForAllWallets, calculateBalanceChangeForAccountGroup, getAggregatedBalanceForAccount, getGroupIdForAccount, getInternalAccountsForGroup, } from './selectors/balance.js';
25
+ export { getAccountGroupLoadingStatus, getAccountLoadingStatus, getIsAssetsLoadingForSelectedAccountGroup, isAccountGroupLoading, isAccountLoading, } from './selectors/loading.js';
25
26
  export type { AccountGroupBalance, AccountsById, AggregatedBalanceEntry, AggregatedBalanceForAccount, AllWalletsBalance, BalanceChangePeriod, BalanceChangeResult, EnabledNetworkMap, WalletBalance, } from './selectors/balance.js';
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EACL,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EACtB,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAGvF,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,EACvB,gCAAgC,EAChC,mCAAmC,EACnC,iCAAiC,EACjC,mCAAmC,EACnC,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,+BAA+B,EAC/B,sCAAsC,EACtC,sCAAsC,EACtC,yCAAyC,EACzC,2CAA2C,EAC3C,6CAA6C,EAC7C,oCAAoC,EACpC,oCAAoC,EACpC,uCAAuC,EACvC,qCAAqC,EACrC,+BAA+B,EAC/B,iCAAiC,EACjC,+CAA+C,EAC/C,+CAA+C,EAC/C,yCAAyC,GAC1C,MAAM,2CAA2C,CAAC;AAGnD,YAAY,EAEV,aAAa,EACb,SAAS,EACT,OAAO,EAEP,SAAS,EACT,aAAa,EAEb,SAAS,EACT,cAAc,EACd,YAAY,EACZ,oBAAoB,EAEpB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,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Middleware, RpcFallbackMiddle
24
24
  export { normalizeAssetId, formatExchangeRatesForBridge, formatStateForTransactionPay, } from './utils/index.js';
25
25
  // Selectors
26
26
  export { calculateBalanceForAllWallets, calculateBalanceChangeForAccountGroup, getAggregatedBalanceForAccount, getGroupIdForAccount, getInternalAccountsForGroup, } from './selectors/balance.js';
27
+ export { getAccountGroupLoadingStatus, getAccountLoadingStatus, getIsAssetsLoadingForSelectedAccountGroup, isAccountGroupLoading, isAccountLoading, } from './selectors/loading.js';
27
28
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,OAAO,EACL,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,+BAA+B,EAC/B,kCAAkC,EAClC,sBAAsB,EACtB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AAGvB,4CAA4C;AAC5C,OAAO,EACL,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EACtB,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAwF3C,sCAAsC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAO7D,6BAA6B;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAQhE,qBAAqB;AACrB,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAS7E,gFAAgF;AAChF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,qBAAqB;AACrB,YAAY;AACZ,kBAAkB;AAClB,oBAAoB;AACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAOjC,0BAA0B;AAC1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAQ3E,cAAc;AACd,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAOhC,YAAY;AACZ,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAU1B,YAAY;AACZ,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,EACrC,8BAA8B,EAC9B,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC","sourcesContent":["// Main controller export\nexport {\n AssetsController,\n getDefaultAssetsControllerState,\n} from './AssetsController.js';\nexport { AssetsDataSourceError } from './errors.js';\nexport {\n DEFAULT_TRACKED_ASSETS_BY_CHAIN,\n CHAINS_WITH_DEFAULT_TRACKED_ASSETS,\n DEFAULT_ASSET_METADATA,\n buildDefaultAssetsInfo,\n getDefaultTrackedAssetsForChain,\n getDefaultAssetMetadata,\n} from './defaults.js';\nexport type { PendingTokenMetadata } from './AssetsController.js';\n\n// Snaps → AssetsController assets migration\nexport {\n SNAPS_ASSETS_MIGRATION_FLAG_KEYS,\n SNAPS_ASSETS_MIGRATION_NAMESPACES,\n SnapsAssetsMigrationStage,\n getSnapsAssetsMigrationNamespace,\n isMigrationStageActive,\n isSnapsAssetsMigrationNamespace,\n parseSnapsAssetsMigrationStage,\n} from './utils/snaps-assets-migration.js';\nexport type { SnapsAssetsMigrationNamespace } from './utils/snaps-assets-migration.js';\n\n// State and messenger types\nexport type {\n AssetsControllerState,\n AssetsControllerMessenger,\n AssetsControllerOptions,\n AssetsControllerGetStateAction,\n AssetsControllerActions,\n AssetsControllerStateChangeEvent,\n AssetsControllerBalanceChangedEvent,\n AssetsControllerPriceChangedEvent,\n AssetsControllerAssetsDetectedEvent,\n AssetsControllerEvents,\n} from './AssetsController.js';\nexport type {\n AssetsControllerGetAssetsAction,\n AssetsControllerGetAssetsBalanceAction,\n AssetsControllerGetAssetMetadataAction,\n AssetsControllerGetAccountAssetByIDAction,\n AssetsControllerGetAccountAssetsByIDsAction,\n AssetsControllerGetAccountAssetsByScopeAction,\n AssetsControllerGetAssetsPriceAction,\n AssetsControllerAddCustomAssetAction,\n AssetsControllerRemoveCustomAssetAction,\n AssetsControllerGetCustomAssetsAction,\n AssetsControllerHideAssetAction,\n AssetsControllerUnhideAssetAction,\n AssetsControllerGetExchangeRatesForBridgeAction,\n AssetsControllerGetStateForTransactionPayAction,\n AssetsControllerSetSelectedCurrencyAction,\n} from './AssetsController-method-action-types.js';\n\n// Core types\nexport type {\n // CAIP types\n Caip19AssetId,\n AccountId,\n ChainId,\n // Asset types\n AssetType,\n TokenStandard,\n // Contract data types\n TokenFees,\n HoneypotStatus,\n StorageSlots,\n LocalizedDescription,\n // Metadata types\n BaseAssetMetadata,\n FungibleAssetMetadata,\n ERC721AssetMetadata,\n ERC1155AssetMetadata,\n AssetMetadata,\n // Price types\n BaseAssetPrice,\n FungibleAssetPrice,\n NFTAssetPrice,\n AssetPrice,\n // Balance types\n FungibleAssetBalance,\n ERC721AssetBalance,\n ERC1155AssetBalance,\n AssetBalance,\n // Data source types\n AccountWithSupportedChains,\n DataType,\n DataRequest,\n DataResponse,\n AssetsUpdateMode,\n // Middleware types\n Context,\n NextFunction,\n Middleware,\n AssetsDataSource,\n FetchContext,\n FetchNextFunction,\n FetchMiddleware,\n SubscriptionResponse,\n // Combined asset type\n Asset,\n // Event types\n BalanceChangeEvent,\n PriceChangeEvent,\n MetadataChangeEvent,\n AssetsDetectedEvent,\n} from './types.js';\n\n// Data sources - base class and types\nexport { AbstractDataSource } from './data-sources/index.js';\n\nexport type {\n DataSourceState,\n SubscriptionRequest,\n} from './data-sources/index.js';\n\n// Data sources - AccountsApi\nexport { AccountsApiDataSource } from './data-sources/index.js';\n\nexport type {\n AccountsApiDataSourceConfig,\n AccountsApiDataSourceOptions,\n AccountsApiDataSourceState,\n} from './data-sources/index.js';\n\n// Data sources - RPC\nexport { RpcDataSource, createRpcDataSource } from './data-sources/index.js';\n\nexport type {\n RpcDataSourceConfig,\n RpcDataSourceOptions,\n RpcDataSourceState,\n ChainStatus,\n} from './data-sources/index.js';\n\n// Data sources - Unified Snap Data Source (dynamically discovers keyring snaps)\nexport {\n SnapDataSource,\n createSnapDataSource,\n SNAP_DATA_SOURCE_NAME,\n // Constants\n KEYRING_PERMISSION,\n // Utility functions\n getChainIdsCaveat,\n extractChainFromAssetId,\n} from './data-sources/index.js';\n\nexport type {\n SnapDataSourceState,\n SnapDataSourceOptions,\n} from './data-sources/index.js';\n\n// Enrichment data sources\nexport { TokenDataSource, PriceDataSource } from './data-sources/index.js';\n\nexport type {\n TokenDataSourceOptions,\n PriceDataSourceConfig,\n PriceDataSourceOptions,\n} from './data-sources/index.js';\n\n// Middlewares\nexport {\n CustomAssetGraduationMiddleware,\n DetectionMiddleware,\n RpcFallbackMiddleware,\n} from './middlewares/index.js';\nexport type {\n CustomAssetGraduationMiddlewareOptions,\n DetectionMiddlewareOptions,\n RpcFallbackMiddlewareOptions,\n} from './middlewares/index.js';\n\n// Utilities\nexport {\n normalizeAssetId,\n formatExchangeRatesForBridge,\n formatStateForTransactionPay,\n} from './utils/index.js';\nexport type {\n AccountForLegacyFormat,\n BridgeExchangeRatesFormat,\n FormatExchangeRatesForBridgeParams,\n FormatStateForTransactionPayParams,\n LegacyToken,\n TransactionPayLegacyFormat,\n} from './utils/index.js';\n\n// Selectors\nexport {\n calculateBalanceForAllWallets,\n calculateBalanceChangeForAccountGroup,\n getAggregatedBalanceForAccount,\n getGroupIdForAccount,\n getInternalAccountsForGroup,\n} from './selectors/balance.js';\n\nexport type {\n AccountGroupBalance,\n AccountsById,\n AggregatedBalanceEntry,\n AggregatedBalanceForAccount,\n AllWalletsBalance,\n BalanceChangePeriod,\n BalanceChangeResult,\n EnabledNetworkMap,\n WalletBalance,\n} from './selectors/balance.js';\n"]}
1
+ {"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,wBAAwB,CAAC;AAEhC,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,yCAAyC,EACzC,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC","sourcesContent":["// Main controller export\nexport {\n AssetsController,\n getDefaultAssetsControllerState,\n} from './AssetsController.js';\nexport { AssetsDataSourceError } from './errors.js';\nexport {\n DEFAULT_TRACKED_ASSETS_BY_CHAIN,\n CHAINS_WITH_DEFAULT_TRACKED_ASSETS,\n DEFAULT_ASSET_METADATA,\n buildDefaultAssetsInfo,\n getDefaultTrackedAssetsForChain,\n getDefaultAssetMetadata,\n} from './defaults.js';\nexport type { PendingTokenMetadata } from './AssetsController.js';\n\n// Snaps → AssetsController assets migration\nexport {\n SNAPS_ASSETS_MIGRATION_FLAG_KEYS,\n SNAPS_ASSETS_MIGRATION_NAMESPACES,\n SnapsAssetsMigrationStage,\n getSnapsAssetsMigrationNamespace,\n isMigrationStageActive,\n isSnapsAssetsMigrationNamespace,\n parseSnapsAssetsMigrationStage,\n} from './utils/snaps-assets-migration.js';\nexport type { SnapsAssetsMigrationNamespace } from './utils/snaps-assets-migration.js';\n\n// State and messenger types\nexport type {\n AssetsControllerState,\n AssetsControllerMessenger,\n AssetsControllerOptions,\n AssetsControllerGetStateAction,\n AssetsControllerActions,\n AssetsControllerStateChangeEvent,\n AssetsControllerBalanceChangedEvent,\n AssetsControllerPriceChangedEvent,\n AssetsControllerAssetsDetectedEvent,\n AssetsControllerEvents,\n} from './AssetsController.js';\nexport type {\n AssetsControllerGetAssetsAction,\n AssetsControllerGetAssetsBalanceAction,\n AssetsControllerGetAssetMetadataAction,\n AssetsControllerGetAccountAssetByIDAction,\n AssetsControllerGetAccountAssetsByIDsAction,\n AssetsControllerGetAccountAssetsByScopeAction,\n AssetsControllerGetAssetsPriceAction,\n AssetsControllerAddCustomAssetAction,\n AssetsControllerRemoveCustomAssetAction,\n AssetsControllerGetCustomAssetsAction,\n AssetsControllerHideAssetAction,\n AssetsControllerUnhideAssetAction,\n AssetsControllerGetExchangeRatesForBridgeAction,\n AssetsControllerGetStateForTransactionPayAction,\n AssetsControllerSetSelectedCurrencyAction,\n} from './AssetsController-method-action-types.js';\n\n// Core types\nexport type {\n // CAIP types\n Caip19AssetId,\n AccountId,\n ChainId,\n // Asset types\n AssetType,\n TokenStandard,\n // Contract data types\n TokenFees,\n HoneypotStatus,\n StorageSlots,\n LocalizedDescription,\n // Metadata types\n BaseAssetMetadata,\n FungibleAssetMetadata,\n ERC721AssetMetadata,\n ERC1155AssetMetadata,\n AssetMetadata,\n // Price types\n BaseAssetPrice,\n FungibleAssetPrice,\n NFTAssetPrice,\n AssetPrice,\n // Balance types\n FungibleAssetBalance,\n ERC721AssetBalance,\n ERC1155AssetBalance,\n AssetBalance,\n // Data source types\n AccountWithSupportedChains,\n DataType,\n DataRequest,\n DataResponse,\n AssetsUpdateMode,\n AssetsLoadingStatus,\n // Middleware types\n Context,\n NextFunction,\n Middleware,\n AssetsDataSource,\n FetchContext,\n FetchNextFunction,\n FetchMiddleware,\n SubscriptionResponse,\n // Combined asset type\n Asset,\n // Event types\n BalanceChangeEvent,\n PriceChangeEvent,\n MetadataChangeEvent,\n AssetsDetectedEvent,\n} from './types.js';\n\n// Data sources - base class and types\nexport { AbstractDataSource } from './data-sources/index.js';\n\nexport type {\n DataSourceState,\n SubscriptionRequest,\n} from './data-sources/index.js';\n\n// Data sources - AccountsApi\nexport { AccountsApiDataSource } from './data-sources/index.js';\n\nexport type {\n AccountsApiDataSourceConfig,\n AccountsApiDataSourceOptions,\n AccountsApiDataSourceState,\n} from './data-sources/index.js';\n\n// Data sources - RPC\nexport { RpcDataSource, createRpcDataSource } from './data-sources/index.js';\n\nexport type {\n RpcDataSourceConfig,\n RpcDataSourceOptions,\n RpcDataSourceState,\n ChainStatus,\n} from './data-sources/index.js';\n\n// Data sources - Unified Snap Data Source (dynamically discovers keyring snaps)\nexport {\n SnapDataSource,\n createSnapDataSource,\n SNAP_DATA_SOURCE_NAME,\n // Constants\n KEYRING_PERMISSION,\n // Utility functions\n getChainIdsCaveat,\n extractChainFromAssetId,\n} from './data-sources/index.js';\n\nexport type {\n SnapDataSourceState,\n SnapDataSourceOptions,\n} from './data-sources/index.js';\n\n// Enrichment data sources\nexport { TokenDataSource, PriceDataSource } from './data-sources/index.js';\n\nexport type {\n TokenDataSourceOptions,\n PriceDataSourceConfig,\n PriceDataSourceOptions,\n} from './data-sources/index.js';\n\n// Middlewares\nexport {\n CustomAssetGraduationMiddleware,\n DetectionMiddleware,\n RpcFallbackMiddleware,\n} from './middlewares/index.js';\nexport type {\n CustomAssetGraduationMiddlewareOptions,\n DetectionMiddlewareOptions,\n RpcFallbackMiddlewareOptions,\n} from './middlewares/index.js';\n\n// Utilities\nexport {\n normalizeAssetId,\n formatExchangeRatesForBridge,\n formatStateForTransactionPay,\n} from './utils/index.js';\nexport type {\n AccountForLegacyFormat,\n BridgeExchangeRatesFormat,\n FormatExchangeRatesForBridgeParams,\n FormatStateForTransactionPayParams,\n LegacyToken,\n TransactionPayLegacyFormat,\n} from './utils/index.js';\n\n// Selectors\nexport {\n calculateBalanceForAllWallets,\n calculateBalanceChangeForAccountGroup,\n getAggregatedBalanceForAccount,\n getGroupIdForAccount,\n getInternalAccountsForGroup,\n} from './selectors/balance.js';\n\nexport {\n getAccountGroupLoadingStatus,\n getAccountLoadingStatus,\n getIsAssetsLoadingForSelectedAccountGroup,\n isAccountGroupLoading,\n isAccountLoading,\n} from './selectors/loading.js';\n\nexport type {\n AccountGroupBalance,\n AccountsById,\n AggregatedBalanceEntry,\n AggregatedBalanceForAccount,\n AllWalletsBalance,\n BalanceChangePeriod,\n BalanceChangeResult,\n EnabledNetworkMap,\n WalletBalance,\n} from './selectors/balance.js';\n"]}
@@ -0,0 +1,48 @@
1
+ import type { AccountTreeControllerState } from '@metamask/account-tree-controller';
2
+ import type { AssetsControllerState } from '../AssetsController.js';
3
+ import type { AccountId, AssetsLoadingStatus } from '../types.js';
4
+ /**
5
+ * Get the loading status for a single account.
6
+ *
7
+ * @param state - AssetsController state slice.
8
+ * @param accountId - The account id (`InternalAccount.id`).
9
+ * @returns `'loading'` while the account's assets are loading, `'loaded'`
10
+ * after its fetch has settled, or `undefined` if no fetch was triggered.
11
+ */
12
+ export declare function getAccountLoadingStatus(state: Pick<AssetsControllerState, 'assetsLoadingStatus'>, accountId: AccountId): AssetsLoadingStatus | undefined;
13
+ /**
14
+ * Check whether an account's assets are currently loading.
15
+ *
16
+ * @param state - AssetsController state slice.
17
+ * @param accountId - The account id (`InternalAccount.id`).
18
+ * @returns True while the account's assets are loading.
19
+ */
20
+ export declare function isAccountLoading(state: Pick<AssetsControllerState, 'assetsLoadingStatus'>, accountId: AccountId): boolean;
21
+ /**
22
+ * Get the loading statuses for every account in an account group.
23
+ *
24
+ * @param state - AssetsController state slice.
25
+ * @param accountTreeState - AccountTreeController state slice.
26
+ * @param groupId - The account group id.
27
+ * @returns A record containing an entry for each account in the group that
28
+ * has a loading status, keyed by account id.
29
+ */
30
+ export declare function getAccountGroupLoadingStatus(state: Pick<AssetsControllerState, 'assetsLoadingStatus'>, accountTreeState: AccountTreeControllerState, groupId: string): Record<AccountId, AssetsLoadingStatus>;
31
+ /**
32
+ * Check whether any account in an account group is currently loading.
33
+ *
34
+ * @param state - AssetsController state slice.
35
+ * @param accountTreeState - AccountTreeController state slice.
36
+ * @param groupId - The account group id.
37
+ * @returns True while at least one account in the group is loading.
38
+ */
39
+ export declare function isAccountGroupLoading(state: Pick<AssetsControllerState, 'assetsLoadingStatus'>, accountTreeState: AccountTreeControllerState, groupId: string): boolean;
40
+ /**
41
+ * Check whether the selected account group is currently loading its assets.
42
+ *
43
+ * @param state - AssetsController state slice.
44
+ * @param accountTreeState - AccountTreeController state slice.
45
+ * @returns True while any account in the selected account group is loading.
46
+ */
47
+ export declare function getIsAssetsLoadingForSelectedAccountGroup(state: Pick<AssetsControllerState, 'assetsLoadingStatus'>, accountTreeState: AccountTreeControllerState): boolean;
48
+ //# sourceMappingURL=loading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../../src/selectors/loading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGlE;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,EACzD,SAAS,EAAE,SAAS,GACnB,mBAAmB,GAAG,SAAS,CAEjC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,EACzD,SAAS,EAAE,SAAS,GACnB,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,EACzD,gBAAgB,EAAE,0BAA0B,EAC5C,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAUxC;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,EACzD,gBAAgB,EAAE,0BAA0B,EAC5C,OAAO,EAAE,MAAM,GACd,OAAO,CAKT;AAED;;;;;;GAMG;AACH,wBAAgB,yCAAyC,CACvD,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,EACzD,gBAAgB,EAAE,0BAA0B,GAC3C,OAAO,CAMT"}
@@ -0,0 +1,69 @@
1
+ import { getAccountIdsForGroup } from './balance.js';
2
+ /**
3
+ * Get the loading status for a single account.
4
+ *
5
+ * @param state - AssetsController state slice.
6
+ * @param accountId - The account id (`InternalAccount.id`).
7
+ * @returns `'loading'` while the account's assets are loading, `'loaded'`
8
+ * after its fetch has settled, or `undefined` if no fetch was triggered.
9
+ */
10
+ export function getAccountLoadingStatus(state, accountId) {
11
+ return state.assetsLoadingStatus?.[accountId];
12
+ }
13
+ /**
14
+ * Check whether an account's assets are currently loading.
15
+ *
16
+ * @param state - AssetsController state slice.
17
+ * @param accountId - The account id (`InternalAccount.id`).
18
+ * @returns True while the account's assets are loading.
19
+ */
20
+ export function isAccountLoading(state, accountId) {
21
+ return getAccountLoadingStatus(state, accountId) === 'loading';
22
+ }
23
+ /**
24
+ * Get the loading statuses for every account in an account group.
25
+ *
26
+ * @param state - AssetsController state slice.
27
+ * @param accountTreeState - AccountTreeController state slice.
28
+ * @param groupId - The account group id.
29
+ * @returns A record containing an entry for each account in the group that
30
+ * has a loading status, keyed by account id.
31
+ */
32
+ export function getAccountGroupLoadingStatus(state, accountTreeState, groupId) {
33
+ const loadingStatus = state.assetsLoadingStatus;
34
+ const result = {};
35
+ for (const accountId of getAccountIdsForGroup(accountTreeState, groupId)) {
36
+ const status = loadingStatus?.[accountId];
37
+ if (status !== undefined) {
38
+ result[accountId] = status;
39
+ }
40
+ }
41
+ return result;
42
+ }
43
+ /**
44
+ * Check whether any account in an account group is currently loading.
45
+ *
46
+ * @param state - AssetsController state slice.
47
+ * @param accountTreeState - AccountTreeController state slice.
48
+ * @param groupId - The account group id.
49
+ * @returns True while at least one account in the group is loading.
50
+ */
51
+ export function isAccountGroupLoading(state, accountTreeState, groupId) {
52
+ const loadingStatus = state.assetsLoadingStatus;
53
+ return getAccountIdsForGroup(accountTreeState, groupId).some((accountId) => loadingStatus?.[accountId] === 'loading');
54
+ }
55
+ /**
56
+ * Check whether the selected account group is currently loading its assets.
57
+ *
58
+ * @param state - AssetsController state slice.
59
+ * @param accountTreeState - AccountTreeController state slice.
60
+ * @returns True while any account in the selected account group is loading.
61
+ */
62
+ export function getIsAssetsLoadingForSelectedAccountGroup(state, accountTreeState) {
63
+ const groupId = accountTreeState.selectedAccountGroup;
64
+ if (!groupId) {
65
+ return false;
66
+ }
67
+ return isAccountGroupLoading(state, accountTreeState, groupId);
68
+ }
69
+ //# sourceMappingURL=loading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading.js","sourceRoot":"","sources":["../../src/selectors/loading.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAyD,EACzD,SAAoB;IAEpB,OAAO,KAAK,CAAC,mBAAmB,EAAE,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAyD,EACzD,SAAoB;IAEpB,OAAO,uBAAuB,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,SAAS,CAAC;AACjE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAAyD,EACzD,gBAA4C,EAC5C,OAAe;IAEf,MAAM,aAAa,GAAG,KAAK,CAAC,mBAAmB,CAAC;IAChD,MAAM,MAAM,GAA2C,EAAE,CAAC;IAC1D,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAAE,CAAC;QACzE,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAyD,EACzD,gBAA4C,EAC5C,OAAe;IAEf,MAAM,aAAa,GAAG,KAAK,CAAC,mBAAmB,CAAC;IAChD,OAAO,qBAAqB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,CAC1D,CAAC,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,CAAC,SAAS,CAAC,KAAK,SAAS,CACxD,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yCAAyC,CACvD,KAAyD,EACzD,gBAA4C;IAE5C,MAAM,OAAO,GAAG,gBAAgB,CAAC,oBAAoB,CAAC;IACtD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import type { AccountTreeControllerState } from '@metamask/account-tree-controller';\n\nimport type { AssetsControllerState } from '../AssetsController.js';\nimport type { AccountId, AssetsLoadingStatus } from '../types.js';\nimport { getAccountIdsForGroup } from './balance.js';\n\n/**\n * Get the loading status for a single account.\n *\n * @param state - AssetsController state slice.\n * @param accountId - The account id (`InternalAccount.id`).\n * @returns `'loading'` while the account's assets are loading, `'loaded'`\n * after its fetch has settled, or `undefined` if no fetch was triggered.\n */\nexport function getAccountLoadingStatus(\n state: Pick<AssetsControllerState, 'assetsLoadingStatus'>,\n accountId: AccountId,\n): AssetsLoadingStatus | undefined {\n return state.assetsLoadingStatus?.[accountId];\n}\n\n/**\n * Check whether an account's assets are currently loading.\n *\n * @param state - AssetsController state slice.\n * @param accountId - The account id (`InternalAccount.id`).\n * @returns True while the account's assets are loading.\n */\nexport function isAccountLoading(\n state: Pick<AssetsControllerState, 'assetsLoadingStatus'>,\n accountId: AccountId,\n): boolean {\n return getAccountLoadingStatus(state, accountId) === 'loading';\n}\n\n/**\n * Get the loading statuses for every account in an account group.\n *\n * @param state - AssetsController state slice.\n * @param accountTreeState - AccountTreeController state slice.\n * @param groupId - The account group id.\n * @returns A record containing an entry for each account in the group that\n * has a loading status, keyed by account id.\n */\nexport function getAccountGroupLoadingStatus(\n state: Pick<AssetsControllerState, 'assetsLoadingStatus'>,\n accountTreeState: AccountTreeControllerState,\n groupId: string,\n): Record<AccountId, AssetsLoadingStatus> {\n const loadingStatus = state.assetsLoadingStatus;\n const result: Record<AccountId, AssetsLoadingStatus> = {};\n for (const accountId of getAccountIdsForGroup(accountTreeState, groupId)) {\n const status = loadingStatus?.[accountId];\n if (status !== undefined) {\n result[accountId] = status;\n }\n }\n return result;\n}\n\n/**\n * Check whether any account in an account group is currently loading.\n *\n * @param state - AssetsController state slice.\n * @param accountTreeState - AccountTreeController state slice.\n * @param groupId - The account group id.\n * @returns True while at least one account in the group is loading.\n */\nexport function isAccountGroupLoading(\n state: Pick<AssetsControllerState, 'assetsLoadingStatus'>,\n accountTreeState: AccountTreeControllerState,\n groupId: string,\n): boolean {\n const loadingStatus = state.assetsLoadingStatus;\n return getAccountIdsForGroup(accountTreeState, groupId).some(\n (accountId) => loadingStatus?.[accountId] === 'loading',\n );\n}\n\n/**\n * Check whether the selected account group is currently loading its assets.\n *\n * @param state - AssetsController state slice.\n * @param accountTreeState - AccountTreeController state slice.\n * @returns True while any account in the selected account group is loading.\n */\nexport function getIsAssetsLoadingForSelectedAccountGroup(\n state: Pick<AssetsControllerState, 'assetsLoadingStatus'>,\n accountTreeState: AccountTreeControllerState,\n): boolean {\n const groupId = accountTreeState.selectedAccountGroup;\n if (!groupId) {\n return false;\n }\n return isAccountGroupLoading(state, accountTreeState, groupId);\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type { InternalAccount } from '@metamask/keyring-internal-api';
2
+ /**
3
+ * Method decorator that tracks a per-account first-load status around the
4
+ * decorated fetch method: accounts whose assets have never been fetched are
5
+ * marked `'loading'` when the method is invoked and settle to `'loaded'` once
6
+ * it completes, whether it succeeded or failed. Accounts that already
7
+ * settled are never re-marked, so later refreshes (network switches, unlocks,
8
+ * direct calls, and so on) do not re-toggle the status. Calls that do not
9
+ * force an update are cache reads and are not tracked.
10
+ *
11
+ * @param target - The decorated fetch method.
12
+ * @param _context - The decorator context.
13
+ * @returns The wrapped fetch method.
14
+ */
15
+ export declare function trackAssetsLoading<This, Args extends [InternalAccount[], {
16
+ forceUpdate?: boolean;
17
+ }?, ...unknown[]], Return>(target: (this: This, ...args: Args) => Promise<Return>, _context: ClassMethodDecoratorContext<This, (this: This, ...args: Args) => Promise<Return>>): (this: This, ...args: Args) => Promise<Return>;
18
+ //# sourceMappingURL=trackAssetsLoading.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackAssetsLoading.d.ts","sourceRoot":"","sources":["../src/trackAssetsLoading.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAwCtE;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EACJ,IAAI,SAAS,CAAC,eAAe,EAAE,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,EAC1E,MAAM,EAEN,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,EACtD,QAAQ,EAAE,2BAA2B,CACnC,IAAI,EACJ,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAC/C,GACA,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAkBhD"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Set the loading status of the given accounts.
3
+ *
4
+ * @param controller - The controller whose state should be updated.
5
+ * @param accounts - The accounts to set the status for.
6
+ * @param status - The loading status to set.
7
+ */
8
+ function setAssetsLoadingStatus(controller, accounts, status) {
9
+ if (accounts.length === 0) {
10
+ return;
11
+ }
12
+ controller.update((state) => {
13
+ state.assetsLoadingStatus ??= {};
14
+ for (const account of accounts) {
15
+ state.assetsLoadingStatus[account.id] = status;
16
+ }
17
+ });
18
+ }
19
+ /**
20
+ * Method decorator that tracks a per-account first-load status around the
21
+ * decorated fetch method: accounts whose assets have never been fetched are
22
+ * marked `'loading'` when the method is invoked and settle to `'loaded'` once
23
+ * it completes, whether it succeeded or failed. Accounts that already
24
+ * settled are never re-marked, so later refreshes (network switches, unlocks,
25
+ * direct calls, and so on) do not re-toggle the status. Calls that do not
26
+ * force an update are cache reads and are not tracked.
27
+ *
28
+ * @param target - The decorated fetch method.
29
+ * @param _context - The decorator context.
30
+ * @returns The wrapped fetch method.
31
+ */
32
+ export function trackAssetsLoading(target, _context) {
33
+ return async function (...args) {
34
+ const [accounts, options] = args;
35
+ if (options?.forceUpdate !== true) {
36
+ return target.call(this, ...args);
37
+ }
38
+ const controller = this;
39
+ const firstLoadAccounts = accounts.filter((account) => controller.state.assetsLoadingStatus?.[account.id] === undefined);
40
+ setAssetsLoadingStatus(controller, firstLoadAccounts, 'loading');
41
+ try {
42
+ return await target.call(this, ...args);
43
+ }
44
+ finally {
45
+ setAssetsLoadingStatus(controller, firstLoadAccounts, 'loaded');
46
+ }
47
+ };
48
+ }
49
+ //# sourceMappingURL=trackAssetsLoading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trackAssetsLoading.js","sourceRoot":"","sources":["../src/trackAssetsLoading.ts"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,SAAS,sBAAsB,CAC7B,UAAqC,EACrC,QAA2B,EAC3B,MAA2B;IAE3B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO;IACT,CAAC;IACD,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,KAAK,CAAC,mBAAmB,KAAK,EAAE,CAAC;QACjC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,KAAK,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACjD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAKhC,MAAsD,EACtD,QAGC;IAED,OAAO,KAAK,WAAuB,GAAG,IAAU;QAC9C,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QACjC,IAAI,OAAO,EAAE,WAAW,KAAK,IAAI,EAAE,CAAC;YAClC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,MAAM,UAAU,GAAG,IAA4C,CAAC;QAChE,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CACvC,CAAC,OAAO,EAAE,EAAE,CACV,UAAU,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,SAAS,CACnE,CAAC;QACF,sBAAsB,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;QACjE,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,CAAC;gBAAS,CAAC;YACT,sBAAsB,CAAC,UAAU,EAAE,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QAClE,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { InternalAccount } from '@metamask/keyring-internal-api';\n\nimport type { AssetsController } from './AssetsController.js';\nimport type { AccountId, AssetsLoadingStatus } from './types.js';\n\n/**\n * The controller surface the loading tracker needs. `update` is spelled out\n * here because it is protected on the controller and so cannot be picked.\n */\ntype AssetsLoadingStateUpdater = Pick<AssetsController, 'state'> & {\n update: (\n callback: (state: {\n assetsLoadingStatus?: Record<AccountId, AssetsLoadingStatus>;\n }) => void,\n ) => void;\n};\n\n/**\n * Set the loading status of the given accounts.\n *\n * @param controller - The controller whose state should be updated.\n * @param accounts - The accounts to set the status for.\n * @param status - The loading status to set.\n */\nfunction setAssetsLoadingStatus(\n controller: AssetsLoadingStateUpdater,\n accounts: InternalAccount[],\n status: AssetsLoadingStatus,\n): void {\n if (accounts.length === 0) {\n return;\n }\n controller.update((state) => {\n state.assetsLoadingStatus ??= {};\n for (const account of accounts) {\n state.assetsLoadingStatus[account.id] = status;\n }\n });\n}\n\n/**\n * Method decorator that tracks a per-account first-load status around the\n * decorated fetch method: accounts whose assets have never been fetched are\n * marked `'loading'` when the method is invoked and settle to `'loaded'` once\n * it completes, whether it succeeded or failed. Accounts that already\n * settled are never re-marked, so later refreshes (network switches, unlocks,\n * direct calls, and so on) do not re-toggle the status. Calls that do not\n * force an update are cache reads and are not tracked.\n *\n * @param target - The decorated fetch method.\n * @param _context - The decorator context.\n * @returns The wrapped fetch method.\n */\nexport function trackAssetsLoading<\n This,\n Args extends [InternalAccount[], { forceUpdate?: boolean }?, ...unknown[]],\n Return,\n>(\n target: (this: This, ...args: Args) => Promise<Return>,\n _context: ClassMethodDecoratorContext<\n This,\n (this: This, ...args: Args) => Promise<Return>\n >,\n): (this: This, ...args: Args) => Promise<Return> {\n return async function (this: This, ...args: Args): Promise<Return> {\n const [accounts, options] = args;\n if (options?.forceUpdate !== true) {\n return target.call(this, ...args);\n }\n const controller = this as unknown as AssetsLoadingStateUpdater;\n const firstLoadAccounts = accounts.filter(\n (account) =>\n controller.state.assetsLoadingStatus?.[account.id] === undefined,\n );\n setAssetsLoadingStatus(controller, firstLoadAccounts, 'loading');\n try {\n return await target.call(this, ...args);\n } finally {\n setAssetsLoadingStatus(controller, firstLoadAccounts, 'loaded');\n }\n };\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -353,6 +353,7 @@ export type DataResponse = {
353
353
  * are applied. Use for event-driven updates and Accounts API v5.
354
354
  */
355
355
  export type AssetsUpdateMode = 'full' | 'merge';
356
+ export type AssetsLoadingStatus = 'loading' | 'loaded';
356
357
  /**
357
358
  * Callbacks for data sources to report to AssetsController.
358
359
  * Passed to data sources so they report by direct call instead of messenger.
@@ -421,6 +422,7 @@ export type AssetsControllerState = {
421
422
  assetPreferences: Record<Caip19AssetId, AssetPreferences>;
422
423
  /** Currently-active ISO 4217 currency code */
423
424
  selectedCurrency: SupportedCurrency;
425
+ assetsLoadingStatus?: Record<AccountId, AssetsLoadingStatus>;
424
426
  };
425
427
  /**
426
428
  * Base context for all middleware operations.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAExE;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC;AAMlC;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,aAAa,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,SAAS,GACT,KAAK,GACL,MAAM,CAAC;AAMX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8DAA8D;IAC9D,IAAI,EAAE,aAAa,CAAC;IACpB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA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,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAoiBA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAqB,EACrB,UAAsB;IAEtB,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC;QAC7C,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QAED,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SupportedCurrency } from '@metamask/core-backend';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type { CaipAssetType, CaipChainId, Json } from '@metamask/utils';\n\n/**\n * CAIP-19 compliant asset identifier\n * Format: \"{chainId}/{assetNamespace}:{assetReference}[/tokenId]\"\n *\n * Examples:\n * - Native: \"eip155:1/slip44:60\" (ETH)\n * - ERC20: \"eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\" (USDC)\n * - ERC721: \"eip155:1/erc721:0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/1234\" (BAYC #1234)\n * - SPL: \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\"\n */\nexport type Caip19AssetId = CaipAssetType;\n\n/**\n * InternalAccount UUID from AccountsController\n * Not the blockchain address!\n */\nexport type AccountId = string;\n\n/**\n * CAIP-2 chain identifier\n */\nexport type ChainId = CaipChainId;\n\n// ============================================================================\n// ASSET TYPES - Defined by metadata structure\n// ============================================================================\n\n/**\n * Asset types define the metadata structure, not blockchain implementation.\n * - \"fungible\" includes: native, erc20, spl - all share balance, symbol, decimals\n * - \"nft\" includes: erc721, erc1155 - include tokenId, image, attributes\n */\nexport type AssetType = 'fungible' | 'nft' | 'collectible';\n\n/**\n * Token standards - blockchain implementation details\n */\nexport type TokenStandard =\n | 'native'\n | 'erc20'\n | 'erc721'\n | 'erc1155'\n | 'spl'\n | string;\n\n// ============================================================================\n// METADATA TYPES (vary by asset type)\n// ============================================================================\n\n/**\n * UI preferences for an asset (stored in assetPreferences state, not in metadata).\n */\nexport type AssetPreferences = {\n /** Whether the asset is hidden from display */\n hidden?: boolean;\n};\n\n/**\n * Base metadata attributes shared by ALL asset types.\n */\nexport type BaseAssetMetadata = {\n /** Token standard - how it's implemented on the blockchain */\n type: TokenStandard;\n /** Display symbol (e.g., \"ETH\", \"USDC\") */\n symbol: string;\n /** Full name (e.g., \"Ethereum\", \"USD Coin\") */\n name: string;\n /** Token decimals (18 for ETH, 6 for USDC, etc.) */\n decimals: number;\n /** Logo URL or data URI */\n image?: string;\n};\n\n// ============================================================================\n// TOKEN CONTRACT DATA TYPES\n// ============================================================================\n\n/** Fee information for token transfers */\nexport type TokenFees = {\n avgFee: number;\n maxFee: number;\n minFee: number;\n};\n\n/** Honeypot detection status */\nexport type HoneypotStatus = {\n honeypotIs: boolean;\n goPlus?: boolean;\n};\n\n/** Storage slot information for the contract */\nexport type StorageSlots = {\n balance: number;\n approval: number;\n};\n\n/** Localized description */\nexport type LocalizedDescription = {\n en: string;\n};\n\n// ============================================================================\n// ASSET METADATA TYPES\n// ============================================================================\n\n/**\n * Metadata for fungible tokens.\n * Structure mirrors V3AssetResponse from the Tokens API.\n *\n * Differences from V3AssetResponse:\n * - `type` is derived from assetId namespace (not in API response)\n * - `image` maps from API's `iconUrl`\n * - `assetId` is not stored (used as the key)\n */\nexport type FungibleAssetMetadata = {\n /** Token type derived from assetId namespace */\n type: 'native' | 'erc20' | 'spl';\n /** CoinGecko ID for price lookups */\n coingeckoId?: string;\n /** Number of token list occurrences */\n occurrences?: number;\n /** DEX/aggregator integrations */\n aggregators?: string[];\n /** Asset labels/tags (e.g., \"stable_coin\") */\n labels?: string[];\n /** Whether the token supports ERC-20 permit */\n erc20Permit?: boolean;\n /** Fee information for token transfers */\n fees?: TokenFees;\n /** Honeypot detection status */\n honeypotStatus?: HoneypotStatus;\n /** Storage slot information for the contract */\n storage?: StorageSlots;\n /** Whether the contract is verified */\n isContractVerified?: boolean;\n /** Localized description */\n description?: LocalizedDescription;\n} & BaseAssetMetadata;\n\n/**\n * Metadata for ERC721 NFTs\n * Asset Type: \"nft\"\n */\nexport type ERC721AssetMetadata = {\n type: 'erc721';\n decimals: 0;\n /** Collection name */\n collectionName?: string;\n /** Collection size */\n collectionSize?: number;\n /** NFT traits/attributes - must be Json-serializable */\n traits?: Record<string, Json>;\n /** Rarity score */\n rarity?: number;\n /** Verification status */\n verified?: boolean;\n} & BaseAssetMetadata;\n\n/**\n * Metadata for ERC1155 multi-tokens\n */\nexport type ERC1155AssetMetadata = {\n type: 'erc1155';\n /** Token URI */\n tokenUri?: string;\n /** Token category */\n category?: string;\n /** Spam detection flag */\n isSpam?: boolean;\n} & BaseAssetMetadata;\n\n/**\n * Union type representing all possible asset metadata types.\n * All types must be JSON-serializable.\n */\nexport type AssetMetadata =\n | FungibleAssetMetadata\n | ERC721AssetMetadata\n | ERC1155AssetMetadata\n | (BaseAssetMetadata & { [key: string]: Json });\n\n// ============================================================================\n// PRICE TYPES (vary by asset type)\n// ============================================================================\n\n/**\n * Base price attributes.\n */\nexport type BaseAssetPrice = {\n /** Current price in selected currency */\n price: number;\n /** Timestamp of last price update */\n lastUpdated: number;\n};\n\n/**\n * Price data for fungible tokens (native, ERC20, SPL)\n * Matches V3SpotPricesResponse from the Price API.\n */\nexport type FungibleAssetPrice = BaseAssetPrice & {\n assetPriceType: 'fungible';\n /** CoinGecko ID */\n id?: string;\n /** Market capitalization */\n marketCap?: number;\n /** All-time high price */\n allTimeHigh?: number;\n /** All-time low price */\n allTimeLow?: number;\n /** 24h trading volume */\n totalVolume?: number;\n /** 24h high price */\n high1d?: number;\n /** 24h low price */\n low1d?: number;\n /** Circulating supply */\n circulatingSupply?: number;\n /** Fully diluted market cap */\n dilutedMarketCap?: number;\n /** 24h market cap change percentage */\n marketCapPercentChange1d?: number;\n /** 24h price change in USD */\n priceChange1d?: number;\n /** 1h price change percentage */\n pricePercentChange1h?: number;\n /** 24h price change percentage */\n pricePercentChange1d?: number;\n /** 7d price change percentage */\n pricePercentChange7d?: number;\n /** 14d price change percentage */\n pricePercentChange14d?: number;\n /** 30d price change percentage */\n pricePercentChange30d?: number;\n /** 200d price change percentage */\n pricePercentChange200d?: number;\n /** 1y price change percentage */\n pricePercentChange1y?: number;\n /** Current price in USD */\n usdPrice: number;\n};\n\n/**\n * Price data for NFT collections\n */\nexport type NFTAssetPrice = BaseAssetPrice & {\n assetPriceType: 'nft';\n /** Floor price */\n floorPrice?: number;\n /** Last sale price */\n lastSalePrice?: number;\n /** Collection trading volume */\n collectionVolume?: number;\n /** Average price */\n averagePrice?: number;\n /** Number of sales in 24h */\n sales24h?: number;\n};\n\n/**\n * Union type representing all possible asset price types.\n * All types must be JSON-serializable.\n */\nexport type AssetPrice = FungibleAssetPrice | NFTAssetPrice;\n\n// ============================================================================\n// BALANCE TYPES (vary by asset type)\n// ============================================================================\n\n/**\n * Balance data for fungible tokens (native, ERC20, SPL).\n */\nexport type FungibleAssetBalance = {\n /** Converted balance amount (e.g., \"1000\" for 1000 USDC) */\n amount: string;\n /**\n * Network-specific balance fields, when the source provides them. Stellar\n * native rows carry `spendableBalance` / `minimumReserveBalance`, and\n * trustlines carry `limit` / `authorized` / `sponsored`.\n */\n metadata?: Json;\n};\n\n/**\n * Balance data for ERC721 NFTs.\n * Each tokenId has its own CAIP-19 asset ID, so always \"1\".\n */\nexport type ERC721AssetBalance = {\n /** Always \"1\" for ERC721 (non-fungible) */\n amount: '1';\n};\n\n/**\n * Balance data for ERC1155 multi-tokens.\n */\nexport type ERC1155AssetBalance = {\n /** Quantity owned of this specific tokenId */\n amount: string;\n};\n\n/**\n * Union type representing all possible asset balance types.\n * All types must be JSON-serializable.\n */\nexport type AssetBalance =\n | FungibleAssetBalance\n | ERC721AssetBalance\n | ERC1155AssetBalance\n | { amount: string; [key: string]: Json };\n\n// ============================================================================\n// DATA SOURCE TYPES\n// ============================================================================\n\n/**\n * Data type dimension - what kind of data\n */\nexport type DataType = 'balance' | 'metadata' | 'price';\n\n/**\n * Account with its supported chains (enabled chains ∩ account scope).\n * Pre-computed by the controller so data sources do not need to implement\n * account-scope logic; they iterate over supportedChains for each account.\n */\nexport type AccountWithSupportedChains = {\n account: InternalAccount;\n supportedChains: ChainId[];\n};\n\n/**\n * Request for data from data sources\n */\nexport type DataRequest = {\n /** Accounts with their supported chains (enabled ∩ account scope). Data sources use this instead of computing accountSupportsChain. */\n accountsWithSupportedChains: AccountWithSupportedChains[];\n /** CAIP-2 chain IDs (union of chains in this request) */\n chainIds: ChainId[];\n /** Filter by asset types */\n assetTypes?: AssetType[];\n /** Which data to fetch */\n dataTypes: DataType[];\n /**\n * Optional scoped CAIP-19 asset IDs for this fetch (not the full pin list).\n * v5 force-update and v5 RPC fallback put pins here. v6 omits it: natives,\n * pins, and default tracked assets are read from controller state as\n * `includeAssetIds`; detected ERC-20 balances come back with the chain\n * snapshot. RPC fallback additionally refetches existing balances.\n */\n customAssets?: Caip19AssetId[];\n /**\n * When true, the data source should poll only the user's `customAssets`\n * for the requested chains and skip refreshing the regular tracked\n * balances. Used by the AssetsController to issue a supplemental RPC\n * subscription on chains that another data source is already covering\n * (Accounts API v5 path). Ignored when Accounts API v6 is enabled.\n */\n customAssetsOnly?: boolean;\n /** Force fresh fetch, bypass cache */\n forceUpdate?: boolean;\n /**\n * Bypass server-side HTTP caches in addition to the client-side ones that\n * `forceUpdate` already skips. Data sources backed by cached HTTP APIs\n * (e.g. the Accounts API with its 60s cache) append a random `bypassServerCache`\n * query param so the server re-reads instead of replaying a stale snapshot.\n * Use sparingly — e.g. right after a transaction confirms.\n */\n bypassServerCache?: boolean;\n /** Hint for polling interval (ms) - used by data sources that implement polling */\n updateInterval?: number;\n /** Specific CAIP-19 asset IDs for price update */\n assetsForPriceUpdate?: Caip19AssetId[];\n};\n\n/**\n * Response from data sources\n */\nexport type DataResponse = {\n /** Metadata for assets (shared across accounts) */\n assetsInfo?: Record<Caip19AssetId, AssetMetadata>;\n /** Price data for assets (shared across accounts) */\n assetsPrice?: Record<Caip19AssetId, AssetPrice>;\n /** Balance data per account */\n assetsBalance?: Record<AccountId, Record<Caip19AssetId, AssetBalance>>;\n /** Errors encountered, keyed by chain ID (chain-axis fallback + telemetry) */\n errors?: Record<ChainId, string>;\n /** Detected assets (assets that do not have metadata) */\n detectedAssets?: Record<AccountId, Caip19AssetId[]>;\n /**\n * How to apply this response to state. See {@link AssetsUpdateMode}.\n * Defaults to `'merge'` if omitted.\n */\n updateMode?: AssetsUpdateMode;\n /**\n * When set with `updateMode: 'merge'`, balances on chains present in\n * `assetsBalance` replace the prior chain slice (stale tokens on those chains\n * are dropped). Custom assets on covered chains are preserved. Used for\n * Accounts API v5 `getAssets({ forceUpdate: true })`. Accounts API v6 uses\n * `updateMode: 'full'` instead.\n */\n replaceCoveredChainBalances?: boolean;\n};\n\n/**\n * Type of {@link DataResponse.updateMode}: how the controller applies the response to state.\n *\n * - **full**: Response is the full set for covered chains (those present in\n * `assetsBalance`). Assets in state on those chains but not in the response\n * are cleared, including custom assets (Accounts API v6 returns pins via\n * `includeAssetIds`). A chain the source could not answer in full is reported\n * in `errors` and left out of `assetsBalance` entirely, so it is never\n * covered. Use for Accounts API v6 and RpcDataSource v6 snapshots.\n * - **merge**: Only assets present in the response are updated; nothing is\n * removed, unless {@link DataResponse.replaceCoveredChainBalances} is set\n * (Accounts API v5 force refresh). Metadata and prices from the response\n * are applied. Use for event-driven updates and Accounts API v5.\n */\nexport type AssetsUpdateMode = 'full' | 'merge';\n\n// ============================================================================\n// DATA SOURCE <-> CONTROLLER (DIRECT CALLS, NO MESSENGER PER SOURCE)\n// ============================================================================\n\n/**\n * Callbacks for data sources to report to AssetsController.\n * Passed to data sources so they report by direct call instead of messenger.\n */\nexport type AssetsControllerReport = {\n onActiveChainsUpdate: (dataSourceId: string, activeChains: ChainId[]) => void;\n onAssetsUpdate: (response: DataResponse, sourceId: string) => Promise<void>;\n};\n\n/** Request passed from controller to data source when subscribing */\nexport type DataSourceSubscriptionRequest = {\n request: DataRequest;\n subscriptionId: string;\n isUpdate: boolean;\n};\n\n/**\n * Interface for balance data sources that the controller calls directly.\n * No messenger is required for controller <-> data source communication.\n */\nexport type BalanceDataSource = {\n getAssetsMiddleware: () => Middleware;\n subscribe: (request: DataSourceSubscriptionRequest) => Promise<void>;\n unsubscribe: (subscriptionId: string) => Promise<void>;\n getName: () => string;\n};\n\n/**\n * Interface for the price data source (subscribe/unsubscribe + middleware).\n * Controller calls these methods directly.\n */\nexport type PriceDataSourceInterface = {\n getAssetsMiddleware: () => Middleware;\n subscribe: (request: DataSourceSubscriptionRequest) => Promise<void>;\n unsubscribe: (subscriptionId: string) => Promise<void>;\n};\n\n/**\n * Middleware-only source (e.g. detection, token enrichment).\n * Controller calls getAssetsMiddleware() directly.\n */\nexport type MiddlewareDataSource = {\n getAssetsMiddleware: () => Middleware;\n};\n\n// ============================================================================\n// CONTROLLER STATE\n// ============================================================================\n\n/**\n * State structure for AssetsController following normalized design.\n *\n * All values must stay JSON-serializable. UI preferences (e.g. hidden) live in\n * assetPreferences, not in metadata.\n *\n * Keys use CAIP identifiers:\n * - assetsInfo keys: CAIP-19 asset IDs (e.g., \"eip155:1/erc20:0x...\")\n * - assetsBalance outer keys: Account IDs (InternalAccount.id UUIDs)\n * - assetsBalance inner keys: CAIP-19 asset IDs\n * - assetsPrice keys: CAIP-19 asset IDs\n * - customAssets outer keys: Account IDs (InternalAccount.id UUIDs)\n * - customAssets inner values: CAIP-19 asset IDs array\n * - assetPreferences keys: CAIP-19 asset IDs\n */\nexport type AssetsControllerState = {\n /** Shared metadata for all assets (stored once per asset) */\n assetsInfo: Record<Caip19AssetId, AssetMetadata>;\n /** Per-account balance data */\n assetsBalance: Record<AccountId, Record<Caip19AssetId, AssetBalance>>;\n /** Price data for assets */\n assetsPrice: Record<Caip19AssetId, AssetPrice>;\n /** Custom assets added by users per account */\n customAssets: Record<AccountId, Caip19AssetId[]>;\n /** UI preferences per asset (e.g. hidden) - separate from metadata */\n assetPreferences: Record<Caip19AssetId, AssetPreferences>;\n /** Currently-active ISO 4217 currency code */\n selectedCurrency: SupportedCurrency;\n};\n\n// ============================================================================\n// UNIFIED MIDDLEWARE TYPES\n// ============================================================================\n\n/**\n * Base context for all middleware operations.\n * Contains the common interface shared by fetch and subscribe.\n */\nexport type Context = {\n /** The data request */\n request: DataRequest;\n /** The response data (mutated by middlewares) */\n response: DataResponse;\n /**\n * Optional breakdown of latency (ms) per data source, e.g. from parallel\n * middlewares. Keys are source names (often \"MiddlewareName.SourceName\").\n * Merged into the controller's durationByDataSource for tracing.\n */\n durationByDataSource?: Record<string, number>;\n};\n\n/**\n * Next function for middleware chain\n */\nexport type NextFunction = (context: Context) => Promise<Context>;\n\n/**\n * Middleware function - works for both fetch and subscribe operations.\n */\nexport type Middleware = (\n context: Context,\n next: NextFunction,\n) => Promise<Context>;\n\n/**\n * An assets data source: any object that can participate in the assets\n * middleware chain with a display name (e.g. for tracing). Used by\n * createParallelMiddleware and by the controller when executing the chain.\n */\nexport type AssetsDataSource = {\n getName(): string;\n assetsMiddleware: Middleware;\n};\n\n/**\n * Wraps a middleware to only execute if specific dataTypes are requested.\n *\n * @param dataTypes - DataTypes that must be in the request for middleware to run\n * @param middleware - The middleware to conditionally execute\n * @returns A middleware that skips execution if none of the dataTypes are requested\n *\n * @example\n * ```typescript\n * // Only runs for metadata requests\n * const metadataMiddleware = forDataTypes(['metadata'], async (ctx, next) => {\n * const result = await next(ctx);\n * // Enrich metadata...\n * return result;\n * });\n *\n * // Runs for balance or price requests\n * const balanceOrPriceMiddleware = forDataTypes(['balance', 'price'], async (ctx, next) => {\n * const result = await next(ctx);\n * // Process balances or prices...\n * return result;\n * });\n * ```\n */\nexport function forDataTypes(\n dataTypes: DataType[],\n middleware: Middleware,\n): Middleware {\n return async (ctx, next) => {\n const requestedTypes = ctx.request.dataTypes;\n const shouldRun = dataTypes.some((dt) => requestedTypes.includes(dt));\n\n if (!shouldRun) {\n return next(ctx);\n }\n\n return middleware(ctx, next);\n };\n}\n\n/**\n * Context for fetch operations.\n * Extends base Context - no additional fields needed for fetch.\n */\nexport type FetchContext = Context;\n\n// Legacy aliases for backwards compatibility\nexport type FetchNextFunction = NextFunction;\nexport type FetchMiddleware = Middleware;\n\n/**\n * Subscription response returned when subscribing to asset updates.\n */\nexport type SubscriptionResponse = {\n /** Chains actively subscribed */\n chains: ChainId[];\n /** Account ID being watched */\n accountId: AccountId;\n /** Asset types being watched */\n assetTypes: AssetType[];\n /** Data types being kept fresh */\n dataTypes: DataType[];\n /** Cleanup function */\n unsubscribe: () => void;\n};\n\n// ============================================================================\n// COMBINED ASSET TYPE (for UI)\n// ============================================================================\n\n/**\n * Combined asset type matching state structure: balance, metadata, price\n */\nexport type Asset = {\n /** CAIP-19 asset ID */\n id: Caip19AssetId;\n /** CAIP-2 chain ID (extracted from id) */\n chainId: ChainId;\n /** Balance data */\n balance: AssetBalance;\n /** Metadata (symbol, name, decimals, etc.) */\n metadata: AssetMetadata;\n /** Price data */\n price: AssetPrice;\n /** Computed fiat value (balance × price) */\n fiatValue: number;\n};\n\n// ============================================================================\n// EVENT TYPES\n// ============================================================================\n\n/**\n * Event emitted when balances change\n */\nexport type BalanceChangeEvent = {\n accountId: AccountId;\n assetId: Caip19AssetId;\n previousAmount: string;\n newAmount: string;\n timestamp: number;\n};\n\n/**\n * Event emitted when prices change\n */\nexport type PriceChangeEvent = {\n assetIds: Caip19AssetId[];\n timestamp: number;\n};\n\n/**\n * Event emitted when metadata changes\n */\nexport type MetadataChangeEvent = {\n assetId: Caip19AssetId;\n changes: Partial<AssetMetadata>;\n};\n\n/**\n * Event emitted when assets without metadata are detected\n */\nexport type AssetsDetectedEvent = {\n accountId: AccountId;\n assetIds: Caip19AssetId[];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAuiBA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAqB,EACrB,UAAsB;IAEtB,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC;QAC7C,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAEtE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QAED,OAAO,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { SupportedCurrency } from '@metamask/core-backend';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport type { CaipAssetType, CaipChainId, Json } from '@metamask/utils';\n\n/**\n * CAIP-19 compliant asset identifier\n * Format: \"{chainId}/{assetNamespace}:{assetReference}[/tokenId]\"\n *\n * Examples:\n * - Native: \"eip155:1/slip44:60\" (ETH)\n * - ERC20: \"eip155:1/erc20:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\" (USDC)\n * - ERC721: \"eip155:1/erc721:0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D/1234\" (BAYC #1234)\n * - SPL: \"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\"\n */\nexport type Caip19AssetId = CaipAssetType;\n\n/**\n * InternalAccount UUID from AccountsController\n * Not the blockchain address!\n */\nexport type AccountId = string;\n\n/**\n * CAIP-2 chain identifier\n */\nexport type ChainId = CaipChainId;\n\n// ============================================================================\n// ASSET TYPES - Defined by metadata structure\n// ============================================================================\n\n/**\n * Asset types define the metadata structure, not blockchain implementation.\n * - \"fungible\" includes: native, erc20, spl - all share balance, symbol, decimals\n * - \"nft\" includes: erc721, erc1155 - include tokenId, image, attributes\n */\nexport type AssetType = 'fungible' | 'nft' | 'collectible';\n\n/**\n * Token standards - blockchain implementation details\n */\nexport type TokenStandard =\n | 'native'\n | 'erc20'\n | 'erc721'\n | 'erc1155'\n | 'spl'\n | string;\n\n// ============================================================================\n// METADATA TYPES (vary by asset type)\n// ============================================================================\n\n/**\n * UI preferences for an asset (stored in assetPreferences state, not in metadata).\n */\nexport type AssetPreferences = {\n /** Whether the asset is hidden from display */\n hidden?: boolean;\n};\n\n/**\n * Base metadata attributes shared by ALL asset types.\n */\nexport type BaseAssetMetadata = {\n /** Token standard - how it's implemented on the blockchain */\n type: TokenStandard;\n /** Display symbol (e.g., \"ETH\", \"USDC\") */\n symbol: string;\n /** Full name (e.g., \"Ethereum\", \"USD Coin\") */\n name: string;\n /** Token decimals (18 for ETH, 6 for USDC, etc.) */\n decimals: number;\n /** Logo URL or data URI */\n image?: string;\n};\n\n// ============================================================================\n// TOKEN CONTRACT DATA TYPES\n// ============================================================================\n\n/** Fee information for token transfers */\nexport type TokenFees = {\n avgFee: number;\n maxFee: number;\n minFee: number;\n};\n\n/** Honeypot detection status */\nexport type HoneypotStatus = {\n honeypotIs: boolean;\n goPlus?: boolean;\n};\n\n/** Storage slot information for the contract */\nexport type StorageSlots = {\n balance: number;\n approval: number;\n};\n\n/** Localized description */\nexport type LocalizedDescription = {\n en: string;\n};\n\n// ============================================================================\n// ASSET METADATA TYPES\n// ============================================================================\n\n/**\n * Metadata for fungible tokens.\n * Structure mirrors V3AssetResponse from the Tokens API.\n *\n * Differences from V3AssetResponse:\n * - `type` is derived from assetId namespace (not in API response)\n * - `image` maps from API's `iconUrl`\n * - `assetId` is not stored (used as the key)\n */\nexport type FungibleAssetMetadata = {\n /** Token type derived from assetId namespace */\n type: 'native' | 'erc20' | 'spl';\n /** CoinGecko ID for price lookups */\n coingeckoId?: string;\n /** Number of token list occurrences */\n occurrences?: number;\n /** DEX/aggregator integrations */\n aggregators?: string[];\n /** Asset labels/tags (e.g., \"stable_coin\") */\n labels?: string[];\n /** Whether the token supports ERC-20 permit */\n erc20Permit?: boolean;\n /** Fee information for token transfers */\n fees?: TokenFees;\n /** Honeypot detection status */\n honeypotStatus?: HoneypotStatus;\n /** Storage slot information for the contract */\n storage?: StorageSlots;\n /** Whether the contract is verified */\n isContractVerified?: boolean;\n /** Localized description */\n description?: LocalizedDescription;\n} & BaseAssetMetadata;\n\n/**\n * Metadata for ERC721 NFTs\n * Asset Type: \"nft\"\n */\nexport type ERC721AssetMetadata = {\n type: 'erc721';\n decimals: 0;\n /** Collection name */\n collectionName?: string;\n /** Collection size */\n collectionSize?: number;\n /** NFT traits/attributes - must be Json-serializable */\n traits?: Record<string, Json>;\n /** Rarity score */\n rarity?: number;\n /** Verification status */\n verified?: boolean;\n} & BaseAssetMetadata;\n\n/**\n * Metadata for ERC1155 multi-tokens\n */\nexport type ERC1155AssetMetadata = {\n type: 'erc1155';\n /** Token URI */\n tokenUri?: string;\n /** Token category */\n category?: string;\n /** Spam detection flag */\n isSpam?: boolean;\n} & BaseAssetMetadata;\n\n/**\n * Union type representing all possible asset metadata types.\n * All types must be JSON-serializable.\n */\nexport type AssetMetadata =\n | FungibleAssetMetadata\n | ERC721AssetMetadata\n | ERC1155AssetMetadata\n | (BaseAssetMetadata & { [key: string]: Json });\n\n// ============================================================================\n// PRICE TYPES (vary by asset type)\n// ============================================================================\n\n/**\n * Base price attributes.\n */\nexport type BaseAssetPrice = {\n /** Current price in selected currency */\n price: number;\n /** Timestamp of last price update */\n lastUpdated: number;\n};\n\n/**\n * Price data for fungible tokens (native, ERC20, SPL)\n * Matches V3SpotPricesResponse from the Price API.\n */\nexport type FungibleAssetPrice = BaseAssetPrice & {\n assetPriceType: 'fungible';\n /** CoinGecko ID */\n id?: string;\n /** Market capitalization */\n marketCap?: number;\n /** All-time high price */\n allTimeHigh?: number;\n /** All-time low price */\n allTimeLow?: number;\n /** 24h trading volume */\n totalVolume?: number;\n /** 24h high price */\n high1d?: number;\n /** 24h low price */\n low1d?: number;\n /** Circulating supply */\n circulatingSupply?: number;\n /** Fully diluted market cap */\n dilutedMarketCap?: number;\n /** 24h market cap change percentage */\n marketCapPercentChange1d?: number;\n /** 24h price change in USD */\n priceChange1d?: number;\n /** 1h price change percentage */\n pricePercentChange1h?: number;\n /** 24h price change percentage */\n pricePercentChange1d?: number;\n /** 7d price change percentage */\n pricePercentChange7d?: number;\n /** 14d price change percentage */\n pricePercentChange14d?: number;\n /** 30d price change percentage */\n pricePercentChange30d?: number;\n /** 200d price change percentage */\n pricePercentChange200d?: number;\n /** 1y price change percentage */\n pricePercentChange1y?: number;\n /** Current price in USD */\n usdPrice: number;\n};\n\n/**\n * Price data for NFT collections\n */\nexport type NFTAssetPrice = BaseAssetPrice & {\n assetPriceType: 'nft';\n /** Floor price */\n floorPrice?: number;\n /** Last sale price */\n lastSalePrice?: number;\n /** Collection trading volume */\n collectionVolume?: number;\n /** Average price */\n averagePrice?: number;\n /** Number of sales in 24h */\n sales24h?: number;\n};\n\n/**\n * Union type representing all possible asset price types.\n * All types must be JSON-serializable.\n */\nexport type AssetPrice = FungibleAssetPrice | NFTAssetPrice;\n\n// ============================================================================\n// BALANCE TYPES (vary by asset type)\n// ============================================================================\n\n/**\n * Balance data for fungible tokens (native, ERC20, SPL).\n */\nexport type FungibleAssetBalance = {\n /** Converted balance amount (e.g., \"1000\" for 1000 USDC) */\n amount: string;\n /**\n * Network-specific balance fields, when the source provides them. Stellar\n * native rows carry `spendableBalance` / `minimumReserveBalance`, and\n * trustlines carry `limit` / `authorized` / `sponsored`.\n */\n metadata?: Json;\n};\n\n/**\n * Balance data for ERC721 NFTs.\n * Each tokenId has its own CAIP-19 asset ID, so always \"1\".\n */\nexport type ERC721AssetBalance = {\n /** Always \"1\" for ERC721 (non-fungible) */\n amount: '1';\n};\n\n/**\n * Balance data for ERC1155 multi-tokens.\n */\nexport type ERC1155AssetBalance = {\n /** Quantity owned of this specific tokenId */\n amount: string;\n};\n\n/**\n * Union type representing all possible asset balance types.\n * All types must be JSON-serializable.\n */\nexport type AssetBalance =\n | FungibleAssetBalance\n | ERC721AssetBalance\n | ERC1155AssetBalance\n | { amount: string; [key: string]: Json };\n\n// ============================================================================\n// DATA SOURCE TYPES\n// ============================================================================\n\n/**\n * Data type dimension - what kind of data\n */\nexport type DataType = 'balance' | 'metadata' | 'price';\n\n/**\n * Account with its supported chains (enabled chains ∩ account scope).\n * Pre-computed by the controller so data sources do not need to implement\n * account-scope logic; they iterate over supportedChains for each account.\n */\nexport type AccountWithSupportedChains = {\n account: InternalAccount;\n supportedChains: ChainId[];\n};\n\n/**\n * Request for data from data sources\n */\nexport type DataRequest = {\n /** Accounts with their supported chains (enabled ∩ account scope). Data sources use this instead of computing accountSupportsChain. */\n accountsWithSupportedChains: AccountWithSupportedChains[];\n /** CAIP-2 chain IDs (union of chains in this request) */\n chainIds: ChainId[];\n /** Filter by asset types */\n assetTypes?: AssetType[];\n /** Which data to fetch */\n dataTypes: DataType[];\n /**\n * Optional scoped CAIP-19 asset IDs for this fetch (not the full pin list).\n * v5 force-update and v5 RPC fallback put pins here. v6 omits it: natives,\n * pins, and default tracked assets are read from controller state as\n * `includeAssetIds`; detected ERC-20 balances come back with the chain\n * snapshot. RPC fallback additionally refetches existing balances.\n */\n customAssets?: Caip19AssetId[];\n /**\n * When true, the data source should poll only the user's `customAssets`\n * for the requested chains and skip refreshing the regular tracked\n * balances. Used by the AssetsController to issue a supplemental RPC\n * subscription on chains that another data source is already covering\n * (Accounts API v5 path). Ignored when Accounts API v6 is enabled.\n */\n customAssetsOnly?: boolean;\n /** Force fresh fetch, bypass cache */\n forceUpdate?: boolean;\n /**\n * Bypass server-side HTTP caches in addition to the client-side ones that\n * `forceUpdate` already skips. Data sources backed by cached HTTP APIs\n * (e.g. the Accounts API with its 60s cache) append a random `bypassServerCache`\n * query param so the server re-reads instead of replaying a stale snapshot.\n * Use sparingly — e.g. right after a transaction confirms.\n */\n bypassServerCache?: boolean;\n /** Hint for polling interval (ms) - used by data sources that implement polling */\n updateInterval?: number;\n /** Specific CAIP-19 asset IDs for price update */\n assetsForPriceUpdate?: Caip19AssetId[];\n};\n\n/**\n * Response from data sources\n */\nexport type DataResponse = {\n /** Metadata for assets (shared across accounts) */\n assetsInfo?: Record<Caip19AssetId, AssetMetadata>;\n /** Price data for assets (shared across accounts) */\n assetsPrice?: Record<Caip19AssetId, AssetPrice>;\n /** Balance data per account */\n assetsBalance?: Record<AccountId, Record<Caip19AssetId, AssetBalance>>;\n /** Errors encountered, keyed by chain ID (chain-axis fallback + telemetry) */\n errors?: Record<ChainId, string>;\n /** Detected assets (assets that do not have metadata) */\n detectedAssets?: Record<AccountId, Caip19AssetId[]>;\n /**\n * How to apply this response to state. See {@link AssetsUpdateMode}.\n * Defaults to `'merge'` if omitted.\n */\n updateMode?: AssetsUpdateMode;\n /**\n * When set with `updateMode: 'merge'`, balances on chains present in\n * `assetsBalance` replace the prior chain slice (stale tokens on those chains\n * are dropped). Custom assets on covered chains are preserved. Used for\n * Accounts API v5 `getAssets({ forceUpdate: true })`. Accounts API v6 uses\n * `updateMode: 'full'` instead.\n */\n replaceCoveredChainBalances?: boolean;\n};\n\n/**\n * Type of {@link DataResponse.updateMode}: how the controller applies the response to state.\n *\n * - **full**: Response is the full set for covered chains (those present in\n * `assetsBalance`). Assets in state on those chains but not in the response\n * are cleared, including custom assets (Accounts API v6 returns pins via\n * `includeAssetIds`). A chain the source could not answer in full is reported\n * in `errors` and left out of `assetsBalance` entirely, so it is never\n * covered. Use for Accounts API v6 and RpcDataSource v6 snapshots.\n * - **merge**: Only assets present in the response are updated; nothing is\n * removed, unless {@link DataResponse.replaceCoveredChainBalances} is set\n * (Accounts API v5 force refresh). Metadata and prices from the response\n * are applied. Use for event-driven updates and Accounts API v5.\n */\nexport type AssetsUpdateMode = 'full' | 'merge';\n\nexport type AssetsLoadingStatus = 'loading' | 'loaded';\n\n// ============================================================================\n// DATA SOURCE <-> CONTROLLER (DIRECT CALLS, NO MESSENGER PER SOURCE)\n// ============================================================================\n\n/**\n * Callbacks for data sources to report to AssetsController.\n * Passed to data sources so they report by direct call instead of messenger.\n */\nexport type AssetsControllerReport = {\n onActiveChainsUpdate: (dataSourceId: string, activeChains: ChainId[]) => void;\n onAssetsUpdate: (response: DataResponse, sourceId: string) => Promise<void>;\n};\n\n/** Request passed from controller to data source when subscribing */\nexport type DataSourceSubscriptionRequest = {\n request: DataRequest;\n subscriptionId: string;\n isUpdate: boolean;\n};\n\n/**\n * Interface for balance data sources that the controller calls directly.\n * No messenger is required for controller <-> data source communication.\n */\nexport type BalanceDataSource = {\n getAssetsMiddleware: () => Middleware;\n subscribe: (request: DataSourceSubscriptionRequest) => Promise<void>;\n unsubscribe: (subscriptionId: string) => Promise<void>;\n getName: () => string;\n};\n\n/**\n * Interface for the price data source (subscribe/unsubscribe + middleware).\n * Controller calls these methods directly.\n */\nexport type PriceDataSourceInterface = {\n getAssetsMiddleware: () => Middleware;\n subscribe: (request: DataSourceSubscriptionRequest) => Promise<void>;\n unsubscribe: (subscriptionId: string) => Promise<void>;\n};\n\n/**\n * Middleware-only source (e.g. detection, token enrichment).\n * Controller calls getAssetsMiddleware() directly.\n */\nexport type MiddlewareDataSource = {\n getAssetsMiddleware: () => Middleware;\n};\n\n// ============================================================================\n// CONTROLLER STATE\n// ============================================================================\n\n/**\n * State structure for AssetsController following normalized design.\n *\n * All values must stay JSON-serializable. UI preferences (e.g. hidden) live in\n * assetPreferences, not in metadata.\n *\n * Keys use CAIP identifiers:\n * - assetsInfo keys: CAIP-19 asset IDs (e.g., \"eip155:1/erc20:0x...\")\n * - assetsBalance outer keys: Account IDs (InternalAccount.id UUIDs)\n * - assetsBalance inner keys: CAIP-19 asset IDs\n * - assetsPrice keys: CAIP-19 asset IDs\n * - customAssets outer keys: Account IDs (InternalAccount.id UUIDs)\n * - customAssets inner values: CAIP-19 asset IDs array\n * - assetPreferences keys: CAIP-19 asset IDs\n */\nexport type AssetsControllerState = {\n /** Shared metadata for all assets (stored once per asset) */\n assetsInfo: Record<Caip19AssetId, AssetMetadata>;\n /** Per-account balance data */\n assetsBalance: Record<AccountId, Record<Caip19AssetId, AssetBalance>>;\n /** Price data for assets */\n assetsPrice: Record<Caip19AssetId, AssetPrice>;\n /** Custom assets added by users per account */\n customAssets: Record<AccountId, Caip19AssetId[]>;\n /** UI preferences per asset (e.g. hidden) - separate from metadata */\n assetPreferences: Record<Caip19AssetId, AssetPreferences>;\n /** Currently-active ISO 4217 currency code */\n selectedCurrency: SupportedCurrency;\n assetsLoadingStatus?: Record<AccountId, AssetsLoadingStatus>;\n};\n\n// ============================================================================\n// UNIFIED MIDDLEWARE TYPES\n// ============================================================================\n\n/**\n * Base context for all middleware operations.\n * Contains the common interface shared by fetch and subscribe.\n */\nexport type Context = {\n /** The data request */\n request: DataRequest;\n /** The response data (mutated by middlewares) */\n response: DataResponse;\n /**\n * Optional breakdown of latency (ms) per data source, e.g. from parallel\n * middlewares. Keys are source names (often \"MiddlewareName.SourceName\").\n * Merged into the controller's durationByDataSource for tracing.\n */\n durationByDataSource?: Record<string, number>;\n};\n\n/**\n * Next function for middleware chain\n */\nexport type NextFunction = (context: Context) => Promise<Context>;\n\n/**\n * Middleware function - works for both fetch and subscribe operations.\n */\nexport type Middleware = (\n context: Context,\n next: NextFunction,\n) => Promise<Context>;\n\n/**\n * An assets data source: any object that can participate in the assets\n * middleware chain with a display name (e.g. for tracing). Used by\n * createParallelMiddleware and by the controller when executing the chain.\n */\nexport type AssetsDataSource = {\n getName(): string;\n assetsMiddleware: Middleware;\n};\n\n/**\n * Wraps a middleware to only execute if specific dataTypes are requested.\n *\n * @param dataTypes - DataTypes that must be in the request for middleware to run\n * @param middleware - The middleware to conditionally execute\n * @returns A middleware that skips execution if none of the dataTypes are requested\n *\n * @example\n * ```typescript\n * // Only runs for metadata requests\n * const metadataMiddleware = forDataTypes(['metadata'], async (ctx, next) => {\n * const result = await next(ctx);\n * // Enrich metadata...\n * return result;\n * });\n *\n * // Runs for balance or price requests\n * const balanceOrPriceMiddleware = forDataTypes(['balance', 'price'], async (ctx, next) => {\n * const result = await next(ctx);\n * // Process balances or prices...\n * return result;\n * });\n * ```\n */\nexport function forDataTypes(\n dataTypes: DataType[],\n middleware: Middleware,\n): Middleware {\n return async (ctx, next) => {\n const requestedTypes = ctx.request.dataTypes;\n const shouldRun = dataTypes.some((dt) => requestedTypes.includes(dt));\n\n if (!shouldRun) {\n return next(ctx);\n }\n\n return middleware(ctx, next);\n };\n}\n\n/**\n * Context for fetch operations.\n * Extends base Context - no additional fields needed for fetch.\n */\nexport type FetchContext = Context;\n\n// Legacy aliases for backwards compatibility\nexport type FetchNextFunction = NextFunction;\nexport type FetchMiddleware = Middleware;\n\n/**\n * Subscription response returned when subscribing to asset updates.\n */\nexport type SubscriptionResponse = {\n /** Chains actively subscribed */\n chains: ChainId[];\n /** Account ID being watched */\n accountId: AccountId;\n /** Asset types being watched */\n assetTypes: AssetType[];\n /** Data types being kept fresh */\n dataTypes: DataType[];\n /** Cleanup function */\n unsubscribe: () => void;\n};\n\n// ============================================================================\n// COMBINED ASSET TYPE (for UI)\n// ============================================================================\n\n/**\n * Combined asset type matching state structure: balance, metadata, price\n */\nexport type Asset = {\n /** CAIP-19 asset ID */\n id: Caip19AssetId;\n /** CAIP-2 chain ID (extracted from id) */\n chainId: ChainId;\n /** Balance data */\n balance: AssetBalance;\n /** Metadata (symbol, name, decimals, etc.) */\n metadata: AssetMetadata;\n /** Price data */\n price: AssetPrice;\n /** Computed fiat value (balance × price) */\n fiatValue: number;\n};\n\n// ============================================================================\n// EVENT TYPES\n// ============================================================================\n\n/**\n * Event emitted when balances change\n */\nexport type BalanceChangeEvent = {\n accountId: AccountId;\n assetId: Caip19AssetId;\n previousAmount: string;\n newAmount: string;\n timestamp: number;\n};\n\n/**\n * Event emitted when prices change\n */\nexport type PriceChangeEvent = {\n assetIds: Caip19AssetId[];\n timestamp: number;\n};\n\n/**\n * Event emitted when metadata changes\n */\nexport type MetadataChangeEvent = {\n assetId: Caip19AssetId;\n changes: Partial<AssetMetadata>;\n};\n\n/**\n * Event emitted when assets without metadata are detected\n */\nexport type AssetsDetectedEvent = {\n accountId: AccountId;\n assetIds: Caip19AssetId[];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/assets-controller",
3
- "version": "18.0.1-preview-44b7ded21",
3
+ "version": "19.0.0-preview-2750df1dc",
4
4
  "description": "Tracks assets balances/prices and handles token detection across all digital assets",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -62,7 +62,7 @@
62
62
  "@metamask/client-controller": "^2.0.0",
63
63
  "@metamask/config-registry-controller": "^5.0.0",
64
64
  "@metamask/controller-utils": "^13.0.0",
65
- "@metamask/core-backend": "^12.0.1",
65
+ "@metamask/core-backend": "^12.1.0",
66
66
  "@metamask/keyring-api": "^24.1.0",
67
67
  "@metamask/keyring-controller": "^28.1.0",
68
68
  "@metamask/keyring-internal-api": "^12.1.0",