From 805f8602e263512c98e67cc492234746c81b0506 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Thu, 27 Jul 2023 11:21:17 +0200 Subject: [PATCH 1/5] Bump Snaps packages --- app/scripts/metamask-controller.js | 2 + builds.yml | 4 +- lavamoat/browserify/desktop/policy.json | 55 +++++++++- lavamoat/browserify/flask/policy.json | 55 +++++++++- lavamoat/build-system/policy.json | 132 ++++++++++++++++++++++-- package.json | 8 +- yarn.lock | 107 +++++++++++++------ 7 files changed, 314 insertions(+), 49 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index dbea5e3ffb98..29f1a1a4ea63 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -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`, diff --git a/builds.yml b/builds.yml index eb178509ffdb..d11fcf08b7d1 100644 --- a/builds.yml +++ b/builds.yml @@ -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 @@ -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 diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index 9ea8e5e2c533..a6805b21fab7 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -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 } @@ -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 @@ -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, @@ -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 } @@ -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 } @@ -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", diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 9ea8e5e2c533..a6805b21fab7 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -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 } @@ -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 @@ -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, @@ -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 } @@ -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 } @@ -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", diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 521216647783..68da7b7322aa 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -1134,6 +1134,21 @@ "string.prototype.matchall>side-channel": true } }, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": { + "builtin": { + "os.type": true + }, + "globals": { + "process.env.LANG": true, + "process.env.LC_ALL": true, + "process.env.LC_CTYPE": true + } + }, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": { + "packages": { + "yargs>string-width": true + } + }, "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": { "builtin": { "os.homedir": true @@ -5017,6 +5032,7 @@ "@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true } @@ -5074,9 +5090,20 @@ }, "packages": { "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": { + "builtin": { + "os.homedir": true + }, + "globals": { + "process.env": true, + "process.getuid": true, + "process.platform": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": { "globals": { "process.env.SystemRoot": true, @@ -5087,6 +5114,70 @@ "process.platform": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": { + "builtin": { + "events.EventEmitter": true, + "util": true + }, + "globals": { + "process.nextTick": true, + "process.stderr": true + }, + "packages": { + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": true, + "nyc>yargs>set-blocking": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": { + "builtin": { + "events.EventEmitter": true, + "util.inherits": true + }, + "packages": { + "koa>delegates": true, + "readable-stream": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": { + "builtin": { + "util.format": true + }, + "globals": { + "clearInterval": true, + "process": true, + "setImmediate": true, + "setInterval": true + }, + "packages": { + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": true, + "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>aproba": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, + "nyc>signal-exit": true, + "react>object-assign": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": { + "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, + "gulp>gulp-cli>yargs>string-width>code-point-at": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": { + "packages": { + "gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true + } + }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": { + "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi>ansi-regex": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": { "builtin": { "assert": true, @@ -5098,9 +5189,34 @@ "setTimeout": true }, "packages": { + "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": true, "nyc>glob": true } }, + "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": { + "builtin": { + "assert": true, + "events.EventEmitter": true, + "fs": true, + "path.join": true, + "path.resolve": true, + "util": true + }, + "globals": { + "console.error": true, + "process.cwd": true, + "process.nextTick": true, + "process.platform": true + }, + "packages": { + "eslint>minimatch": true, + "gulp-watch>path-is-absolute": true, + "nyc>glob>fs.realpath": true, + "nyc>glob>inflight": true, + "pump>once": true, + "pumpify>inherits": true + } + }, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": { "globals": { "console": true, @@ -6556,6 +6672,13 @@ "process.platform": true } }, + "mockttp>portfinder>mkdirp": { + "builtin": { + "fs": true, + "path.dirname": true, + "path.resolve": true + } + }, "nock>debug": { "builtin": { "tty.isatty": true, @@ -8163,14 +8286,7 @@ "path.dirname": true }, "packages": { - "stylelint>file-entry-cache>flat-cache>write>mkdirp": true - } - }, - "stylelint>file-entry-cache>flat-cache>write>mkdirp": { - "builtin": { - "fs": true, - "path.dirname": true, - "path.resolve": true + "mockttp>portfinder>mkdirp": true } }, "stylelint>global-modules": { diff --git a/package.json b/package.json index 2ef54b75cfed..380171a7b533 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 769b72e43875..93de5ab42cce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4615,20 +4615,20 @@ __metadata: languageName: node linkType: hard -"@metamask/rpc-methods-flask@npm:@metamask/rpc-methods@0.37.1-flask.1, @metamask/rpc-methods@npm:^0.37.1-flask.1": - version: 0.37.1-flask.1 - resolution: "@metamask/rpc-methods@npm:0.37.1-flask.1" +"@metamask/rpc-methods-flask@npm:@metamask/rpc-methods@0.37.2-flask.1, @metamask/rpc-methods@npm:^0.37.2-flask.1": + version: 0.37.2-flask.1 + resolution: "@metamask/rpc-methods@npm:0.37.2-flask.1" dependencies: "@metamask/key-tree": ^9.0.0 "@metamask/permission-controller": ^4.0.0 - "@metamask/snaps-ui": ^0.37.1-flask.1 - "@metamask/snaps-utils": ^0.37.1-flask.1 + "@metamask/snaps-ui": ^0.37.2-flask.1 + "@metamask/snaps-utils": ^0.37.2-flask.1 "@metamask/types": ^1.1.0 "@metamask/utils": ^6.0.1 "@noble/hashes": ^1.3.1 eth-rpc-errors: ^4.0.3 superstruct: ^1.0.3 - checksum: 75515666e9347d59f5c4658c85daec061839f80279164e05d1950d2c83e29e19a37230d03f6d373ad48eab271579a19e8b93fe89ff5f2068633496cf3169848b + checksum: f5b955c3a7b7c042c27aa5d9464ea5d9135104c20af3315ea00d8941c5c6379c12c82c0988bc5c21409f4dd8b740bb93b387e2ee115c914b434e28101cd9d877 languageName: node linkType: hard @@ -4755,19 +4755,19 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-controllers-flask@npm:@metamask/snaps-controllers@0.37.1-flask.1": - version: 0.37.1-flask.1 - resolution: "@metamask/snaps-controllers@npm:0.37.1-flask.1" +"@metamask/snaps-controllers-flask@npm:@metamask/snaps-controllers@0.38.0-flask.1": + version: 0.38.0-flask.1 + resolution: "@metamask/snaps-controllers@npm:0.38.0-flask.1" dependencies: "@metamask/approval-controller": ^3.0.0 "@metamask/base-controller": ^3.0.0 "@metamask/object-multiplex": ^1.2.0 "@metamask/permission-controller": ^4.0.0 "@metamask/post-message-stream": ^6.1.2 - "@metamask/rpc-methods": ^0.37.1-flask.1 - "@metamask/snaps-execution-environments": ^0.37.1-flask.1 + "@metamask/rpc-methods": ^0.37.2-flask.1 + "@metamask/snaps-execution-environments": ^0.38.0-flask.1 "@metamask/snaps-registry": ^1.2.1 - "@metamask/snaps-utils": ^0.37.1-flask.1 + "@metamask/snaps-utils": ^0.38.0-flask.1 "@metamask/utils": ^6.0.1 "@xstate/fsm": ^2.0.0 concat-stream: ^2.0.0 @@ -4781,7 +4781,7 @@ __metadata: pump: ^3.0.0 readable-web-to-node-stream: ^3.0.2 tar-stream: ^2.2.0 - checksum: f36e2cb69569d950b6da6f977be2dabe2cb28aa69a14d252834b5a6be3ce631337ca5ab9b997fb1cc56c1c070e595efebf9e525ce0a59b18b84fda9a0c8bb731 + checksum: 538d2fc5295f094d5852c8385b99c60daf3874628f6627926b10412a309d86a7ee3e5bcb61f8c3fdd40b403d6ea08795aa2d338271924c36c6204d65adfcacd6 languageName: node linkType: hard @@ -4866,15 +4866,15 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-execution-environments@npm:^0.37.1-flask.1": - version: 0.37.1-flask.1 - resolution: "@metamask/snaps-execution-environments@npm:0.37.1-flask.1" +"@metamask/snaps-execution-environments@npm:^0.38.0-flask.1": + version: 0.38.0-flask.1 + resolution: "@metamask/snaps-execution-environments@npm:0.38.0-flask.1" dependencies: "@metamask/object-multiplex": ^1.2.0 "@metamask/post-message-stream": ^6.1.2 "@metamask/providers": ^11.0.0 - "@metamask/rpc-methods": ^0.37.1-flask.1 - "@metamask/snaps-utils": ^0.37.1-flask.1 + "@metamask/rpc-methods": ^0.37.2-flask.1 + "@metamask/snaps-utils": ^0.38.0-flask.1 "@metamask/utils": ^6.0.1 eth-rpc-errors: ^4.0.3 json-rpc-engine: ^6.1.0 @@ -4883,7 +4883,7 @@ __metadata: ses: ^0.18.1 stream-browserify: ^3.0.0 superstruct: ^1.0.3 - checksum: 4a02b82fd83e957029bbab0d96001221ae82e81c68f38394915946983f1a66f96faa2dc16946c01b962463ee202825529ff9d115836e56a99f658848e0367da8 + checksum: 725163d03c3c17d0a67ad5829adf69da8bcd2d3890efd984ff5954a19aeeeb4e024a96810d9ae9d5f095f1e39965376f62d41637ff61c59519f46c093f05b0f9 languageName: node linkType: hard @@ -4918,13 +4918,13 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-ui-flask@npm:@metamask/snaps-ui@0.37.1-flask.1, @metamask/snaps-ui@npm:^0.37.1-flask.1": - version: 0.37.1-flask.1 - resolution: "@metamask/snaps-ui@npm:0.37.1-flask.1" +"@metamask/snaps-ui-flask@npm:@metamask/snaps-ui@0.37.3-flask.1, @metamask/snaps-ui@npm:^0.37.3-flask.1": + version: 0.37.3-flask.1 + resolution: "@metamask/snaps-ui@npm:0.37.3-flask.1" dependencies: "@metamask/utils": ^6.0.1 superstruct: ^1.0.3 - checksum: d4f32e56fb5a2fcb1b45ff12fe995d4f3dd812520d397094f69a31087d0923c5111b8727bbec3d1ab93db911d23994b56f1f2a6136703208307b2bed440ef662 + checksum: 0b93f6edeca18afc799f16be8b4e4d758800ea0d68298c70492dc85f74ec9f79c2aa32749f6725bb83a4896fdb1ec95a7d19a10a617484e0a7574ddad7969bd3 languageName: node linkType: hard @@ -4938,6 +4938,16 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-ui@npm:^0.37.2-flask.1": + version: 0.37.2-flask.1 + resolution: "@metamask/snaps-ui@npm:0.37.2-flask.1" + dependencies: + "@metamask/utils": ^6.0.1 + superstruct: ^1.0.3 + checksum: a52a887411d689a7a0b017b3741c76819567416c7943ca3c71f5b5f8b623605689f370f70caa8a22531d711d10738c913b0d561fcda09a92c38e288d115e6bac + languageName: node + linkType: hard + "@metamask/snaps-ui@npm:^1.0.0-prerelease.1": version: 1.0.0-prerelease.1 resolution: "@metamask/snaps-ui@npm:1.0.0-prerelease.1" @@ -4948,9 +4958,9 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-utils-flask@npm:@metamask/snaps-utils@0.37.1-flask.1, @metamask/snaps-utils@npm:^0.37.1-flask.1": - version: 0.37.1-flask.1 - resolution: "@metamask/snaps-utils@npm:0.37.1-flask.1" +"@metamask/snaps-utils-flask@npm:@metamask/snaps-utils@0.38.0-flask.1, @metamask/snaps-utils@npm:^0.38.0-flask.1": + version: 0.38.0-flask.1 + resolution: "@metamask/snaps-utils@npm:0.38.0-flask.1" dependencies: "@babel/core": ^7.20.12 "@babel/types": ^7.18.7 @@ -4959,21 +4969,22 @@ __metadata: "@metamask/permission-controller": ^4.0.0 "@metamask/providers": ^11.0.0 "@metamask/snaps-registry": ^1.2.1 - "@metamask/snaps-ui": ^0.37.1-flask.1 + "@metamask/snaps-ui": ^0.37.3-flask.1 "@metamask/utils": ^6.0.1 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 + chalk: ^4.1.2 cron-parser: ^4.5.0 eth-rpc-errors: ^4.0.3 fast-deep-equal: ^3.1.3 fast-json-stable-stringify: ^2.1.0 is-svg: ^4.4.0 rfdc: ^1.3.0 - semver: ^7.3.7 + semver: ^7.5.4 ses: ^0.18.1 superstruct: ^1.0.3 validate-npm-package-name: ^5.0.0 - checksum: 3c49e5ac9c01d2f3db497dc5e1c6557641dcc35d358b35f4a244235b7e0c855e8bb7e582cd28d33647295838e31cd679225c5496ca67060b7088c4644d9ba335 + checksum: 9b79feabcf3a99f0faa53c87711e0de155807d49dd3a9117933b9636d529fa3f3449bd563535f056fc7cbb3eaffcd9e9703b02985bdb6cfdc090d096d76dad8e languageName: node linkType: hard @@ -5006,6 +5017,36 @@ __metadata: languageName: node linkType: hard +"@metamask/snaps-utils@npm:^0.37.2-flask.1": + version: 0.37.2-flask.1 + resolution: "@metamask/snaps-utils@npm:0.37.2-flask.1" + dependencies: + "@babel/core": ^7.20.12 + "@babel/types": ^7.18.7 + "@metamask/base-controller": ^3.0.0 + "@metamask/key-tree": ^9.0.0 + "@metamask/permission-controller": ^4.0.0 + "@metamask/providers": ^11.0.0 + "@metamask/snaps-registry": ^1.2.1 + "@metamask/snaps-ui": ^0.37.2-flask.1 + "@metamask/utils": ^6.0.1 + "@noble/hashes": ^1.3.1 + "@scure/base": ^1.1.1 + chalk: ^4.1.2 + cron-parser: ^4.5.0 + eth-rpc-errors: ^4.0.3 + fast-deep-equal: ^3.1.3 + fast-json-stable-stringify: ^2.1.0 + is-svg: ^4.4.0 + rfdc: ^1.3.0 + semver: ^7.3.7 + ses: ^0.18.1 + superstruct: ^1.0.3 + validate-npm-package-name: ^5.0.0 + checksum: eeb31013a8af39b5488fdb8a6a72e11c54274e423e0f2560fd5cf4ea0278e278aff60be070c1e5b847d84220f15338e01c4725ce7ebb5f3fc614553ae4235f44 + languageName: node + linkType: hard + "@metamask/snaps-utils@npm:^1.0.0-prerelease.1": version: 1.0.0-prerelease.1 resolution: "@metamask/snaps-utils@npm:1.0.0-prerelease.1" @@ -24249,18 +24290,18 @@ __metadata: "@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/test-dapp": ^7.0.1 "@metamask/utils": ^5.0.0 From 958dac1a4c86f52d6a7f11b1425fcb94134e43b7 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Thu, 27 Jul 2023 11:47:30 +0200 Subject: [PATCH 2/5] Add endowment:lifecycle-hooks permission --- app/_locales/en/messages.json | 8 ++++++++ shared/constants/snaps/permissions.ts | 7 +++++-- ui/helpers/utils/permission.js | 6 ++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 81a89b0a6aa5..5b698b5163fa 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -3180,6 +3180,14 @@ "message": "Allow $1 to send messages to the snap and receive a response from the snap.", "description": "An extended description for the `endowment:rpc` permission. $1 is 'other snaps' or 'websites'." }, + "permission_lifecycleHooks": { + "message": "Use lifecycle hooks.", + "description": "The description for the `endowment:lifecycle-hooks` permission" + }, + "permission_lifecycleHooksDescription": { + "message": "Allow the snap to use lifecycle hooks to run code at specific times during its lifecycle.", + "description": "An extended description for the `endowment:lifecycle-hooks` permission" + }, "permission_transactionInsight": { "message": "Fetch and display transaction insights.", "description": "The description for the `endowment:transaction-insight` permission" diff --git a/shared/constants/snaps/permissions.ts b/shared/constants/snaps/permissions.ts index be3590ef40cb..3642e2187166 100644 --- a/shared/constants/snaps/permissions.ts +++ b/shared/constants/snaps/permissions.ts @@ -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); @@ -18,7 +19,7 @@ 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({ @@ -26,7 +27,9 @@ export const ExcludedSnapEndowments = Object.freeze({ '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 }); diff --git a/ui/helpers/utils/permission.js b/ui/helpers/utils/permission.js index fa1b00a531f2..d751bfb4fe02 100644 --- a/ui/helpers/utils/permission.js +++ b/ui/helpers/utils/permission.js @@ -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 }) => ({ From eff48c3ee8f6e56a527bf6f30c97a7301ad0ad4e Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Thu, 27 Jul 2023 11:54:03 +0200 Subject: [PATCH 3/5] Run yarn lint:fix --- app/_locales/en/messages.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 5b698b5163fa..45fd6204fa7b 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -3124,6 +3124,14 @@ "message": "Allow the snap to derive arbitrary keys unique to this snap, without exposing them. These keys are separate from your MetaMask account(s) and not related to your private keys or Secret Recovery Phrase. Other snaps cannot access this information.", "description": "An extended description for the `snap_getEntropy` permission" }, + "permission_lifecycleHooks": { + "message": "Use lifecycle hooks.", + "description": "The description for the `endowment:lifecycle-hooks` permission" + }, + "permission_lifecycleHooksDescription": { + "message": "Allow the snap to use lifecycle hooks to run code at specific times during its lifecycle.", + "description": "An extended description for the `endowment:lifecycle-hooks` permission" + }, "permission_longRunning": { "message": "Run indefinitely.", "description": "The description for the `endowment:long-running` permission" @@ -3180,14 +3188,6 @@ "message": "Allow $1 to send messages to the snap and receive a response from the snap.", "description": "An extended description for the `endowment:rpc` permission. $1 is 'other snaps' or 'websites'." }, - "permission_lifecycleHooks": { - "message": "Use lifecycle hooks.", - "description": "The description for the `endowment:lifecycle-hooks` permission" - }, - "permission_lifecycleHooksDescription": { - "message": "Allow the snap to use lifecycle hooks to run code at specific times during its lifecycle.", - "description": "An extended description for the `endowment:lifecycle-hooks` permission" - }, "permission_transactionInsight": { "message": "Fetch and display transaction insights.", "description": "The description for the `endowment:transaction-insight` permission" From 4c5509e0ca7f9a4626e5dcd22155555a24be9c22 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Thu, 27 Jul 2023 12:07:52 +0200 Subject: [PATCH 4/5] Fix unit test --- shared/constants/permissions.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/constants/permissions.test.js b/shared/constants/permissions.test.js index 94f6388eff78..f1ef4a5563a2 100644 --- a/shared/constants/permissions.test.js +++ b/shared/constants/permissions.test.js @@ -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), From 348eaf7ac3d9199f465d312df3b77265057b4c24 Mon Sep 17 00:00:00 2001 From: MetaMask Bot Date: Thu, 27 Jul 2023 10:28:30 +0000 Subject: [PATCH 5/5] Update LavaMoat policies --- lavamoat/build-system/policy.json | 132 ++---------------------------- 1 file changed, 8 insertions(+), 124 deletions(-) diff --git a/lavamoat/build-system/policy.json b/lavamoat/build-system/policy.json index 68da7b7322aa..521216647783 100644 --- a/lavamoat/build-system/policy.json +++ b/lavamoat/build-system/policy.json @@ -1134,21 +1134,6 @@ "string.prototype.matchall>side-channel": true } }, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": { - "builtin": { - "os.type": true - }, - "globals": { - "process.env.LANG": true, - "process.env.LC_ALL": true, - "process.env.LC_CTYPE": true - } - }, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": { - "packages": { - "yargs>string-width": true - } - }, "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": { "builtin": { "os.homedir": true @@ -5032,7 +5017,6 @@ "@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true } @@ -5090,20 +5074,9 @@ }, "packages": { "@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": true, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-homedir": { - "builtin": { - "os.homedir": true - }, - "globals": { - "process.env": true, - "process.getuid": true, - "process.platform": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": { "globals": { "process.env.SystemRoot": true, @@ -5114,70 +5087,6 @@ "process.platform": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog": { - "builtin": { - "events.EventEmitter": true, - "util": true - }, - "globals": { - "process.nextTick": true, - "process.stderr": true - }, - "packages": { - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": true, - "nyc>yargs>set-blocking": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>are-we-there-yet": { - "builtin": { - "events.EventEmitter": true, - "util.inherits": true - }, - "packages": { - "koa>delegates": true, - "readable-stream": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge": { - "builtin": { - "util.format": true - }, - "globals": { - "clearInterval": true, - "process": true, - "setImmediate": true, - "setInterval": true - }, - "packages": { - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>console-control-strings": true, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>has-unicode": true, - "@storybook/addon-mdx-gfm>@storybook/node-logger>npmlog>gauge>wide-align": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>aproba": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, - "nyc>signal-exit": true, - "react>object-assign": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width": { - "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": true, - "gulp>gulp-cli>yargs>string-width>code-point-at": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": { - "packages": { - "gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true - } - }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi": { - "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>npmlog>gauge>strip-ansi>ansi-regex": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": { "builtin": { "assert": true, @@ -5189,34 +5098,9 @@ "setTimeout": true }, "packages": { - "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": true, "nyc>glob": true } }, - "gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf>glob": { - "builtin": { - "assert": true, - "events.EventEmitter": true, - "fs": true, - "path.join": true, - "path.resolve": true, - "util": true - }, - "globals": { - "console.error": true, - "process.cwd": true, - "process.nextTick": true, - "process.platform": true - }, - "packages": { - "eslint>minimatch": true, - "gulp-watch>path-is-absolute": true, - "nyc>glob>fs.realpath": true, - "nyc>glob>inflight": true, - "pump>once": true, - "pumpify>inherits": true - } - }, "gulp-watch>chokidar>fsevents>node-pre-gyp>semver": { "globals": { "console": true, @@ -6672,13 +6556,6 @@ "process.platform": true } }, - "mockttp>portfinder>mkdirp": { - "builtin": { - "fs": true, - "path.dirname": true, - "path.resolve": true - } - }, "nock>debug": { "builtin": { "tty.isatty": true, @@ -8286,7 +8163,14 @@ "path.dirname": true }, "packages": { - "mockttp>portfinder>mkdirp": true + "stylelint>file-entry-cache>flat-cache>write>mkdirp": true + } + }, + "stylelint>file-entry-cache>flat-cache>write>mkdirp": { + "builtin": { + "fs": true, + "path.dirname": true, + "path.resolve": true } }, "stylelint>global-modules": {