diff --git a/.yarn/patches/@metamask-snaps-controllers-npm-9.2.0-09a31bab4f.patch b/.yarn/patches/@metamask-snaps-controllers-npm-9.4.0-7c3abbbea6.patch similarity index 76% rename from .yarn/patches/@metamask-snaps-controllers-npm-9.2.0-09a31bab4f.patch rename to .yarn/patches/@metamask-snaps-controllers-npm-9.4.0-7c3abbbea6.patch index ab75de4b5022..ec4dfb871c9a 100644 --- a/.yarn/patches/@metamask-snaps-controllers-npm-9.2.0-09a31bab4f.patch +++ b/.yarn/patches/@metamask-snaps-controllers-npm-9.4.0-7c3abbbea6.patch @@ -1,5 +1,5 @@ diff --git a/package.json b/package.json -index 7e70a2db3606d673d92d38a2755e155bf2af5fd3..67cff443e63bd04e5699279d8101ef4ec547e9cb 100644 +index 9464ffc2614c6c648051df5cb5c9c9b9e651a831..5b1bcb34b8167cf6bbc5b2854b1f196e0fa0204f 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ diff --git a/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch b/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch deleted file mode 100644 index 82ddce260b99..000000000000 --- a/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/dist/chunk-37VHIRUJ.js b/dist/chunk-37VHIRUJ.js -index a909a4ef20305665a07db5c25b4a9ff7eb0a447e..98dd75bf33a9716dc6cca96a38d184645f6ec033 100644 ---- a/dist/chunk-37VHIRUJ.js -+++ b/dist/chunk-37VHIRUJ.js -@@ -53,8 +53,8 @@ function assertIsKeyringOrigins(value, ErrorWrapper) { - } - function createOriginRegExp(matcher) { - const escaped = matcher.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"); -- const regex = escaped.replace(/\*/gu, ".*"); -- return RegExp(regex, "u"); -+ const regex = escaped.replace(/\\\*/gu, '.*'); -+ return RegExp(`${regex}$`, 'u'); - } - function checkAllowedOrigin(matcher, origin) { - if (matcher === "*" || matcher === origin) { -diff --git a/dist/chunk-K2OTEZZZ.mjs b/dist/chunk-K2OTEZZZ.mjs -index 15be5da7563a5bdf464d7e9c28ed6f04863e378a..7f38bf328e71c1feb2b8850ba050ce9e55801668 100644 ---- a/dist/chunk-K2OTEZZZ.mjs -+++ b/dist/chunk-K2OTEZZZ.mjs -@@ -53,8 +53,8 @@ function assertIsKeyringOrigins(value, ErrorWrapper) { - } - function createOriginRegExp(matcher) { - const escaped = matcher.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"); -- const regex = escaped.replace(/\*/gu, ".*"); -- return RegExp(regex, "u"); -+ const regex = escaped.replace(/\\\*/gu, '.*'); -+ return RegExp(`${regex}$`, 'u'); - } - function checkAllowedOrigin(matcher, origin) { - if (matcher === "*" || matcher === origin) { diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 4e03546efcf7..9af9196a0ef5 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -3846,6 +3846,14 @@ "message": "Let $1 access your preferred language from your MetaMask settings. This can be used to localize and display $1's content using your language.", "description": "An extended description for the `snap_getLocale` permission. $1 is the snap name." }, + "permission_getPreferences": { + "message": "See information like your preferred language and fiat currency.", + "description": "The description for the `snap_getPreferences` permission" + }, + "permission_getPreferencesDescription": { + "message": "Let $1 access information like your preferred language and fiat currency in your MetaMask settings. This helps $1 display content tailored to your preferences. ", + "description": "An extended description for the `snap_getPreferences` permission. $1 is the snap name." + }, "permission_homePage": { "message": "Display a custom screen", "description": "The description for the `endowment:page-home` permission" diff --git a/app/scripts/background.js b/app/scripts/background.js index 747bc9f0079a..aecec7c82869 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -19,6 +19,7 @@ import { ApprovalType } from '@metamask/controller-utils'; import PortStream from 'extension-port-stream'; import { ethErrors } from 'eth-rpc-errors'; +import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods'; import { ENVIRONMENT_TYPE_POPUP, ENVIRONMENT_TYPE_NOTIFICATION, @@ -1102,6 +1103,7 @@ export function setupController( switch (type) { case ApprovalType.SnapDialogAlert: case ApprovalType.SnapDialogPrompt: + case DIALOG_APPROVAL_TYPES.default: controller.approvalController.accept(id, null); break; case ApprovalType.SnapDialogConfirmation: diff --git a/app/scripts/controllers/permissions/specifications.js b/app/scripts/controllers/permissions/specifications.js index e7db368bf0c6..e88c12a74e1a 100644 --- a/app/scripts/controllers/permissions/specifications.js +++ b/app/scripts/controllers/permissions/specifications.js @@ -408,6 +408,7 @@ export const unrestrictedMethods = Object.freeze([ 'snap_createInterface', 'snap_updateInterface', 'snap_getInterfaceState', + 'snap_resolveInterface', ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) 'metamaskinstitutional_authenticate', 'metamaskinstitutional_reauthenticate', diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index b490b53d2c78..1ed12e84b7ce 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -185,7 +185,6 @@ import { UI_NOTIFICATIONS } from '../../shared/notifications'; import { MILLISECOND, SECOND } from '../../shared/constants/time'; import { ORIGIN_METAMASK, - SNAP_DIALOG_TYPES, POLLING_TOKEN_ENVIRONMENT_TYPES, } from '../../shared/constants/app'; import { @@ -1409,6 +1408,8 @@ export default class MetamaskController extends EventEmitter { allowedActions: [ `${this.phishingController.name}:maybeUpdateState`, `${this.phishingController.name}:testOrigin`, + `${this.approvalController.name}:hasRequest`, + `${this.approvalController.name}:acceptRequest`, ], }); @@ -2572,7 +2573,11 @@ export default class MetamaskController extends EventEmitter { ...buildSnapRestrictedMethodSpecifications( Object.keys(ExcludedSnapPermissions), { - getLocale: this.getLocale.bind(this), + getPreferences: () => { + const locale = this.getLocale(); + const currency = this.currencyRateController.state.currentCurrency; + return { locale, currency }; + }, clearSnapState: this.controllerMessenger.call.bind( this.controllerMessenger, 'SnapController:clearSnapState', @@ -2590,12 +2595,10 @@ export default class MetamaskController extends EventEmitter { this.controllerMessenger, 'SnapController:getSnapState', ), - showDialog: (origin, type, id, placeholder) => - this.approvalController.addAndShowApprovalRequest({ - origin, - type: SNAP_DIALOG_TYPES[type], - requestData: { id, placeholder }, - }), + requestUserApproval: + this.approvalController.addAndShowApprovalRequest.bind( + this.approvalController, + ), showNativeNotification: (origin, args) => this.controllerMessenger.call( 'RateLimitController:call', @@ -5667,6 +5670,11 @@ export default class MetamaskController extends EventEmitter { 'SnapInterfaceController:updateInterface', origin, ), + resolveInterface: this.controllerMessenger.call.bind( + this.controllerMessenger, + 'SnapInterfaceController:resolveInterface', + origin, + ), getSnap: this.controllerMessenger.call.bind( this.controllerMessenger, 'SnapController:get', diff --git a/app/scripts/snaps/preinstalled-snaps.ts b/app/scripts/snaps/preinstalled-snaps.ts index ee3bb06c6242..e44682963f61 100644 --- a/app/scripts/snaps/preinstalled-snaps.ts +++ b/app/scripts/snaps/preinstalled-snaps.ts @@ -4,10 +4,11 @@ import MessageSigningSnap from '@metamask/message-signing-snap/dist/preinstalled import BitcoinWalletSnap from '@metamask/bitcoin-wallet-snap/dist/preinstalled-snap.json'; ///: END:ONLY_INCLUDE_IF +// The casts here are less than ideal but we expect the SnapController to validate the inputs. const PREINSTALLED_SNAPS: readonly PreinstalledSnap[] = Object.freeze([ - MessageSigningSnap as PreinstalledSnap, + MessageSigningSnap as unknown as PreinstalledSnap, ///: BEGIN:ONLY_INCLUDE_IF(build-flask) - BitcoinWalletSnap as PreinstalledSnap, + BitcoinWalletSnap as unknown as PreinstalledSnap, ///: END:ONLY_INCLUDE_IF ]); diff --git a/builds.yml b/builds.yml index 6c9b799729af..ff12b626a44f 100644 --- a/builds.yml +++ b/builds.yml @@ -26,7 +26,7 @@ buildTypes: - SEGMENT_WRITE_KEY_REF: SEGMENT_PROD_WRITE_KEY - ALLOW_LOCAL_SNAPS: false - REQUIRE_SNAPS_ALLOWLIST: true - - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html + - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html - ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management # Main build uses the default browser manifest manifestOverrides: false @@ -46,7 +46,7 @@ buildTypes: - SEGMENT_WRITE_KEY_REF: SEGMENT_BETA_WRITE_KEY - ALLOW_LOCAL_SNAPS: false - REQUIRE_SNAPS_ALLOWLIST: true - - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html + - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html - ACCOUNT_SNAPS_DIRECTORY_URL: https://snaps.metamask.io/account-management # Modifies how the version is displayed. # eg. instead of 10.25.0 -> 10.25.0-beta.2 @@ -67,7 +67,7 @@ buildTypes: - SEGMENT_FLASK_WRITE_KEY - ALLOW_LOCAL_SNAPS: true - REQUIRE_SNAPS_ALLOWLIST: false - - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html + - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html - SUPPORT_LINK: https://support.metamask.io/ - SUPPORT_REQUEST_LINK: https://support.metamask.io/ - INFURA_ENV_KEY_REF: INFURA_FLASK_PROJECT_ID @@ -90,7 +90,7 @@ buildTypes: - SEGMENT_WRITE_KEY_REF: SEGMENT_MMI_WRITE_KEY - ALLOW_LOCAL_SNAPS: false - REQUIRE_SNAPS_ALLOWLIST: true - - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.5.0/index.html + - IFRAME_EXECUTION_ENVIRONMENT_URL: https://execution.metamask.io/iframe/6.6.2/index.html - MMI_CONFIGURATION_SERVICE_URL: https://configuration.metamask-institutional.io/v2/configuration/default - SUPPORT_LINK: https://mmi-support.metamask.io/hc/en-us - SUPPORT_REQUEST_LINK: https://mmi-support.metamask.io/hc/en-us/requests/new diff --git a/development/build/scripts.js b/development/build/scripts.js index 2e947a1e3783..35a931841aef 100644 --- a/development/build/scripts.js +++ b/development/build/scripts.js @@ -929,7 +929,11 @@ function setupBundlerDefaults( [ babelify, { - only: ['./**/node_modules/firebase', './**/node_modules/@firebase'], + only: [ + './**/node_modules/firebase', + './**/node_modules/@firebase', + './**/node_modules/marked', + ], global: true, }, ], diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index bc8823a0f527..eee2bda9aeb1 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -952,7 +952,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1095,7 +1095,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1582,7 +1582,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1709,7 +1709,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1885,7 +1885,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1958,7 +1958,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2073,7 +2073,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2312,7 +2312,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2503,7 +2503,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2642,12 +2642,13 @@ }, "packages": { "@metamask/object-multiplex": true, - "@metamask/permission-controller": true, "@metamask/post-message-stream": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@metamask/base-controller": true, "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, "@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true, + "@metamask/snaps-controllers>@metamask/permission-controller": true, + "@metamask/snaps-controllers>@metamask/utils": true, "@metamask/snaps-controllers>@xstate/fsm": true, "@metamask/snaps-controllers>concat-stream": true, "@metamask/snaps-controllers>get-npm-tarball-url": true, @@ -2658,7 +2659,6 @@ "@metamask/snaps-sdk": true, "@metamask/snaps-utils": true, "@metamask/snaps-utils>@metamask/snaps-registry": true, - "@metamask/utils": true, "browserify>browserify-zlib": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -2690,7 +2690,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2716,7 +2716,55 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-controllers>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/base-controller": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "@metamask/snaps-controllers>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-controllers>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2776,20 +2824,179 @@ }, "packages": { "@metamask/post-message-stream": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, "@metamask/snaps-utils": true, "@metamask/utils": true } }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": { + "globals": { + "File": true, + "FileReader": true, + "TextDecoder": true, + "TextEncoder": true, + "URL": true, + "console.error": true, + "console.log": true, + "console.warn": true, + "crypto": true, + "document.body.appendChild": true, + "document.createElement": true, + "fetch": true + }, + "packages": { + "@metamask/eth-snap-keyring>@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/rpc-errors": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-sdk": true, + "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>cron-parser": true, + "@metamask/snaps-utils>fast-json-stable-stringify": true, + "@metamask/snaps-utils>fast-xml-parser": true, + "@metamask/snaps-utils>marked": true, + "@metamask/snaps-utils>rfdc": true, + "@metamask/snaps-utils>validate-npm-package-name": true, + "@metamask/utils>@scure/base": true, + "@noble/hashes": true, + "chalk": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-execution-environments>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-execution-environments>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, "@metamask/snaps-rpc-methods": { "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils": true, - "@metamask/utils": true, + "@noble/hashes": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, "@noble/hashes": true, - "superstruct": true + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/snaps-sdk": { @@ -2798,8 +3005,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/utils": true } }, "@metamask/snaps-sdk>@metamask/key-tree": { @@ -2817,7 +3024,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-sdk>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2842,29 +3064,75 @@ "fetch": true }, "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>@metamask/permission-controller": true, "@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/snaps-utils>@metamask/utils": true, "@metamask/snaps-utils>cron-parser": true, "@metamask/snaps-utils>fast-json-stable-stringify": true, "@metamask/snaps-utils>fast-xml-parser": true, "@metamask/snaps-utils>marked": true, "@metamask/snaps-utils>rfdc": true, "@metamask/snaps-utils>validate-npm-package-name": true, - "@metamask/utils": true, "@metamask/utils>@scure/base": true, "@noble/hashes": true, "chalk": true, - "semver": true, - "superstruct": true + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-utils>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-utils>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true } }, "@metamask/snaps-utils>@metamask/snaps-registry": { "packages": { "@metamask/message-signing-snap>@noble/curves": true, - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": true, "@noble/hashes": true } @@ -2875,7 +3143,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3039,7 +3322,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3116,7 +3399,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index bc8823a0f527..eee2bda9aeb1 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -952,7 +952,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1095,7 +1095,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1582,7 +1582,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1709,7 +1709,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1885,7 +1885,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1958,7 +1958,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2073,7 +2073,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2312,7 +2312,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2503,7 +2503,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2642,12 +2642,13 @@ }, "packages": { "@metamask/object-multiplex": true, - "@metamask/permission-controller": true, "@metamask/post-message-stream": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@metamask/base-controller": true, "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, "@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true, + "@metamask/snaps-controllers>@metamask/permission-controller": true, + "@metamask/snaps-controllers>@metamask/utils": true, "@metamask/snaps-controllers>@xstate/fsm": true, "@metamask/snaps-controllers>concat-stream": true, "@metamask/snaps-controllers>get-npm-tarball-url": true, @@ -2658,7 +2659,6 @@ "@metamask/snaps-sdk": true, "@metamask/snaps-utils": true, "@metamask/snaps-utils>@metamask/snaps-registry": true, - "@metamask/utils": true, "browserify>browserify-zlib": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -2690,7 +2690,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2716,7 +2716,55 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-controllers>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/base-controller": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "@metamask/snaps-controllers>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-controllers>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2776,20 +2824,179 @@ }, "packages": { "@metamask/post-message-stream": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, "@metamask/snaps-utils": true, "@metamask/utils": true } }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": { + "globals": { + "File": true, + "FileReader": true, + "TextDecoder": true, + "TextEncoder": true, + "URL": true, + "console.error": true, + "console.log": true, + "console.warn": true, + "crypto": true, + "document.body.appendChild": true, + "document.createElement": true, + "fetch": true + }, + "packages": { + "@metamask/eth-snap-keyring>@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/rpc-errors": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-sdk": true, + "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>cron-parser": true, + "@metamask/snaps-utils>fast-json-stable-stringify": true, + "@metamask/snaps-utils>fast-xml-parser": true, + "@metamask/snaps-utils>marked": true, + "@metamask/snaps-utils>rfdc": true, + "@metamask/snaps-utils>validate-npm-package-name": true, + "@metamask/utils>@scure/base": true, + "@noble/hashes": true, + "chalk": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-execution-environments>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-execution-environments>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, "@metamask/snaps-rpc-methods": { "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils": true, - "@metamask/utils": true, + "@noble/hashes": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, "@noble/hashes": true, - "superstruct": true + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/snaps-sdk": { @@ -2798,8 +3005,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/utils": true } }, "@metamask/snaps-sdk>@metamask/key-tree": { @@ -2817,7 +3024,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-sdk>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2842,29 +3064,75 @@ "fetch": true }, "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>@metamask/permission-controller": true, "@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/snaps-utils>@metamask/utils": true, "@metamask/snaps-utils>cron-parser": true, "@metamask/snaps-utils>fast-json-stable-stringify": true, "@metamask/snaps-utils>fast-xml-parser": true, "@metamask/snaps-utils>marked": true, "@metamask/snaps-utils>rfdc": true, "@metamask/snaps-utils>validate-npm-package-name": true, - "@metamask/utils": true, "@metamask/utils>@scure/base": true, "@noble/hashes": true, "chalk": true, - "semver": true, - "superstruct": true + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-utils>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-utils>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true } }, "@metamask/snaps-utils>@metamask/snaps-registry": { "packages": { "@metamask/message-signing-snap>@noble/curves": true, - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": true, "@noble/hashes": true } @@ -2875,7 +3143,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3039,7 +3322,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3116,7 +3399,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index bc8823a0f527..eee2bda9aeb1 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -952,7 +952,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1095,7 +1095,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1582,7 +1582,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1709,7 +1709,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1885,7 +1885,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1958,7 +1958,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2073,7 +2073,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2312,7 +2312,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2503,7 +2503,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2642,12 +2642,13 @@ }, "packages": { "@metamask/object-multiplex": true, - "@metamask/permission-controller": true, "@metamask/post-message-stream": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@metamask/base-controller": true, "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, "@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true, + "@metamask/snaps-controllers>@metamask/permission-controller": true, + "@metamask/snaps-controllers>@metamask/utils": true, "@metamask/snaps-controllers>@xstate/fsm": true, "@metamask/snaps-controllers>concat-stream": true, "@metamask/snaps-controllers>get-npm-tarball-url": true, @@ -2658,7 +2659,6 @@ "@metamask/snaps-sdk": true, "@metamask/snaps-utils": true, "@metamask/snaps-utils>@metamask/snaps-registry": true, - "@metamask/utils": true, "browserify>browserify-zlib": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -2690,7 +2690,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2716,7 +2716,55 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-controllers>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/base-controller": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "@metamask/snaps-controllers>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-controllers>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2776,20 +2824,179 @@ }, "packages": { "@metamask/post-message-stream": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, "@metamask/snaps-utils": true, "@metamask/utils": true } }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": { + "globals": { + "File": true, + "FileReader": true, + "TextDecoder": true, + "TextEncoder": true, + "URL": true, + "console.error": true, + "console.log": true, + "console.warn": true, + "crypto": true, + "document.body.appendChild": true, + "document.createElement": true, + "fetch": true + }, + "packages": { + "@metamask/eth-snap-keyring>@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/rpc-errors": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-sdk": true, + "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>cron-parser": true, + "@metamask/snaps-utils>fast-json-stable-stringify": true, + "@metamask/snaps-utils>fast-xml-parser": true, + "@metamask/snaps-utils>marked": true, + "@metamask/snaps-utils>rfdc": true, + "@metamask/snaps-utils>validate-npm-package-name": true, + "@metamask/utils>@scure/base": true, + "@noble/hashes": true, + "chalk": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-execution-environments>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-execution-environments>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, "@metamask/snaps-rpc-methods": { "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils": true, - "@metamask/utils": true, + "@noble/hashes": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, "@noble/hashes": true, - "superstruct": true + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/snaps-sdk": { @@ -2798,8 +3005,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/utils": true } }, "@metamask/snaps-sdk>@metamask/key-tree": { @@ -2817,7 +3024,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-sdk>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2842,29 +3064,75 @@ "fetch": true }, "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>@metamask/permission-controller": true, "@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/snaps-utils>@metamask/utils": true, "@metamask/snaps-utils>cron-parser": true, "@metamask/snaps-utils>fast-json-stable-stringify": true, "@metamask/snaps-utils>fast-xml-parser": true, "@metamask/snaps-utils>marked": true, "@metamask/snaps-utils>rfdc": true, "@metamask/snaps-utils>validate-npm-package-name": true, - "@metamask/utils": true, "@metamask/utils>@scure/base": true, "@noble/hashes": true, "chalk": true, - "semver": true, - "superstruct": true + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-utils>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-utils>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true } }, "@metamask/snaps-utils>@metamask/snaps-registry": { "packages": { "@metamask/message-signing-snap>@noble/curves": true, - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": true, "@noble/hashes": true } @@ -2875,7 +3143,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3039,7 +3322,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3116,7 +3399,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, diff --git a/lavamoat/browserify/mmi/policy.json b/lavamoat/browserify/mmi/policy.json index 8cec5f656bf5..02d132bfc7cd 100644 --- a/lavamoat/browserify/mmi/policy.json +++ b/lavamoat/browserify/mmi/policy.json @@ -1044,7 +1044,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1187,7 +1187,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1674,7 +1674,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1801,7 +1801,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -1977,7 +1977,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2050,7 +2050,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2165,7 +2165,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2404,7 +2404,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2595,7 +2595,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2734,12 +2734,13 @@ }, "packages": { "@metamask/object-multiplex": true, - "@metamask/permission-controller": true, "@metamask/post-message-stream": true, "@metamask/rpc-errors": true, "@metamask/snaps-controllers>@metamask/base-controller": true, "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, "@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true, + "@metamask/snaps-controllers>@metamask/permission-controller": true, + "@metamask/snaps-controllers>@metamask/utils": true, "@metamask/snaps-controllers>@xstate/fsm": true, "@metamask/snaps-controllers>concat-stream": true, "@metamask/snaps-controllers>get-npm-tarball-url": true, @@ -2750,7 +2751,6 @@ "@metamask/snaps-sdk": true, "@metamask/snaps-utils": true, "@metamask/snaps-utils>@metamask/snaps-registry": true, - "@metamask/utils": true, "browserify>browserify-zlib": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -2782,7 +2782,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2808,7 +2808,55 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-controllers>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/base-controller": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "@metamask/snaps-controllers>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-controllers>@metamask/phishing-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-controllers>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-controllers>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2868,20 +2916,179 @@ }, "packages": { "@metamask/post-message-stream": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, "@metamask/snaps-utils": true, "@metamask/utils": true } }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils": { + "globals": { + "File": true, + "FileReader": true, + "TextDecoder": true, + "TextEncoder": true, + "URL": true, + "console.error": true, + "console.log": true, + "console.warn": true, + "crypto": true, + "document.body.appendChild": true, + "document.createElement": true, + "fetch": true + }, + "packages": { + "@metamask/eth-snap-keyring>@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/rpc-errors": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-sdk": true, + "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>cron-parser": true, + "@metamask/snaps-utils>fast-json-stable-stringify": true, + "@metamask/snaps-utils>fast-xml-parser": true, + "@metamask/snaps-utils>marked": true, + "@metamask/snaps-utils>rfdc": true, + "@metamask/snaps-utils>validate-npm-package-name": true, + "@metamask/utils>@scure/base": true, + "@noble/hashes": true, + "chalk": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "@metamask/snaps-execution-environments>nanoid": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-execution-environments>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-execution-environments>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-execution-environments>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, "@metamask/snaps-rpc-methods": { "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils": true, - "@metamask/utils": true, + "@noble/hashes": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-rpc-methods>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true + } + }, + "@metamask/snaps-rpc-methods>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, "@noble/hashes": true, - "superstruct": true + "browserify>buffer": true, + "nock>debug": true, + "semver": true } }, "@metamask/snaps-sdk": { @@ -2890,8 +3097,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/utils": true } }, "@metamask/snaps-sdk>@metamask/key-tree": { @@ -2909,7 +3116,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-sdk>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -2934,29 +3156,75 @@ "fetch": true }, "packages": { - "@metamask/permission-controller": true, "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, "@metamask/snaps-sdk>@metamask/key-tree": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/snaps-utils>@metamask/permission-controller": true, "@metamask/snaps-utils>@metamask/slip44": true, + "@metamask/snaps-utils>@metamask/utils": true, "@metamask/snaps-utils>cron-parser": true, "@metamask/snaps-utils>fast-json-stable-stringify": true, "@metamask/snaps-utils>fast-xml-parser": true, "@metamask/snaps-utils>marked": true, "@metamask/snaps-utils>rfdc": true, "@metamask/snaps-utils>validate-npm-package-name": true, - "@metamask/utils": true, "@metamask/utils>@scure/base": true, "@noble/hashes": true, "chalk": true, - "semver": true, - "superstruct": true + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/base-controller": { + "globals": { + "setTimeout": true + }, + "packages": { + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller": { + "globals": { + "console.error": true + }, + "packages": { + "@metamask/rpc-errors": true, + "@metamask/snaps-controllers>@metamask/json-rpc-engine": true, + "@metamask/snaps-utils>@metamask/base-controller": true, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": true, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": true, + "@metamask/snaps-utils>@metamask/utils": true, + "deep-freeze-strict": true, + "immer": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils": { + "globals": { + "URL": true, + "console.error": true, + "fetch": true, + "setTimeout": true + }, + "packages": { + "@ethereumjs/tx>@ethereumjs/util": true, + "@metamask/controller-utils>@spruceid/siwe-parser": true, + "@metamask/ethjs>@metamask/ethjs-unit": true, + "@metamask/snaps-utils>@metamask/utils": true, + "bn.js": true, + "browserify>buffer": true, + "eslint>fast-deep-equal": true, + "eth-ens-namehash": true + } + }, + "@metamask/snaps-utils>@metamask/permission-controller>nanoid": { + "globals": { + "crypto.getRandomValues": true } }, "@metamask/snaps-utils>@metamask/snaps-registry": { "packages": { "@metamask/message-signing-snap>@noble/curves": true, - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/snaps-utils>@metamask/snaps-registry>@metamask/utils": true, "@noble/hashes": true } @@ -2967,7 +3235,22 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, + "@metamask/utils>@scure/base": true, + "@metamask/utils>pony-cause": true, + "@noble/hashes": true, + "browserify>buffer": true, + "nock>debug": true, + "semver": true + } + }, + "@metamask/snaps-utils>@metamask/utils": { + "globals": { + "TextDecoder": true, + "TextEncoder": true + }, + "packages": { + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3131,7 +3414,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, @@ -3208,7 +3491,7 @@ "TextEncoder": true }, "packages": { - "@metamask/rpc-errors>@metamask/utils>@metamask/superstruct": true, + "@metamask/snaps-sdk>@metamask/superstruct": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "@noble/hashes": true, diff --git a/package.json b/package.json index b8774bb632fc..eb128ebbe436 100644 --- a/package.json +++ b/package.json @@ -227,7 +227,7 @@ "semver@7.3.8": "^7.5.4", "@trezor/schema-utils@npm:1.0.2": "patch:@trezor/schema-utils@npm%3A1.0.2#~/.yarn/patches/@trezor-schema-utils-npm-1.0.2-7dd48689b2.patch", "lavamoat-core@npm:^15.1.1": "patch:lavamoat-core@npm%3A15.1.1#~/.yarn/patches/lavamoat-core-npm-15.1.1-51fbe39988.patch", - "@metamask/snaps-sdk": "^6.0.0", + "@metamask/snaps-sdk": "^6.2.1", "@metamask/transaction-controller": "^34.0.0", "@swc/types@0.1.5": "^0.1.6", "@babel/runtime@npm:^7.7.6": "patch:@babel/runtime@npm%3A7.24.0#~/.yarn/patches/@babel-runtime-npm-7.24.0-7eb1dd11a2.patch", @@ -261,12 +261,9 @@ "@solana/web3.js/rpc-websockets": "^8.0.1", "@metamask/network-controller@npm:^19.0.0": "patch:@metamask/network-controller@npm%3A19.0.0#~/.yarn/patches/@metamask-network-controller-npm-19.0.0-a5e0d1fe14.patch", "@metamask/gas-fee-controller@npm:^15.1.1": "patch:@metamask/gas-fee-controller@npm%3A15.1.2#~/.yarn/patches/@metamask-gas-fee-controller-npm-15.1.2-db4d2976aa.patch", - "@metamask/snaps-controllers@npm:^8.1.1": "patch:@metamask/snaps-controllers@npm%3A9.2.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.2.0-09a31bab4f.patch", - "@metamask/snaps-controllers@npm:^9.2.0": "patch:@metamask/snaps-controllers@npm%3A9.2.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.2.0-09a31bab4f.patch", + "@metamask/snaps-controllers@npm:^8.1.1": "patch:@metamask/snaps-controllers@npm%3A9.4.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.4.0-7c3abbbea6.patch", + "@metamask/snaps-controllers@npm:^9.4.0": "patch:@metamask/snaps-controllers@npm%3A9.4.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.4.0-7c3abbbea6.patch", "@metamask/nonce-tracker@npm:^5.0.0": "patch:@metamask/nonce-tracker@npm%3A5.0.0#~/.yarn/patches/@metamask-nonce-tracker-npm-5.0.0-d81478218e.patch", - "@metamask/snaps-utils@npm:^7.7.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", - "@metamask/snaps-utils@npm:^7.4.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", - "@metamask/snaps-utils@npm:^7.5.0": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", "@metamask/keyring-controller@npm:^16.0.0": "patch:@metamask/keyring-controller@npm%3A17.1.1#~/.yarn/patches/@metamask-keyring-controller-npm-17.1.1-098cb41930.patch", "@metamask/keyring-controller@npm:^17.1.0": "patch:@metamask/keyring-controller@npm%3A17.1.1#~/.yarn/patches/@metamask-keyring-controller-npm-17.1.1-098cb41930.patch" }, @@ -353,11 +350,11 @@ "@metamask/selected-network-controller": "^15.0.2", "@metamask/signature-controller": "^17.0.0", "@metamask/smart-transactions-controller": "^11.0.0", - "@metamask/snaps-controllers": "^9.2.0", - "@metamask/snaps-execution-environments": "^6.5.0", - "@metamask/snaps-rpc-methods": "^9.1.4", - "@metamask/snaps-sdk": "^6.0.0", - "@metamask/snaps-utils": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch", + "@metamask/snaps-controllers": "^9.4.0", + "@metamask/snaps-execution-environments": "^6.6.2", + "@metamask/snaps-rpc-methods": "^11.0.0", + "@metamask/snaps-sdk": "^6.2.1", + "@metamask/snaps-utils": "^8.0.1", "@metamask/transaction-controller": "^34.0.0", "@metamask/user-operation-controller": "^13.0.0", "@metamask/utils": "^8.2.1", diff --git a/shared/constants/app.ts b/shared/constants/app.ts index b60b98b46fbb..70a393626b58 100644 --- a/shared/constants/app.ts +++ b/shared/constants/app.ts @@ -1,4 +1,4 @@ -import { DialogType } from '@metamask/snaps-sdk'; +import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods'; import { RestrictedMethods } from './permissions'; /** @@ -48,9 +48,10 @@ export const MESSAGE_TYPE = { WALLET_REQUEST_PERMISSIONS: 'wallet_requestPermissions', WATCH_ASSET: 'wallet_watchAsset', WATCH_ASSET_LEGACY: 'metamask_watchAsset', - SNAP_DIALOG_ALERT: `${RestrictedMethods.snap_dialog}:alert`, - SNAP_DIALOG_CONFIRMATION: `${RestrictedMethods.snap_dialog}:confirmation`, - SNAP_DIALOG_PROMPT: `${RestrictedMethods.snap_dialog}:prompt`, + SNAP_DIALOG_ALERT: DIALOG_APPROVAL_TYPES.alert, + SNAP_DIALOG_CONFIRMATION: DIALOG_APPROVAL_TYPES.confirmation, + SNAP_DIALOG_PROMPT: DIALOG_APPROVAL_TYPES.prompt, + SNAP_DIALOG_DEFAULT: DIALOG_APPROVAL_TYPES.default, ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) MMI_AUTHENTICATE: 'metamaskinstitutional_authenticate', MMI_REAUTHENTICATE: 'metamaskinstitutional_reauthenticate', @@ -64,12 +65,6 @@ export const MESSAGE_TYPE = { ///: END:ONLY_INCLUDE_IF } as const; -export const SNAP_DIALOG_TYPES = { - [DialogType.Alert]: MESSAGE_TYPE.SNAP_DIALOG_ALERT, - [DialogType.Confirmation]: MESSAGE_TYPE.SNAP_DIALOG_CONFIRMATION, - [DialogType.Prompt]: MESSAGE_TYPE.SNAP_DIALOG_PROMPT, -}; - ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) export const SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES = { confirmAccountCreation: 'snap_manageAccounts:confirmAccountCreation', diff --git a/shared/constants/permissions.ts b/shared/constants/permissions.ts index a34065b2ee31..0829d772e854 100644 --- a/shared/constants/permissions.ts +++ b/shared/constants/permissions.ts @@ -17,6 +17,7 @@ export const RestrictedMethods = Object.freeze({ snap_getBip44Entropy: 'snap_getBip44Entropy', snap_getEntropy: 'snap_getEntropy', snap_getLocale: 'snap_getLocale', + snap_getPreferences: 'snap_getPreferences', wallet_snap: 'wallet_snap', ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) snap_manageAccounts: 'snap_manageAccounts', diff --git a/test/e2e/snaps/enums.js b/test/e2e/snaps/enums.js index 98bbdfea099a..981984634a37 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/snaps/test-snaps/2.11.0/', + TEST_SNAPS_WEBSITE_URL: 'https://metamask.github.io/snaps/test-snaps/2.12.0/', }; diff --git a/ui/components/app/app-components.scss b/ui/components/app/app-components.scss index 321a5faf9448..bb421c08fe8c 100644 --- a/ui/components/app/app-components.scss +++ b/ui/components/app/app-components.scss @@ -32,6 +32,7 @@ @import 'snaps/show-more/index'; @import 'snaps/insight-warnings/index'; @import 'snaps/snap-authorship-header/index'; +@import 'snaps/snap-footer-button/index'; @import 'hold-to-reveal-button/index'; @import 'home-notification/index'; @import 'info-box/index'; diff --git a/ui/components/app/metamask-template-renderer/safe-component-list.js b/ui/components/app/metamask-template-renderer/safe-component-list.js index 5c306e0c17d2..13dd62e1110c 100644 --- a/ui/components/app/metamask-template-renderer/safe-component-list.js +++ b/ui/components/app/metamask-template-renderer/safe-component-list.js @@ -12,7 +12,7 @@ import TextField from '../../ui/text-field'; import ConfirmationNetworkSwitch from '../../../pages/confirmations/confirmation/components/confirmation-network-switch'; import UrlIcon from '../../ui/url-icon'; import Tooltip from '../../ui/tooltip/tooltip'; -import { AvatarIcon, Text } from '../../component-library'; +import { AvatarIcon, FormTextField, Text } from '../../component-library'; import ActionableMessage from '../../ui/actionable-message/actionable-message'; import { AccountListItem } from '../../multichain'; import { @@ -32,8 +32,10 @@ import { SnapUIInput } from '../snaps/snap-ui-input'; import { SnapUIForm } from '../snaps/snap-ui-form'; import { SnapUIButton } from '../snaps/snap-ui-button'; import { SnapUIDropdown } from '../snaps/snap-ui-dropdown'; +import { SnapUIRadioGroup } from '../snaps/snap-ui-radio-group'; import { SnapUICheckbox } from '../snaps/snap-ui-checkbox'; import { SnapUITooltip } from '../snaps/snap-ui-tooltip'; +import { SnapFooterButton } from '../snaps/snap-footer-button'; ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) import { SnapAccountSuccessMessage } from '../../../pages/confirmations/components/snap-account-success-message'; import { SnapAccountErrorMessage } from '../../../pages/confirmations/components/snap-account-error-message'; @@ -87,8 +89,11 @@ export const safeComponentList = { SnapUIButton, SnapUIForm, SnapUIDropdown, + SnapUIRadioGroup, SnapUICheckbox, SnapUITooltip, + SnapFooterButton, + FormTextField, ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) CreateSnapAccount, RemoveSnapAccount, diff --git a/ui/components/app/snaps/snap-avatar/snap-avatar.js b/ui/components/app/snaps/snap-avatar/snap-avatar.js index 5c7fd79b45e1..97b6fa90de5b 100644 --- a/ui/components/app/snaps/snap-avatar/snap-avatar.js +++ b/ui/components/app/snaps/snap-avatar/snap-avatar.js @@ -1,29 +1,20 @@ import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; -import { useSelector } from 'react-redux'; + import { - TextColor, IconColor, - AlignItems, - Display, - JustifyContent, BackgroundColor, } from '../../../../helpers/constants/design-system'; import { - AvatarFavicon, BadgeWrapper, BadgeWrapperPosition, AvatarIcon, - AvatarBase, IconName, IconSize, } from '../../../component-library'; -import { - getSnapMetadata, - getTargetSubjectMetadata, -} from '../../../../selectors'; -import { getAvatarFallbackLetter } from '../../../../helpers/utils/util'; + +import { SnapIcon } from '../snap-icon'; const SnapAvatar = ({ snapId, @@ -33,19 +24,6 @@ const SnapAvatar = ({ className, badgeBackgroundColor = BackgroundColor.backgroundAlternative, }) => { - const subjectMetadata = useSelector((state) => - getTargetSubjectMetadata(state, snapId), - ); - - const { name: snapName } = useSelector((state) => - getSnapMetadata(state, snapId), - ); - - const iconUrl = subjectMetadata?.iconUrl; - - // We choose the first non-symbol char as the fallback icon. - const fallbackIcon = getAvatarFallbackLetter(snapName); - return ( - {iconUrl ? ( - - ) : ( - - {fallbackIcon} - - )} + ); }; diff --git a/ui/components/app/snaps/snap-footer-button/index.scss b/ui/components/app/snaps/snap-footer-button/index.scss new file mode 100644 index 000000000000..10a830eccf80 --- /dev/null +++ b/ui/components/app/snaps/snap-footer-button/index.scss @@ -0,0 +1,45 @@ +.snap-footer-button { + &.mm-button-primary { + box-shadow: none; + color: var(--color-text-alternative); + background-color: var(--color-icon-default); + + &:hover:not(&--disabled) { + opacity: 80%; + box-shadow: none; + } + + &:active:not(&--disabled) { + opacity: 60%; + } + } + + &.mm-button-secondary { + border-color: var(--color-icon-default); + color: var(--color-icon-default); + + & span { + color: var(--color-icon-default); + } + + &:hover:not(&--disabled) { + border-color: var(--color-icon-default); + color: var(--color-background-default); + background-color: var(--color-background-default-hover); + box-shadow: none; + + & span { + color: var(--color-icon-default); + } + } + + &:active:not(&--disabled) { + border-color: var(--color-icon-default); + opacity: 60%; + + & span { + color: var(--color-icon-default); + } + } + } +} diff --git a/ui/components/app/snaps/snap-footer-button/index.ts b/ui/components/app/snaps/snap-footer-button/index.ts new file mode 100644 index 000000000000..caec6d30d2f8 --- /dev/null +++ b/ui/components/app/snaps/snap-footer-button/index.ts @@ -0,0 +1 @@ +export * from './snap-footer-button'; diff --git a/ui/components/app/snaps/snap-footer-button/snap-footer-button.tsx b/ui/components/app/snaps/snap-footer-button/snap-footer-button.tsx new file mode 100644 index 000000000000..64abe9032a3a --- /dev/null +++ b/ui/components/app/snaps/snap-footer-button/snap-footer-button.tsx @@ -0,0 +1,58 @@ +import React, { FunctionComponent, MouseEvent as ReactMouseEvent } from 'react'; +import { ButtonVariant, UserInputEventType } from '@metamask/snaps-sdk'; +import { Button, ButtonSize, IconSize } from '../../../component-library'; +import { + AlignItems, + Display, + FlexDirection, +} from '../../../../helpers/constants/design-system'; +import { useSnapInterfaceContext } from '../../../../contexts/snaps'; +import { SnapIcon } from '../snap-icon'; + +type SnapFooterButtonProps = { + name?: string; + isSnapAction?: boolean; + onCancel?: () => void; +}; + +export const SnapFooterButton: FunctionComponent = ({ + onCancel, + name, + children, + isSnapAction = false, + ...props +}) => { + const { handleEvent, snapId } = useSnapInterfaceContext(); + + const handleSnapAction = (event: ReactMouseEvent) => { + event.preventDefault(); + + handleEvent({ + event: UserInputEventType.ButtonClickEvent, + name, + }); + }; + + const handleClick = isSnapAction ? handleSnapAction : onCancel; + + return ( + + ); +}; diff --git a/ui/components/app/snaps/snap-icon/index.ts b/ui/components/app/snaps/snap-icon/index.ts new file mode 100644 index 000000000000..b93c5393f991 --- /dev/null +++ b/ui/components/app/snaps/snap-icon/index.ts @@ -0,0 +1 @@ +export * from './snap-icon'; diff --git a/ui/components/app/snaps/snap-icon/snap-icon.tsx b/ui/components/app/snaps/snap-icon/snap-icon.tsx new file mode 100644 index 000000000000..fa27616e4d97 --- /dev/null +++ b/ui/components/app/snaps/snap-icon/snap-icon.tsx @@ -0,0 +1,78 @@ +import React, { FunctionComponent } from 'react'; + +import { useSelector } from 'react-redux'; +import { + getSnapMetadata, + getTargetSubjectMetadata, +} from '../../../../selectors'; +import { getAvatarFallbackLetter } from '../../../../helpers/utils/util'; +import { + AvatarBase, + AvatarBaseSize, + AvatarFavicon, + AvatarFaviconProps, + AvatarFaviconSize, + IconSize, +} from '../../../component-library'; +import { + AlignItems, + BackgroundColor, + Display, + JustifyContent, + TextColor, +} from '../../../../helpers/constants/design-system'; + +type SnapIconProps = { + snapId: string; + avatarSize?: IconSize; + borderWidth?: number; + className?: string; + badgeBackgroundColor?: BackgroundColor; +} & Omit, 'name'>; + +export const SnapIcon: FunctionComponent = ({ + snapId, + avatarSize = IconSize.Lg, + ...props +}) => { + const subjectMetadata = useSelector((state) => + getTargetSubjectMetadata(state, snapId), + ); + + const { name: snapName } = useSelector((state) => + /* @ts-expect-error wrong type on selector. */ + getSnapMetadata(state, snapId), + ); + + const iconUrl = subjectMetadata?.iconUrl; + + // We choose the first non-symbol char as the fallback icon. + const fallbackIcon = getAvatarFallbackLetter(snapName); + + return iconUrl ? ( + + ) : ( + + {fallbackIcon} + + ); +}; diff --git a/ui/components/app/snaps/snap-ui-button/snap-ui-button.tsx b/ui/components/app/snaps/snap-ui-button/snap-ui-button.tsx index 998a7ca2d782..32df513de8ee 100644 --- a/ui/components/app/snaps/snap-ui-button/snap-ui-button.tsx +++ b/ui/components/app/snaps/snap-ui-button/snap-ui-button.tsx @@ -2,11 +2,11 @@ import React, { FunctionComponent, MouseEvent as ReactMouseEvent } from 'react'; import classnames from 'classnames'; import { ButtonType, UserInputEventType } from '@metamask/snaps-sdk'; import { ButtonLinkProps, Text } from '../../../component-library'; -import { useSnapInterfaceContext } from '../../../../contexts/snaps'; import { FontWeight, TextColor, } from '../../../../helpers/constants/design-system'; +import { useSnapInterfaceContext } from '../../../../contexts/snaps'; export type SnapUIButtonProps = { name?: string; diff --git a/ui/components/app/snaps/snap-ui-card/index.ts b/ui/components/app/snaps/snap-ui-card/index.ts new file mode 100644 index 000000000000..4bedd11620ca --- /dev/null +++ b/ui/components/app/snaps/snap-ui-card/index.ts @@ -0,0 +1 @@ +export * from './snap-ui-card'; diff --git a/ui/components/app/snaps/snap-ui-card/snap-ui-card.stories.tsx b/ui/components/app/snaps/snap-ui-card/snap-ui-card.stories.tsx new file mode 100644 index 000000000000..f8a9f63d47bb --- /dev/null +++ b/ui/components/app/snaps/snap-ui-card/snap-ui-card.stories.tsx @@ -0,0 +1,33 @@ +import React from 'react'; +import { SnapUICard } from './snap-ui-card'; + +export default { + title: 'Components/App/Snaps/SnapUICard', + component: SnapUICard, + argTypes: { + title: { + control: 'text', + }, + description: { + control: 'text', + }, + value: { + control: 'text', + }, + extra: { + control: 'text', + }, + }, +}; + +export const DefaultStory = (args) => ; + +DefaultStory.storyName = 'Default'; + +DefaultStory.args = { + image: ``, + title: 'Title', + description: 'Description', + value: 'Value', + extra: 'Extra', +}; diff --git a/ui/components/app/snaps/snap-ui-card/snap-ui-card.tsx b/ui/components/app/snaps/snap-ui-card/snap-ui-card.tsx new file mode 100644 index 000000000000..d2f2a6a1e8de --- /dev/null +++ b/ui/components/app/snaps/snap-ui-card/snap-ui-card.tsx @@ -0,0 +1,58 @@ +import React, { FunctionComponent } from 'react'; +import { + Display, + FlexDirection, + JustifyContent, + TextAlign, + TextColor, + TextVariant, +} from '../../../../helpers/constants/design-system'; +import { Box, Text } from '../../../component-library'; +import { SnapUIImage } from '../snap-ui-image'; + +export type SnapUICardProps = { + image?: string | undefined; + title: string; + description?: string | undefined; + value: string; + extra?: string | undefined; +}; + +export const SnapUICard: FunctionComponent = ({ + image, + title, + description, + value, + extra, +}) => { + return ( + + + {image && ( + + )} + + {title} + {description} + + + + {value} + {extra} + + + ); +}; diff --git a/ui/components/app/snaps/snap-ui-checkbox/snap-ui-checkbox.tsx b/ui/components/app/snaps/snap-ui-checkbox/snap-ui-checkbox.tsx index 39df1c0ff8f7..a5f769bbef80 100644 --- a/ui/components/app/snaps/snap-ui-checkbox/snap-ui-checkbox.tsx +++ b/ui/components/app/snaps/snap-ui-checkbox/snap-ui-checkbox.tsx @@ -33,7 +33,7 @@ export const SnapUICheckbox: FunctionComponent = ({ }) => { const { handleInputChange, getValue } = useSnapInterfaceContext(); - const initialValue = getValue(name, form); + const initialValue = getValue(name, form) as boolean; const [value, setValue] = useState(initialValue ?? false); diff --git a/ui/components/app/snaps/snap-ui-dropdown/snap-ui-dropdown.tsx b/ui/components/app/snaps/snap-ui-dropdown/snap-ui-dropdown.tsx index 2e70f2809399..46a5d6e35ef6 100644 --- a/ui/components/app/snaps/snap-ui-dropdown/snap-ui-dropdown.tsx +++ b/ui/components/app/snaps/snap-ui-dropdown/snap-ui-dropdown.tsx @@ -29,7 +29,7 @@ export const SnapUIDropdown: FunctionComponent = ({ }) => { const { handleInputChange, getValue } = useSnapInterfaceContext(); - const initialValue = getValue(name, form); + const initialValue = getValue(name, form) as string; const [value, setValue] = useState(initialValue ?? ''); diff --git a/ui/components/app/snaps/snap-ui-image/snap-ui-image.tsx b/ui/components/app/snaps/snap-ui-image/snap-ui-image.tsx index 29c28b56a564..840ac42845bd 100644 --- a/ui/components/app/snaps/snap-ui-image/snap-ui-image.tsx +++ b/ui/components/app/snaps/snap-ui-image/snap-ui-image.tsx @@ -2,10 +2,27 @@ import React from 'react'; export type SnapUIImageProps = { value: string; + style?: React.CSSProperties; + width?: string; + height?: string; }; -export const SnapUIImage = ({ value }: SnapUIImageProps) => { +export const SnapUIImage = ({ + value, + width, + height, + style, +}: SnapUIImageProps) => { const src = `data:image/svg+xml;utf8,${encodeURIComponent(value)}`; - return ; + return ( + + ); }; diff --git a/ui/components/app/snaps/snap-ui-input/snap-ui-input.tsx b/ui/components/app/snaps/snap-ui-input/snap-ui-input.tsx index 43c612517139..e489d2a6f4a5 100644 --- a/ui/components/app/snaps/snap-ui-input/snap-ui-input.tsx +++ b/ui/components/app/snaps/snap-ui-input/snap-ui-input.tsx @@ -17,7 +17,7 @@ export const SnapUIInput: FunctionComponent< > = ({ name, form, ...props }) => { const { handleInputChange, getValue } = useSnapInterfaceContext(); - const initialValue = getValue(name, form); + const initialValue = getValue(name, form) as string; const [value, setValue] = useState(initialValue ?? ''); diff --git a/ui/components/app/snaps/snap-ui-radio-group/index.ts b/ui/components/app/snaps/snap-ui-radio-group/index.ts new file mode 100644 index 000000000000..973dd83fc50f --- /dev/null +++ b/ui/components/app/snaps/snap-ui-radio-group/index.ts @@ -0,0 +1 @@ +export * from './snap-ui-radio-group'; diff --git a/ui/components/app/snaps/snap-ui-radio-group/snap-ui-radio-group.tsx b/ui/components/app/snaps/snap-ui-radio-group/snap-ui-radio-group.tsx new file mode 100644 index 000000000000..4563fbc02fe3 --- /dev/null +++ b/ui/components/app/snaps/snap-ui-radio-group/snap-ui-radio-group.tsx @@ -0,0 +1,91 @@ +import React, { FunctionComponent, useEffect, useState } from 'react'; +import { useSnapInterfaceContext } from '../../../../contexts/snaps'; +import { + AlignItems, + Display, + FlexDirection, + TextVariant, +} from '../../../../helpers/constants/design-system'; +import { + Box, + HelpText, + HelpTextSeverity, + Label, + Text, +} from '../../../component-library'; + +export type SnapUIRadioOption = { value: string; name: string }; + +export type SnapUIRadioGroupProps = { + name: string; + label?: string; + error?: string; + options: SnapUIRadioOption[]; + form?: string; +}; + +export const SnapUIRadioGroup: FunctionComponent = ({ + name, + label, + error, + form, + ...props +}) => { + const { handleInputChange, getValue } = useSnapInterfaceContext(); + + const initialValue = getValue(name, form) as string; + + const [value, setValue] = useState(initialValue ?? ''); + + useEffect(() => { + if (initialValue && value !== initialValue) { + setValue(initialValue); + } + }, [initialValue]); + + const handleChange = (newValue: string) => { + setValue(newValue); + handleInputChange(name, newValue, form); + }; + + const displayRadioOptions = (options: SnapUIRadioOption[]) => { + return options.map((option: SnapUIRadioOption) => { + return ( + + handleChange(option.value)} + /> + + {option.name} + + + ); + }); + }; + + return ( + + {label && } + {displayRadioOptions(props.options)} + {error && ( + + {error} + + )} + + ); +}; diff --git a/ui/components/app/snaps/snap-ui-renderer/components/card.ts b/ui/components/app/snaps/snap-ui-renderer/components/card.ts new file mode 100644 index 000000000000..64c2b1c12a57 --- /dev/null +++ b/ui/components/app/snaps/snap-ui-renderer/components/card.ts @@ -0,0 +1,13 @@ +import { CardElement } from '@metamask/snaps-sdk/jsx'; +import { UIComponentFactory } from './types'; + +export const card: UIComponentFactory = ({ element }) => ({ + element: 'SnapUICard', + props: { + image: element.props.image, + title: element.props.title, + description: element.props.description, + value: element.props.value, + extra: element.props.extra, + }, +}); diff --git a/ui/components/app/snaps/snap-ui-renderer/components/container.ts b/ui/components/app/snaps/snap-ui-renderer/components/container.ts new file mode 100644 index 000000000000..e6496d32fbe5 --- /dev/null +++ b/ui/components/app/snaps/snap-ui-renderer/components/container.ts @@ -0,0 +1,84 @@ +import { BoxElement, JSXElement } from '@metamask/snaps-sdk/jsx'; +import { getJsxChildren } from '@metamask/snaps-utils'; +import { mapToTemplate } from '../utils'; +import { + BlockSize, + Display, + FlexDirection, +} from '../../../../../helpers/constants/design-system'; +import { UIComponentFactory } from './types'; +import { DEFAULT_FOOTER } from './footer'; + +export const container: UIComponentFactory = ({ + element, + useFooter, + onCancel, + promptLegacyProps, + t, + ...params +}) => { + const children = getJsxChildren(element); + + // Remove footer if it's not allowed + if (!useFooter && children.length === 2) { + children.pop(); + } + + const templateChildren = children.map((child) => + mapToTemplate({ + useFooter, + onCancel, + t, + ...params, + element: child as JSXElement, + }), + ); + + // Injects the prompt input field into the template if the dialog is a prompt type. + if (promptLegacyProps) { + templateChildren.push({ + element: 'FormTextField', + key: 'snap-prompt-input', + props: { + marginLeft: 4, + marginRight: 4, + className: 'snap-prompt-input', + value: promptLegacyProps.inputValue, + onChange: promptLegacyProps.onInputChange, + placeholder: promptLegacyProps.placeholder, + maxLength: 300, + }, + }); + } + + // Injects the default footer if the dialog uses default footer but none was provided. + if (useFooter && !children[1]) { + templateChildren.push({ + ...DEFAULT_FOOTER, + props: { + ...DEFAULT_FOOTER.props, + className: 'snap-ui-renderer__footer-centered', + }, + children: { + element: 'SnapFooterButton', + key: 'default-button', + props: { + onCancel, + isSnapAction: false, + }, + children: t('close'), + }, + }); + } + + return { + element: 'Box', + children: templateChildren, + props: { + display: Display.Flex, + flexDirection: FlexDirection.Column, + height: BlockSize.Full, + className: 'snap-ui-renderer__container', + }, + }; +}; diff --git a/ui/components/app/snaps/snap-ui-renderer/components/field.ts b/ui/components/app/snaps/snap-ui-renderer/components/field.ts index eb5b0b0e2256..61a7cab9466a 100644 --- a/ui/components/app/snaps/snap-ui-renderer/components/field.ts +++ b/ui/components/app/snaps/snap-ui-renderer/components/field.ts @@ -4,11 +4,13 @@ import { ButtonElement, JSXElement, DropdownElement, + RadioGroupElement, CheckboxElement, } from '@metamask/snaps-sdk/jsx'; import { getJsxChildren } from '@metamask/snaps-utils'; import { button as buttonFn } from './button'; import { dropdown as dropdownFn } from './dropdown'; +import { radioGroup as radioGroupFn } from './radioGroup'; import { checkbox as checkboxFn } from './checkbox'; import { UIComponentFactory, UIComponentParams } from './types'; @@ -84,6 +86,24 @@ export const field: UIComponentFactory = ({ element, form }) => { }; } + case 'RadioGroup': { + const radioGroup = child as RadioGroupElement; + const radioGroupMapped = radioGroupFn({ + element: radioGroup, + } as UIComponentParams); + return { + element: 'SnapUIRadioGroup', + props: { + ...radioGroupMapped.props, + id: radioGroup.props.name, + label: element.props.label, + name: radioGroup.props.name, + form, + error: element.props.error, + }, + }; + } + case 'Checkbox': { const checkbox = child as CheckboxElement; const checkboxMapped = checkboxFn({ diff --git a/ui/components/app/snaps/snap-ui-renderer/components/footer.ts b/ui/components/app/snaps/snap-ui-renderer/components/footer.ts new file mode 100644 index 000000000000..f71f3f3ba362 --- /dev/null +++ b/ui/components/app/snaps/snap-ui-renderer/components/footer.ts @@ -0,0 +1,80 @@ +import { FooterElement, ButtonElement } from '@metamask/snaps-sdk/jsx'; +import { getJsxChildren } from '@metamask/snaps-utils'; + +import { + BackgroundColor, + BlockSize, + Display, + FlexDirection, +} from '../../../../../helpers/constants/design-system'; +import { UIComponentFactory } from './types'; + +export const DEFAULT_FOOTER = { + element: 'Box', + key: 'default-footer', + props: { + display: Display.Flex, + flexDirection: FlexDirection.Row, + width: BlockSize.Full, + padding: 4, + className: 'snap-ui-renderer__footer', + backgroundColor: BackgroundColor.backgroundDefault, + style: { + boxShadow: 'var(--shadow-size-lg) var(--color-shadow-default)', + }, + }, +}; + +const getDefaultButtons = ( + footer: FooterElement, + t: (value: string) => string, + onCancel: () => void, +) => { + const children = getJsxChildren(footer); + + if (children.length === 1) { + return { + element: 'SnapFooterButton', + key: 'default-button', + props: { + onCancel, + isSnapAction: false, + }, + children: t('cancel'), + }; + } + + return undefined; +}; + +export const footer: UIComponentFactory = ({ + element, + t, + onCancel, +}) => { + const defaultButtons = getDefaultButtons(element, t, onCancel); + + const footerChildren = (getJsxChildren(element) as ButtonElement[]).map( + (children) => { + const { children: buttonChildren, ...props } = children.props; + return { + element: 'SnapFooterButton', + key: `snap-footer-button-${props.name}`, + props: { + ...props, + isSnapAction: true, + }, + children: buttonChildren, + }; + }, + ); + + if (defaultButtons) { + footerChildren.unshift(defaultButtons); + } + + return { + ...DEFAULT_FOOTER, + children: footerChildren, + }; +}; diff --git a/ui/components/app/snaps/snap-ui-renderer/components/heading.ts b/ui/components/app/snaps/snap-ui-renderer/components/heading.ts index d135c3598d00..709868fd4a6e 100644 --- a/ui/components/app/snaps/snap-ui-renderer/components/heading.ts +++ b/ui/components/app/snaps/snap-ui-renderer/components/heading.ts @@ -1,11 +1,11 @@ -import { Heading } from '@metamask/snaps-sdk'; +import { HeadingElement } from '@metamask/snaps-sdk/jsx'; import { OverflowWrap, TextVariant, } from '../../../../../helpers/constants/design-system'; import { UIComponentFactory } from './types'; -export const heading: UIComponentFactory = ({ element }) => ({ +export const heading: UIComponentFactory = ({ element }) => ({ element: 'Text', children: element.props.children, props: { diff --git a/ui/components/app/snaps/snap-ui-renderer/components/index.ts b/ui/components/app/snaps/snap-ui-renderer/components/index.ts index eed08c75fb91..e68a5e15b7c2 100644 --- a/ui/components/app/snaps/snap-ui-renderer/components/index.ts +++ b/ui/components/app/snaps/snap-ui-renderer/components/index.ts @@ -16,9 +16,13 @@ import { italic } from './italic'; import { link } from './link'; import { field } from './field'; import { dropdown } from './dropdown'; +import { radioGroup } from './radioGroup'; import { value } from './value'; import { checkbox } from './checkbox'; import { tooltip } from './tooltip'; +import { card } from './card'; +import { footer } from './footer'; +import { container } from './container'; export const COMPONENT_MAPPING = { Box: box, @@ -39,7 +43,11 @@ export const COMPONENT_MAPPING = { Link: link, Field: field, Dropdown: dropdown, + RadioGroup: radioGroup, Value: value, Checkbox: checkbox, Tooltip: tooltip, + Card: card, + Footer: footer, + Container: container, }; diff --git a/ui/components/app/snaps/snap-ui-renderer/components/radioGroup.ts b/ui/components/app/snaps/snap-ui-renderer/components/radioGroup.ts new file mode 100644 index 000000000000..78677e60ec35 --- /dev/null +++ b/ui/components/app/snaps/snap-ui-renderer/components/radioGroup.ts @@ -0,0 +1,26 @@ +import { RadioGroupElement, RadioElement } from '@metamask/snaps-sdk/jsx'; +import { getJsxChildren } from '@metamask/snaps-utils'; + +import { UIComponentFactory } from './types'; + +export const radioGroup: UIComponentFactory = ({ + element, + form, +}) => { + const children = getJsxChildren(element) as RadioElement[]; + + const options = children.map((child) => ({ + value: child.props.value, + name: child.props.children, + })); + + return { + element: 'SnapUIRadioGroup', + props: { + id: element.props.name, + name: element.props.name, + form, + options, + }, + }; +}; diff --git a/ui/components/app/snaps/snap-ui-renderer/components/row.ts b/ui/components/app/snaps/snap-ui-renderer/components/row.ts index b57425250c7a..dc0aba71ece1 100644 --- a/ui/components/app/snaps/snap-ui-renderer/components/row.ts +++ b/ui/components/app/snaps/snap-ui-renderer/components/row.ts @@ -1,9 +1,12 @@ -import { Row } from '@metamask/snaps-sdk'; +import { RowElement } from '@metamask/snaps-sdk/jsx'; import { mapToTemplate } from '../utils'; import { UIComponentFactory } from './types'; -export const row: UIComponentFactory = ({ element, ...params }) => ({ +export const row: UIComponentFactory = ({ + element, + ...params +}) => ({ element: 'ConfirmInfoRow', children: [mapToTemplate({ ...params, element: element.props.children })], props: { diff --git a/ui/components/app/snaps/snap-ui-renderer/components/types.ts b/ui/components/app/snaps/snap-ui-renderer/components/types.ts index 4e4824f686e1..f2eff8560ea9 100644 --- a/ui/components/app/snaps/snap-ui-renderer/components/types.ts +++ b/ui/components/app/snaps/snap-ui-renderer/components/types.ts @@ -1,9 +1,18 @@ +import { ChangeEvent as ReactChangeEvent } from 'react'; import { JSXElement, SnapsChildren } from '@metamask/snaps-sdk/jsx'; export type UIComponentParams = { map: Record; element: T; form?: string; + useFooter: boolean; + onCancel: () => void; + promptLegacyProps?: { + onInputChange: (event: ReactChangeEvent) => void; + inputValue: string; + placeholder?: string; + }; + t: (key: string) => string; }; export type UIComponent = { diff --git a/ui/components/app/snaps/snap-ui-renderer/index.scss b/ui/components/app/snaps/snap-ui-renderer/index.scss index 334ac76e049e..354efe794602 100644 --- a/ui/components/app/snaps/snap-ui-renderer/index.scss +++ b/ui/components/app/snaps/snap-ui-renderer/index.scss @@ -1,4 +1,14 @@ .snap-ui-renderer { + &__content { + margin-bottom: 0 !important; + } + + &__container { + & > div:first-child { + padding: 16px; + } + } + &__error { margin-top: 0 !important; } @@ -13,7 +23,6 @@ } &__panel { - height: 100%; gap: 8px; } @@ -31,4 +40,28 @@ font-weight: inherit; } } + + &__image { + max-width: 100%; + } + + &__footer { + margin-top: auto; + + &-centered { + margin-top: auto; + + & button { + &:first-child { + margin-right: 0; + } + } + } + + & button { + &:first-child { + margin-right: 16px; + } + } + } } diff --git a/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.js b/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.js index 7d26859d5908..d012af7ce677 100644 --- a/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.js +++ b/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.js @@ -1,12 +1,13 @@ import React, { memo, useMemo } from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; +import { Container } from '@metamask/snaps-sdk/jsx'; import { isEqual } from 'lodash'; import MetaMaskTemplateRenderer from '../../metamask-template-renderer/metamask-template-renderer'; import { SnapDelineator } from '../snap-delineator'; import { getSnapMetadata, getMemoizedInterface } from '../../../../selectors'; -import { Box, FormTextField } from '../../../component-library'; +import { Box } from '../../../component-library'; import { DelineatorType } from '../../../../helpers/constants/snaps'; import { SnapInterfaceContextProvider } from '../../../../contexts/snaps'; @@ -17,6 +18,7 @@ import { Display, JustifyContent, } from '../../../../helpers/constants/design-system'; +import { useI18nContext } from '../../../../hooks/useI18nContext'; import { mapToTemplate } from './utils'; // Component that maps Snaps UI JSON format to MetaMask Template Renderer format @@ -35,7 +37,11 @@ const SnapUIRendererComponent = ({ boxProps, interfaceId, useDelineator = true, + useFooter = false, + onCancel, }) => { + const t = useI18nContext(); + const { name: snapName } = useSelector((state) => getSnapMetadata(state, snapId), ); @@ -46,18 +52,34 @@ const SnapUIRendererComponent = ({ // We do this to avoid useless re-renders. (oldState, newState) => isEqual(oldState.content, newState.content), ); + const rawContent = interfaceState?.content; + const content = + rawContent?.type === 'Container' || !rawContent + ? rawContent + : Container({ children: rawContent }); - const content = interfaceState?.content; + const promptLegacyProps = useMemo( + () => + isPrompt && { + inputValue, + onInputChange, + placeholder, + }, + [inputValue, onInputChange, placeholder, isPrompt], + ); - // sections are memoized to avoid useless re-renders if one of the parents element re-renders. const sections = useMemo( () => content && mapToTemplate({ map: {}, element: content, + onCancel, + useFooter, + promptLegacyProps, + t, }), - [content], + [content, onCancel, useFooter, promptLegacyProps, t], ); if (isLoading || !content) { @@ -94,39 +116,19 @@ const SnapUIRendererComponent = ({ > - {isPrompt && ( - - )} ) : ( - - + + - - {isPrompt && ( - - )} - + + ); }; @@ -150,4 +152,6 @@ SnapUIRendererComponent.propTypes = { boxProps: PropTypes.object, interfaceId: PropTypes.string, useDelineator: PropTypes.bool, + useFooter: PropTypes.bool, + onCancel: PropTypes.func, }; diff --git a/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.test.js b/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.test.js index 6b6f5b659c54..510d7466e22c 100644 --- a/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.test.js +++ b/ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.test.js @@ -1,7 +1,7 @@ import { JSXElementStruct } from '@metamask/snaps-sdk/jsx'; import { COMPONENT_MAPPING } from './components'; -const EXCLUDED_COMPONENTS = ['Option']; +const EXCLUDED_COMPONENTS = ['Option', 'Radio']; describe('Snap UI mapping', () => { it('supports all exposed components', () => { diff --git a/ui/components/app/snaps/snap-ui-renderer/utils.ts b/ui/components/app/snaps/snap-ui-renderer/utils.ts index 4ad950d7c415..b3d0e1eb57ae 100644 --- a/ui/components/app/snaps/snap-ui-renderer/utils.ts +++ b/ui/components/app/snaps/snap-ui-renderer/utils.ts @@ -4,6 +4,7 @@ import { memoize } from 'lodash'; import { sha256 } from '@noble/hashes/sha256'; import { NonEmptyArray, bytesToHex, remove0x } from '@metamask/utils'; import { unescape as unescapeEntities } from 'he'; +import { ChangeEvent as ReactChangeEvent } from 'react'; import { COMPONENT_MAPPING } from './components'; import { UIComponent } from './components/types'; @@ -11,6 +12,14 @@ export type MapToTemplateParams = { map: Record; element: JSXElement; form?: string; + useFooter?: boolean; + onCancel?: () => void; + promptLegacyProps?: { + onInputChange: (event: ReactChangeEvent) => void; + inputValue: string; + placeholder?: string; + }; + t?: (key: string) => string; }; /** @@ -89,7 +98,7 @@ export const mapToTemplate = (params: MapToTemplateParams): UIComponent => { const { type, key } = params.element; const elementKey = key ?? generateKey(params.map, params.element); const mapped = COMPONENT_MAPPING[ - type as Exclude + type as Exclude // TODO: Replace `any` with type // eslint-disable-next-line @typescript-eslint/no-explicit-any ](params as any); diff --git a/ui/contexts/snaps/snap-interface.tsx b/ui/contexts/snaps/snap-interface.tsx index 45af0572a03e..27dd3fd3716c 100644 --- a/ui/contexts/snaps/snap-interface.tsx +++ b/ui/contexts/snaps/snap-interface.tsx @@ -2,6 +2,7 @@ import { File as FileObject, FormState, InterfaceState, + State, UserInputEventType, } from '@metamask/snaps-sdk'; import { encodeBase64 } from '@metamask/snaps-utils'; @@ -22,20 +23,20 @@ import { } from '../../store/actions'; import { mergeValue } from './utils'; -export type HandleEvent = (args: { +export type HandleEvent = (args: { event: UserInputEventType; name?: string; value?: Type; flush?: boolean; }) => void; -export type HandleInputChange = ( +export type HandleInputChange = ( name: string, value: Type | null, form?: string, ) => void; -export type GetValue = (name: string, form?: string) => Type | undefined; +export type GetValue = (name: string, form?: string) => State | undefined; export type HandleFileChange = ( name: string, @@ -48,6 +49,7 @@ export type SnapInterfaceContextType = { getValue: GetValue; handleInputChange: HandleInputChange; handleFileChange: HandleFileChange; + snapId: string; }; export const SnapInterfaceContext = @@ -56,7 +58,7 @@ export const SnapInterfaceContext = export type SnapInterfaceContextProviderProps = { interfaceId: string; snapId: string; - initialState: Record | unknown>; + initialState: InterfaceState; context: Json; }; @@ -146,7 +148,7 @@ export const SnapInterfaceContextProvider: FunctionComponent< const handleEvent: HandleEvent = ({ event, name, - value = internalState.current[name], + value = name ? internalState.current[name] : undefined, flush = false, }) => { // We always flush the debounced request for updating the state. @@ -192,7 +194,7 @@ export const SnapInterfaceContextProvider: FunctionComponent< handleInputChangeDebounced(name, value); }; - const uploadFile = (name: string, file: File | null) => { + const uploadFile = (name: string, file: FileObject | null) => { handleSnapRequest({ snapId, origin: '', @@ -231,7 +233,7 @@ export const SnapInterfaceContextProvider: FunctionComponent< name: file.name, size: file.size, contentType: file.type, - contents: base64, + contents: base64 as string, }; const state = mergeValue( @@ -280,7 +282,13 @@ export const SnapInterfaceContextProvider: FunctionComponent< return ( {children} diff --git a/ui/contexts/snaps/utils.ts b/ui/contexts/snaps/utils.ts index 2dbf75be662a..934aac9100e5 100644 --- a/ui/contexts/snaps/utils.ts +++ b/ui/contexts/snaps/utils.ts @@ -1,4 +1,4 @@ -import { FormState, InterfaceState } from '@metamask/snaps-sdk'; +import { FormState, InterfaceState, State } from '@metamask/snaps-sdk'; /** * Merge a new input value in the interface state. @@ -10,7 +10,7 @@ import { FormState, InterfaceState } from '@metamask/snaps-sdk'; * Optional if the input is not contained in a form. * @returns The interface state with the new value merged in. */ -export const mergeValue = ( +export const mergeValue = ( state: InterfaceState, name: string, value: Type | null, diff --git a/ui/helpers/utils/permission.js b/ui/helpers/utils/permission.js index 62d3dca494d3..2a0720d815fe 100644 --- a/ui/helpers/utils/permission.js +++ b/ui/helpers/utils/permission.js @@ -251,6 +251,14 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({ leftIcon: IconName.Global, weight: PermissionWeight.snap_getLocale, }), + [RestrictedMethods.snap_getPreferences]: ({ t, subjectName }) => ({ + label: t('permission_getPreferences'), + description: t('permission_getPreferencesDescription', [ + getSnapNameComponent(subjectName), + ]), + leftIcon: IconName.Customize, + weight: 4, + }), [RestrictedMethods.wallet_snap]: ({ t, permissionValue, getSubjectName }) => { const snaps = permissionValue.caveats[0].value; const baseDescription = { diff --git a/ui/pages/confirmations/confirmation/confirmation.js b/ui/pages/confirmations/confirmation/confirmation.js index 2f5fc3b08bb8..a1fc6bc5c7af 100644 --- a/ui/pages/confirmations/confirmation/confirmation.js +++ b/ui/pages/confirmations/confirmation/confirmation.js @@ -13,6 +13,7 @@ import { isEqual } from 'lodash'; import { produce } from 'immer'; import log from 'loglevel'; import { ApprovalType } from '@metamask/controller-utils'; +import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods'; import fetchWithCache from '../../../../shared/lib/fetch-with-cache'; import Box from '../../../components/ui/box'; import { @@ -42,6 +43,7 @@ import { SnapUIRenderer } from '../../../components/app/snaps/snap-ui-renderer'; import { SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES } from '../../../../shared/constants/app'; ///: END:ONLY_INCLUDE_IF import { DAY } from '../../../../shared/constants/time'; +import { BlockSize } from '../../../helpers/constants/design-system'; import ConfirmationFooter from './components/confirmation-footer'; import { getTemplateValues, @@ -248,17 +250,9 @@ export default function ConfirmationPage({ const name = snapsMetadata[pendingConfirmation?.origin]?.name; - const SNAP_DIALOG_TYPE = [ - ApprovalType.SnapDialogAlert, - ApprovalType.SnapDialogConfirmation, - ApprovalType.SnapDialogPrompt, - ]; + const SNAP_DIALOG_TYPE = Object.values(DIALOG_APPROVAL_TYPES); - const SNAP_CUSTOM_UI_DIALOG = [ - ApprovalType.SnapDialogAlert, - ApprovalType.SnapDialogConfirmation, - ApprovalType.SnapDialogPrompt, - ]; + const SNAP_CUSTOM_UI_DIALOG = Object.values(DIALOG_APPROVAL_TYPES); ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) SNAP_DIALOG_TYPE.push( @@ -272,23 +266,15 @@ export default function ConfirmationPage({ ); const isSnapPrompt = pendingConfirmation?.type === ApprovalType.SnapDialogPrompt; - let useSnapHeader = isSnapDialog; + + const isSnapDefaultDialog = + pendingConfirmation?.type === DIALOG_APPROVAL_TYPES.default; // When pendingConfirmation is undefined, this will also be undefined const snapName = isSnapDialog && name; const INPUT_STATE_CONFIRMATIONS = [ApprovalType.SnapDialogPrompt]; - ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) - if ( - Object.values(SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES).includes( - pendingConfirmation?.type, - ) - ) { - useSnapHeader = false; - } - ///: END:ONLY_INCLUDE_IF - // Generating templatedValues is potentially expensive, and if done on every render // will result in a new object. Avoiding calling this generation unnecessarily will // improve performance and prevent unnecessary draws. @@ -474,6 +460,13 @@ export default function ConfirmationPage({ } }; + const handleSnapDialogCancel = + templatedValues.onCancel || + // /!\ Treat cancel as submit only if approval type is appropriate /!\ + (pendingConfirmation?.type === ApprovalType.SnapDialogAlert + ? handleSubmit + : null); + return (
{pendingConfirmations.length > 1 && ( @@ -508,47 +501,37 @@ export default function ConfirmationPage({
)}
+ {isSnapCustomUIDialog && ( + + + + )} {templatedValues.networkDisplay ? ( ) : null} - {useSnapHeader && ( - - )} - {isSnapCustomUIDialog ? ( - - - ) : ( )} + {showWarningModal && ( { @@ -560,50 +543,57 @@ export default function ConfirmationPage({ /> )}
- alert.dismissed === false) - .map((alert, idx, filtered) => ( - dismissAlert(alert.id)} - isFirst={idx === 0} - isLast={idx === filtered.length - 1} - isMultiple={filtered.length > 1} - > - - - )) - } - style={ - isSnapDialog - ? { - boxShadow: 'var(--shadow-size-lg) var(--color-shadow-default)', - } - : {} - } - actionsStyle={ - isSnapDialog - ? { - borderTop: 0, - } - : {} - } - onSubmit={!templatedValues.hideSubmitButton && handleSubmit} - onCancel={templatedValues.onCancel} - submitText={templatedValues.submitText} - cancelText={templatedValues.cancelText} - loadingText={loadingText || templatedValues.loadingText} - loading={loading} - submitAlerts={submitAlerts.map((alert, idx) => ( - - - - ))} - /> + {!isSnapDefaultDialog && ( + alert.dismissed === false) + .map((alert, idx, filtered) => ( + dismissAlert(alert.id)} + isFirst={idx === 0} + isLast={idx === filtered.length - 1} + isMultiple={filtered.length > 1} + > + + + )) + } + style={ + isSnapDialog + ? { + boxShadow: + 'var(--shadow-size-lg) var(--color-shadow-default)', + } + : {} + } + actionsStyle={ + isSnapDialog + ? { + borderTop: 0, + } + : {} + } + onSubmit={!templatedValues.hideSubmitButton && handleSubmit} + onCancel={templatedValues.onCancel} + submitText={templatedValues.submitText} + cancelText={templatedValues.cancelText} + loadingText={loadingText || templatedValues.loadingText} + loading={loading} + submitAlerts={submitAlerts.map((alert, idx) => ( + + + + ))} + /> + )} ); } diff --git a/ui/pages/confirmations/confirmation/templates/index.js b/ui/pages/confirmations/confirmation/templates/index.js index ba193811cb02..c49f34ca69ca 100644 --- a/ui/pages/confirmations/confirmation/templates/index.js +++ b/ui/pages/confirmations/confirmation/templates/index.js @@ -1,5 +1,6 @@ import { omit, pick } from 'lodash'; import { ApprovalType } from '@metamask/controller-utils'; +import { DIALOG_APPROVAL_TYPES } from '@metamask/snaps-rpc-methods'; import { deleteInterface, rejectPendingApproval, @@ -27,6 +28,7 @@ import error from './error'; import snapAlert from './snaps/snap-alert/snap-alert'; import snapConfirmation from './snaps/snap-confirmation/snap-confirmation'; import snapPrompt from './snaps/snap-prompt/snap-prompt'; +import snapDefault from './snaps/snap-default/snap-default'; /** * Approval templates that will be prioritized ahead of transaction and signature confirmations. @@ -46,6 +48,7 @@ const APPROVAL_TEMPLATES = { [ApprovalType.SnapDialogAlert]: snapAlert, [ApprovalType.SnapDialogConfirmation]: snapConfirmation, [ApprovalType.SnapDialogPrompt]: snapPrompt, + [DIALOG_APPROVAL_TYPES.default]: snapDefault, ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) [SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation]: createSnapAccount, diff --git a/ui/pages/confirmations/confirmation/templates/snaps/snap-default/snap-default.js b/ui/pages/confirmations/confirmation/templates/snaps/snap-default/snap-default.js new file mode 100644 index 000000000000..4bd7a8c60944 --- /dev/null +++ b/ui/pages/confirmations/confirmation/templates/snaps/snap-default/snap-default.js @@ -0,0 +1,17 @@ +function getValues(pendingApproval, _t, actions) { + const { + requestData: { id }, + } = pendingApproval; + return { + onCancel: () => { + actions.resolvePendingApproval(pendingApproval.id, null); + actions.deleteInterface(id); + }, + }; +} + +const snapDefault = { + getValues, +}; + +export default snapDefault; diff --git a/yarn.lock b/yarn.lock index e9ceb9a926c9..a66ead175712 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4879,7 +4879,7 @@ __metadata: languageName: node linkType: hard -"@metamask/approval-controller@npm:^7.0.0, @metamask/approval-controller@npm:^7.0.1": +"@metamask/approval-controller@npm:^7.0.0, @metamask/approval-controller@npm:^7.0.1, @metamask/approval-controller@npm:^7.0.2": version: 7.0.2 resolution: "@metamask/approval-controller@npm:7.0.2" dependencies: @@ -5605,19 +5605,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-middleware-stream@npm:^7.0.1": - version: 7.0.1 - resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.1" - dependencies: - "@metamask/json-rpc-engine": "npm:^8.0.1" - "@metamask/safe-event-emitter": "npm:^3.0.0" - "@metamask/utils": "npm:^8.3.0" - readable-stream: "npm:^3.6.2" - checksum: 10/1df955cd6c39fb40388e1b656b401d94da1a6c9a780be0b17cff7d6ed8d63a6960e0693c18778e7acc79e3eec183df524ca711d98e17e0eefbaab5f4fe8a2fc4 - languageName: node - linkType: hard - -"@metamask/json-rpc-middleware-stream@npm:^8.0.0": +"@metamask/json-rpc-middleware-stream@npm:^8.0.1, @metamask/json-rpc-middleware-stream@npm:^8.0.2": version: 8.0.2 resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.2" dependencies: @@ -5629,7 +5617,7 @@ __metadata: languageName: node linkType: hard -"@metamask/key-tree@npm:^9.1.1, @metamask/key-tree@npm:^9.1.2": +"@metamask/key-tree@npm:^9.1.2": version: 9.1.2 resolution: "@metamask/key-tree@npm:9.1.2" dependencies: @@ -6016,7 +6004,7 @@ __metadata: languageName: node linkType: hard -"@metamask/phishing-controller@npm:^10.0.0": +"@metamask/phishing-controller@npm:^10.1.1": version: 10.1.1 resolution: "@metamask/phishing-controller@npm:10.1.1" dependencies: @@ -6180,24 +6168,24 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^17.0.0": - version: 17.0.0 - resolution: "@metamask/providers@npm:17.0.0" +"@metamask/providers@npm:^17.1.2": + version: 17.1.2 + resolution: "@metamask/providers@npm:17.1.2" dependencies: - "@metamask/json-rpc-engine": "npm:^8.0.1" - "@metamask/json-rpc-middleware-stream": "npm:^7.0.1" + "@metamask/json-rpc-engine": "npm:^9.0.1" + "@metamask/json-rpc-middleware-stream": "npm:^8.0.1" "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" + "@metamask/rpc-errors": "npm:^6.3.1" "@metamask/safe-event-emitter": "npm:^3.1.1" - "@metamask/utils": "npm:^8.3.0" + "@metamask/utils": "npm:^9.0.0" detect-browser: "npm:^5.2.0" - extension-port-stream: "npm:^3.0.0" + extension-port-stream: "npm:^4.1.0" fast-deep-equal: "npm:^3.1.3" is-stream: "npm:^2.0.0" readable-stream: "npm:^3.6.2" peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 10/9e6b84120276035c9d7e776da4f7e18243116c53fd0c33efca17034971981164720e808dff055e871d08b9ed9d78dc9ebd0d974238baa599d7d91e1560fc1abb + checksum: 10/bf555f9774e340d4497c09c980094e759a198f11c5a78b403e639cf01904b9ec3b19a5e9f53567465dd8739da4138e2021ac9a404a99b1a6022add12a4b19a31 languageName: node linkType: hard @@ -6308,6 +6296,13 @@ __metadata: languageName: node linkType: hard +"@metamask/slip44@npm:^4.0.0": + version: 4.0.0 + resolution: "@metamask/slip44@npm:4.0.0" + checksum: 10/3e47e8834b0fbdabe1f126fd78665767847ddc1f9ccc8defb23007dd71fcd2e4899c8ca04857491be3630668a3765bad1e40fdfca9a61ef33236d8d08e51535e + languageName: node + linkType: hard + "@metamask/smart-transactions-controller@npm:^11.0.0": version: 11.0.0 resolution: "@metamask/smart-transactions-controller@npm:11.0.0" @@ -6331,24 +6326,24 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-controllers@npm:9.2.0": - version: 9.2.0 - resolution: "@metamask/snaps-controllers@npm:9.2.0" +"@metamask/snaps-controllers@npm:9.4.0": + version: 9.4.0 + resolution: "@metamask/snaps-controllers@npm:9.4.0" dependencies: - "@metamask/approval-controller": "npm:^7.0.0" - "@metamask/base-controller": "npm:^6.0.0" - "@metamask/json-rpc-engine": "npm:^9.0.0" - "@metamask/json-rpc-middleware-stream": "npm:^8.0.0" + "@metamask/approval-controller": "npm:^7.0.2" + "@metamask/base-controller": "npm:^6.0.2" + "@metamask/json-rpc-engine": "npm:^9.0.2" + "@metamask/json-rpc-middleware-stream": "npm:^8.0.2" "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/permission-controller": "npm:^10.0.0" - "@metamask/phishing-controller": "npm:^10.0.0" + "@metamask/permission-controller": "npm:^11.0.0" + "@metamask/phishing-controller": "npm:^10.1.1" "@metamask/post-message-stream": "npm:^8.1.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/snaps-registry": "npm:^3.1.0" - "@metamask/snaps-rpc-methods": "npm:^9.1.4" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "npm:^7.7.0" - "@metamask/utils": "npm:^8.3.0" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/snaps-registry": "npm:^3.2.1" + "@metamask/snaps-rpc-methods": "npm:^11.0.0" + "@metamask/snaps-sdk": "npm:^6.2.0" + "@metamask/snaps-utils": "npm:^8.0.0" + "@metamask/utils": "npm:^9.1.0" "@xstate/fsm": "npm:^2.0.0" browserify-zlib: "npm:^0.2.0" concat-stream: "npm:^2.0.0" @@ -6360,32 +6355,32 @@ __metadata: readable-web-to-node-stream: "npm:^3.0.2" tar-stream: "npm:^3.1.7" peerDependencies: - "@metamask/snaps-execution-environments": ^6.5.0 + "@metamask/snaps-execution-environments": ^6.6.2 peerDependenciesMeta: "@metamask/snaps-execution-environments": optional: true - checksum: 10/3926bdfc3f064d57162825028aca2cf433e7adfe02ecdade174e2c75686c3dff407ee195f352662754846fc4edad8d2c6c5ce73471e3a09191a91070a98ba046 + checksum: 10/36c9fb83c675443b1dd9f2bf9eccd1eda1648c5c451bb93e432a358377557f7953b96579d2b5d9605f39bfb96062968a8e612b9500c14fb1fb7bb15d176bd7a1 languageName: node linkType: hard -"@metamask/snaps-controllers@patch:@metamask/snaps-controllers@npm%3A9.2.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.2.0-09a31bab4f.patch": - version: 9.2.0 - resolution: "@metamask/snaps-controllers@patch:@metamask/snaps-controllers@npm%3A9.2.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.2.0-09a31bab4f.patch::version=9.2.0&hash=6a6349" +"@metamask/snaps-controllers@patch:@metamask/snaps-controllers@npm%3A9.4.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.4.0-7c3abbbea6.patch": + version: 9.4.0 + resolution: "@metamask/snaps-controllers@patch:@metamask/snaps-controllers@npm%3A9.4.0#~/.yarn/patches/@metamask-snaps-controllers-npm-9.4.0-7c3abbbea6.patch::version=9.4.0&hash=ef8724" dependencies: - "@metamask/approval-controller": "npm:^7.0.0" - "@metamask/base-controller": "npm:^6.0.0" - "@metamask/json-rpc-engine": "npm:^9.0.0" - "@metamask/json-rpc-middleware-stream": "npm:^8.0.0" + "@metamask/approval-controller": "npm:^7.0.2" + "@metamask/base-controller": "npm:^6.0.2" + "@metamask/json-rpc-engine": "npm:^9.0.2" + "@metamask/json-rpc-middleware-stream": "npm:^8.0.2" "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/permission-controller": "npm:^10.0.0" - "@metamask/phishing-controller": "npm:^10.0.0" + "@metamask/permission-controller": "npm:^11.0.0" + "@metamask/phishing-controller": "npm:^10.1.1" "@metamask/post-message-stream": "npm:^8.1.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/snaps-registry": "npm:^3.1.0" - "@metamask/snaps-rpc-methods": "npm:^9.1.4" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "npm:^7.7.0" - "@metamask/utils": "npm:^8.3.0" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/snaps-registry": "npm:^3.2.1" + "@metamask/snaps-rpc-methods": "npm:^11.0.0" + "@metamask/snaps-sdk": "npm:^6.2.0" + "@metamask/snaps-utils": "npm:^8.0.0" + "@metamask/utils": "npm:^9.1.0" "@xstate/fsm": "npm:^2.0.0" browserify-zlib: "npm:^0.2.0" concat-stream: "npm:^2.0.0" @@ -6397,34 +6392,34 @@ __metadata: readable-web-to-node-stream: "npm:^3.0.2" tar-stream: "npm:^3.1.7" peerDependencies: - "@metamask/snaps-execution-environments": ^6.5.0 + "@metamask/snaps-execution-environments": ^6.6.2 peerDependenciesMeta: "@metamask/snaps-execution-environments": optional: true - checksum: 10/2df9b875d8a985a6d305f86e2b13e088843040ccde1b4d7d4d5dc7c06116dafa6b4edc2de84086b10c3fe59ab780d74f177dd789a788ea930c5d6477c01e4d0c + checksum: 10/b97867e92de6e4c3aca6e5e0dc5f44aca826a038eb2660e5757bb713ab612ca55a58af91750fe5b6e085d23d00fb7df901f2c18e2bade0210ad99ada69b7a3e9 languageName: node linkType: hard -"@metamask/snaps-execution-environments@npm:^6.5.0": - version: 6.5.0 - resolution: "@metamask/snaps-execution-environments@npm:6.5.0" +"@metamask/snaps-execution-environments@npm:^6.6.2": + version: 6.6.2 + resolution: "@metamask/snaps-execution-environments@npm:6.6.2" dependencies: - "@metamask/json-rpc-engine": "npm:^9.0.0" + "@metamask/json-rpc-engine": "npm:^9.0.2" "@metamask/object-multiplex": "npm:^2.0.0" "@metamask/post-message-stream": "npm:^8.1.0" - "@metamask/providers": "npm:^17.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "npm:^7.7.0" - "@metamask/utils": "npm:^8.3.0" + "@metamask/providers": "npm:^17.1.2" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/snaps-sdk": "npm:^6.1.0" + "@metamask/snaps-utils": "npm:^7.8.1" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.1.0" nanoid: "npm:^3.1.31" readable-stream: "npm:^3.6.2" - superstruct: "npm:^1.0.3" - checksum: 10/f502fb1ff1c7c574bf4b7e189cc636d85aacb9e86116720a8c6305ce2054a3ebd966b2f73be242bf5f8f301c79f6b3461a7d2c631301b6593ad1d3f09e100c21 + checksum: 10/b06b03f784b7c20ac9f39f9bec8a7e2e06ebcd8678659e01745d73f1c08bd2605352144bc8ecab7d6b0a7db69ebf62febad517a5c8a1309aa1e173049ce350e7 languageName: node linkType: hard -"@metamask/snaps-registry@npm:^3.1.0, @metamask/snaps-registry@npm:^3.2.1": +"@metamask/snaps-registry@npm:^3.2.1": version: 3.2.1 resolution: "@metamask/snaps-registry@npm:3.2.1" dependencies: @@ -6436,67 +6431,36 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-rpc-methods@npm:^9.1.4": - version: 9.1.4 - resolution: "@metamask/snaps-rpc-methods@npm:9.1.4" +"@metamask/snaps-rpc-methods@npm:^11.0.0": + version: 11.0.0 + resolution: "@metamask/snaps-rpc-methods@npm:11.0.0" dependencies: - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/permission-controller": "npm:^10.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "npm:^7.7.0" - "@metamask/utils": "npm:^8.3.0" + "@metamask/key-tree": "npm:^9.1.2" + "@metamask/permission-controller": "npm:^11.0.0" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/snaps-sdk": "npm:^6.2.0" + "@metamask/snaps-utils": "npm:^8.0.0" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.1.0" "@noble/hashes": "npm:^1.3.1" - superstruct: "npm:^1.0.3" - checksum: 10/db4963c2eaf1763ca48be4f095b0adae29596efc9ebf7876ac92fa6e3ef8d2bc5d45634293566b8a4703109c569f2666b4350700139d0566cb29f65be77a17f1 - languageName: node - linkType: hard - -"@metamask/snaps-sdk@npm:^6.0.0": - version: 6.0.0 - resolution: "@metamask/snaps-sdk@npm:6.0.0" - dependencies: - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/providers": "npm:^17.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/utils": "npm:^8.3.0" - superstruct: "npm:^1.0.3" - checksum: 10/91774ea791423a3cfef4ddbe30fc0351d9bfb9bad071ebce6a74be85cdd9b864b2666785cb6f0e8257a9778bc630f2de71544258d0367a93917ffe3d72ef90a5 + checksum: 10/2e594d7f9fde910e87525a6ded9a162d2ea8631249b7868ca710df0d8d25c127674079956976c7443e30c96bedb84bf818748a01aad41cfe69f88524781b994f languageName: node linkType: hard -"@metamask/snaps-utils@npm:7.7.0": - version: 7.7.0 - resolution: "@metamask/snaps-utils@npm:7.7.0" +"@metamask/snaps-sdk@npm:^6.2.1": + version: 6.2.1 + resolution: "@metamask/snaps-sdk@npm:6.2.1" dependencies: - "@babel/core": "npm:^7.23.2" - "@babel/types": "npm:^7.23.0" - "@metamask/base-controller": "npm:^6.0.0" - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/permission-controller": "npm:^10.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/slip44": "npm:^3.1.0" - "@metamask/snaps-registry": "npm:^3.1.0" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/utils": "npm:^8.3.0" - "@noble/hashes": "npm:^1.3.1" - "@scure/base": "npm:^1.1.1" - chalk: "npm:^4.1.2" - cron-parser: "npm:^4.5.0" - fast-deep-equal: "npm:^3.1.3" - fast-json-stable-stringify: "npm:^2.1.0" - fast-xml-parser: "npm:^4.3.4" - marked: "npm:^12.0.1" - rfdc: "npm:^1.3.0" - semver: "npm:^7.5.4" - ses: "npm:^1.1.0" - superstruct: "npm:^1.0.3" - validate-npm-package-name: "npm:^5.0.0" - checksum: 10/ac5b216b81157f71244e5922befccb214be402f0f5b784086cea46d7b0142f14f555ec7986cb7c867d1b99bfe43b08a687d8db22db85fada55764c2f4afcff97 + "@metamask/key-tree": "npm:^9.1.2" + "@metamask/providers": "npm:^17.1.2" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.1.0" + checksum: 10/95728ff7cb5646d04221230c1368f84b1aef931a361ef79689d32426f9f86c6524345e3bd387221a8e7ee0d47e15d1797665bf244566b94cacc09bd643567f05 languageName: node linkType: hard -"@metamask/snaps-utils@npm:^7.8.1": +"@metamask/snaps-utils@npm:^7.4.0, @metamask/snaps-utils@npm:^7.8.1": version: 7.8.1 resolution: "@metamask/snaps-utils@npm:7.8.1" dependencies: @@ -6527,34 +6491,34 @@ __metadata: languageName: node linkType: hard -"@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch": - version: 7.7.0 - resolution: "@metamask/snaps-utils@patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch::version=7.7.0&hash=5f2735" +"@metamask/snaps-utils@npm:^8.0.0, @metamask/snaps-utils@npm:^8.0.1": + version: 8.0.1 + resolution: "@metamask/snaps-utils@npm:8.0.1" dependencies: "@babel/core": "npm:^7.23.2" "@babel/types": "npm:^7.23.0" - "@metamask/base-controller": "npm:^6.0.0" - "@metamask/key-tree": "npm:^9.1.1" - "@metamask/permission-controller": "npm:^10.0.0" - "@metamask/rpc-errors": "npm:^6.2.1" - "@metamask/slip44": "npm:^3.1.0" - "@metamask/snaps-registry": "npm:^3.1.0" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/utils": "npm:^8.3.0" + "@metamask/base-controller": "npm:^6.0.2" + "@metamask/key-tree": "npm:^9.1.2" + "@metamask/permission-controller": "npm:^11.0.0" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/slip44": "npm:^4.0.0" + "@metamask/snaps-registry": "npm:^3.2.1" + "@metamask/snaps-sdk": "npm:^6.2.1" + "@metamask/superstruct": "npm:^3.1.0" + "@metamask/utils": "npm:^9.1.0" "@noble/hashes": "npm:^1.3.1" "@scure/base": "npm:^1.1.1" chalk: "npm:^4.1.2" cron-parser: "npm:^4.5.0" fast-deep-equal: "npm:^3.1.3" fast-json-stable-stringify: "npm:^2.1.0" - fast-xml-parser: "npm:^4.3.4" + fast-xml-parser: "npm:^4.4.1" marked: "npm:^12.0.1" rfdc: "npm:^1.3.0" semver: "npm:^7.5.4" ses: "npm:^1.1.0" - superstruct: "npm:^1.0.3" validate-npm-package-name: "npm:^5.0.0" - checksum: 10/9ac16da1c2c1c7e2b857078ff4d9d450db8d5dbf650143ffc7953d2aea70fd58c87d1c1f2429a5a1c1418334d27e87d4a6a03089a55ba86840c417dfdb73b2fe + checksum: 10/4c0d58ad04f1e4c625dd01aaf171de0f538afc2003ac928159deee5ebed6d490ccd50575ad585b4f6846aa8d00bccd8f1ea4b32f124e6427873fb985cae8513f languageName: node linkType: hard @@ -18943,6 +18907,17 @@ __metadata: languageName: node linkType: hard +"extension-port-stream@npm:^4.1.0": + version: 4.2.0 + resolution: "extension-port-stream@npm:4.2.0" + dependencies: + readable-stream: "npm:^3.6.2 || ^4.4.2" + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 10/85559c82e3f3aa21462e234b30b7d53872708893664cd03f2f848af556cf0730cf2243b089efc9d40bbe9a4f73bd8fd19684db5a985329b0c4402b4f2fe26358 + languageName: node + linkType: hard + "extglob@npm:^0.3.1": version: 0.3.2 resolution: "extglob@npm:0.3.2" @@ -19144,7 +19119,7 @@ __metadata: languageName: node linkType: hard -"fast-xml-parser@npm:^4.3.4": +"fast-xml-parser@npm:^4.3.4, fast-xml-parser@npm:^4.4.1": version: 4.4.1 resolution: "fast-xml-parser@npm:4.4.1" dependencies: @@ -26060,11 +26035,11 @@ __metadata: "@metamask/selected-network-controller": "npm:^15.0.2" "@metamask/signature-controller": "npm:^17.0.0" "@metamask/smart-transactions-controller": "npm:^11.0.0" - "@metamask/snaps-controllers": "npm:^9.2.0" - "@metamask/snaps-execution-environments": "npm:^6.5.0" - "@metamask/snaps-rpc-methods": "npm:^9.1.4" - "@metamask/snaps-sdk": "npm:^6.0.0" - "@metamask/snaps-utils": "patch:@metamask/snaps-utils@npm%3A7.7.0#~/.yarn/patches/@metamask-snaps-utils-npm-7.7.0-2cc1f044af.patch" + "@metamask/snaps-controllers": "npm:^9.4.0" + "@metamask/snaps-execution-environments": "npm:^6.6.2" + "@metamask/snaps-rpc-methods": "npm:^11.0.0" + "@metamask/snaps-sdk": "npm:^6.2.1" + "@metamask/snaps-utils": "npm:^8.0.1" "@metamask/test-bundler": "npm:^1.0.0" "@metamask/test-dapp": "npm:^8.4.0" "@metamask/transaction-controller": "npm:^34.0.0"