Skip to content

Commit

Permalink
Update and fix store, memStore
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Dec 6, 2024
1 parent 90e3fc6 commit ee9c45e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 71 deletions.
119 changes: 59 additions & 60 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2519,7 +2519,7 @@ export default class MetamaskController extends EventEmitter {
PPOMController: this.ppomController.state,
};

const storeControllersComposedState = {
this.store.updateStructure({
AccountsController: this.accountsController.state,
AppStateController: this.appStateController.state,
AppMetadataController: this.appMetadataController.state,
Expand Down Expand Up @@ -2562,75 +2562,74 @@ export default class MetamaskController extends EventEmitter {
this.institutionalFeaturesController.store,
MmiConfigurationController: this.mmiConfigurationController.store,
///: END:ONLY_INCLUDE_IF
PPOMController: this.ppomController.state,
NameController: this.nameController.state,
UserOperationController: this.userOperationController.state,
// Notification Controllers
AuthenticationController: this.authenticationController.state,
UserStorageController: this.userStorageController.state,
NotificationServicesController: this.notificationServicesController.state,
NotificationServicesPushController:
this.notificationServicesPushController,
RemoteFeatureFlagController: this.remoteFeatureFlagController,
...resetOnRestartStore,
};
this.store.updateStructure(storeControllersComposedState);

const memStoreControllersComposedState = {
AccountsController: this.accountsController.state,
AppStateController: this.appStateController.state,
AppMetadataController: this.appMetadataController.state,
MultichainBalancesController: this.multichainBalancesController.state,
NetworkController: this.networkController.state,
KeyringController: this.keyringController.state,
PreferencesController: this.preferencesController.state,
MetaMetricsController: this.metaMetricsController.state,
MetaMetricsDataDeletionController:
this.metaMetricsDataDeletionController.state,
AddressBookController: this.addressBookController.state,
CurrencyController: this.currencyRateController.state,
AlertController: this.alertController.state,
OnboardingController: this.onboardingController.state,
PermissionController: this.permissionController.state,
PermissionLogController: this.permissionLogController.state,
SubjectMetadataController: this.subjectMetadataController.state,
AnnouncementController: this.announcementController.state,
NetworkOrderController: this.networkOrderController.state,
AccountOrderController: this.accountOrderController.state,
GasFeeController: this.gasFeeController.state,
TokenListController: this.tokenListController.state,
TokensController: this.tokensController.state,
TokenBalancesController: this.tokenBalancesController.state,
SmartTransactionsController: this.smartTransactionsController.state,
NftController: this.nftController.state,
SelectedNetworkController: this.selectedNetworkController.state,
LoggingController: this.loggingController.state,
TxController: this.txController.state,
MultichainRatesController: this.multichainRatesController.state,
SnapController: this.snapController.state,
CronjobController: this.cronjobController.state,
SnapsRegistry: this.snapsRegistry,
SnapInterfaceController: this.snapInterfaceController.state,
SnapInsightsController: this.snapInsightsController.state,
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
CustodyController: this.custodyController.store,
InstitutionalFeaturesController:
this.institutionalFeaturesController.store,
MmiConfigurationController: this.mmiConfigurationController.store,
///: END:ONLY_INCLUDE_IF
NameController: this.nameController.state,
UserOperationController: this.userOperationController.state,
// Notification Controllers
AuthenticationController: this.authenticationController.state,
UserStorageController: this.userStorageController.state,
NotificationServicesController: this.notificationServicesController.state,
QueuedRequestController: this.queuedRequestController.state,
NotificationServicesPushController:
this.notificationServicesPushController.state,
RemoteFeatureFlagController: this.remoteFeatureFlagController.state,
...resetOnRestartStore,
};
});

this.memStore = new ComposableObservableStore({
config: memStoreControllersComposedState,
config: {
AccountsController: this.accountsController.state,
AppStateController: this.appStateController.state,
AppMetadataController: this.appMetadataController.state,
MultichainBalancesController: this.multichainBalancesController.state,
NetworkController: this.networkController.state,
KeyringController: this.keyringController.state,
PreferencesController: this.preferencesController.state,
MetaMetricsController: this.metaMetricsController.state,
MetaMetricsDataDeletionController:
this.metaMetricsDataDeletionController.state,
AddressBookController: this.addressBookController.state,
CurrencyController: this.currencyRateController.state,
AlertController: this.alertController.state,
OnboardingController: this.onboardingController.state,
PermissionController: this.permissionController.state,
PermissionLogController: this.permissionLogController.state,
SubjectMetadataController: this.subjectMetadataController.state,
AnnouncementController: this.announcementController.state,
NetworkOrderController: this.networkOrderController.state,
AccountOrderController: this.accountOrderController.state,
GasFeeController: this.gasFeeController.state,
TokenListController: this.tokenListController.state,
TokensController: this.tokensController.state,
TokenBalancesController: this.tokenBalancesController.state,
SmartTransactionsController: this.smartTransactionsController.state,
NftController: this.nftController.state,
SelectedNetworkController: this.selectedNetworkController.state,
LoggingController: this.loggingController.state,
TxController: this.txController.state,
MultichainRatesController: this.multichainRatesController.state,
SnapController: this.snapController.state,
CronjobController: this.cronjobController.state,
SnapsRegistry: this.snapsRegistry.state,
SnapInterfaceController: this.snapInterfaceController.state,
SnapInsightsController: this.snapInsightsController.state,
///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
CustodyController: this.custodyController.store,
InstitutionalFeaturesController:
this.institutionalFeaturesController.store,
MmiConfigurationController: this.mmiConfigurationController.store,
///: END:ONLY_INCLUDE_IF
NameController: this.nameController.state,
UserOperationController: this.userOperationController.state,
// Notification Controllers
AuthenticationController: this.authenticationController.state,
UserStorageController: this.userStorageController.state,
NotificationServicesController:
this.notificationServicesController.state,
QueuedRequestController: this.queuedRequestController.state,
NotificationServicesPushController:
this.notificationServicesPushController.state,
RemoteFeatureFlagController: this.remoteFeatureFlagController.state,
...resetOnRestartStore,
},
controllerMessenger: this.controllerMessenger,
});

Expand Down
17 changes: 6 additions & 11 deletions shared/types/metamask.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable import/no-restricted-paths */
/** Circular dependencies in this file should not have any performance impact, since all imports/exports are types that are stripped at runtime */

import type {
CurrencyRateState,
NftControllerState,
Expand All @@ -23,6 +22,7 @@ import type {
PermissionControllerState,
SubjectMetadataControllerState,
} from '@metamask/permission-controller';
import type { RemoteFeatureFlagControllerState } from '@metamask/remote-feature-flag-controller';
import type { SmartTransactionsControllerState } from '@metamask/smart-transactions-controller';
import type { SelectedNetworkControllerState } from '@metamask/selected-network-controller';
import type { LoggingControllerState } from '@metamask/logging-controller';
Expand All @@ -35,21 +35,16 @@ import type {
SnapsRegistryState,
} from '@metamask/snaps-controllers';
import type { AccountsControllerState } from '@metamask/accounts-controller';

///: BEGIN:ONLY_INCLUDE_IF(build-mmi)
import type { MmiConfigurationController } from '@metamask-institutional/custody-keyring';
import type { InstitutionalFeaturesController } from '@metamask-institutional/institutional-features';
import type { CustodyController } from '@metamask-institutional/custody-controller';
///: END:ONLY_INCLUDE_IF
import type { SignatureControllerState } from '@metamask/signature-controller';
import type { PPOMState } from '@metamask/ppom-validator';

import type { NameControllerState } from '@metamask/name-controller';

import type { QueuedRequestControllerState } from '@metamask/queued-request-controller';

import type { UserOperationControllerState } from '@metamask/user-operation-controller';

import type { TransactionControllerState } from '@metamask/transaction-controller';
import type {
AuthenticationController,
Expand All @@ -72,11 +67,10 @@ import type { AppMetadataControllerState } from '../../app/scripts/controllers/a
import type { DecryptMessageControllerState } from '../../app/scripts/controllers/decrypt-message';
import type { SwapsControllerState } from '../../app/scripts/controllers/swaps/swaps.types';
import type { BridgeControllerState } from '../../app/scripts/controllers/bridge/types';
import { MetaMetricsDataDeletionState } from '../../app/scripts/controllers/metametrics-data-deletion/metametrics-data-deletion';
import { MetaMetricsControllerState } from '../../app/scripts/controllers/metametrics-controller';
import { AccountTrackerControllerState } from '../../app/scripts/controllers/account-tracker-controller';

import { BridgeStatusControllerState } from './bridge-status';
import type { MetaMetricsDataDeletionState } from '../../app/scripts/controllers/metametrics-data-deletion/metametrics-data-deletion';
import type { MetaMetricsControllerState } from '../../app/scripts/controllers/metametrics-controller';
import type { AccountTrackerControllerState } from '../../app/scripts/controllers/account-tracker-controller';
import type { BridgeStatusControllerState } from './bridge-status';

export type ResetOnRestartStoresComposedState = {
AccountTracker: AccountTrackerControllerState;
Expand Down Expand Up @@ -141,6 +135,7 @@ export type StoreControllersComposedState =
UserStorageController: UserStorageController.UserStorageControllerState;
NotificationServicesController: NotificationServicesController.NotificationServicesControllerState;
NotificationServicesPushController: NotificationServicesPushController.NotificationServicesPushControllerState;
RemoteFeatureFlagController: RemoteFeatureFlagControllerState;
};

export type MemStoreControllersComposedState = Omit<
Expand Down

0 comments on commit ee9c45e

Please sign in to comment.