@metamask-previews/assets-controller 14.0.3-preview-a302de5c3 → 14.0.3-preview-e12b5ece6
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 +24 -1
- package/dist/AssetsController.cjs +24 -103
- package/dist/AssetsController.cjs.map +1 -1
- package/dist/AssetsController.d.cts +12 -5
- package/dist/AssetsController.d.cts.map +1 -1
- package/dist/AssetsController.d.mts +12 -5
- package/dist/AssetsController.d.mts.map +1 -1
- package/dist/AssetsController.mjs +24 -103
- package/dist/AssetsController.mjs.map +1 -1
- package/dist/data-sources/AccountsApiDataSource.cjs +9 -2
- package/dist/data-sources/AccountsApiDataSource.cjs.map +1 -1
- package/dist/data-sources/AccountsApiDataSource.d.cts.map +1 -1
- package/dist/data-sources/AccountsApiDataSource.d.mts.map +1 -1
- package/dist/data-sources/AccountsApiDataSource.mjs +9 -2
- package/dist/data-sources/AccountsApiDataSource.mjs.map +1 -1
- package/dist/data-sources/RpcDataSource.cjs +9 -0
- 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 +9 -0
- package/dist/data-sources/RpcDataSource.mjs.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.cjs +142 -14
- package/dist/middlewares/RpcFallbackMiddleware.cjs.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.d.cts +14 -6
- package/dist/middlewares/RpcFallbackMiddleware.d.cts.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.d.mts +14 -6
- package/dist/middlewares/RpcFallbackMiddleware.d.mts.map +1 -1
- package/dist/middlewares/RpcFallbackMiddleware.mjs +142 -14
- package/dist/middlewares/RpcFallbackMiddleware.mjs.map +1 -1
- package/dist/selectors/balance.cjs +9 -4
- package/dist/selectors/balance.cjs.map +1 -1
- package/dist/selectors/balance.d.cts.map +1 -1
- package/dist/selectors/balance.d.mts.map +1 -1
- package/dist/selectors/balance.mjs +9 -4
- package/dist/selectors/balance.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +8 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +8 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerInitializedEvent,
|
|
1
|
+
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerInitializedEvent, AccountTreeControllerIsInitializedAction, AccountTreeControllerSelectedAccountGroupChangeEvent, 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 { ClientControllerStateChangeEvent } from "@metamask/client-controller";
|
|
5
|
+
import type { ClientControllerGetStateAction, 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 { KeyringControllerLockEvent, KeyringControllerUnlockEvent } from "@metamask/keyring-controller";
|
|
9
|
+
import type { KeyringControllerIsUnlockedAction, 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 | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction | NetworkEnablementControllerGetStateAction | SnapControllerGetRunnableSnapsAction | SnapControllerHandleRequestAction | GetPermissions | PhishingControllerBulkScanTokensAction | RemoteFeatureFlagControllerGetStateAction;
|
|
116
|
-
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent |
|
|
115
|
+
type AllowedActions = AccountsControllerGetSelectedAccountAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction | AccountTreeControllerIsInitializedAction | ClientControllerGetStateAction | KeyringControllerIsUnlockedAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction | NetworkEnablementControllerGetStateAction | SnapControllerGetRunnableSnapsAction | SnapControllerHandleRequestAction | GetPermissions | PhishingControllerBulkScanTokensAction | RemoteFeatureFlagControllerGetStateAction;
|
|
116
|
+
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent | 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;
|
|
@@ -219,6 +219,13 @@ export declare class AssetsController extends BaseController<typeof CONTROLLER_N
|
|
|
219
219
|
chainIds?: ChainId[];
|
|
220
220
|
assetTypes?: AssetType[];
|
|
221
221
|
forceUpdate?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Also bypass server-side HTTP caches (e.g. the Accounts API's 60s
|
|
224
|
+
* cache, via a random `bypassServerCache` query param). Only meaningful
|
|
225
|
+
* together with `forceUpdate`. Use sparingly — e.g. right after a
|
|
226
|
+
* transaction confirms, when the API's cached snapshot is known stale.
|
|
227
|
+
*/
|
|
228
|
+
bypassServerCache?: boolean;
|
|
222
229
|
dataTypes?: DataType[];
|
|
223
230
|
assetsForPriceUpdate?: Caip19AssetId[];
|
|
224
231
|
/** When set to `'merge'`, fetch result is merged with existing state instead of replacing. Use for partial fetches (e.g. newly added chains). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetsController.d.cts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8DAA8D,EAC9D,qCAAqC,EACrC,oDAAoD,EACpD,
|
|
1
|
+
{"version":3,"file":"AssetsController.d.cts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KA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ent,
|
|
1
|
+
import type { AccountTreeControllerGetAccountsFromSelectedAccountGroupAction, AccountTreeControllerInitializedEvent, AccountTreeControllerIsInitializedAction, AccountTreeControllerSelectedAccountGroupChangeEvent, 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 { ClientControllerStateChangeEvent } from "@metamask/client-controller";
|
|
5
|
+
import type { ClientControllerGetStateAction, 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 { KeyringControllerLockEvent, KeyringControllerUnlockEvent } from "@metamask/keyring-controller";
|
|
9
|
+
import type { KeyringControllerIsUnlockedAction, 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 | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction | NetworkEnablementControllerGetStateAction | SnapControllerGetRunnableSnapsAction | SnapControllerHandleRequestAction | GetPermissions | PhishingControllerBulkScanTokensAction | RemoteFeatureFlagControllerGetStateAction;
|
|
116
|
-
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent |
|
|
115
|
+
type AllowedActions = AccountsControllerGetSelectedAccountAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction | AccountTreeControllerIsInitializedAction | ClientControllerGetStateAction | KeyringControllerIsUnlockedAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | ConfigRegistryControllerGetNetworkConfigByCaip2ChainIdAction | NetworkEnablementControllerGetStateAction | SnapControllerGetRunnableSnapsAction | SnapControllerHandleRequestAction | GetPermissions | PhishingControllerBulkScanTokensAction | RemoteFeatureFlagControllerGetStateAction;
|
|
116
|
+
type AllowedEvents = AccountTreeControllerSelectedAccountGroupChangeEvent | 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;
|
|
@@ -219,6 +219,13 @@ export declare class AssetsController extends BaseController<typeof CONTROLLER_N
|
|
|
219
219
|
chainIds?: ChainId[];
|
|
220
220
|
assetTypes?: AssetType[];
|
|
221
221
|
forceUpdate?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Also bypass server-side HTTP caches (e.g. the Accounts API's 60s
|
|
224
|
+
* cache, via a random `bypassServerCache` query param). Only meaningful
|
|
225
|
+
* together with `forceUpdate`. Use sparingly — e.g. right after a
|
|
226
|
+
* transaction confirms, when the API's cached snapshot is known stale.
|
|
227
|
+
*/
|
|
228
|
+
bypassServerCache?: boolean;
|
|
222
229
|
dataTypes?: DataType[];
|
|
223
230
|
assetsForPriceUpdate?: Caip19AssetId[];
|
|
224
231
|
/** When set to `'merge'`, fetch result is merged with existing state instead of replacing. Use for partial fetches (e.g. newly added chains). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetsController.d.mts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8DAA8D,EAC9D,qCAAqC,EACrC,oDAAoD,EACpD,
|
|
1
|
+
{"version":3,"file":"AssetsController.d.mts","sourceRoot":"","sources":["../src/AssetsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8DAA8D,EAC9D,qCAAqC,EACrC,wCAAwC,EACxC,oDAAoD,EACpD,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,EACV,8BAA8B,EAC9B,gCAAgC,EACjC,oCAAoC;AAErC,OAAO,KAAK,EAAE,4DAA4D,EAAE,6CAA6C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AAC,IAAI,CAAC;IAgFhB;;;;;OAKG;IACH,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI;IAuBrE;;;;;OAKG;IACH,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa,EAAE;IAQtD;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAavC;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAoBzC;;;;OAIG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,IAAI;IA+F9D;;;;;;OAMG;IACH,oBAAoB,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAqC5E;;OAEG;IACH,sBAAsB,IAAI,IAAI;IA2uB9B;;;;;;;OAOG;IACH,8BAA8B,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAurBvD;;;;;;;;;OASG;IACG,kBAAkB,CACtB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC;IAyHhB,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,
|
|
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, _AssetsController_getSelectedAccounts, _AssetsController_isAccountTreeInitialized, _AssetsController_isUiOpen, _AssetsController_isKeyringUnlocked, _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_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,15 +299,6 @@ 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);
|
|
311
302
|
_AssetsController_controllerMutex.set(this, new Mutex());
|
|
312
303
|
/** Serializes account-switch fetch + subscribe to prevent overlapping races. */
|
|
313
304
|
_AssetsController_accountRefreshMutex.set(this, new Mutex());
|
|
@@ -320,12 +311,6 @@ export class AssetsController extends BaseController {
|
|
|
320
311
|
_AssetsController_activeSubscriptions.set(this, new Map());
|
|
321
312
|
/** Currently enabled chains from NetworkEnablementController */
|
|
322
313
|
_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());
|
|
329
314
|
_AssetsController_accountActivityDataSource.set(this, void 0);
|
|
330
315
|
_AssetsController_accountsApiDataSource.set(this, void 0);
|
|
331
316
|
_AssetsController_snapDataSource.set(this, void 0);
|
|
@@ -482,6 +467,7 @@ export class AssetsController extends BaseController {
|
|
|
482
467
|
dataTypes,
|
|
483
468
|
customAssets: customAssets.length > 0 ? customAssets : undefined,
|
|
484
469
|
forceUpdate: true,
|
|
470
|
+
bypassServerCache: options?.bypassServerCache,
|
|
485
471
|
assetsForPriceUpdate: options?.assetsForPriceUpdate,
|
|
486
472
|
});
|
|
487
473
|
// Fast pipeline: accountsApi + stakedBalance → detection → token + price.
|
|
@@ -1090,6 +1076,7 @@ export class AssetsController extends BaseController {
|
|
|
1090
1076
|
// detection, so spam is never detected, enriched, priced or persisted.
|
|
1091
1077
|
const shouldFilterOccurrences = sourceId === 'AccountActivityDataSource' &&
|
|
1092
1078
|
__classPrivateFieldGet(this, _AssetsController_isBasicFunctionality, "f").call(this);
|
|
1079
|
+
const shouldRunRpcFallback = sourceId === 'AccountsApiDataSource';
|
|
1093
1080
|
const enrichmentSources = [
|
|
1094
1081
|
...(shouldGraduateCustomAssets
|
|
1095
1082
|
? [__classPrivateFieldGet(this, _AssetsController_customAssetGraduationMiddleware, "f")]
|
|
@@ -1102,6 +1089,7 @@ export class AssetsController extends BaseController {
|
|
|
1102
1089
|
},
|
|
1103
1090
|
]
|
|
1104
1091
|
: []),
|
|
1092
|
+
...(shouldRunRpcFallback ? [__classPrivateFieldGet(this, _AssetsController_rpcFallbackMiddleware, "f")] : []),
|
|
1105
1093
|
__classPrivateFieldGet(this, _AssetsController_detectionMiddleware, "f"),
|
|
1106
1094
|
];
|
|
1107
1095
|
if (__classPrivateFieldGet(this, _AssetsController_isBasicFunctionality, "f").call(this)) {
|
|
@@ -1178,7 +1166,7 @@ export class AssetsController extends BaseController {
|
|
|
1178
1166
|
this.messenger.unregisterActionHandler('AssetsController:setSelectedCurrency');
|
|
1179
1167
|
}
|
|
1180
1168
|
}
|
|
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(),
|
|
1169
|
+
_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() {
|
|
1182
1170
|
if (!__classPrivateFieldGet(this, _AssetsController_trace, "f") || __classPrivateFieldGet(this, _AssetsController_stateSizeReported, "f")) {
|
|
1183
1171
|
return;
|
|
1184
1172
|
}
|
|
@@ -1231,6 +1219,12 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1231
1219
|
return [selectedAccount];
|
|
1232
1220
|
}
|
|
1233
1221
|
return [];
|
|
1222
|
+
}, _AssetsController_isAccountTreeInitialized = function _AssetsController_isAccountTreeInitialized() {
|
|
1223
|
+
return this.messenger.call('AccountTreeController:isInitialized');
|
|
1224
|
+
}, _AssetsController_isUiOpen = function _AssetsController_isUiOpen() {
|
|
1225
|
+
return clientControllerSelectors.selectIsUiOpen(this.messenger.call('ClientController:getState'));
|
|
1226
|
+
}, _AssetsController_isKeyringUnlocked = function _AssetsController_isKeyringUnlocked() {
|
|
1227
|
+
return this.messenger.call('KeyringController:isUnlocked');
|
|
1234
1228
|
}, _AssetsController_allBalanceDataSources_get = function _AssetsController_allBalanceDataSources_get() {
|
|
1235
1229
|
return [
|
|
1236
1230
|
__classPrivateFieldGet(this, _AssetsController_accountActivityDataSource, "f"),
|
|
@@ -1290,16 +1284,14 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1290
1284
|
}
|
|
1291
1285
|
return reference;
|
|
1292
1286
|
}, _AssetsController_subscribeToEvents = function _AssetsController_subscribeToEvents() {
|
|
1293
|
-
// Subscribe to account group changes (when user switches between account groups like Account 1 -> Account 2)
|
|
1294
1287
|
this.messenger.subscribe('AccountTreeController:selectedAccountGroupChange', (groupId, previousGroupId) => {
|
|
1295
1288
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_handleAccountGroupChanged).call(this, groupId, previousGroupId).catch(console.error);
|
|
1296
1289
|
});
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_handleAccountTreeStateChange).call(this);
|
|
1290
|
+
this.messenger.subscribe('AccountTreeController:initialized', () => {
|
|
1291
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1292
|
+
});
|
|
1293
|
+
this.messenger.subscribe('AccountTreeController:uninitialized', () => {
|
|
1294
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1303
1295
|
});
|
|
1304
1296
|
// Subscribe to network enablement changes (only enabledNetworkMap)
|
|
1305
1297
|
this.messenger.subscribe('NetworkEnablementController:stateChange', ({ enabledNetworkMap }) => {
|
|
@@ -1326,20 +1318,17 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1326
1318
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_handleNetworkDidChange).call(this, networkState).catch(console.error);
|
|
1327
1319
|
});
|
|
1328
1320
|
// Client + Keyring lifecycle: only run when UI is open AND keyring is unlocked
|
|
1329
|
-
this.messenger.subscribe('ClientController:stateChange', (
|
|
1330
|
-
__classPrivateFieldSet(this, _AssetsController_uiOpen, isUiOpen, "f");
|
|
1321
|
+
this.messenger.subscribe('ClientController:stateChange', () => {
|
|
1331
1322
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1332
1323
|
}, clientControllerSelectors.selectIsUiOpen);
|
|
1333
1324
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1334
1325
|
this.messenger.subscribe('KeyringController:unlock', async () => {
|
|
1335
|
-
__classPrivateFieldSet(this, _AssetsController_keyringUnlocked, true, "f");
|
|
1336
1326
|
await __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_runSpamCleanup).call(this).catch(() => {
|
|
1337
1327
|
/* Do nothing */
|
|
1338
1328
|
});
|
|
1339
1329
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1340
1330
|
});
|
|
1341
1331
|
this.messenger.subscribe('KeyringController:lock', () => {
|
|
1342
|
-
__classPrivateFieldSet(this, _AssetsController_keyringUnlocked, false, "f");
|
|
1343
1332
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_updateActive).call(this);
|
|
1344
1333
|
});
|
|
1345
1334
|
// Subscribe to unapproved transactions - TXs that need confirmation.
|
|
@@ -1355,17 +1344,6 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1355
1344
|
this.messenger.subscribe('TransactionController:transactionConfirmed', (transactionMeta) => {
|
|
1356
1345
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_refreshAssetsForTransaction).call(this, transactionMeta);
|
|
1357
1346
|
});
|
|
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
|
-
});
|
|
1369
1347
|
}, _AssetsController_refreshAssetsForTransaction = function _AssetsController_refreshAssetsForTransaction(transactionMeta) {
|
|
1370
1348
|
const hexChainId = transactionMeta.chainId;
|
|
1371
1349
|
if (!hexChainId) {
|
|
@@ -1390,12 +1368,13 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1390
1368
|
this.getAssets([matchedAccount], {
|
|
1391
1369
|
chainIds: [caipChainId],
|
|
1392
1370
|
forceUpdate: true,
|
|
1371
|
+
bypassServerCache: true,
|
|
1393
1372
|
}).catch((error) => {
|
|
1394
1373
|
log('Failed to refresh assets after transaction event', { error });
|
|
1395
1374
|
});
|
|
1396
1375
|
}, _AssetsController_runSpamCleanup = async function _AssetsController_runSpamCleanup() {
|
|
1397
1376
|
try {
|
|
1398
|
-
const shouldRun = __classPrivateFieldGet(this,
|
|
1377
|
+
const shouldRun = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isKeyringUnlocked).call(this) &&
|
|
1399
1378
|
__classPrivateFieldGet(this, _AssetsController_isBasicFunctionality, "f").call(this) &&
|
|
1400
1379
|
isUnlockCleanupEnabled(this.messenger.call('RemoteFeatureFlagController:getState')
|
|
1401
1380
|
?.remoteFeatureFlags);
|
|
@@ -1427,67 +1406,15 @@ _AssetsController_isEnabled = new WeakMap(), _AssetsController_isBasicFunctional
|
|
|
1427
1406
|
log('Failed to run spam cleanup', { error });
|
|
1428
1407
|
}
|
|
1429
1408
|
}, _AssetsController_updateActive = function _AssetsController_updateActive() {
|
|
1430
|
-
const shouldRun = __classPrivateFieldGet(this,
|
|
1409
|
+
const shouldRun = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isUiOpen).call(this) &&
|
|
1410
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isKeyringUnlocked).call(this) &&
|
|
1411
|
+
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isAccountTreeInitialized).call(this);
|
|
1431
1412
|
if (shouldRun) {
|
|
1432
1413
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_start).call(this);
|
|
1433
1414
|
}
|
|
1434
1415
|
else {
|
|
1435
1416
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_stop).call(this);
|
|
1436
1417
|
}
|
|
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
|
-
}
|
|
1491
1418
|
}, _AssetsController_runStartupRefresh =
|
|
1492
1419
|
/**
|
|
1493
1420
|
* Force-fetch balances then subscribe. Used on unlock / first startup.
|
|
@@ -1522,7 +1449,7 @@ async function _AssetsController_runStartupRefresh(accounts) {
|
|
|
1522
1449
|
}, _AssetsController_registerActionHandlers = function _AssetsController_registerActionHandlers() {
|
|
1523
1450
|
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
1524
1451
|
}, _AssetsController_handleActiveChainsUpdate = function _AssetsController_handleActiveChainsUpdate(dataSourceId, activeChains, previousChains) {
|
|
1525
|
-
if (!__classPrivateFieldGet(this,
|
|
1452
|
+
if (!__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isUiOpen).call(this) || !__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isKeyringUnlocked).call(this) || !__classPrivateFieldGet(this, _AssetsController_isEnabled, "f").call(this)) {
|
|
1526
1453
|
return;
|
|
1527
1454
|
}
|
|
1528
1455
|
log('Data source active chains changed', {
|
|
@@ -2095,7 +2022,6 @@ async function _AssetsController_executeMiddlewares(params) {
|
|
|
2095
2022
|
selectedAccountCount: accounts.length,
|
|
2096
2023
|
enabledChainCount: chainIds.length,
|
|
2097
2024
|
});
|
|
2098
|
-
__classPrivateFieldSet(this, _AssetsController_lastKnownAccountIds, new Set(accounts.map((a) => a.id)), "f");
|
|
2099
2025
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_runStartupRefresh).call(this, accounts).catch((error) => {
|
|
2100
2026
|
log('Failed to start asset tracking', error);
|
|
2101
2027
|
});
|
|
@@ -2106,7 +2032,6 @@ async function _AssetsController_executeMiddlewares(params) {
|
|
|
2106
2032
|
});
|
|
2107
2033
|
__classPrivateFieldSet(this, _AssetsController_firstInitFetchReported, false, "f");
|
|
2108
2034
|
__classPrivateFieldSet(this, _AssetsController_stateSizeReported, false, "f");
|
|
2109
|
-
__classPrivateFieldSet(this, _AssetsController_lastKnownAccountIds, new Set(), "f");
|
|
2110
2035
|
// Stop price subscription first (uses direct messenger call)
|
|
2111
2036
|
this.unsubscribeAssetsPrice();
|
|
2112
2037
|
// Stop balance subscriptions by properly notifying data sources via messenger
|
|
@@ -2375,7 +2300,6 @@ async function _AssetsController_executeMiddlewares(params) {
|
|
|
2375
2300
|
// EVENT HANDLERS
|
|
2376
2301
|
// ============================================================================
|
|
2377
2302
|
async function _AssetsController_handleAccountGroupChanged(groupId, previousGroupId = '') {
|
|
2378
|
-
// The selected account group can be empty during onboarding or wallet reset.
|
|
2379
2303
|
if (!groupId) {
|
|
2380
2304
|
return;
|
|
2381
2305
|
}
|
|
@@ -2396,7 +2320,6 @@ async function _AssetsController_handleAccountGroupChanged(groupId, previousGrou
|
|
|
2396
2320
|
groupId,
|
|
2397
2321
|
previousGroupId,
|
|
2398
2322
|
});
|
|
2399
|
-
__classPrivateFieldSet(this, _AssetsController_lastKnownAccountIds, new Set(accounts.map((a) => a.id)), "f");
|
|
2400
2323
|
const releaseLock = await __classPrivateFieldGet(this, _AssetsController_accountRefreshMutex, "f").acquire();
|
|
2401
2324
|
try {
|
|
2402
2325
|
if (accounts.length > 0) {
|
|
@@ -2407,8 +2330,6 @@ async function _AssetsController_handleAccountGroupChanged(groupId, previousGrou
|
|
|
2407
2330
|
}
|
|
2408
2331
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_ensureNativeBalancesDefaultZero).call(this);
|
|
2409
2332
|
__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.
|
|
2412
2333
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_subscribeAssets).call(this, { skipInitialFetch: true });
|
|
2413
2334
|
__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_fetchMissingPricesWithoutCache).call(this, accounts, [...__classPrivateFieldGet(this, _AssetsController_enabledChains, "f")]);
|
|
2414
2335
|
}
|
|
@@ -2506,7 +2427,7 @@ async function _AssetsController_refreshActiveChainsOnNetworkSwitch() {
|
|
|
2506
2427
|
* @param networkState - NetworkController state after the switch.
|
|
2507
2428
|
*/
|
|
2508
2429
|
async function _AssetsController_handleNetworkDidChange(networkState) {
|
|
2509
|
-
if (!__classPrivateFieldGet(this,
|
|
2430
|
+
if (!__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isUiOpen).call(this) || !__classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_isKeyringUnlocked).call(this) || !__classPrivateFieldGet(this, _AssetsController_isEnabled, "f").call(this)) {
|
|
2510
2431
|
return;
|
|
2511
2432
|
}
|
|
2512
2433
|
const accounts = __classPrivateFieldGet(this, _AssetsController_instances, "m", _AssetsController_getSelectedAccounts).call(this);
|