Skip to content

Commit 61cf238

Browse files
committed
Refactor snap manifest to use package version from package.json and enhance local development permissions documentation
1 parent 580122b commit 61cf238

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

packages/gator-permissions-snap/snap.manifest.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33

44
import type { SnapManifest } from '@metamask/7715-permissions-shared/types';
55

6+
// eslint-disable-next-line import/no-relative-packages
7+
import packageJson from './package.json' with { type: 'json' };
8+
69
const kernelSnapId = process.env.KERNEL_SNAP_ID;
710
const messageSnapId = process.env.MESSAGE_SIGNING_SNAP_ID;
811
const snapEnv = process.env.SNAP_ENV;
912
const manifest: SnapManifest = {
10-
version: '0.3.0',
13+
version: packageJson.version,
1114
description: 'Grants 7715 permissions from a DeleGator smart account',
1215
proposedName: 'Gator Permissions',
1316
repository: {
@@ -48,7 +51,18 @@ if (kernelSnapId) {
4851
}
4952

5053
if (snapEnv === 'local') {
51-
// Grant lifecycle hooks permission in local development environment
54+
/**
55+
* Grant lifecycle hooks permission in local development environment.
56+
*
57+
* The lifecycle hooks endowment is required to enable the onInstall handler
58+
* which automatically installs the message signing snap during local development.
59+
* This ensures that the gator permissions snap can establish the necessary
60+
* connection to the message signing snap for 7715 permissions functionality.
61+
*
62+
* In production environments, the message signing snap is pre-installed by
63+
* the MetaMask extension, making this endowment unnecessary and it's excluded
64+
* to minimize the snap's permission footprint.
65+
*/
5266
manifest.initialPermissions['endowment:lifecycle-hooks'] = {};
5367
}
5468

packages/permissions-kernel-snap/snap.manifest.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
/* eslint-disable no-restricted-globals */
33
import type { SnapManifest } from '@metamask/7715-permissions-shared/types';
44

5-
const gatorSnapId = process.env.GATOR_PERMISSIONS_PROVIDER_SNAP_ID;
5+
// eslint-disable-next-line import/no-relative-packages
6+
import packageJson from './package.json' with { type: 'json' };
67

78
const manifest: SnapManifest = {
8-
version: '0.3.0',
9+
version: packageJson.version,
910
description: 'Manage onchain 7715 permissions',
1011
proposedName: 'MetaMask Permissions Kernel',
1112
repository: {
@@ -33,10 +34,4 @@ const manifest: SnapManifest = {
3334
manifestVersion: '0.1',
3435
};
3536

36-
if (gatorSnapId) {
37-
manifest.initialConnections = {
38-
[gatorSnapId]: {},
39-
};
40-
}
41-
4237
export default manifest;

0 commit comments

Comments
 (0)