Skip to content

Commit

Permalink
chore: bump MetaMask dependencies (#2460)
Browse files Browse the repository at this point in the history
Bump several MetaMask dependencies to latest, closing a bunch of
dependabot PRs.
  • Loading branch information
FrederikBolding committed Jun 7, 2024
1 parent 4c8ee13 commit 1bf7e4f
Show file tree
Hide file tree
Showing 28 changed files with 147 additions and 105 deletions.
12 changes: 6 additions & 6 deletions packages/snaps-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
"build:ci": "tsup --clean"
},
"dependencies": {
"@metamask/approval-controller": "^6.0.2",
"@metamask/base-controller": "^5.0.2",
"@metamask/json-rpc-engine": "^8.0.1",
"@metamask/json-rpc-middleware-stream": "^7.0.1",
"@metamask/approval-controller": "^7.0.0",
"@metamask/base-controller": "^6.0.0",
"@metamask/json-rpc-engine": "^9.0.0",
"@metamask/json-rpc-middleware-stream": "^8.0.0",
"@metamask/object-multiplex": "^2.0.0",
"@metamask/permission-controller": "^9.0.2",
"@metamask/phishing-controller": "^9.0.1",
"@metamask/permission-controller": "^10.0.0",
"@metamask/phishing-controller": "^10.0.0",
"@metamask/post-message-stream": "^8.1.0",
"@metamask/rpc-errors": "^6.2.1",
"@metamask/snaps-registry": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"console": true
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand All @@ -52,6 +52,13 @@
"readable-stream": true
}
},
"@metamask/providers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/rpc-errors": true,
"@metamask/utils": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"console": true
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand All @@ -59,6 +59,13 @@
"readable-stream": true
}
},
"@metamask/providers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/rpc-errors": true,
"@metamask/utils": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"console": true
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand All @@ -59,6 +59,13 @@
"readable-stream": true
}
},
"@metamask/providers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/rpc-errors": true,
"@metamask/utils": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"console": true
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
Expand All @@ -52,6 +52,13 @@
"readable-stream": true
}
},
"@metamask/providers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/rpc-errors": true,
"@metamask/utils": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-execution-environments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"build:ci": "tsup --clean"
},
"dependencies": {
"@metamask/json-rpc-engine": "^8.0.1",
"@metamask/json-rpc-engine": "^9.0.0",
"@metamask/object-multiplex": "^2.0.0",
"@metamask/post-message-stream": "^8.1.0",
"@metamask/providers": "^17.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/snaps-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"@jest/environment": "^29.5.0",
"@jest/expect": "^29.5.0",
"@jest/globals": "^29.5.0",
"@metamask/base-controller": "^5.0.2",
"@metamask/base-controller": "^6.0.0",
"@metamask/eth-json-rpc-middleware": "^12.1.1",
"@metamask/json-rpc-engine": "^8.0.1",
"@metamask/json-rpc-middleware-stream": "^7.0.1",
"@metamask/json-rpc-engine": "^9.0.0",
"@metamask/json-rpc-middleware-stream": "^8.0.0",
"@metamask/key-tree": "^9.1.1",
"@metamask/permission-controller": "^9.0.2",
"@metamask/permission-controller": "^10.0.0",
"@metamask/snaps-controllers": "workspace:^",
"@metamask/snaps-execution-environments": "workspace:^",
"@metamask/snaps-rpc-methods": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-rpc-methods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"dependencies": {
"@metamask/key-tree": "^9.1.1",
"@metamask/permission-controller": "^9.0.2",
"@metamask/permission-controller": "^10.0.0",
"@metamask/rpc-errors": "^6.2.1",
"@metamask/snaps-sdk": "workspace:^",
"@metamask/snaps-utils": "workspace:^",
Expand All @@ -55,7 +55,7 @@
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/json-rpc-engine": "^8.0.1",
"@metamask/json-rpc-engine": "^9.0.0",
"@swc/core": "1.3.78",
"@swc/jest": "^0.2.26",
"@types/node": "18.14.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-rpc-methods/src/endowments/cronjob.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('endowment:cronjob', () => {
subjectTypes: [SubjectType.Snap],
});

