diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 70b05b8fe..0f201d55e 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -56,6 +56,7 @@ import SmartTransactionsController from '@metamask/smart-transactions-controller ///: BEGIN:ONLY_INCLUDE_IN(flask) import { CronjobController, + JsonSnapsRegistry, SnapController, IframeExecutionService, } from '@metamask/snaps-controllers'; @@ -701,6 +702,8 @@ export default class MetamaskController extends EventEmitter { `${this.approvalController.name}:hasRequest`, `${this.approvalController.name}:acceptRequest`, `${this.approvalController.name}:rejectRequest`, + `SnapController:getPermitted`, + `SnapController:install`, ], }), state: initState.PermissionController, @@ -760,9 +763,7 @@ export default class MetamaskController extends EventEmitter { ///: BEGIN:ONLY_INCLUDE_IN(flask) const snapExecutionServiceArgs = { - iframeUrl: new URL( - 'https://metamask.github.io/iframe-execution-environment/0.14.0', - ), + iframeUrl: new URL('https://execution.metamask.io/0.15.1/index.html'), messenger: this.controllerMessenger.getRestricted({ name: 'ExecutionService', }), @@ -800,6 +801,8 @@ export default class MetamaskController extends EventEmitter { 'ExecutionService:terminateSnap', 'ExecutionService:terminateAllSnaps', 'ExecutionService:handleRpcRequest', + 'SnapsRegistry:get', + 'SnapsRegistry:getMetadata', ], }); @@ -858,7 +861,6 @@ export default class MetamaskController extends EventEmitter { }, }, }); - // --- Snaps Cronjob Controller configuration const cronjobControllerMessenger = this.controllerMessenger.getRestricted({ name: 'CronjobController', allowedEvents: [ @@ -877,6 +879,24 @@ export default class MetamaskController extends EventEmitter { messenger: cronjobControllerMessenger, }); + const snapsRegistryMessenger = this.controllerMessenger.getRestricted({ + name: 'SnapsRegistry', + allowedEvents: [], + allowedActions: [], + }); + this.snapsRegistry = new JsonSnapsRegistry({ + state: initState.SnapsRegistry, + messenger: snapsRegistryMessenger, + refetchOnAllowlistMiss: isMain, + failOnUnavailableRegistry: isMain, + url: { + registry: 'https://acl.execution.metamask.io/latest/registry.json', + signature: 'https://acl.execution.metamask.io/latest/signature.json', + }, + publicKey: + '0x025b65308f0f0fb8bc7f7ff87bfc296e0330eee5d3c1d1ee4a048b2fd6a86fa0a6', + }); + this.desktopController = new DesktopController({ initState: initState.DesktopController, }); @@ -1259,6 +1279,7 @@ export default class MetamaskController extends EventEmitter { ///: BEGIN:ONLY_INCLUDE_IN(flask) SnapController: this.snapController, CronjobController: this.cronjobController, + SnapsRegistry: this.snapsRegistry, NotificationController: this.notificationController, DesktopController: this.desktopController.store, ///: END:ONLY_INCLUDE_IN @@ -1292,6 +1313,7 @@ export default class MetamaskController extends EventEmitter { ///: BEGIN:ONLY_INCLUDE_IN(flask) SnapController: this.snapController, CronjobController: this.cronjobController, + SnapsRegistry: this.snapsRegistry, NotificationController: this.notificationController, DesktopController: this.desktopController.store, ///: END:ONLY_INCLUDE_IN @@ -3866,15 +3888,11 @@ export default class MetamaskController extends EventEmitter { 'SnapController:getPermitted', origin, ), - requestPermissions: async (requestedPermissions) => { - const [approvedPermissions] = - await this.permissionController.requestPermissions( - { origin }, - requestedPermissions, - ); - - return Object.values(approvedPermissions); - }, + requestPermissions: async (requestedPermissions) => + await this.permissionController.requestPermissions( + { origin }, + requestedPermissions, + ), getPermissions: this.permissionController.getPermissions.bind( this.permissionController, origin, diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 7d933f82d..cf463cda4 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -1295,6 +1295,8 @@ "setTimeout": true }, "packages": { + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1302,6 +1304,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/message-manager>jsonschema": { "packages": { "browserify>url": true @@ -1331,8 +1345,11 @@ } }, "@metamask/permission-controller": { + "globals": { + "console.error": true + }, "packages": { - "@metamask/base-controller": true, + "@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/controller-utils": true, "@metamask/permission-controller>nanoid": true, "deep-freeze-strict": true, @@ -1341,6 +1358,11 @@ "json-rpc-engine": true } }, + "@metamask/permission-controller>@metamask/base-controller": { + "packages": { + "immer": true + } + }, "@metamask/permission-controller>@metamask/controller-utils": { "globals": { "console.error": true, @@ -1348,7 +1370,8 @@ "setTimeout": true }, "packages": { - "@metamask/controller-utils>isomorphic-fetch": true, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1356,6 +1379,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/permission-controller>nanoid": { "globals": { "crypto.getRandomValues": true @@ -1533,7 +1568,15 @@ "packages": { "@metamask/key-tree>@noble/hashes": true, "@metamask/key-tree>@scure/base": true, - "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@noble/secp256k1": true + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": true + } + }, + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": { + "globals": { + "crypto": true + }, + "packages": { + "browserify>browser-resolve": true } }, "@ngraveio/bc-ur": { @@ -2579,11 +2622,6 @@ "document.createElement": true } }, - "btoa": { - "packages": { - "browserify>buffer": true - } - }, "classnames": { "globals": { "classNames": "write", diff --git a/lavamoat/browserify/desktop/policy.json b/lavamoat/browserify/desktop/policy.json index 46ce15ef8..c2acd56f3 100644 --- a/lavamoat/browserify/desktop/policy.json +++ b/lavamoat/browserify/desktop/policy.json @@ -1349,6 +1349,8 @@ "setTimeout": true }, "packages": { + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1356,6 +1358,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/message-manager>jsonschema": { "packages": { "browserify>url": true @@ -1397,8 +1411,11 @@ } }, "@metamask/permission-controller": { + "globals": { + "console.error": true + }, "packages": { - "@metamask/base-controller": true, + "@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/controller-utils": true, "@metamask/permission-controller>nanoid": true, "deep-freeze-strict": true, @@ -1407,6 +1424,11 @@ "json-rpc-engine": true } }, + "@metamask/permission-controller>@metamask/base-controller": { + "packages": { + "immer": true + } + }, "@metamask/permission-controller>@metamask/controller-utils": { "globals": { "console.error": true, @@ -1414,7 +1436,8 @@ "setTimeout": true }, "packages": { - "@metamask/controller-utils>isomorphic-fetch": true, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1422,6 +1445,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/permission-controller>nanoid": { "globals": { "crypto.getRandomValues": true @@ -1461,6 +1496,7 @@ }, "@metamask/post-message-stream": { "globals": { + "MessageEvent.prototype": true, "WorkerGlobalScope": true, "addEventListener": true, "browser": true, @@ -1545,8 +1581,8 @@ "packages": { "@metamask/key-tree": true, "@metamask/key-tree>@noble/hashes": true, + "@metamask/permission-controller": true, "@metamask/rpc-methods>@metamask/browser-passworder": true, - "@metamask/rpc-methods>@metamask/permission-controller": true, "@metamask/rpc-methods>nanoid": true, "@metamask/snaps-ui": true, "@metamask/snaps-utils": true, @@ -1569,36 +1605,6 @@ "browserify>buffer": true } }, - "@metamask/rpc-methods>@metamask/permission-controller": { - "packages": { - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/base-controller": true, - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/controller-utils": true, - "@metamask/rpc-methods>nanoid": true, - "deep-freeze-strict": true, - "eth-rpc-errors": true, - "immer": true, - "json-rpc-engine": true - } - }, - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/base-controller": { - "packages": { - "immer": true - } - }, - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/controller-utils": { - "globals": { - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "browserify>buffer": true, - "eslint>fast-deep-equal": true, - "eth-ens-namehash": true, - "ethereumjs-util": true, - "ethjs>ethjs-unit": true - } - }, "@metamask/rpc-methods>nanoid": { "globals": { "crypto.getRandomValues": true @@ -1656,11 +1662,11 @@ "setTimeout": true }, "packages": { + "@metamask/permission-controller": true, "@metamask/post-message-stream": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-methods": true, "@metamask/snaps-controllers>@metamask/base-controller": true, - "@metamask/snaps-controllers>@metamask/permission-controller": true, "@metamask/snaps-controllers>@metamask/subject-metadata-controller": true, "@metamask/snaps-controllers>@xstate/fsm": true, "@metamask/snaps-controllers>concat-stream": true, @@ -1669,6 +1675,7 @@ "@metamask/snaps-controllers>readable-web-to-node-stream": true, "@metamask/snaps-controllers>tar-stream": true, "@metamask/snaps-utils": true, + "@metamask/snaps-utils>@metamask/snaps-registry": true, "@metamask/utils": true, "eth-rpc-errors": true, "json-rpc-engine": true, @@ -1681,31 +1688,6 @@ "immer": true } }, - "@metamask/snaps-controllers>@metamask/base-controller>@metamask/controller-utils": { - "globals": { - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "browserify>buffer": true, - "eslint>fast-deep-equal": true, - "eth-ens-namehash": true, - "ethereumjs-util": true, - "ethjs>ethjs-unit": true - } - }, - "@metamask/snaps-controllers>@metamask/permission-controller": { - "packages": { - "@metamask/snaps-controllers>@metamask/base-controller": true, - "@metamask/snaps-controllers>@metamask/base-controller>@metamask/controller-utils": true, - "@metamask/snaps-controllers>nanoid": true, - "deep-freeze-strict": true, - "eth-rpc-errors": true, - "immer": true, - "json-rpc-engine": true - } - }, "@metamask/snaps-controllers>@metamask/subject-metadata-controller": { "packages": { "@metamask/snaps-controllers>@metamask/base-controller": true @@ -1885,6 +1867,13 @@ "semver": true } }, + "@metamask/snaps-utils>@metamask/snaps-registry": { + "packages": { + "@metamask/key-tree>@noble/secp256k1": true, + "@metamask/utils": true, + "@metamask/utils>superstruct": true + } + }, "@metamask/snaps-utils>cron-parser": { "packages": { "browserify>browser-resolve": true, @@ -1974,7 +1963,15 @@ "packages": { "@metamask/key-tree>@noble/hashes": true, "@metamask/key-tree>@scure/base": true, - "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@noble/secp256k1": true + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": true + } + }, + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": { + "globals": { + "crypto": true + }, + "packages": { + "browserify>browser-resolve": true } }, "@ngraveio/bc-ur": { @@ -3020,11 +3017,6 @@ "document.createElement": true } }, - "btoa": { - "packages": { - "browserify>buffer": true - } - }, "classnames": { "globals": { "classNames": "write", diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 46ce15ef8..c2acd56f3 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -1349,6 +1349,8 @@ "setTimeout": true }, "packages": { + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1356,6 +1358,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/message-manager>jsonschema": { "packages": { "browserify>url": true @@ -1397,8 +1411,11 @@ } }, "@metamask/permission-controller": { + "globals": { + "console.error": true + }, "packages": { - "@metamask/base-controller": true, + "@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/controller-utils": true, "@metamask/permission-controller>nanoid": true, "deep-freeze-strict": true, @@ -1407,6 +1424,11 @@ "json-rpc-engine": true } }, + "@metamask/permission-controller>@metamask/base-controller": { + "packages": { + "immer": true + } + }, "@metamask/permission-controller>@metamask/controller-utils": { "globals": { "console.error": true, @@ -1414,7 +1436,8 @@ "setTimeout": true }, "packages": { - "@metamask/controller-utils>isomorphic-fetch": true, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1422,6 +1445,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/permission-controller>nanoid": { "globals": { "crypto.getRandomValues": true @@ -1461,6 +1496,7 @@ }, "@metamask/post-message-stream": { "globals": { + "MessageEvent.prototype": true, "WorkerGlobalScope": true, "addEventListener": true, "browser": true, @@ -1545,8 +1581,8 @@ "packages": { "@metamask/key-tree": true, "@metamask/key-tree>@noble/hashes": true, + "@metamask/permission-controller": true, "@metamask/rpc-methods>@metamask/browser-passworder": true, - "@metamask/rpc-methods>@metamask/permission-controller": true, "@metamask/rpc-methods>nanoid": true, "@metamask/snaps-ui": true, "@metamask/snaps-utils": true, @@ -1569,36 +1605,6 @@ "browserify>buffer": true } }, - "@metamask/rpc-methods>@metamask/permission-controller": { - "packages": { - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/base-controller": true, - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/controller-utils": true, - "@metamask/rpc-methods>nanoid": true, - "deep-freeze-strict": true, - "eth-rpc-errors": true, - "immer": true, - "json-rpc-engine": true - } - }, - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/base-controller": { - "packages": { - "immer": true - } - }, - "@metamask/rpc-methods>@metamask/permission-controller>@metamask/controller-utils": { - "globals": { - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "browserify>buffer": true, - "eslint>fast-deep-equal": true, - "eth-ens-namehash": true, - "ethereumjs-util": true, - "ethjs>ethjs-unit": true - } - }, "@metamask/rpc-methods>nanoid": { "globals": { "crypto.getRandomValues": true @@ -1656,11 +1662,11 @@ "setTimeout": true }, "packages": { + "@metamask/permission-controller": true, "@metamask/post-message-stream": true, "@metamask/providers>@metamask/object-multiplex": true, "@metamask/rpc-methods": true, "@metamask/snaps-controllers>@metamask/base-controller": true, - "@metamask/snaps-controllers>@metamask/permission-controller": true, "@metamask/snaps-controllers>@metamask/subject-metadata-controller": true, "@metamask/snaps-controllers>@xstate/fsm": true, "@metamask/snaps-controllers>concat-stream": true, @@ -1669,6 +1675,7 @@ "@metamask/snaps-controllers>readable-web-to-node-stream": true, "@metamask/snaps-controllers>tar-stream": true, "@metamask/snaps-utils": true, + "@metamask/snaps-utils>@metamask/snaps-registry": true, "@metamask/utils": true, "eth-rpc-errors": true, "json-rpc-engine": true, @@ -1681,31 +1688,6 @@ "immer": true } }, - "@metamask/snaps-controllers>@metamask/base-controller>@metamask/controller-utils": { - "globals": { - "console.error": true, - "fetch": true, - "setTimeout": true - }, - "packages": { - "browserify>buffer": true, - "eslint>fast-deep-equal": true, - "eth-ens-namehash": true, - "ethereumjs-util": true, - "ethjs>ethjs-unit": true - } - }, - "@metamask/snaps-controllers>@metamask/permission-controller": { - "packages": { - "@metamask/snaps-controllers>@metamask/base-controller": true, - "@metamask/snaps-controllers>@metamask/base-controller>@metamask/controller-utils": true, - "@metamask/snaps-controllers>nanoid": true, - "deep-freeze-strict": true, - "eth-rpc-errors": true, - "immer": true, - "json-rpc-engine": true - } - }, "@metamask/snaps-controllers>@metamask/subject-metadata-controller": { "packages": { "@metamask/snaps-controllers>@metamask/base-controller": true @@ -1885,6 +1867,13 @@ "semver": true } }, + "@metamask/snaps-utils>@metamask/snaps-registry": { + "packages": { + "@metamask/key-tree>@noble/secp256k1": true, + "@metamask/utils": true, + "@metamask/utils>superstruct": true + } + }, "@metamask/snaps-utils>cron-parser": { "packages": { "browserify>browser-resolve": true, @@ -1974,7 +1963,15 @@ "packages": { "@metamask/key-tree>@noble/hashes": true, "@metamask/key-tree>@scure/base": true, - "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@noble/secp256k1": true + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": true + } + }, + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": { + "globals": { + "crypto": true + }, + "packages": { + "browserify>browser-resolve": true } }, "@ngraveio/bc-ur": { @@ -3020,11 +3017,6 @@ "document.createElement": true } }, - "btoa": { - "packages": { - "browserify>buffer": true - } - }, "classnames": { "globals": { "classNames": "write", diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 7d933f82d..cf463cda4 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -1295,6 +1295,8 @@ "setTimeout": true }, "packages": { + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1302,6 +1304,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/message-manager>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/message-manager>jsonschema": { "packages": { "browserify>url": true @@ -1331,8 +1345,11 @@ } }, "@metamask/permission-controller": { + "globals": { + "console.error": true + }, "packages": { - "@metamask/base-controller": true, + "@metamask/permission-controller>@metamask/base-controller": true, "@metamask/permission-controller>@metamask/controller-utils": true, "@metamask/permission-controller>nanoid": true, "deep-freeze-strict": true, @@ -1341,6 +1358,11 @@ "json-rpc-engine": true } }, + "@metamask/permission-controller>@metamask/base-controller": { + "packages": { + "immer": true + } + }, "@metamask/permission-controller>@metamask/controller-utils": { "globals": { "console.error": true, @@ -1348,7 +1370,8 @@ "setTimeout": true }, "packages": { - "@metamask/controller-utils>isomorphic-fetch": true, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": true, + "@spruceid/siwe-parser": true, "browserify>buffer": true, "eslint>fast-deep-equal": true, "eth-ens-namehash": true, @@ -1356,6 +1379,18 @@ "ethjs>ethjs-unit": true } }, + "@metamask/permission-controller>@metamask/controller-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/utils>superstruct": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, "@metamask/permission-controller>nanoid": { "globals": { "crypto.getRandomValues": true @@ -1533,7 +1568,15 @@ "packages": { "@metamask/key-tree>@noble/hashes": true, "@metamask/key-tree>@scure/base": true, - "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@noble/secp256k1": true + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": true + } + }, + "@metamask/utils>@ethereumjs/tx>ethereum-cryptography>@scure/bip32>@noble/secp256k1": { + "globals": { + "crypto": true + }, + "packages": { + "browserify>browser-resolve": true } }, "@ngraveio/bc-ur": { @@ -2579,11 +2622,6 @@ "document.createElement": true } }, - "btoa": { - "packages": { - "browserify>buffer": true - } - }, "classnames": { "globals": { "classNames": "write", diff --git a/package.json b/package.json index ec9321133..b0cdf96a7 100644 --- a/package.json +++ b/package.json @@ -247,18 +247,18 @@ "@metamask/metamask-eth-abis": "^3.0.0", "@metamask/notification-controller": "^1.0.0", "@metamask/obs-store": "^5.0.0", - "@metamask/permission-controller": "^2.0.0", + "@metamask/permission-controller": "^3.1.0", "@metamask/phishing-controller": "^2.0.0", "@metamask/post-message-stream": "^6.0.0", "@metamask/providers": "^10.2.1", "@metamask/rate-limit-controller": "^1.0.0", - "@metamask/rpc-methods": "^0.31.0", + "@metamask/rpc-methods": "^0.32.2", "@metamask/scure-bip39": "^2.0.3", "@metamask/slip44": "^2.1.0", "@metamask/smart-transactions-controller": "^3.1.0", - "@metamask/snaps-controllers": "^0.31.0", - "@metamask/snaps-ui": "^0.31.0", - "@metamask/snaps-utils": "^0.31.0", + "@metamask/snaps-controllers": "^0.32.2", + "@metamask/snaps-ui": "^0.32.2", + "@metamask/snaps-utils": "^0.32.2", "@metamask/subject-metadata-controller": "^1.0.0", "@metamask/utils": "^5.0.0", "@ngraveio/bc-ur": "^1.1.6", diff --git a/test/e2e/snaps/enums.js b/test/e2e/snaps/enums.js index c9dccd198..ec89f5314 100644 --- a/test/e2e/snaps/enums.js +++ b/test/e2e/snaps/enums.js @@ -1,3 +1,3 @@ module.exports = { - TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/test-snaps/5.1.0/', + TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/test-snaps/5.1.2/', }; diff --git a/test/e2e/snaps/test-snap-update.spec.js b/test/e2e/snaps/test-snap-update.spec.js index eaf0b847c..aff7214d4 100644 --- a/test/e2e/snaps/test-snap-update.spec.js +++ b/test/e2e/snaps/test-snap-update.spec.js @@ -127,7 +127,7 @@ describe('Test Snap update', function () { // look for the correct version text const versionResult = await driver.findElement('#updateSnapVersion'); await driver.delay(1000); - assert.equal(await versionResult.getText(), '"5.0.1"'); + assert.equal(await versionResult.getText(), '"5.1.2"'); }, ); }); diff --git a/yarn.lock b/yarn.lock index 6ea77ae8f..e1de27f68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3595,7 +3595,7 @@ __metadata: languageName: node linkType: hard -"@metamask/approval-controller@npm:^1.0.0, @metamask/approval-controller@npm:^1.0.1, @metamask/approval-controller@npm:^1.1.0": +"@metamask/approval-controller@npm:^1.0.0, @metamask/approval-controller@npm:^1.0.1": version: 1.1.0 resolution: "@metamask/approval-controller@npm:1.1.0" dependencies: @@ -3739,16 +3739,18 @@ __metadata: languageName: node linkType: hard -"@metamask/controller-utils@npm:^3.0.0": - version: 3.0.0 - resolution: "@metamask/controller-utils@npm:3.0.0" +"@metamask/controller-utils@npm:^3.0.0, @metamask/controller-utils@npm:^3.1.0": + version: 3.1.0 + resolution: "@metamask/controller-utils@npm:3.1.0" dependencies: + "@metamask/utils": ^3.3.1 + "@spruceid/siwe-parser": 1.1.3 eth-ens-namehash: ^2.0.8 eth-rpc-errors: ^4.0.0 ethereumjs-util: ^7.0.10 ethjs-unit: ^0.1.6 fast-deep-equal: ^3.1.3 - checksum: 44227aa9f716f86373a1a4fb86b7ae1c51199dd819f30a3a310a9f87838b7e11c1a3bb024572253bd3cb0258281596cfab8fbf317c3fe90962fa6cf426aa6858 + checksum: 811fc4b9da98ca406a0e002c87933687e745d20f802305bb2af0affcdad454189c705caae9389444da1f5f88f2d10269b3ae8354aa1f600a11ddb9315cfa5718 languageName: node linkType: hard @@ -4168,33 +4170,13 @@ __metadata: languageName: node linkType: hard -"@metamask/permission-controller@npm:^2.0.0": - version: 2.0.0 - resolution: "@metamask/permission-controller@npm:2.0.0" - dependencies: - "@metamask/approval-controller": ^1.1.0 - "@metamask/base-controller": ^1.1.2 - "@metamask/controller-utils": ^2.0.0 - "@metamask/types": ^1.1.0 - "@types/deep-freeze-strict": ^1.1.0 - deep-freeze-strict: ^1.1.1 - eth-rpc-errors: ^4.0.0 - immer: ^9.0.6 - json-rpc-engine: ^6.1.0 - nanoid: ^3.1.31 - peerDependencies: - "@metamask/approval-controller": ^1.1.0 - checksum: 152be8429ceebf7dfbd415ff12746ee9c0216fa4dfb90f825532fd216f6b2aa66061748fb0685ec23ad6bde21212c6ccd32a4219b803913d45b70f8ded45ac2e - languageName: node - linkType: hard - -"@metamask/permission-controller@npm:^3.0.0": - version: 3.0.0 - resolution: "@metamask/permission-controller@npm:3.0.0" +"@metamask/permission-controller@npm:^3.0.0, @metamask/permission-controller@npm:^3.1.0": + version: 3.1.0 + resolution: "@metamask/permission-controller@npm:3.1.0" dependencies: "@metamask/approval-controller": ^2.0.0 "@metamask/base-controller": ^2.0.0 - "@metamask/controller-utils": ^3.0.0 + "@metamask/controller-utils": ^3.1.0 "@metamask/types": ^1.1.0 "@types/deep-freeze-strict": ^1.1.0 deep-freeze-strict: ^1.1.1 @@ -4204,7 +4186,7 @@ __metadata: nanoid: ^3.1.31 peerDependencies: "@metamask/approval-controller": ^2.0.0 - checksum: 67e104d21b3f0258863ecaabd11cb587f10dbcc91ff9b081d8b9569d163d6d54dd5b8fb267d5416ab8e41c8c48b5103e92e013fd1916d492b72706cda2474962 + checksum: 91c615e2faf9c1ce16371602e99354178d79a0af0697f1c3c81c860c2e9972f23e8189290cd41423c3df3048906bbf55c01fef8326677f2ea5cbcfdfb6a58db6 languageName: node linkType: hard @@ -4239,13 +4221,13 @@ __metadata: languageName: node linkType: hard -"@metamask/post-message-stream@npm:^6.0.0, @metamask/post-message-stream@npm:^6.1.0": - version: 6.1.0 - resolution: "@metamask/post-message-stream@npm:6.1.0" +"@metamask/post-message-stream@npm:^6.0.0, @metamask/post-message-stream@npm:^6.1.1": + version: 6.1.1 + resolution: "@metamask/post-message-stream@npm:6.1.1" dependencies: - "@metamask/utils": ^3.0.1 + "@metamask/utils": ^4.0.0 readable-stream: 2.3.3 - checksum: 2503f3fbce7f9c8372ccc429253688f296876ccb83e7c55e8cbc512e7004d84555f111c75c0f81444a6f8148533a86d537bffa9fad9b5c8b13727615a96b32fe + checksum: 588988d555ff20e0d60ed2de71e804d96963a9d4c07716901d5ae13100eb0f97c49eb6b2dbd93ac408098067c0e12cbfca90fed345fecdb69c92e852ab28c0b4 languageName: node linkType: hard @@ -4290,22 +4272,22 @@ __metadata: languageName: node linkType: hard -"@metamask/rpc-methods@npm:^0.31.0": - version: 0.31.0 - resolution: "@metamask/rpc-methods@npm:0.31.0" +"@metamask/rpc-methods@npm:^0.32.2": + version: 0.32.2 + resolution: "@metamask/rpc-methods@npm:0.32.2" dependencies: "@metamask/browser-passworder": ^4.0.2 "@metamask/key-tree": ^7.0.0 - "@metamask/permission-controller": ^3.0.0 - "@metamask/snaps-ui": ^0.31.0 - "@metamask/snaps-utils": ^0.31.0 + "@metamask/permission-controller": ^3.1.0 + "@metamask/snaps-ui": ^0.32.2 + "@metamask/snaps-utils": ^0.32.2 "@metamask/types": ^1.1.0 "@metamask/utils": ^5.0.0 "@noble/hashes": ^1.1.3 eth-rpc-errors: ^4.0.2 nanoid: ^3.1.31 superstruct: ^1.0.3 - checksum: 73e7271279a3eff43f5bca46343d582a3f90f2eda3c8e4dcfc46e01f097be2222decf8a4d66aee3a8fc4fdc1b15de176460ea0f2a87ec99889a2c5456800879c + checksum: 11a996de95c64ef26e22fcd276a04e7ef93e1cd8ef279bea46a6293c7c0e714f22c417ebd92ca50fca505aaf4c68bcaf818466c24cdc93c77afad9842a50f394 languageName: node linkType: hard @@ -4352,19 +4334,19 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-controllers@npm:^0.31.0": - version: 0.31.0 - resolution: "@metamask/snaps-controllers@npm:0.31.0" +"@metamask/snaps-controllers@npm:^0.32.2": + version: 0.32.2 + resolution: "@metamask/snaps-controllers@npm:0.32.2" dependencies: "@metamask/approval-controller": ^2.0.0 "@metamask/base-controller": ^2.0.0 "@metamask/object-multiplex": ^1.1.0 - "@metamask/permission-controller": ^3.0.0 - "@metamask/post-message-stream": ^6.1.0 - "@metamask/rpc-methods": ^0.31.0 - "@metamask/snaps-execution-environments": ^0.31.0 - "@metamask/snaps-registry": ^1.1.1 - "@metamask/snaps-utils": ^0.31.0 + "@metamask/permission-controller": ^3.1.0 + "@metamask/post-message-stream": ^6.1.1 + "@metamask/rpc-methods": ^0.32.2 + "@metamask/snaps-execution-environments": ^0.32.2 + "@metamask/snaps-registry": ^1.2.0 + "@metamask/snaps-utils": ^0.32.2 "@metamask/subject-metadata-controller": ^2.0.0 "@metamask/utils": ^5.0.0 "@xstate/fsm": ^2.0.0 @@ -4379,19 +4361,19 @@ __metadata: pump: ^3.0.0 readable-web-to-node-stream: ^3.0.2 tar-stream: ^2.2.0 - checksum: 6e3a69216a3dbcdef7702caf60795bd7bc25169e491d695a14638c0ce67dcfc67e509f8f29604d974d23cc132edf933e16d2859d4502455e805a2ffd9a366d12 + checksum: f3994b4245d74f324b83ffb5ce2879201b77ea4916d46c5d20fba49d21d8cf10ff74252b0c0e29215587e67a94b18e2c2d6bbeac934ec669d3e56eeabae5b04f languageName: node linkType: hard -"@metamask/snaps-execution-environments@npm:^0.31.0": - version: 0.31.0 - resolution: "@metamask/snaps-execution-environments@npm:0.31.0" +"@metamask/snaps-execution-environments@npm:^0.32.2": + version: 0.32.2 + resolution: "@metamask/snaps-execution-environments@npm:0.32.2" dependencies: "@metamask/object-multiplex": ^1.2.0 - "@metamask/post-message-stream": ^6.1.0 + "@metamask/post-message-stream": ^6.1.1 "@metamask/providers": ^10.2.0 - "@metamask/rpc-methods": ^0.31.0 - "@metamask/snaps-utils": ^0.31.0 + "@metamask/rpc-methods": ^0.32.2 + "@metamask/snaps-utils": ^0.32.2 "@metamask/utils": ^5.0.0 eth-rpc-errors: ^4.0.3 json-rpc-engine: ^6.1.0 @@ -4399,40 +4381,42 @@ __metadata: ses: ^0.18.1 stream-browserify: ^3.0.0 superstruct: ^1.0.3 - checksum: 114b8370980868e3a8db650a9cac35a31f063d82621bbc7e052157a54ee96b60c26db260bcac904813b751fec103da5fe74af061d0c7dd3fb6c50dd975258350 + checksum: 10d5d727dea00628c0644ab639bd734b9fb793cdc01ebe5d1101db3041de54b854acc8f935ec8acff134fa12a5713c038c466c2f2813b038dd1eea84d700856f languageName: node linkType: hard -"@metamask/snaps-registry@npm:^1.1.1": - version: 1.1.1 - resolution: "@metamask/snaps-registry@npm:1.1.1" +"@metamask/snaps-registry@npm:^1.2.0": + version: 1.2.0 + resolution: "@metamask/snaps-registry@npm:1.2.0" + dependencies: + "@metamask/utils": ^5.0.0 + "@noble/secp256k1": ^1.7.1 + superstruct: ^1.0.3 + checksum: d0534680e713ca94e41cbb86f5f700aaf8c1f36b88fc1ed24b4669f11f8583b6d949f6724b8d9fd518a6210131af4ea7822e73ce34e64649dbe29a28850c6682 + languageName: node + linkType: hard + +"@metamask/snaps-ui@npm:^0.32.2": + version: 0.32.2 + resolution: "@metamask/snaps-ui@npm:0.32.2" dependencies: "@metamask/utils": ^5.0.0 superstruct: ^1.0.3 - checksum: 1e77c30af2955baf559160c1098f79a042196b23cd691448668672b4c8c3d92a0602061ab4c4f05b2f60310cfd81147c5e87ce80da6d4a48e45765d569132a77 + checksum: 98e8900efb63a0f1ec4893624290a1bf2d0fa416f99d57f33532865063f4e4b9b3787b77630629c64d7dc041e3508cac81044eca067ed76a07aa380bc5997db2 languageName: node linkType: hard -"@metamask/snaps-ui@npm:^0.31.0": - version: 0.31.0 - resolution: "@metamask/snaps-ui@npm:0.31.0" - dependencies: - "@metamask/utils": ^5.0.0 - superstruct: ^1.0.3 - checksum: b4d7df0e3f3bd28c8cb958c72143d442c44f0ca4f02e226725b804e9f24c1d9a0f7d1d46818adb2969651d4a4626b57a80e669c9867f0dc3335fd85cf458c9a3 - languageName: node - linkType: hard - -"@metamask/snaps-utils@npm:^0.31.0": - version: 0.31.0 - resolution: "@metamask/snaps-utils@npm:0.31.0" +"@metamask/snaps-utils@npm:^0.32.2": + version: 0.32.2 + resolution: "@metamask/snaps-utils@npm:0.32.2" dependencies: "@babel/core": ^7.18.6 "@babel/types": ^7.18.7 - "@metamask/permission-controller": ^3.0.0 + "@metamask/base-controller": ^2.0.0 + "@metamask/permission-controller": ^3.1.0 "@metamask/providers": ^10.2.1 - "@metamask/snaps-registry": ^1.1.1 - "@metamask/snaps-ui": ^0.31.0 + "@metamask/snaps-registry": ^1.2.0 + "@metamask/snaps-ui": ^0.32.2 "@metamask/utils": ^5.0.0 "@noble/hashes": ^1.1.3 "@scure/base": ^1.1.1 @@ -4445,7 +4429,7 @@ __metadata: ses: ^0.18.1 superstruct: ^1.0.3 validate-npm-package-name: ^5.0.0 - checksum: 007dc6e08989b0a197cc84d95b29a194c3408a2f9e822a42c2060a1c842ff10c737cf8f5f0e8f8178a7ea7f98565cfc8e16eaa9181331b50b5dc13c3a80655cd + checksum: 3568fb79cff8283eacb6e1bd498e20191f2c7c6774675be372f5305a4b5275512d1ded2a9fb36c106a8b10c5cbf480f6a87cdacfc70baf642b9bf3094ee3aefa languageName: node linkType: hard @@ -4499,6 +4483,18 @@ __metadata: languageName: node linkType: hard +"@metamask/utils@npm:^4.0.0": + version: 4.0.0 + resolution: "@metamask/utils@npm:4.0.0" + dependencies: + "@types/debug": ^4.1.7 + debug: ^4.3.4 + semver: ^7.3.8 + superstruct: ^1.0.3 + checksum: 6d4edca78fe1f66504ed5e5ca021a67f4b4e0893e86484c746b87039c2161c39d3b8bd8e4b9235ddfd023b2d76dd54210af94ec5550e27bc4ad9c0d7d5f3f231 + languageName: node + linkType: hard + "@metamask/utils@npm:^5.0.0": version: 5.0.0 resolution: "@metamask/utils@npm:5.0.0" @@ -4572,7 +4568,7 @@ __metadata: languageName: node linkType: hard -"@noble/secp256k1@npm:^1.5.5, @noble/secp256k1@npm:^1.7.0": +"@noble/secp256k1@npm:^1.5.5, @noble/secp256k1@npm:^1.7.0, @noble/secp256k1@npm:^1.7.1": version: 1.7.1 resolution: "@noble/secp256k1@npm:1.7.1" checksum: d2301f1f7690368d8409a3152450458f27e54df47e3f917292de3de82c298770890c2de7c967d237eff9c95b70af485389a9695f73eb05a43e2bd562d18b18cb @@ -5104,7 +5100,7 @@ __metadata: languageName: node linkType: hard -"@spruceid/siwe-parser@npm:^1.1.3": +"@spruceid/siwe-parser@npm:1.1.3, @spruceid/siwe-parser@npm:^1.1.3": version: 1.1.3 resolution: "@spruceid/siwe-parser@npm:1.1.3" dependencies: @@ -24294,19 +24290,19 @@ __metadata: "@metamask/metamask-eth-abis": ^3.0.0 "@metamask/notification-controller": ^1.0.0 "@metamask/obs-store": ^5.0.0 - "@metamask/permission-controller": ^2.0.0 + "@metamask/permission-controller": ^3.1.0 "@metamask/phishing-controller": ^2.0.0 "@metamask/phishing-warning": ^2.0.1 "@metamask/post-message-stream": ^6.0.0 "@metamask/providers": ^10.2.1 "@metamask/rate-limit-controller": ^1.0.0 - "@metamask/rpc-methods": ^0.31.0 + "@metamask/rpc-methods": ^0.32.2 "@metamask/scure-bip39": ^2.0.3 "@metamask/slip44": ^2.1.0 "@metamask/smart-transactions-controller": ^3.1.0 - "@metamask/snaps-controllers": ^0.31.0 - "@metamask/snaps-ui": ^0.31.0 - "@metamask/snaps-utils": ^0.31.0 + "@metamask/snaps-controllers": ^0.32.2 + "@metamask/snaps-ui": ^0.32.2 + "@metamask/snaps-utils": ^0.32.2 "@metamask/subject-metadata-controller": ^1.0.0 "@metamask/test-dapp": ^5.6.0 "@metamask/utils": ^5.0.0