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

fix(snaps): Add missing controller names to ControllersToInitialize #30301

Merged
merged 10 commits into from
Feb 17, 2025
14 changes: 7 additions & 7 deletions app/scripts/controller-init/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ type ControllerMessengerCallback = (
BaseControllerMessenger: BaseControllerMessenger,
) => BaseRestrictedControllerMessenger;

type ControllersToInitialize = 'PPOMController' | 'TransactionController';
type ControllersToInitialize =
| 'PPOMController'
| 'TransactionController'
| 'RateLimitController'
| 'SnapController';
GuillaumeRx marked this conversation as resolved.
Show resolved Hide resolved

type InitFunction<Name extends ControllersToInitialize> =
ControllerInitFunction<
Expand Down Expand Up @@ -101,7 +105,6 @@ export function initControllers({
const messengerCallbacks = CONTROLLER_MESSENGERS[controllerName];

const controllerMessengerCallback =
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
messengerCallbacks?.getMessenger as ControllerMessengerCallback;

const initMessengerCallback =
Expand All @@ -120,11 +123,8 @@ export function initControllers({
initMessenger,
};

// TODO: Remove @ts-expect-error once base-controller version mismatch is resolved
// Instead of suppressing all type errors, we'll be specific about the controllerMessenger mismatch
const result = initFunction({
...finalInitRequest,
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
controllerMessenger: finalInitRequest.controllerMessenger,
});

Expand All @@ -144,8 +144,8 @@ export function initControllers({
const memStateKey =
memStateKeyRaw === null ? undefined : memStateKeyRaw ?? controllerName;

partialControllersByName[controllerName] = controller as Controller &
undefined;
// @ts-expect-error: Union too complex.
partialControllersByName[controllerName] = controller;

controllerApi = {
...controllerApi,
Expand Down
Loading