expect(specification.endowmentGetter()).toBeUndefined();
expect(specification.endowmentGetter()).toBeNull();
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-rpc-methods/src/endowments/cronjob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const permissionName = SnapEndowments.Cronjob;
type CronjobEndowmentSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: any) => undefined;
endowmentGetter: (_options?: any) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
}>;

Expand All @@ -42,7 +42,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
permissionType: PermissionType.Endowment,
targetName: permissionName,
allowedCaveats: [SnapCaveatType.SnapCronjob],
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
subjectTypes: [SubjectType.Snap],
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ describe('endowment:page-home', () => {
subjectTypes: [SubjectType.Snap],
});

expect(specification.endowmentGetter()).toBeUndefined();
expect(specification.endowmentGetter()).toBeNull();
});
});
4 changes: 2 additions & 2 deletions packages/snaps-rpc-methods/src/endowments/home-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const permissionName = SnapEndowments.HomePage;
type HomePageEndowmentSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: EndowmentGetterParams) => undefined;
endowmentGetter: (_options?: EndowmentGetterParams) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
}>;

Expand All @@ -34,7 +34,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
permissionType: PermissionType.Endowment,
targetName: permissionName,
allowedCaveats: null,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
subjectTypes: [SubjectType.Snap],
};
};
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-rpc-methods/src/endowments/keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const permissionName = SnapEndowments.Keyring;
type KeyringEndowmentSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: EndowmentGetterParams) => undefined;
endowmentGetter: (_options?: EndowmentGetterParams) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
validator: PermissionValidatorConstraint;
subjectTypes: readonly SubjectType[];
Expand All @@ -47,7 +47,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
SnapCaveatType.KeyringOrigin,
SnapCaveatType.MaxRequestTime,
],
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
validator: createGenericPermissionValidator([
{ type: SnapCaveatType.KeyringOrigin },
{ type: SnapCaveatType.MaxRequestTime, optional: true },
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-rpc-methods/src/endowments/lifecycle-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const permissionName = SnapEndowments.LifecycleHooks;
type LifecycleHooksEndowmentSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: EndowmentGetterParams) => undefined;
endowmentGetter: (_options?: EndowmentGetterParams) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
}>;

Expand All @@ -34,7 +34,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
permissionType: PermissionType.Endowment,
targetName: permissionName,
allowedCaveats: null,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
subjectTypes: [SubjectType.Snap],
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('endowment:name-lookup', () => {
validator: expect.any(Function),
});

expect(specification.endowmentGetter()).toBeUndefined();
expect(specification.endowmentGetter()).toBeNull();
});

describe('validator', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-rpc-methods/src/endowments/name-lookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const permissionName = SnapEndowments.NameLookup;
type NameLookupEndowmentSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: EndowmentGetterParams) => undefined;
endowmentGetter: (_options?: EndowmentGetterParams) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
validator: PermissionValidatorConstraint;
}>;
Expand All @@ -57,7 +57,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
SnapCaveatType.LookupMatchers,
SnapCaveatType.MaxRequestTime,
],
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
validator: createGenericPermissionValidator([
{ type: SnapCaveatType.ChainIds, optional: true },
{ type: SnapCaveatType.LookupMatchers, optional: true },
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-rpc-methods/src/endowments/rpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('endowment:rpc', () => {
subjectTypes: [SubjectType.Snap],
});

expect(specification.endowmentGetter()).toBeUndefined();
expect(specification.endowmentGetter()).toBeNull();
});

