|
3 | 3 |
|
4 | 4 | import type { SnapManifest } from '@metamask/7715-permissions-shared/types'; |
5 | 5 |
|
| 6 | +// eslint-disable-next-line import/no-relative-packages |
| 7 | +import packageJson from './package.json' with { type: 'json' }; |
| 8 | + |
6 | 9 | const kernelSnapId = process.env.KERNEL_SNAP_ID; |
7 | 10 | const messageSnapId = process.env.MESSAGE_SIGNING_SNAP_ID; |
8 | 11 | const snapEnv = process.env.SNAP_ENV; |
9 | 12 | const manifest: SnapManifest = { |
10 | | - version: '0.3.0', |
| 13 | + version: packageJson.version, |
11 | 14 | description: 'Grants 7715 permissions from a DeleGator smart account', |
12 | 15 | proposedName: 'Gator Permissions', |
13 | 16 | repository: { |
@@ -48,7 +51,18 @@ if (kernelSnapId) { |
48 | 51 | } |
49 | 52 |
|
50 | 53 | 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 | + */ |
52 | 66 | manifest.initialPermissions['endowment:lifecycle-hooks'] = {}; |
53 | 67 | } |
54 | 68 |
|
|
0 commit comments