Skip to content

Commit

Permalink
[FLASK] Bump Snaps packages (#20230)
Browse files Browse the repository at this point in the history
* Bump Snaps packages

* Add endowment:lifecycle-hooks permission

* Run yarn lint:fix

* Fix unit test

* Update LavaMoat policies

---------

Co-authored-by: MetaMask Bot <metamaskbot@users.noreply.github.com>
  • Loading branch information
Mrtenz and metamaskbot authored Jul 28, 2023
1 parent 553da10 commit 01a3a5d
Show file tree
Hide file tree
Showing 10 changed files with 212 additions and 44 deletions.
8 changes: 8 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,8 @@ export default class MetamaskController extends EventEmitter {
'ExecutionService:unhandledError',
'ExecutionService:outboundRequest',
'ExecutionService:outboundResponse',
'SnapController:snapInstalled',
'SnapController:snapUpdated',
],
allowedActions: [
`${this.permissionController.name}:getEndowments`,
Expand Down
4 changes: 2 additions & 2 deletions builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ buildTypes:
- SEGMENT_FLASK_WRITE_KEY
- ALLOW_LOCAL_SNAPS: true
- REQUIRE_SNAPS_ALLOWLIST: false
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.37.1-flask.1/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.38.0-flask.1/index.html
- SUPPORT_LINK: https://metamask-flask.zendesk.com/hc
- SUPPORT_REQUEST_LINK: https://metamask-flask.zendesk.com/hc/en-us/requests/new
- INFURA_ENV_KEY_REF: INFURA_FLASK_PROJECT_ID
Expand All @@ -72,7 +72,7 @@ buildTypes:
- SEGMENT_FLASK_WRITE_KEY
- ALLOW_LOCAL_SNAPS: true
- REQUIRE_SNAPS_ALLOWLIST: false
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.37.1-flask.1/index.html
- IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/0.38.0-flask.1/index.html
- SUPPORT_LINK: https://metamask-flask.zendesk.com/hc
- SUPPORT_REQUEST_LINK: https://metamask-flask.zendesk.com/hc/en-us/requests/new
- INFURA_ENV_KEY_REF: INFURA_FLASK_PROJECT_ID
Expand Down
55 changes: 54 additions & 1 deletion lavamoat/browserify/desktop/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,9 @@
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
Expand Down Expand Up @@ -2200,7 +2203,7 @@
"@metamask/key-tree>@noble/hashes": true,
"@metamask/permission-controller": true,
"@metamask/snaps-controllers-flask>@metamask/rpc-methods>@metamask/snaps-ui": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/rpc-methods>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"eth-rpc-errors": true,
"superstruct": true
Expand All @@ -2212,6 +2215,34 @@
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/rpc-methods>@metamask/snaps-utils": {
"globals": {
"TextDecoder": true,
"URL": true,
"console.error": true,
"console.log": true,
"console.warn": true,
"document.body.appendChild": true,
"document.createElement": true
},
"packages": {
"@metamask/key-tree": true,
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": {
"globals": {
"TextDecoder": true,
Expand All @@ -2233,6 +2264,9 @@
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
Expand Down Expand Up @@ -2441,6 +2475,9 @@
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
Expand Down Expand Up @@ -3589,6 +3626,22 @@
"document.createElement": true
}
},
"chalk": {
"packages": {
"chalk>ansi-styles": true,
"chalk>supports-color": true
}
},
"chalk>ansi-styles": {
"packages": {
"chalk>ansi-styles>color-convert": true
}
},
"chalk>ansi-styles>color-convert": {
"packages": {
"jest-canvas-mock>moo-color>color-name": true
}
},
"classnames": {
"globals": {
"classNames": "write",
Expand Down
55 changes: 54 additions & 1 deletion lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,9 @@
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
Expand Down Expand Up @@ -2200,7 +2203,7 @@
"@metamask/key-tree>@noble/hashes": true,
"@metamask/permission-controller": true,
"@metamask/snaps-controllers-flask>@metamask/rpc-methods>@metamask/snaps-ui": true,
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/rpc-methods>@metamask/snaps-utils": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"eth-rpc-errors": true,
"superstruct": true
Expand All @@ -2212,6 +2215,34 @@
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/rpc-methods>@metamask/snaps-utils": {
"globals": {
"TextDecoder": true,
"URL": true,
"console.error": true,
"console.log": true,
"console.warn": true,
"document.body.appendChild": true,
"document.createElement": true
},
"packages": {
"@metamask/key-tree": true,
"@metamask/key-tree>@noble/hashes": true,
"@metamask/key-tree>@scure/base": true,
"@metamask/snaps-controllers-flask>@metamask/utils": true,
"@metamask/snaps-utils-flask>is-svg": true,
"@metamask/snaps-utils>cron-parser": true,
"@metamask/snaps-utils>fast-json-stable-stringify": true,
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
},
"@metamask/snaps-controllers-flask>@metamask/snaps-utils": {
"globals": {
"TextDecoder": true,
Expand All @@ -2233,6 +2264,9 @@
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
Expand Down Expand Up @@ -2441,6 +2475,9 @@
"@metamask/snaps-utils>rfdc": true,
"@metamask/snaps-utils>validate-npm-package-name": true,
"browserify>buffer": true,
"browserify>path-browserify": true,
"browserify>process": true,
"chalk": true,
"semver": true,
"superstruct": true
}
Expand Down Expand Up @@ -3589,6 +3626,22 @@
"document.createElement": true
}
},
"chalk": {
"packages": {
"chalk>ansi-styles": true,
"chalk>supports-color": true
}
},
"chalk>ansi-styles": {
"packages": {
"chalk>ansi-styles>color-convert": true
}
},
"chalk>ansi-styles>color-convert": {
"packages": {
"jest-canvas-mock>moo-color>color-name": true
}
},
"classnames": {
"globals": {
"classNames": "write",
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,18 @@
"@metamask/providers": "^11.1.0",
"@metamask/rate-limit-controller": "^3.0.0",
"@metamask/rpc-methods": "^1.0.0-prerelease.1",
"@metamask/rpc-methods-flask": "npm:@metamask/rpc-methods@0.37.1-flask.1",
"@metamask/rpc-methods-flask": "npm:@metamask/rpc-methods@0.37.2-flask.1",
"@metamask/safe-event-emitter": "^2.0.0",
"@metamask/scure-bip39": "^2.0.3",
"@metamask/signature-controller": "^5.3.0",
"@metamask/slip44": "^3.0.0",
"@metamask/smart-transactions-controller": "^4.0.0",
"@metamask/snaps-controllers": "^1.0.0-prerelease.1",
"@metamask/snaps-controllers-flask": "npm:@metamask/snaps-controllers@0.37.1-flask.1",
"@metamask/snaps-controllers-flask": "npm:@metamask/snaps-controllers@0.38.0-flask.1",
"@metamask/snaps-ui": "^1.0.0-prerelease.1",
"@metamask/snaps-ui-flask": "npm:@metamask/snaps-ui@0.37.1-flask.1",
"@metamask/snaps-ui-flask": "npm:@metamask/snaps-ui@0.37.3-flask.1",
"@metamask/snaps-utils": "^1.0.0-prerelease.1",
"@metamask/snaps-utils-flask": "npm:@metamask/snaps-utils@0.37.1-flask.1",
"@metamask/snaps-utils-flask": "npm:@metamask/snaps-utils@0.38.0-flask.1",
"@metamask/subject-metadata-controller": "^2.0.0",
"@metamask/utils": "^5.0.0",
"@ngraveio/bc-ur": "^1.1.6",
Expand Down
4 changes: 3 additions & 1 deletion shared/constants/permissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import {

describe('EndowmentPermissions', () => {
it('has the expected permission keys', () => {
// Since long-running is fenced out this causes problems with the test, we re-add it here.
// Since some permissions are fenced out, this causes problems with the
// test, so we re-add them here.
expect(Object.keys(EndowmentPermissions).sort()).toStrictEqual(
[
'endowment:long-running',
'endowment:lifecycle-hooks',
...Object.keys(endowmentPermissionBuilders).filter(
(targetName) =>
!Object.keys(ExcludedSnapEndowments).includes(targetName),
Expand Down
7 changes: 5 additions & 2 deletions shared/constants/snaps/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const EndowmentPermissions = Object.freeze({
'endowment:webassembly': 'endowment:webassembly',
///: BEGIN:ONLY_INCLUDE_IN(build-flask)
'endowment:long-running': 'endowment:long-running',
'endowment:lifecycle-hooks': 'endowment:lifecycle-hooks',
///: END:ONLY_INCLUDE_IN
} as const);

Expand All @@ -18,15 +19,17 @@ export const ExcludedSnapPermissions = Object.freeze({
'This permission is still in development and therefore not available.',
///: END:ONLY_INCLUDE_IN
eth_accounts:
'eth_accounts is disabled. For more information please see https://github.com/MetaMask/snaps-monorepo/issues/990.',
'eth_accounts is disabled. For more information please see https://github.com/MetaMask/snaps/issues/990.',
});

export const ExcludedSnapEndowments = Object.freeze({
///: BEGIN:ONLY_INCLUDE_IN(build-main)
'endowment:keyring':
'This endowment is still in development therefore not available.',
'endowment:long-running':
'endowment:long-running is deprecated. For more information please see https://github.com/MetaMask/snaps-monorepo/issues/945.',
'endowment:long-running is deprecated. For more information please see https://github.com/MetaMask/snaps/issues/945.',
'endowment:lifecycle-hooks':
'This endowment is experimental and therefore not available.',
///: END:ONLY_INCLUDE_IN
});

Expand Down
6 changes: 6 additions & 0 deletions ui/helpers/utils/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({

return results;
},
[EndowmentPermissions['endowment:lifecycle-hooks']]: ({ t }) => ({
label: t('permission_lifecycleHooks'),
description: t('permission_lifecycleHooksDescription'),
leftIcon: IconName.Hierarchy,
weight: 3,
}),
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(keyring-snaps)
[RestrictedMethods.snap_manageAccounts]: ({ t }) => ({
Expand Down
Loading

0 comments on commit 01a3a5d

Please sign in to comment.