@metamask-previews/assets-controller 14.0.3-preview-00a181c → 14.0.3-preview-a302de5c3
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/CHANGELOG.md +0 -11
- package/dist/AssetsController.cjs +103 -20
- package/dist/AssetsController.cjs.map +1 -1
- package/dist/AssetsController.d.cts +5 -5
- package/dist/AssetsController.d.cts.map +1 -1
- package/dist/AssetsController.d.mts +5 -5
- package/dist/AssetsController.d.mts.map +1 -1
- package/dist/AssetsController.mjs +103 -20
- package/dist/AssetsController.mjs.map +1 -1
- package/dist/data-sources/RpcDataSource.cjs +0 -9
- package/dist/data-sources/RpcDataSource.cjs.map +1 -1
- package/dist/data-sources/RpcDataSource.d.cts.map +1 -1
- package/dist/data-sources/RpcDataSource.d.mts.map +1 -1
- package/dist/data-sources/RpcDataSource.mjs +0 -9
- package/dist/data-sources/RpcDataSource.mjs.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.cjs +14 -142
- package/dist/middlewares/RpcFallbackMiddleware.cjs.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.d.cts +6 -14
- package/dist/middlewares/RpcFallbackMiddleware.d.cts.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.d.mts +6 -14
- package/dist/middlewares/RpcFallbackMiddleware.d.mts.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.mjs +14 -142
- package/dist/middlewares/RpcFallbackMiddleware.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerInitializedEvent,
|
|
1
|
+
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerInitializedEvent, AccountTreeControllerSelectedAccountGroupChangeEvent, AccountTreeControllerStateChangeEvent, AccountTreeControllerUninitializedEvent } from "@metamask/account-tree-controller";
|
|
2
2
|
import type { AccountsControllerGetSelectedAccountAction } from "@metamask/accounts-controller";
|
|
3
3
|
import { BaseController } from "@metamask/base-controller";
|
|
4
4
|
import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ClientControllerStateChangeEvent } from "@metamask/client-controller";
|
|
6
6
|
import type { ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction } from "@metamask/config-registry-controller";
|
|
7
7
|
import type { TraceCallback } from "@metamask/controller-utils";
|
|
8
8
|
import type { ApiPlatformClient, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceStatusChangedEvent, SupportedCurrency } from "@metamask/core-backend";
|
|
9
|
-
import type {
|
|
9
|
+
import type { KeyringControllerLockEvent, KeyringControllerUnlockEvent } from "@metamask/keyring-controller";
|
|
10
10
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
11
11
|
import type { Messenger } from "@metamask/messenger";
|
|
12
12
|
import type { NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction, NetworkControllerNetworkAddedEvent, NetworkControllerNetworkDidChangeEvent, NetworkControllerNetworkRemovedEvent, NetworkControllerStateChangeEvent } from "@metamask/network-controller";
|
|
@@ -112,8 +112,8 @@ export type AssetsControllerAssetsDetectedEvent = {
|
|
|
112
112
|
}];
|
|
113
113
|
};
|
|
114
114
|
export type AssetsControllerEvents = AssetsControllerStateChangeEvent | AssetsControllerBalanceChangedEvent | AssetsControllerPriceChangedEvent | AssetsControllerAssetsDetectedEvent;
|
|
115
|
-
type AllowedActions = AccountsControllerGetSelectedAccountAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction |
|
|
116
|
-
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent | AccountTreeControllerInitializedEvent | AccountTreeControllerUninitializedEvent | ClientControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | PreferencesControllerStateChangeEvent | TransactionControllerUnapprovedTransactionAddedEvent | TransactionControllerTransactionConfirmedEvent | NetworkControllerStateChangeEvent | NetworkControllerNetworkAddedEvent | NetworkControllerNetworkDidChangeEvent | NetworkControllerNetworkRemovedEvent | NetworkEnablementControllerEvents | AccountsControllerAccountBalancesUpdatedEvent | PermissionControllerStateChange | SnapControllerSnapInstalledEvent | AccountActivityServiceBalanceUpdatedEvent | AccountActivityServiceStatusChangedEvent | RemoteFeatureFlagControllerStateChangeEvent;
|
|
115
|
+
type AllowedActions = AccountsControllerGetSelectedAccountAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction | NetworkEnablementControllerGetStateAction | SnapControllerGetRunnableSnapsAction | SnapControllerHandleRequestAction | GetPermissions | PhishingControllerBulkScanTokensAction | RemoteFeatureFlagControllerGetStateAction;
|
|
116
|
+
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent | AccountTreeControllerStateChangeEvent | AccountTreeControllerInitializedEvent | AccountTreeControllerUninitializedEvent | ClientControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | PreferencesControllerStateChangeEvent | TransactionControllerUnapprovedTransactionAddedEvent | TransactionControllerTransactionConfirmedEvent | NetworkControllerStateChangeEvent | NetworkControllerNetworkAddedEvent | NetworkControllerNetworkDidChangeEvent | NetworkControllerNetworkRemovedEvent | NetworkEnablementControllerEvents | AccountsControllerAccountBalancesUpdatedEvent | PermissionControllerStateChange | SnapControllerSnapInstalledEvent | AccountActivityServiceBalanceUpdatedEvent | AccountActivityServiceStatusChangedEvent | RemoteFeatureFlagControllerStateChangeEvent;
|
|
117
117
|
export type AssetsControllerMessenger = Messenger<typeof CONTROLLER_NAME, AssetsControllerActions | AllowedActions, AssetsControllerEvents | AllowedEvents>;
|
|
118
118
|
export type AssetsControllerOptions = {
|
|
119
119
|
messenger: AssetsControllerMessenger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetsController.d.cts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8DAA8D,EAC9D,qCAAqC,EACrC,
|
|
1
|
+
{"version":3,"file":"AssetsController.d.cts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8DAA8D,EAC9D,qCAAqC,EACrC,oDAAoD,EACpD,qCAAqC,EACrC,uCAAuC,EACxC,0CAA0C;AAC3C,OAAO,KAAK,EAAE,0CAA0C,EAAE,sCAAsC;AAChG,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,KAAK,EAAE,gCAAgC,EAAE,oCAAoC;AAEpF,OAAO,KAAK,EAAE,4DAA4D,EAAE,6CAA6C;AACzH,OAAO,KAAK,EAAE,aAAa,EAAgB,mCAAmC;AAC9E,OAAO,KAAK,EACV,iBAAiB,EACjB,yCAAyC,EACzC,wCAAwC,EACxC,iBAAiB,EAClB,+BAA+B;AAChC,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC7B,qCAAqC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,2CAA2C,EAC3C,+BAA+B,EAC/B,kCAAkC,EAClC,sCAAsC,EACtC,oCAAoC,EAEpC,iCAAiC,EAClC,qCAAqC;AACtC,OAAO,KAAK,EACV,yCAAyC,EACzC,iCAAiC,EAElC,gDAAgD;AACjD,OAAO,KAAK,EACV,cAAc,EACd,+BAA+B,EAChC,wCAAwC;AACzC,OAAO,EAAE,sCAAsC,EAAE,sCAAsC;AACvF,OAAO,KAAK,EAAE,qCAAqC,EAAE,yCAAyC;AAC9F,OAAO,KAAK,EACV,yCAAyC,EACzC,2CAA2C,EAC5C,iDAAiD;AAClD,OAAO,KAAK,EAC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1,12 +1,12 @@
|
|
|
1
|
-
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerInitializedEvent,
|
|
1
|
+
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerInitializedEvent, AccountTreeControllerSelectedAccountGroupChangeEvent, AccountTreeControllerStateChangeEvent, AccountTreeControllerUninitializedEvent } from "@metamask/account-tree-controller";
|
|
2
2
|
import type { AccountsControllerGetSelectedAccountAction } from "@metamask/accounts-controller";
|
|
3
3
|
import { BaseController } from "@metamask/base-controller";
|
|
4
4
|
import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ClientControllerStateChangeEvent } from "@metamask/client-controller";
|
|
6
6
|
import type { ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction } from "@metamask/config-registry-controller";
|
|
7
7
|
import type { TraceCallback } from "@metamask/controller-utils";
|
|
8
8
|
import type { ApiPlatformClient, AccountActivityServiceBalanceUpdatedEvent, AccountActivityServiceStatusChangedEvent, SupportedCurrency } from "@metamask/core-backend";
|
|
9
|
-
import type {
|
|
9
|
+
import type { KeyringControllerLockEvent, KeyringControllerUnlockEvent } from "@metamask/keyring-controller";
|
|
10
10
|
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
11
11
|
import type { Messenger } from "@metamask/messenger";
|
|
12
12
|
import type { NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction, NetworkControllerNetworkAddedEvent, NetworkControllerNetworkDidChangeEvent, NetworkControllerNetworkRemovedEvent, NetworkControllerStateChangeEvent } from "@metamask/network-controller";
|
|
@@ -112,8 +112,8 @@ export type AssetsControllerAssetsDetectedEvent = {
|
|
|
112
112
|
}];
|
|
113
113
|
};
|
|
114
114
|
export type AssetsControllerEvents = AssetsControllerStateChangeEvent | AssetsControllerBalanceChangedEvent | AssetsControllerPriceChangedEvent | AssetsControllerAssetsDetectedEvent;
|
|
115
|
-
type AllowedActions = AccountsControllerGetSelectedAccountAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction |
|
|
116
|
-
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent | AccountTreeControllerInitializedEvent | AccountTreeControllerUninitializedEvent | ClientControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | PreferencesControllerStateChangeEvent | TransactionControllerUnapprovedTransactionAddedEvent | TransactionControllerTransactionConfirmedEvent | NetworkControllerStateChangeEvent | NetworkControllerNetworkAddedEvent | NetworkControllerNetworkDidChangeEvent | NetworkControllerNetworkRemovedEvent | NetworkEnablementControllerEvents | AccountsControllerAccountBalancesUpdatedEvent | PermissionControllerStateChange | SnapControllerSnapInstalledEvent | AccountActivityServiceBalanceUpdatedEvent | AccountActivityServiceStatusChangedEvent | RemoteFeatureFlagControllerStateChangeEvent;
|
|
115
|
+
type AllowedActions = AccountsControllerGetSelectedAccountAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction | NetworkEnablementControllerGetStateAction | SnapControllerGetRunnableSnapsAction | SnapControllerHandleRequestAction | GetPermissions | PhishingControllerBulkScanTokensAction | RemoteFeatureFlagControllerGetStateAction;
|
|
116
|
+
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent | AccountTreeControllerStateChangeEvent | AccountTreeControllerInitializedEvent | AccountTreeControllerUninitializedEvent | ClientControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | PreferencesControllerStateChangeEvent | TransactionControllerUnapprovedTransactionAddedEvent | TransactionControllerTransactionConfirmedEvent | NetworkControllerStateChangeEvent | NetworkControllerNetworkAddedEvent | NetworkControllerNetworkDidChangeEvent | NetworkControllerNetworkRemovedEvent | NetworkEnablementControllerEvents | AccountsControllerAccountBalancesUpdatedEvent | PermissionControllerStateChange | SnapControllerSnapInstalledEvent | AccountActivityServiceBalanceUpdatedEvent | AccountActivityServiceStatusChangedEvent | RemoteFeatureFlagControllerStateChangeEvent;
|
|
117
117
|
export type AssetsControllerMessenger = Messenger<typeof CONTROLLER_NAME, AssetsControllerActions | AllowedActions, AssetsControllerEvents | AllowedEvents>;
|
|
118
118
|
export type AssetsControllerOptions = {
|
|
119
119
|
messenger: AssetsControllerMessenger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetsController.d.mts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8DAA8D,EAC9D,qCAAqC,EACrC,
|
|
1
|
+
{"version":3,"file":"AssetsController.d.mts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8DAA8D,EAC9D,qCAAqC,EACrC,oDAAoD,EACpD,qCAAqC,EACrC,uCAAuC,EACxC,0CAA0C;AAC3C,OAAO,KAAK,EAAE,0CAA0C,EAAE,sCAAsC;AAChG,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,KAAK,EAAE,gCAAgC,EAAE,oCAAoC;AAEpF,OAAO,KAAK,EAAE,4DAA4D,EAAE,6CAA6C;AACzH,OAAO,KAAK,EAAE,aAAa,EAAgB,mCAAmC;AAC9E,OAAO,KAAK,EACV,iBAAiB,EACjB,yCAAyC,EACzC,wCAAwC,EACxC,iBAAiB,EAClB,+BAA+B;AAChC,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC7B,qCAAqC;AACtC,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,2CAA2C,EAC3C,+BAA+B,EAC/B,kCAAkC,EAClC,sCAAsC,EACtC,oCAAoC,EAEpC,iCAAiC,EAClC,qCAAqC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sBAAsB,IAAI,IAAI;IA6uB9B;;;;;;;OAOG;IACH,8BAA8B,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IA4rBvD;;;;;;;;;OASG;IACG,kBAAkB,CACtB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC;IAuHhB,OAAO,IAAI,IAAI;CAoDhB"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _AssetsController_instances, _AssetsController_isEnabled, _AssetsController_isBasicFunctionality, _AssetsController_defaultUpdateInterval, _AssetsController_trace, _AssetsController_captureException, _AssetsController_firstInitFetchReported, _AssetsController_stateSizeReported, _AssetsController_emitStateSizeTrace, _AssetsController_controllerMutex, _AssetsController_accountRefreshMutex, _AssetsController_activeSubscriptions, _AssetsController_enabledChains,
|
|
12
|
+
var _AssetsController_instances, _AssetsController_isEnabled, _AssetsController_isBasicFunctionality, _AssetsController_defaultUpdateInterval, _AssetsController_trace, _AssetsController_captureException, _AssetsController_firstInitFetchReported, _AssetsController_stateSizeReported, _AssetsController_emitStateSizeTrace, _AssetsController_uiOpen, _AssetsController_keyringUnlocked, _AssetsController_accountTreeInitialized, _AssetsController_controllerMutex, _AssetsController_accountRefreshMutex, _AssetsController_activeSubscriptions, _AssetsController_enabledChains, _AssetsController_lastKnownAccountIds, _AssetsController_getSelectedAccounts, _AssetsController_accountActivityDataSource, _AssetsController_accountsApiDataSource, _AssetsController_snapDataSource, _AssetsController_rpcDataSource, _AssetsController_stakedBalanceDataSource, _AssetsController_allBalanceDataSources_get, _AssetsController_priceDataSource, _AssetsController_detectionMiddleware, _AssetsController_customAssetGraduationMiddleware, _AssetsController_rpcFallbackMiddleware, _AssetsController_tokenDataSource, _AssetsController_unsubscribeBasicFunctionality, _AssetsController_queryApiClient, _AssetsController_onActiveChainsUpdated, _AssetsController_initializeNativeAssetsMap, _AssetsController_initializeState, _AssetsController_extractEnabledChains, _AssetsController_normalizeChainReference, _AssetsController_subscribeToEvents, _AssetsController_refreshAssetsForTransaction, _AssetsController_runSpamCleanup, _AssetsController_updateActive, _AssetsController_handleAccountTreeStateChange, _AssetsController_runAccountTreeRefresh, _AssetsController_runStartupRefresh, _AssetsController_registerActionHandlers, _AssetsController_handleActiveChainsUpdate, _AssetsController_executeMiddlewares, _AssetsController_assertNonEmptyAccountId, _AssetsController_normalizeAssetIdOrThrow, _AssetsController_fetchMissingPricesWithoutCache, _AssetsController_getNativeAssetMap, _AssetsController_isNativeAsset, _AssetsController_getAssetType, _AssetsController_resolveNativeAssetIds, _AssetsController_getNativeAssetIdsForEnabledChains, _AssetsController_getNativeAssetIdsForAccount, _AssetsController_getSlowPipelineChainIds, _AssetsController_ensureNativeBalancesDefaultZero, _AssetsController_ensureDefaultTrackedAssetsSeeded, _AssetsController_updateState, _AssetsController_getAssetsFromState, _AssetsController_getAssetFromState, _AssetsController_shouldHideNativeToken, _AssetsController_tokenStandardToAssetType, _AssetsController_start, _AssetsController_stop, _AssetsController_subscribeAssets, _AssetsController_subscribeAssetsBalance, _AssetsController_subscribeRpcCustomAssetsSupplement, _AssetsController_unsubscribeBySubscriptionKey, _AssetsController_subscribeStakedBalance, _AssetsController_buildChainToAccountsMap, _AssetsController_subscribeDataSource, _AssetsController_unsubscribeDataSource, _AssetsController_buildDataRequest, _AssetsController_getEnabledChainsForAccount, _AssetsController_handleAccountGroupChanged, _AssetsController_handleEnabledNetworksChanged, _AssetsController_handleNetworkAdded, _AssetsController_refreshActiveChainsOnNetworkSwitch, _AssetsController_getSelectedEvmChainIdFromNetworkState, _AssetsController_handleNetworkDidChange, _AssetsController_refreshAssetsAfterNetworkChange, _AssetsController_refreshAssetsAfterNetworkAdded;
|
|
13
13
|
import { BaseController } from "@metamask/base-controller";
|
|
14
14
|
import { clientControllerSelectors } from "@metamask/client-controller";
|
|
15
15
|
import { isCaipChainId, isStrictHexString, KnownCaipNamespace, parseCaipAssetType, parseCaipChainId } from "@metamask/utils";
|
|
@@ -299,6 +299,15 @@ export class AssetsController extends BaseController {
|
|
|
299
299
|
_AssetsController_firstInitFetchReported.set(this, false);
|
|
300
300
|
/** Whether we have already reported state size for this session (reset on #stop). */
|
|
301
301
|
_AssetsController_stateSizeReported.set(this, false);
|
|
302
|
+
/** Whether the client (UI) is open. Combined with #keyringUnlocked for #updateActive. */
|
|
303
|
+
_AssetsController_uiOpen.set(this, false);
|
|
304
|
+
/** Whether the keyring is unlocked. Combined with #uiOpen for #updateActive. */
|
|
305
|
+
_AssetsController_keyringUnlocked.set(this, false);
|
|
306
|
+
/**
|
|
307
|
+
* Whether `AccountTreeController` has finished `init()`. Unlock / UI-open
|
|
308
|
+
* alone must not start fetches — the tree can still be mid-build.
|
|
309
|
+
*/
|
|
310
|
+
_AssetsController_accountTreeInitialized.set(this, false);
|
|
302
311
|
_AssetsController_controllerMutex.set(this, new Mutex());
|
|
303
312
|
/** Serializes account-switch fetch + subscribe to prevent overlapping races. */
|
|
304
313
|
_AssetsController_accountRefreshMutex.set(this, new Mutex());
|
|
@@ -311,6 +320,12 @@ export class AssetsController extends BaseController {
|
|
|
311
320
|
_AssetsController_activeSubscriptions.set(this, new Map());
|
|
312
321
|
/** Currently enabled chains from NetworkEnablementController */
|
|
313
322
|
_AssetsController_enabledChains.set(this, new Set());
|
|
323
|
+
/**
|
|
324
|
+
* Snapshot of account IDs that were active when the last subscription/fetch
|
|
325
|
+
* cycle ran. Used by #handleAccountTreeStateChange to skip redundant
|
|
326
|
+
* re-subscriptions when the account set hasn't actually changed.
|
|
327
|
+
*/
|
|
328
|
+
_AssetsController_lastKnownAccountIds.set(this, new Set());
|
|
314
329
|
_AssetsController_accountActivityDataSource.set(this, void 0);
|
|
315
330
|
_AssetsController_accountsApiDataSource.set(this, void 0);
|
|
316
331
|
_AssetsController_snapDataSource.set(this, void 0);
|
|
@@ -1163,7 +1178,7 @@ export class AssetsController extends BaseController {
|
|
|
1163
1178
|
this.messenger.unregisterActionHandler('AssetsController:setSelectedCurrency');
|
|
1164
1179
|
}
|
|
1165
1180
|
}
|
|
1166
|
-
_AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctionality = new WeakMap(), _AssetsController_defaultUpdateInterval = new WeakMap(), _AssetsController_trace = new WeakMap(), _AssetsController_captureException = new WeakMap(), _AssetsController_firstInitFetchReported = new WeakMap(), _AssetsController_stateSizeReported = new WeakMap(), _AssetsController_controllerMutex = new WeakMap(), _AssetsController_accountRefreshMutex = new WeakMap(), _AssetsController_activeSubscriptions = new WeakMap(), _AssetsController_enabledChains = new WeakMap(), _AssetsController_accountActivityDataSource = new WeakMap(), _AssetsController_accountsApiDataSource = new WeakMap(), _AssetsController_snapDataSource = new WeakMap(), _AssetsController_rpcDataSource = new WeakMap(), _AssetsController_stakedBalanceDataSource = new WeakMap(), _AssetsController_priceDataSource = new WeakMap(), _AssetsController_detectionMiddleware = new WeakMap(), _AssetsController_customAssetGraduationMiddleware = new WeakMap(), _AssetsController_rpcFallbackMiddleware = new WeakMap(), _AssetsController_tokenDataSource = new WeakMap(), _AssetsController_unsubscribeBasicFunctionality = new WeakMap(), _AssetsController_queryApiClient = new WeakMap(), _AssetsController_onActiveChainsUpdated = new WeakMap(), _AssetsController_instances = new WeakSet(), _AssetsController_emitStateSizeTrace = function _AssetsController_emitStateSizeTrace() {
|
|
1181
|
+
_AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctionality = new WeakMap(), _AssetsController_defaultUpdateInterval = new WeakMap(), _AssetsController_trace = new WeakMap(), _AssetsController_captureException = new WeakMap(), _AssetsController_firstInitFetchReported = new WeakMap(), _AssetsController_stateSizeReported = new WeakMap(), _AssetsController_uiOpen = new WeakMap(), _AssetsController_keyringUnlocked = new WeakMap(), _AssetsController_accountTreeInitialized = new WeakMap(), _AssetsController_controllerMutex = new WeakMap(), _AssetsController_accountRefreshMutex = new WeakMap(), _AssetsController_activeSubscriptions = new WeakMap(), _AssetsController_enabledChains = new WeakMap(), _AssetsController_lastKnownAccountIds = new WeakMap(), _AssetsController_accountActivityDataSource = new WeakMap(), _AssetsController_accountsApiDataSource = new WeakMap(), _AssetsController_snapDataSource = new WeakMap(), _AssetsController_rpcDataSource = new WeakMap(), _AssetsController_stakedBalanceDataSource = new WeakMap(), _AssetsController_priceDataSource = new WeakMap(), _AssetsController_detectionMiddleware = new WeakMap(), _AssetsController_customAssetGraduationMiddleware = new WeakMap(), _AssetsController_rpcFallbackMiddleware = new WeakMap(), _AssetsController_tokenDataSource = new WeakMap(), _AssetsController_unsubscribeBasicFunctionality = new WeakMap(), _AssetsController_queryApiClient = new WeakMap(), _AssetsController_onActiveChainsUpdated = new WeakMap(), _AssetsController_instances = new WeakSet(), _AssetsController_emitStateSizeTrace = function _AssetsController_emitStateSizeTrace() {
|
|
1167
1182
|
if (!__classPrivateFieldGet(this, _AssetsController_trace, "f") || __classPrivateFieldGet(this, _AssetsController_stateSizeReported, "f")) {
|
|
1168
1183
|
return;
|
|
1169
1184
|
}
|
|
@@ -1216,12 +1231,6 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1216
1231
|
return [selectedAccount];
|
|
1217
1232
|
}
|
|
1218
1233
|
return [];
|
|
1219
|
-
}, _AssetsController_isAccountTreeInitialized = function _AssetsController_isAccountTreeInitialized() {
|
|
1220
|
-
return this.messenger.call('AccountTreeController:isInitialized');
|
|
1221
|
-
}, _AssetsController_isUiOpen = function _AssetsController_isUiOpen() {
|
|
1222
|
-
return clientControllerSelectors.selectIsUiOpen(this.messenger.call('ClientController:getState'));
|
|
1223
|
-
}, _AssetsController_isKeyringUnlocked = function _AssetsController_isKeyringUnlocked() {
|
|
1224
|
-
return this.messenger.call('KeyringController:isUnlocked');
|
|
1225
1234
|
}, _AssetsController_allBalanceDataSources_get = function _AssetsController_allBalanceDataSources_get() {
|
|
1226
1235
|
return [
|
|
1227
1236
|
__classPrivateFieldGet(this, _AssetsController_accountActivityDataSource, "f"),
|
|
@@ -1281,14 +1290,16 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1281
1290
|
}
|
|
1282
1291
|
return reference;
|
|
1283
1292
|
}, _AssetsController_subscribeToEvents = function _AssetsController_subscribeToEvents() {
|
|
1293
|
+
// Subscribe to account group changes (when user switches between account groups like Account 1 -> Account 2)
|
|
1284
1294
|
this.messenger.subscribe('AccountTreeController:selectedAccountGroupChange', (groupId, previousGroupId) => {
|
|
1285
1295
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_handleAccountGroupChanged).call(this, groupId, previousGroupId).catch(console.error);
|
|
1286
1296
|
});
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1297
|
+
// Catch post-init tree mutations that change the selected account set
|
|
1298
|
+
// (e.g. a snap account added to the current group) without changing
|
|
1299
|
+
// the selected group id. Intermediate `:stateChange` events during
|
|
1300
|
+
// `AccountTreeController.init()` are ignored until `:initialized`.
|
|
1301
|
+
this.messenger.subscribe('AccountTreeController:stateChange', () => {
|
|
1302
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_handleAccountTreeStateChange).call(this);
|
|
1292
1303
|
});
|
|
1293
1304
|
// Subscribe to network enablement changes (only enabledNetworkMap)
|
|
1294
1305
|
this.messenger.subscribe('NetworkEnablementController:stateChange', ({ enabledNetworkMap }) => {
|
|
@@ -1315,17 +1326,20 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1315
1326
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_handleNetworkDidChange).call(this, networkState).catch(console.error);
|
|
1316
1327
|
});
|
|
1317
1328
|
// Client + Keyring lifecycle: only run when UI is open AND keyring is unlocked
|
|
1318
|
-
this.messenger.subscribe('ClientController:stateChange', () => {
|
|
1329
|
+
this.messenger.subscribe('ClientController:stateChange', (isUiOpen) => {
|
|
1330
|
+
__classPrivateFieldSet(this, _AssetsController_uiOpen, isUiOpen, "f");
|
|
1319
1331
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1320
1332
|
}, clientControllerSelectors.selectIsUiOpen);
|
|
1321
1333
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1322
1334
|
this.messenger.subscribe('KeyringController:unlock', async () => {
|
|
1335
|
+
__classPrivateFieldSet(this, _AssetsController_keyringUnlocked, true, "f");
|
|
1323
1336
|
await __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_runSpamCleanup).call(this).catch(() => {
|
|
1324
1337
|
/* Do nothing */
|
|
1325
1338
|
});
|
|
1326
1339
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1327
1340
|
});
|
|
1328
1341
|
this.messenger.subscribe('KeyringController:lock', () => {
|
|
1342
|
+
__classPrivateFieldSet(this, _AssetsController_keyringUnlocked, false, "f");
|
|
1329
1343
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1330
1344
|
});
|
|
1331
1345
|
// Subscribe to unapproved transactions - TXs that need confirmation.
|
|
@@ -1341,6 +1355,17 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1341
1355
|
this.messenger.subscribe('TransactionController:transactionConfirmed', (transactionMeta) => {
|
|
1342
1356
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_refreshAssetsForTransaction).call(this, transactionMeta);
|
|
1343
1357
|
});
|
|
1358
|
+
// Start tracking only after the account tree is fully built. Unlock can
|
|
1359
|
+
// happen before `AccountTreeController.init()`, and `:stateChange` fires
|
|
1360
|
+
// for intermediate mutations during that build.
|
|
1361
|
+
this.messenger.subscribe('AccountTreeController:initialized', () => {
|
|
1362
|
+
__classPrivateFieldSet(this, _AssetsController_accountTreeInitialized, true, "f");
|
|
1363
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1364
|
+
});
|
|
1365
|
+
this.messenger.subscribe('AccountTreeController:uninitialized', () => {
|
|
1366
|
+
__classPrivateFieldSet(this, _AssetsController_accountTreeInitialized, false, "f");
|
|
1367
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1368
|
+
});
|
|
1344
1369
|
}, _AssetsController_refreshAssetsForTransaction = function _AssetsController_refreshAssetsForTransaction(transactionMeta) {
|
|
1345
1370
|
const hexChainId = transactionMeta.chainId;
|
|
1346
1371
|
if (!hexChainId) {
|
|
@@ -1370,7 +1395,7 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1370
1395
|
});
|
|
1371
1396
|
}, _AssetsController_runSpamCleanup = async function _AssetsController_runSpamCleanup() {
|
|
1372
1397
|
try {
|
|
1373
|
-
const shouldRun = __classPrivateFieldGet(this,
|
|
1398
|
+
const shouldRun = __classPrivateFieldGet(this, _AssetsController_keyringUnlocked, "f") &&
|
|
1374
1399
|
__classPrivateFieldGet(this, _AssetsController_isBasicFunctionality, "f").call(this) &&
|
|
1375
1400
|
isUnlockCleanupEnabled(this.messenger.call('RemoteFeatureFlagController:getState')
|
|
1376
1401
|
?.remoteFeatureFlags);
|
|
@@ -1402,15 +1427,67 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1402
1427
|
log('Failed to run spam cleanup', { error });
|
|
1403
1428
|
}
|
|
1404
1429
|
}, _AssetsController_updateActive = function _AssetsController_updateActive() {
|
|
1405
|
-
const shouldRun = __classPrivateFieldGet(this,
|
|
1406
|
-
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isKeyringUnlocked).call(this) &&
|
|
1407
|
-
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isAccountTreeInitialized).call(this);
|
|
1430
|
+
const shouldRun = __classPrivateFieldGet(this, _AssetsController_uiOpen, "f") && __classPrivateFieldGet(this, _AssetsController_keyringUnlocked, "f") && __classPrivateFieldGet(this, _AssetsController_accountTreeInitialized, "f");
|
|
1408
1431
|
if (shouldRun) {
|
|
1409
1432
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_start).call(this);
|
|
1410
1433
|
}
|
|
1411
1434
|
else {
|
|
1412
1435
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_stop).call(this);
|
|
1413
1436
|
}
|
|
1437
|
+
}, _AssetsController_handleAccountTreeStateChange = function _AssetsController_handleAccountTreeStateChange() {
|
|
1438
|
+
const shouldRun = __classPrivateFieldGet(this, _AssetsController_uiOpen, "f") &&
|
|
1439
|
+
__classPrivateFieldGet(this, _AssetsController_keyringUnlocked, "f") &&
|
|
1440
|
+
__classPrivateFieldGet(this, _AssetsController_accountTreeInitialized, "f") &&
|
|
1441
|
+
__classPrivateFieldGet(this, _AssetsController_activeSubscriptions, "f").size > 0;
|
|
1442
|
+
if (!shouldRun) {
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
const accounts = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_getSelectedAccounts).call(this);
|
|
1446
|
+
const currentIds = new Set(accounts.map((a) => a.id));
|
|
1447
|
+
const accountsChanged = currentIds.size !== __classPrivateFieldGet(this, _AssetsController_lastKnownAccountIds, "f").size ||
|
|
1448
|
+
[...currentIds].some((id) => !__classPrivateFieldGet(this, _AssetsController_lastKnownAccountIds, "f").has(id));
|
|
1449
|
+
if (!accountsChanged) {
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
const hasOverlap = [...currentIds].some((id) => __classPrivateFieldGet(this, _AssetsController_lastKnownAccountIds, "f").has(id));
|
|
1453
|
+
if (!hasOverlap && __classPrivateFieldGet(this, _AssetsController_lastKnownAccountIds, "f").size > 0) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
log('Account tree changed with new accounts, re-subscribing', {
|
|
1457
|
+
previousCount: __classPrivateFieldGet(this, _AssetsController_lastKnownAccountIds, "f").size,
|
|
1458
|
+
currentCount: currentIds.size,
|
|
1459
|
+
});
|
|
1460
|
+
const newAccounts = accounts.filter((account) => !__classPrivateFieldGet(this, _AssetsController_lastKnownAccountIds, "f").has(account.id));
|
|
1461
|
+
__classPrivateFieldSet(this, _AssetsController_lastKnownAccountIds, currentIds, "f");
|
|
1462
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_ensureNativeBalancesDefaultZero).call(this);
|
|
1463
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_ensureDefaultTrackedAssetsSeeded).call(this);
|
|
1464
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_runAccountTreeRefresh).call(this, accounts, newAccounts).catch((error) => {
|
|
1465
|
+
log('Failed to refresh assets after tree change', error);
|
|
1466
|
+
});
|
|
1467
|
+
}, _AssetsController_runAccountTreeRefresh = async function _AssetsController_runAccountTreeRefresh(accounts, newAccounts = []) {
|
|
1468
|
+
const releaseLock = await __classPrivateFieldGet(this, _AssetsController_accountRefreshMutex, "f").acquire();
|
|
1469
|
+
try {
|
|
1470
|
+
await this.getAssets(accounts, {
|
|
1471
|
+
chainIds: [...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f")],
|
|
1472
|
+
forceUpdate: true,
|
|
1473
|
+
});
|
|
1474
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeAssets).call(this, { skipInitialFetch: true });
|
|
1475
|
+
if (newAccounts.length > 0) {
|
|
1476
|
+
await this.getAssets(newAccounts, {
|
|
1477
|
+
chainIds: [...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f")],
|
|
1478
|
+
forceUpdate: true,
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_fetchMissingPricesWithoutCache).call(this, accounts, [...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f")]);
|
|
1482
|
+
}
|
|
1483
|
+
catch (error) {
|
|
1484
|
+
log('Failed to fetch assets after tree change', error);
|
|
1485
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeAssets).call(this, { skipInitialFetch: true });
|
|
1486
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_fetchMissingPricesWithoutCache).call(this, accounts, [...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f")]);
|
|
1487
|
+
}
|
|
1488
|
+
finally {
|
|
1489
|
+
releaseLock();
|
|
1490
|
+
}
|
|
1414
1491
|
}, _AssetsController_runStartupRefresh =
|
|
1415
1492
|
/**
|
|
1416
1493
|
* Force-fetch balances then subscribe. Used on unlock / first startup.
|
|
@@ -1445,7 +1522,7 @@ async function _AssetsController_runStartupRefresh(accounts) {
|
|
|
1445
1522
|
}, _AssetsController_registerActionHandlers = function _AssetsController_registerActionHandlers() {
|
|
1446
1523
|
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
1447
1524
|
}, _AssetsController_handleActiveChainsUpdate = function _AssetsController_handleActiveChainsUpdate(dataSourceId, activeChains, previousChains) {
|
|
1448
|
-
if (!__classPrivateFieldGet(this,
|
|
1525
|
+
if (!__classPrivateFieldGet(this, _AssetsController_uiOpen, "f") || !__classPrivateFieldGet(this, _AssetsController_keyringUnlocked, "f") || !__classPrivateFieldGet(this, _AssetsController_isEnabled, "f").call(this)) {
|
|
1449
1526
|
return;
|
|
1450
1527
|
}
|
|
1451
1528
|
log('Data source active chains changed', {
|
|
@@ -2018,6 +2095,7 @@ async function _AssetsController_executeMiddlewares(params) {
|
|
|
2018
2095
|
selectedAccountCount: accounts.length,
|
|
2019
2096
|
enabledChainCount: chainIds.length,
|
|
2020
2097
|
});
|
|
2098
|
+
__classPrivateFieldSet(this, _AssetsController_lastKnownAccountIds, new Set(accounts.map((a) => a.id)), "f");
|
|
2021
2099
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_runStartupRefresh).call(this, accounts).catch((error) => {
|
|
2022
2100
|
log('Failed to start asset tracking', error);
|
|
2023
2101
|
});
|
|
@@ -2028,6 +2106,7 @@ async function _AssetsController_executeMiddlewares(params) {
|
|
|
2028
2106
|
});
|
|
2029
2107
|
__classPrivateFieldSet(this, _AssetsController_firstInitFetchReported, false, "f");
|
|
2030
2108
|
__classPrivateFieldSet(this, _AssetsController_stateSizeReported, false, "f");
|
|
2109
|
+
__classPrivateFieldSet(this, _AssetsController_lastKnownAccountIds, new Set(), "f");
|
|
2031
2110
|
// Stop price subscription first (uses direct messenger call)
|
|
2032
2111
|
this.unsubscribeAssetsPrice();
|
|
2033
2112
|
// Stop balance subscriptions by properly notifying data sources via messenger
|
|
@@ -2296,6 +2375,7 @@ async function _AssetsController_executeMiddlewares(params) {
|
|
|
2296
2375
|
// EVENT HANDLERS
|
|
2297
2376
|
// ============================================================================
|
|
2298
2377
|
async function _AssetsController_handleAccountGroupChanged(groupId, previousGroupId = '') {
|
|
2378
|
+
// The selected account group can be empty during onboarding or wallet reset.
|
|
2299
2379
|
if (!groupId) {
|
|
2300
2380
|
return;
|
|
2301
2381
|
}
|
|
@@ -2316,6 +2396,7 @@ async function _AssetsController_handleAccountGroupChanged(groupId, previousGrou
|
|
|
2316
2396
|
groupId,
|
|
2317
2397
|
previousGroupId,
|
|
2318
2398
|
});
|
|
2399
|
+
__classPrivateFieldSet(this, _AssetsController_lastKnownAccountIds, new Set(accounts.map((a) => a.id)), "f");
|
|
2319
2400
|
const releaseLock = await __classPrivateFieldGet(this, _AssetsController_accountRefreshMutex, "f").acquire();
|
|
2320
2401
|
try {
|
|
2321
2402
|
if (accounts.length > 0) {
|
|
@@ -2326,6 +2407,8 @@ async function _AssetsController_handleAccountGroupChanged(groupId, previousGrou
|
|
|
2326
2407
|
}
|
|
2327
2408
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_ensureNativeBalancesDefaultZero).call(this);
|
|
2328
2409
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_ensureDefaultTrackedAssetsSeeded).call(this);
|
|
2410
|
+
// Subscribe after seed so the price poll sees natives / defaults.
|
|
2411
|
+
// Balances were just force-fetched — skip AccountsApi's subscribe-time poll.
|
|
2329
2412
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeAssets).call(this, { skipInitialFetch: true });
|
|
2330
2413
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_fetchMissingPricesWithoutCache).call(this, accounts, [...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f")]);
|
|
2331
2414
|
}
|
|
@@ -2423,7 +2506,7 @@ async function _AssetsController_refreshActiveChainsOnNetworkSwitch() {
|
|
|
2423
2506
|
* @param networkState - NetworkController state after the switch.
|
|
2424
2507
|
*/
|
|
2425
2508
|
async function _AssetsController_handleNetworkDidChange(networkState) {
|
|
2426
|
-
if (!__classPrivateFieldGet(this,
|
|
2509
|
+
if (!__classPrivateFieldGet(this, _AssetsController_uiOpen, "f") || !__classPrivateFieldGet(this, _AssetsController_keyringUnlocked, "f") || !__classPrivateFieldGet(this, _AssetsController_isEnabled, "f").call(this)) {
|
|
2427
2510
|
return;
|
|
2428
2511
|
}
|
|
2429
2512
|
const accounts = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_getSelectedAccounts).call(this);
|