Skip to content

Commit b7fe7d5

Browse files
committed
Remove useCaip25Permission feature flag
1 parent 354b572 commit b7fe7d5

File tree

3 files changed

+4
-82
lines changed

3 files changed

+4
-82
lines changed

packages/snaps-controllers/coverage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"branches": 93.68,
2+
"branches": 93.66,
33
"functions": 98.17,
44
"lines": 98.51,
55
"statements": 98.35

packages/snaps-controllers/src/snaps/SnapController.test.tsx

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5696,7 +5696,7 @@ describe('SnapController', () => {
56965696
snapController.destroy();
56975697
});
56985698

5699-
it('grants the `endowment:caip25` permission to a Snap with `endowment:ethereum-provider` if the `useCaip25Permission` feature flag is enabled', async () => {
5699+
it('grants the `endowment:caip25` permission to a Snap with `endowment:ethereum-provider`', async () => {
57005700
const rootMessenger = getControllerMessenger();
57015701
const messenger = getSnapControllerMessenger(rootMessenger);
57025702

@@ -5732,9 +5732,6 @@ describe('SnapController', () => {
57325732
getSnapControllerOptions({
57335733
messenger,
57345734
detectSnapLocation: loopbackDetect({ manifest }),
5735-
featureFlags: {
5736-
useCaip25Permission: true,
5737-
},
57385735
}),
57395736
);
57405737

@@ -5778,7 +5775,7 @@ describe('SnapController', () => {
57785775
snapController.destroy();
57795776
});
57805777

5781-
it('grants the `endowment:caip25` permission when updating a Snap with `endowment:ethereum-provider` if the `useCaip25Permission` feature flag is enabled', async () => {
5778+
it('grants the `endowment:caip25` permission when updating a Snap with `endowment:ethereum-provider`', async () => {
57825779
const newVersion = '1.0.2';
57835780
const newVersionRange = '>=1.0.1';
57845781

@@ -5838,9 +5835,6 @@ describe('SnapController', () => {
58385835
getSnapControllerOptions({
58395836
messenger,
58405837
detectSnapLocation: detectLocationMock,
5841-
featureFlags: {
5842-
useCaip25Permission: true,
5843-
},
58445838
}),
58455839
);
58465840

@@ -5911,71 +5905,6 @@ describe('SnapController', () => {
59115905
controller.destroy();
59125906
});
59135907

5914-
it('does not grant the `endowment:caip25` permission to a Snap with `endowment:ethereum-provider` if the `useCaip25Permission` feature flag is disabled', async () => {
5915-
const rootMessenger = getControllerMessenger();
5916-
const messenger = getSnapControllerMessenger(rootMessenger);
5917-
5918-
rootMessenger.registerActionHandler(
5919-
'PermissionController:getPermissions',
5920-
() => ({}),
5921-
);
5922-
5923-
rootMessenger.registerActionHandler(
5924-
'SelectedNetworkController:getNetworkClientIdForDomain',
5925-
() => 'mainnet',
5926-
);
5927-
5928-
rootMessenger.registerActionHandler(
5929-
'NetworkController:getNetworkClientById',
5930-
() => ({
5931-
configuration: {
5932-
chainId: '0x1',
5933-
},
5934-
}),
5935-
);
5936-
5937-
const { manifest } = await getMockSnapFilesWithUpdatedChecksum({
5938-
manifest: getSnapManifest({
5939-
initialPermissions: {
5940-
'endowment:page-home': {},
5941-
'endowment:ethereum-provider': {},
5942-
},
5943-
}),
5944-
});
5945-
5946-
const snapController = getSnapController(
5947-
getSnapControllerOptions({
5948-
messenger,
5949-
detectSnapLocation: loopbackDetect({ manifest }),
5950-
featureFlags: {
5951-
useCaip25Permission: false,
5952-
},
5953-
}),
5954-
);
5955-
5956-
await snapController.installSnaps(MOCK_ORIGIN, {
5957-
[MOCK_SNAP_ID]: {},
5958-
});
5959-
5960-
const approvedPermissions = {
5961-
'endowment:page-home': {
5962-
caveats: null,
5963-
},
5964-
'endowment:ethereum-provider': {},
5965-
};
5966-
5967-
expect(messenger.call).toHaveBeenCalledWith(
5968-
'PermissionController:grantPermissions',
5969-
{
5970-
approvedPermissions,
5971-
subject: { origin: MOCK_SNAP_ID },
5972-
requestData: expect.any(Object),
5973-
},
5974-
);
5975-
5976-
snapController.destroy();
5977-
});
5978-
59795908
it('does not grant the `endowment:caip25` permission if the Snap does not have the `endowment:ethereum-provider` permission', async () => {
59805909
const rootMessenger = getControllerMessenger();
59815910
const messenger = getSnapControllerMessenger(rootMessenger);
@@ -6011,9 +5940,6 @@ describe('SnapController', () => {
60115940
getSnapControllerOptions({
60125941
messenger,
60135942
detectSnapLocation: loopbackDetect({ manifest }),
6014-
featureFlags: {
6015-
useCaip25Permission: true,
6016-
},
60175943
}),
60185944
);
60195945

packages/snaps-controllers/src/snaps/SnapController.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,6 @@ type FeatureFlags = {
689689
allowLocalSnaps?: boolean;
690690
disableSnapInstallation?: boolean;
691691
rejectInvalidPlatformVersion?: boolean;
692-
useCaip25Permission?: boolean;
693692
};
694693

695694
type DynamicFeatureFlags = {
@@ -4254,10 +4253,7 @@ export class SnapController extends BaseController<
42544253
* @returns The permissions to grant to the Snap.
42554254
*/
42564255
#getPermissionsToGrant(snapId: SnapId, newPermissions: RequestedPermissions) {
4257-
if (
4258-
this.#featureFlags.useCaip25Permission &&
4259-
Object.keys(newPermissions).includes(SnapEndowments.EthereumProvider)
4260-
) {
4256+
if (Object.keys(newPermissions).includes(SnapEndowments.EthereumProvider)) {
42614257
// This will return the globally selected network if the Snap doesn't have
42624258
// one set.
42634259
const networkClientId = this.messagingSystem.call(

0 commit comments

Comments
 (0)