Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] Preview branch of complete ComposableController fix with no type error suppression #10374

Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2508142
Pin yarn resolution for `@metamask/base-controller` to `6.0.2`
MajorLift Jul 31, 2024
f848a68
Remove all `@ts-{expect-error,ignore}` directives on base-controller…
MajorLift Jul 31, 2024
37795b9
Fix `PPOMController` outdated base-controller version and missing `st…
MajorLift Jul 31, 2024
34a9752
Bump `@metamask/assets-controllers` from `^30.0.0` to `^37.0.0` to re…
MajorLift Jul 31, 2024
7e30987
Update controller state types that have been renamed
MajorLift Jul 31, 2024
99072a9
Fix `TokenBalancesController:stateChange` error, add `TokenBalancesCo…
MajorLift Jul 31, 2024
6487a84
Fix `name` property missing from `AssetsContractController`
MajorLift Jul 31, 2024
4a2908c
Add `AccountTrackerController`, `TokenRatesController` actions/events…
MajorLift Jul 29, 2024
b3ff544
Fix `AddressBookController:stateChange` error by updating to new pack…
MajorLift Jul 31, 2024
56e5bbc
Fix `TransactionController:stateChange` error by updating to new pack…
MajorLift Jul 31, 2024
6b301ce
Fix `NftController:stateChange` error by registering to `Global{Actio…
MajorLift Jul 29, 2024
4ea1202
Fix `SnapsRegistry:stateChange` error by creating yarn patch that exp…
MajorLift Jul 31, 2024
cc68d4a
Fix `PhishingController:stateChange` error by creating yarn patch tha…
MajorLift Jul 29, 2024
e5518b5
Fix `NotificationServicesController:stateChange` error by creating ya…
MajorLift Jul 29, 2024
4db53e8
Fix `{Authentication,UserStorage}Controller:stateChange` error by cre…
MajorLift Jul 31, 2024
3ab8991
Fix `LoggingController:stateChange` error by creating yarn patch that…
MajorLift Jul 29, 2024
1601618
Consolidate comments on ComposableController events allowlist
MajorLift Jul 29, 2024
36b966e
Apply core PR: "Move composable-controller utility types to base-cont…
MajorLift Aug 1, 2024
a9204a5
Add logic for excluding non-controllers from child controllers passed…
MajorLift Aug 1, 2024
6ba9da2
Remove non-controllers from `EngineState`
MajorLift Aug 1, 2024
141c010
Revert "Remove non-controllers from `EngineState`"
MajorLift Aug 2, 2024
85c8af6
Exclude non-controllers from the type argument for the `ComposableCo…
MajorLift Aug 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/dist/types/LoggingController.d.ts b/dist/types/LoggingController.d.ts
index 4f00c2991dfd20a47944944eacae96c636a2accf..a8a70110d6db24dfa24324369e7f11a96f77e790 100644
--- a/dist/types/LoggingController.d.ts
+++ b/dist/types/LoggingController.d.ts
@@ -1,4 +1,4 @@
-import type { RestrictedControllerMessenger } from '@metamask/base-controller';
+import type { RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import type { Log } from './logTypes';
/**
@@ -29,12 +29,15 @@ export declare type AddLog = {
type: `${typeof name}:add`;
handler: LoggingController['add'];
};
+export declare type LoggingControllerGetStateAction = ControllerGetStateAction<typeof name, LoggingControllerState>;
/**
* Currently only an alias, but the idea here is if future actions are needed
* this can transition easily into a union type.
*/
-export declare type LoggingControllerActions = AddLog;
-export declare type LoggingControllerMessenger = RestrictedControllerMessenger<typeof name, LoggingControllerActions, never, never, never>;
+export declare type LoggingControllerActions = LoggingControllerGetStateAction | AddLog;
+export declare type LoggingControllerStateChangeEvent = ControllerStateChangeEvent<typeof name, LoggingControllerState>;
+export declare type LoggingControllerEvents = LoggingControllerStateChangeEvent;
+export declare type LoggingControllerMessenger = RestrictedControllerMessenger<typeof name, LoggingControllerActions, LoggingControllerEvents, never, never>;
/**
* Controller that manages a list of logs for signature requests.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/dist/types/NotificationServicesController/NotificationServicesController.d.ts b/dist/types/NotificationServicesController/NotificationServicesController.d.ts
index 601da4f67dddf0da7d6fc00328d90ad29b6d92b3..965be3196681b666315a786dd16b46190e34950b 100644
--- a/dist/types/NotificationServicesController/NotificationServicesController.d.ts
+++ b/dist/types/NotificationServicesController/NotificationServicesController.d.ts
@@ -82,11 +82,13 @@ export type NotificationServicesControllerSelectIsNotificationServicesEnabled =
type: `${typeof controllerName}:selectIsNotificationServicesEnabled`;
handler: NotificationServicesController['selectIsNotificationServicesEnabled'];
};
-export type Actions = NotificationServicesControllerUpdateMetamaskNotificationsList | NotificationServicesControllerDisableNotificationServices | NotificationServicesControllerSelectIsNotificationServicesEnabled | ControllerGetStateAction<'state', NotificationServicesControllerState>;
+export type NotificationServicesControllerGetStateAction = ControllerGetStateAction<typeof controllerName, NotificationServicesControllerState>;
+export type NotificationServicesControllerActions = NotificationServicesControllerGetStateAction | NotificationServicesControllerUpdateMetamaskNotificationsList | NotificationServicesControllerDisableNotificationServices | NotificationServicesControllerSelectIsNotificationServicesEnabled;
export type AllowedActions = KeyringControllerGetAccountsAction | AuthenticationController.AuthenticationControllerGetBearerToken | AuthenticationController.AuthenticationControllerIsSignedIn | UserStorageController.UserStorageControllerEnableProfileSyncing | UserStorageController.UserStorageControllerGetStorageKey | UserStorageController.UserStorageControllerPerformGetStorage | UserStorageController.UserStorageControllerPerformSetStorage | NotificationServicesPushControllerEnablePushNotifications | NotificationServicesPushControllerDisablePushNotifications | NotificationServicesPushControllerUpdateTriggerPushNotifications;
-export type NotificationServicesControllerMessengerEvents = ControllerStateChangeEvent<typeof controllerName, NotificationServicesControllerState>;
+export type NotificationServicesControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, NotificationServicesControllerState>
+export type NotificationServicesControllerEvents = NotificationServicesControllerStateChangeEvent;
export type AllowedEvents = KeyringControllerStateChangeEvent | NotificationServicesPushControllerOnNewNotification;
-export type NotificationServicesControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
+export type NotificationServicesControllerMessenger = RestrictedControllerMessenger<typeof controllerName, NotificationServicesControllerActions | AllowedActions, NotificationServicesControllerEvents | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
Comment on lines +9 to +18
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type FeatureAnnouncementEnv = {
spaceId: string;
accessToken: string;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/dist/types/PhishingController.d.ts b/dist/types/PhishingController.d.ts
index 866e53b5b7bc447b2434b73a2b5a7b14dbb21145..e2624b79f8428152251196db1fd36d002f646e98 100644
--- a/dist/types/PhishingController.d.ts
+++ b/dist/types/PhishingController.d.ts
@@ -1,4 +1,4 @@
-import type { RestrictedControllerMessenger } from '@metamask/base-controller';
+import type { RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
export declare const PHISHING_CONFIG_BASE_URL = "https://phishing-detection.api.cx.metamask.io";
export declare const METAMASK_STALELIST_FILE = "/v1/stalelist";
@@ -172,7 +172,10 @@ export type TestOrigin = {
type: `${typeof controllerName}:testOrigin`;
handler: PhishingController['test'];
};
-export type PhishingControllerActions = MaybeUpdateState | TestOrigin;
+export type PhishingControllerGetStateAction = ControllerGetStateAction<typeof controllerName, PhishingControllerState>;
+export type PhishingControllerActions = PhishingControllerGetStateAction | MaybeUpdateState | TestOrigin;
+export type PhishingControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, PhishingControllerState>;
+export type PhishingControllerEvents = PhishingControllerStateChangeEvent;
export type PhishingControllerMessenger = RestrictedControllerMessenger<typeof controllerName, PhishingControllerActions, never, never, never>;
/**
* Controller that manages community-maintained lists of approved and unapproved website origins.
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/dist/types/controllers/authentication/AuthenticationController.d.ts b/dist/types/controllers/authentication/AuthenticationController.d.ts
index 03de3c60c5ce203ba45d316d42fe28827cca435c..e8634e9cc9faabec8c1190bce3980dcf46a7287f 100644
--- a/dist/types/controllers/authentication/AuthenticationController.d.ts
+++ b/dist/types/controllers/authentication/AuthenticationController.d.ts
@@ -1,4 +1,4 @@
-import type { RestrictedControllerMessenger } from '@metamask/base-controller';
+import type { RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import type { HandleSnapRequest } from '@metamask/snaps-controllers';
import type { UserStorageControllerDisableProfileSyncing } from '../user-storage/UserStorageController';
@@ -35,14 +35,17 @@ type CreateActionsObj<Controller extends keyof AuthenticationController> = {
};
};
type ActionsObj = CreateActionsObj<'performSignIn' | 'performSignOut' | 'getBearerToken' | 'getSessionProfile' | 'isSignedIn'>;
-export type Actions = ActionsObj[keyof ActionsObj];
+export type AuthenticationControllerGetStateAction = ControllerGetStateAction<typeof controllerName, AuthenticationControllerState>;
+export type AuthenticationControllerActions = ActionsObj[keyof ActionsObj];
export type AuthenticationControllerPerformSignIn = ActionsObj['performSignIn'];
export type AuthenticationControllerPerformSignOut = ActionsObj['performSignOut'];
export type AuthenticationControllerGetBearerToken = ActionsObj['getBearerToken'];
export type AuthenticationControllerGetSessionProfile = ActionsObj['getSessionProfile'];
export type AuthenticationControllerIsSignedIn = ActionsObj['isSignedIn'];
export type AllowedActions = HandleSnapRequest | UserStorageControllerDisableProfileSyncing;
-export type AuthenticationControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, never, AllowedActions['type'], never>;
+export type AuthenticationControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, AuthenticationControllerState>
+export type AuthenticationControllerEvents = AuthenticationControllerStateChangeEvent;
+export type AuthenticationControllerMessenger = RestrictedControllerMessenger<typeof controllerName, AuthenticationControllerGetStateAction | AllowedActions, AuthenticationControllerEvents, AllowedActions['type'], never>;
/**
* Controller that enables authentication for restricted endpoints.
* Used for Global Profile Syncing and Notifications
diff --git a/dist/types/controllers/user-storage/UserStorageController.d.ts b/dist/types/controllers/user-storage/UserStorageController.d.ts
index b0e10b67c70a9e9c4ea7a5412c922b9d67cd01aa..74fb153105d798987a9cf3ec851e4cc362614da7 100644
--- a/dist/types/controllers/user-storage/UserStorageController.d.ts
+++ b/dist/types/controllers/user-storage/UserStorageController.d.ts
@@ -1,4 +1,4 @@
-import type { RestrictedControllerMessenger } from '@metamask/base-controller';
+import type { RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import type { HandleSnapRequest } from '@metamask/snaps-controllers';
import type { AuthenticationControllerGetBearerToken, AuthenticationControllerGetSessionProfile, AuthenticationControllerIsSignedIn, AuthenticationControllerPerformSignIn, AuthenticationControllerPerformSignOut } from '../authentication/AuthenticationController';
@@ -30,14 +30,17 @@ type CreateActionsObj<Controller extends keyof UserStorageController> = {
};
};
type ActionsObj = CreateActionsObj<'performGetStorage' | 'performSetStorage' | 'getStorageKey' | 'enableProfileSyncing' | 'disableProfileSyncing'>;
-export type Actions = ActionsObj[keyof ActionsObj];
+export type UserStorageControllerGetStateAction = ControllerGetStateAction<typeof controllerName, UserStorageControllerState>;
+export type UserStorageControllerActions = ActionsObj[keyof ActionsObj];
export type UserStorageControllerPerformGetStorage = ActionsObj['performGetStorage'];
export type UserStorageControllerPerformSetStorage = ActionsObj['performSetStorage'];
export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
export type UserStorageControllerEnableProfileSyncing = ActionsObj['enableProfileSyncing'];
export type UserStorageControllerDisableProfileSyncing = ActionsObj['disableProfileSyncing'];
export type AllowedActions = HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AuthenticationControllerPerformSignOut | NotificationServicesControllerDisableNotificationServices | NotificationServicesControllerSelectIsNotificationServicesEnabled;
-export type UserStorageControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, never, AllowedActions['type'], never>;
+export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
+export type UserStorageControllerEvents = UserStorageControllerStateChangeEvent;
+export type UserStorageControllerMessenger = RestrictedControllerMessenger<typeof controllerName, UserStorageControllerActions | AllowedActions, UserStorageControllerEvents, AllowedActions['type'], never>;
/**
* Reusable controller that allows any team to store synchronized data for a given user.
* These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/dist/types/snaps/registry/json.d.ts b/dist/types/snaps/registry/json.d.ts
index 4d36ce09af223f423de71b1ffff5afc285ca6c99..27a00b395ef7d1d0f13ebe6424086a07fce314ba 100644
--- a/dist/types/snaps/registry/json.d.ts
+++ b/dist/types/snaps/registry/json.d.ts
@@ -1,4 +1,4 @@
-import type { RestrictedControllerMessenger } from '@metamask/base-controller';
+import type { RestrictedControllerMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import type { SnapsRegistryDatabase } from '@metamask/snaps-registry';
import type { Hex } from '@metamask/utils';
@@ -32,8 +32,11 @@ export declare type Update = {
type: `${typeof controllerName}:update`;
handler: SnapsRegistry['update'];
};
+
+export declare type SnapsRegistryGetStateAction = ControllerGetStateAction<typeof controllerName, SnapsRegistryState>;
export declare type SnapsRegistryActions = GetResult | GetMetadata | Update | ResolveVersion;
-export declare type SnapsRegistryEvents = never;
+export declare type SnapsRegistryStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, SnapsRegistryState>;
+export declare type SnapsRegistryEvents = SnapsRegistryStateChangeEvent;
export declare type SnapsRegistryMessenger = RestrictedControllerMessenger<'SnapsRegistry', SnapsRegistryActions, SnapsRegistryEvents, SnapsRegistryActions['type'], SnapsRegistryEvents['type']>;
export declare type SnapsRegistryState = {
database: SnapsRegistryDatabase | null;
Loading
Loading