describe('validator', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/snaps-rpc-methods/src/endowments/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const targetName = SnapEndowments.Rpc;
type RpcSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof targetName;
endowmentGetter: (_options?: any) => undefined;
endowmentGetter: (_options?: any) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
validator: PermissionValidatorConstraint;
subjectTypes: readonly SubjectType[];
Expand All @@ -47,7 +47,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
permissionType: PermissionType.Endowment,
targetName,
allowedCaveats: [SnapCaveatType.RpcOrigin, SnapCaveatType.MaxRequestTime],
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
validator: createGenericPermissionValidator([
{ type: SnapCaveatType.RpcOrigin },
{ type: SnapCaveatType.MaxRequestTime, optional: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('endowment:signature-insight', () => {
subjectTypes: [SubjectType.Snap],
});

expect(specification.endowmentGetter()).toBeUndefined();
expect(specification.endowmentGetter()).toBeNull();
});

describe('validator', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const permissionName = SnapEndowments.SignatureInsight;
type SignatureInsightEndowmentSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: EndowmentGetterParams) => undefined;
endowmentGetter: (_options?: EndowmentGetterParams) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
validator: PermissionValidatorConstraint;
}>;
Expand All @@ -42,7 +42,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
permissionType: PermissionType.Endowment,
targetName: permissionName,
allowedCaveats: [SnapCaveatType.SignatureOrigin],
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
validator: createGenericPermissionValidator([
{ type: SnapCaveatType.SignatureOrigin, optional: true },
{ type: SnapCaveatType.MaxRequestTime, optional: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('endowment:transaction-insight', () => {
subjectTypes: [SubjectType.Snap],
});

expect(specification.endowmentGetter()).toBeUndefined();
expect(specification.endowmentGetter()).toBeNull();
});

describe('validator', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const permissionName = SnapEndowments.TransactionInsight;
type TransactionInsightEndowmentSpecification = ValidPermissionSpecification<{
permissionType: PermissionType.Endowment;
targetName: typeof permissionName;
endowmentGetter: (_options?: EndowmentGetterParams) => undefined;
endowmentGetter: (_options?: EndowmentGetterParams) => null;
allowedCaveats: Readonly<NonEmptyArray<string>> | null;
validator: PermissionValidatorConstraint;
}>;
Expand All @@ -45,7 +45,7 @@ const specificationBuilder: PermissionSpecificationBuilder<
SnapCaveatType.TransactionOrigin,
SnapCaveatType.MaxRequestTime,
],
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => undefined,
endowmentGetter: (_getterOptions?: EndowmentGetterParams) => null,
validator: createGenericPermissionValidator([
{ type: SnapCaveatType.TransactionOrigin, optional: true },
{ type: SnapCaveatType.MaxRequestTime, optional: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,12 @@ export const PermittedCoinTypesCaveatSpecification: Record<
> = {
[SnapCaveatType.PermittedCoinTypes]: Object.freeze({
type: SnapCaveatType.PermittedCoinTypes,
decorator: (
method,
caveat: Caveat<
SnapCaveatType.PermittedCoinTypes,
GetBip44EntropyParams[]
>,
) => {
decorator: (method, caveat) => {
return async (args) => {
const { params } = args;
validateBIP44Params(params);

const coinType = caveat.value.find(
const coinType = (caveat.value as GetBip44EntropyParams[]).find(
(caveatValue) => caveatValue.coinType === params.coinType,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,12 @@ export const PermittedDerivationPathsCaveatSpecification: Record<
> = {
[SnapCaveatType.PermittedDerivationPaths]: Object.freeze({
type: SnapCaveatType.PermittedDerivationPaths,
decorator: (
method,
caveat: Caveat<SnapCaveatType.PermittedDerivationPaths, Bip32Entropy[]>,
) => {
decorator: (method, caveat) => {
return async (args) => {
const { params } = args;
validateBIP32Path(params);

const path = caveat.value.find(
const path = (caveat.value as Bip32Entropy[]).find(
(caveatPath) =>
isEqual(
params.path.slice(0, caveatPath.path.length),
Expand Down
Loading

0 comments on commit 1bf7e4f

Please sign in to comment.