From f84abee104d5d237d2bcb70b70d774e39a051119 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 17 Jul 2024 11:00:52 -0700 Subject: [PATCH] Replace `superstruct` with ESM-compatible fork `@metamask/superstruct` (#2445) ## Explanation As part of the Wallet Framework Team's OKR ([Q2 2024 O3KR4](https://docs.google.com/document/d/1NYWepE--9HLG9NHAxmsHKQI7lfZL2nW0kv7UVd4q160/edit#bookmark=kix.h65bod9heydk), [Q3 2024 O2KR4](https://docs.google.com/document/d/1JLEzfUxHlT8lw8ntgMWG0vQb5BAATcrYZDj0wRB2ogI/edit#bookmark=kix.yxz96lxhvjk3)) for upgrading TypeScript to v5.0+ in the core monorepo, we are updating dependencies of the core repo so that they can be used with projects that use `Node16` or `NodeNext` as their `moduleResolution` tsconfig option. To achieve this, all dependencies that are ESM packages need to be updated so that they generate separate builds and type declarations that are explicitly designated for CJS and ESM. This requirement applies to nested dependencies as well, so we are also replacing `superstruct` with the ESM-compatible fork `@metamask/superstruct` in all dependencies of core that have `superstruct` as a dependency. ## Description - [x] Replace `superstruct` dependency with `@metamask/superstruct` `^3.0.0`. - [x] `^3.1.0` - [x] Replace all `superstruct` import statements with `@metamask/superstruct` - [x] Bump `@metamask/utils` to `^8.5.0`. - [x] `^9.1.0` - [x] remove yarn resolution to `@metamask/superstruct@npm:3.1.0` - [ ] ~If feasible without too much additional work:~ -> create separate PRs for these tasks - [ ] ~Bump `typescript` to `~5.0.4`~ - [ ] ~https://github.com/MetaMask/snaps/pull/2514~ Further context on why the `superstruct` and `utils` changes are necessary: - https://github.com/MetaMask/utils/pull/144 - https://github.com/MetaMask/superstruct/pull/1 - https://github.com/MetaMask/superstruct/pull/18 - https://github.com/MetaMask/utils/pull/182 - https://github.com/MetaMask/metamask-module-template/pull/247 ### `yarn resolutions` `@metamask/utils` is pinned to `^9.1.0` via yarn resolutions, as there are a large number of dependencies that are set to `^8.5.0` (see below), and some of them (especially the core packages) are blocked by the merge and release of this PR: - core monorepo: `approval-controller`, `base-controller`, `controller-utils`, `eth-json-rpc-provider`, `json-rpc-engine`, `json-rpc-middleware-stream`, `permission-controller` - standalone: `browser-passworder`, `create-release-branch`, `eth-block-tracker`, `eth-json-rpc-middleware`, `eth-sig-util`, `key-tree`, `post-message-stream`, `providers`, `snaps-registry` Mixed usage of `utils` v8 and v9 anywhere in the monorepo's dependency tree causes the following type errors: - https://github.com/MetaMask/snaps/actions/runs/9720788583/job/26900545288?pr=2445 ### Release order roadmap Due to interdependencies between the packages involved in this PR, we will need to update and release them in a specific order: - [ ] Merge this PR: https://github.com/MetaMask/snaps/pull/2445 - Request snaps team to hold off on releases until yarn resolution for utils can be removed - Bump `@metamask/utils` in dependencies of `snaps-{sdk,utils,rpc-methods}`: - [x] `rpc-errors`: - [x] https://github.com/MetaMask/rpc-errors/pull/147 - [x] https://github.com/MetaMask/rpc-errors/pull/148 - [x] `key-tree` - [x] https://github.com/MetaMask/key-tree/pull/181 - [x] https://github.com/MetaMask/key-tree/pull/182 - [x] `snaps-registry` - [x] https://github.com/MetaMask/snaps-registry/pull/693 - [x] https://github.com/MetaMask/snaps-registry/pull/694 - [x] `base-controller`, `permission-controller` - [x] https://github.com/MetaMask/core/pull/4516 - [x] https://github.com/MetaMask/core/pull/4517 - [ ] Release `snaps-sdk` - [x] Release `keyring-api`: https://github.com/MetaMask/keyring-api/pull/328 - [ ] Release `snaps-utils` - [ ] Release `snaps-rpc-methods` - [ ] Merge core PR: https://github.com/MetaMask/core/pull/3645 - Before merging, first remove yarn resolutions for `snaps-sdk`, `snaps-utils`, `keyring-api` - [ ] Release all core pkgs (especially deps of `snaps-controllers` and consumers of `utils`) - Exclude core pkgs that have `snaps-controllers` as dependency: `{accounts,chain,profile-sync}-controller` - [ ] Bump and release all remaining `@metamask/utils@8.x.x` usage in the `snaps-controllers` dependency tree - [x] `browser-passworder` - [x] https://github.com/MetaMask/browser-passworder/pull/63 - [x] https://github.com/MetaMask/browser-passworder/pull/64 - [x] `post-message-stream` - [x] https://github.com/MetaMask/post-message-stream/pull/140 - ~Blocked by build error https://github.com/MetaMask/post-message-stream/actions/runs/9863225191/job/27235524010?pr=140~ - [x] https://github.com/MetaMask/post-message-stream/pull/141 - [ ] Release `snaps-controllers` - [ ] Release `{accounts,chain,profile-sync}-controller`, `eth-snap-keyring` (https://github.com/MetaMask/eth-snap-keyring/pull/311) - [ ] Bump and release all remaining `@metamask/utils@8.x.x` usage in the snaps monorepo dependency tree - [ ] `create-release-branch` - [x] https://github.com/MetaMask/create-release-branch/pull/150 - [x] https://github.com/MetaMask/create-release-branch/pull/149 - [ ] `eth-block-tracker` - ~Blocked by `eth-json-rpc-provider`~ - [ ] Blocked by https://github.com/MetaMask/eth-block-tracker/pull/252 - [ ] `eth-json-rpc-middleware` - Blocked by `eth-block-tracker`, ~`eth-json-rpc-provider`,~ `eth-sig-util`, ~`json-rpc-engine`~ - [x] `abi-utils` - [x] https://github.com/MetaMask/abi-utils/pull/80 - [x] https://github.com/MetaMask/abi-utils/pull/81 - [ ] `eth-sig-util` - ~Blocked by `abi-utils`~ - [x] https://github.com/MetaMask/eth-sig-util/pull/381 - [x] https://github.com/MetaMask/eth-sig-util/pull/382 - [x] `providers` - ~Blocked by `json-rpc-engine`, `json-rpc-middleware-stream`, `rpc-errors`~ - [x] https://github.com/MetaMask/providers/pull/345 - [x] https://github.com/MetaMask/providers/pull/347 - [ ] Remove yarn resolution for `@metamask/utils` - [ ] Release all remaining snaps pkgs - New snaps monorepo releases are now safe to publish. ## References - Closes https://github.com/MetaMask/snaps/issues/2444 - Followed by https://github.com/MetaMask/snaps/pull/2514 - Blocked by type errors caused by simultaneous usage of `@metamask/utils` `9.0.0` and `8.5.0` in dependency tree. - All tests passing with `@metamask/utils` fixed to `9.0.0` in yarn resolutions: https://github.com/MetaMask/snaps/actions/runs/9745954683/job/26895208572?pr=2445 - [ ] `snaps-sdk`, `snaps-utils` and their dependencies that use `@metamask/utils@8.5.0` are blocking: - [ ] core release via https://github.com/MetaMask/core/pull/3645, which is blocking: - [ ] `snaps-controllers` type errors - [ ] `snaps-rpc-methods` type errors - [ ] `{accounts,chain,profile-sync}-controller` as dependencies - `@metamask/providers` update to `^17.1.0` is being blocked by https://github.com/MetaMask/providers/pull/340, https://github.com/ts-bridge/ts-bridge/issues/22 - Causes CI failure: https://github.com/MetaMask/snaps/actions/runs/9783767567/job/27013136688?pr=2445 - [x] Fix: https://github.com/MetaMask/providers/pull/347 ## Changelog ### `@metamask/snaps-cli` ```md ### Changed - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option. ``` ### `@metamask/snaps-controllers` ```md ### Changed - Bump `@metamask/base-controller` from `^6.0.0` to `^6.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/permission-controller` from `^10.0.0` to `^10.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/snaps-registry` from `^3.1.0` to `^3.2.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ``` ### `@metamask/snaps-execution-environments` ```md ### Changed - Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option. - Set `@metamask/providers` from `^17.0.0` to `17.0.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - `17.1.0` and `17.1.1` introduce regressions. ``` ### `@metamask/snaps-jest` ```md ### Changed - Bump `@metamask/base-controller` from `^6.0.0` to `^6.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/key-tree` from `^9.1.1` to `^9.1.2` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/permission-controller` from `^10.0.0` to `^10.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option. ``` ### `@metamask/snaps-rpc-methods` ```md ### Changed - Bump `@metamask/key-tree` from `^9.1.1` to `^9.1.2` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/permission-controller` from `^10.0.0` to `^10.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option. ``` ### `@metamask/snaps-sdk` ```md ### Changed - Bump `@metamask/key-tree` from `^9.1.1` to `^9.1.2` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option. - Set `@metamask/providers` from `^17.0.0` to `17.0.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - `17.1.0` and `17.1.1` introduce regressions. ``` ### `@metamask/snaps-simulator` (major) ```md ### Changed - **BREAKING:** Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Due to the return type of `bigIntToHex` being narrowed from `string` to `Hex`, the return type of `hexlifyTransactionData` is narrowed from an object of type `Record` to an object of type `Record`, where `transaction` is of type `Omit` - Bump `@metamask/base-controller` from `^6.0.0` to `^6.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/key-tree` from `^9.1.1` to `^9.1.2` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/permission-controller` from `^10.0.0` to `^10.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option. ``` ### `@metamask/snaps-utils` ```md ### Changed - Bump `@metamask/base-controller` from `^6.0.0` to `^6.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/key-tree` from `^9.1.1` to `^9.1.2` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/permission-controller` from `^10.0.0` to `^10.0.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/snaps-registry` from `^3.1.0` to `^3.2.1` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Replace `superstruct` with ESM-compatible `@metamask/superstruct` `^3.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - This fixes the issue of this package being unusable by any TypeScript project that uses `Node16` or `NodeNext` as its `moduleResolution` option. ``` ### `@metamask/snaps-webpack-plugin` ```md ### Changed - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ``` ### `@metamask/test-snaps` ```md ### Changed - Bump `@metamask/utils` from `^8.3.0` to `^9.1.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) ### Fixed - Set `@metamask/providers` from `^17.0.0` to `17.0.0` ([#2445](https://github.com/MetaMask/snaps/pull/2445)) - `17.1.0` and `17.1.1` introduce regressions. ``` --- package.json | 3 +- packages/examples/packages/bip32/package.json | 4 +- .../packages/bip32/snap.manifest.json | 2 +- packages/examples/packages/bip44/package.json | 4 +- .../packages/bip44/snap.manifest.json | 2 +- .../browserify-plugin/snap.manifest.json | 2 +- .../packages/browserify/snap.manifest.json | 2 +- .../packages/client-status/snap.manifest.json | 2 +- .../packages/cronjobs/snap.manifest.json | 2 +- .../packages/dialogs/snap.manifest.json | 2 +- .../packages/ethereum-provider/package.json | 2 +- .../ethereum-provider/snap.manifest.json | 2 +- .../packages/ethers-js/snap.manifest.json | 2 +- .../packages/file-upload/package.json | 2 +- .../packages/file-upload/snap.manifest.json | 2 +- .../packages/get-entropy/package.json | 2 +- .../packages/get-entropy/snap.manifest.json | 2 +- .../packages/get-file/snap.manifest.json | 2 +- .../packages/home-page/snap.manifest.json | 2 +- .../packages/images/snap.manifest.json | 2 +- .../packages/interactive-ui/package.json | 2 +- .../interactive-ui/snap.manifest.json | 2 +- .../packages/consumer-signer/package.json | 4 +- .../consumer-signer/snap.manifest.json | 2 +- .../packages/core-signer/package.json | 4 +- .../packages/core-signer/snap.manifest.json | 2 +- .../packages/json-rpc/snap.manifest.json | 2 +- packages/examples/packages/jsx/package.json | 4 +- .../examples/packages/jsx/snap.manifest.json | 2 +- .../lifecycle-hooks/snap.manifest.json | 2 +- .../packages/localization/snap.manifest.json | 2 +- .../packages/manage-state/snap.manifest.json | 2 +- .../packages/network-access/package.json | 2 +- .../network-access/snap.manifest.json | 2 +- .../packages/notifications/snap.manifest.json | 2 +- .../packages/rollup-plugin/snap.manifest.json | 2 +- .../signature-insights/snap.manifest.json | 2 +- .../transaction-insights/package.json | 2 +- .../transaction-insights/snap.manifest.json | 2 +- .../examples/packages/wasm/snap.manifest.json | 2 +- .../webpack-plugin/snap.manifest.json | 2 +- packages/snaps-cli/package.json | 4 +- packages/snaps-cli/src/config.ts | 18 +- packages/snaps-cli/src/structs.test.ts | 2 +- packages/snaps-cli/src/structs.ts | 2 +- packages/snaps-controllers/package.json | 10 +- .../src/services/AbstractExecutionService.ts | 10 +- .../lavamoat/browserify/iframe/policy.json | 16 +- .../browserify/node-process/policy.json | 16 +- .../browserify/node-thread/policy.json | 16 +- .../lavamoat/browserify/webview/policy.json | 16 +- .../browserify/worker-executor/policy.json | 16 +- .../browserify/worker-pool/policy.json | 16 +- .../lavamoat/build-system/policy.json | 8 +- .../snaps-execution-environments/package.json | 10 +- .../src/common/BaseSnapExecutor.ts | 2 +- .../src/common/validation.ts | 22 +- packages/snaps-jest/package.json | 12 +- packages/snaps-jest/src/helpers.ts | 7 +- packages/snaps-jest/src/internals/request.ts | 2 +- .../src/internals/simulation/options.ts | 6 +- .../snaps-jest/src/internals/structs.test.tsx | 2 +- packages/snaps-jest/src/internals/structs.ts | 16 +- packages/snaps-jest/src/matchers.ts | 2 +- packages/snaps-jest/src/options.ts | 4 +- packages/snaps-jest/src/types.ts | 2 +- packages/snaps-rpc-methods/package.json | 12 +- .../src/permitted/createInterface.ts | 2 +- .../src/permitted/getFile.ts | 2 +- .../src/permitted/getInterfaceState.ts | 2 +- .../src/permitted/resolveInterface.ts | 2 +- .../src/permitted/updateInterface.ts | 2 +- .../caveats/permittedDerivationPaths.ts | 2 +- .../src/restricted/caveats/snapIds.ts | 2 +- .../src/restricted/dialog.ts | 8 +- .../src/restricted/getBip32PublicKey.ts | 2 +- .../src/restricted/getEntropy.ts | 4 +- .../src/restricted/manageAccounts.ts | 9 +- packages/snaps-sdk/package.json | 10 +- packages/snaps-sdk/src/internals/jsx.ts | 5 +- .../snaps-sdk/src/internals/structs.test.ts | 2 +- packages/snaps-sdk/src/internals/structs.ts | 7 +- packages/snaps-sdk/src/internals/svg.test.ts | 2 +- packages/snaps-sdk/src/internals/svg.ts | 2 +- .../snaps-sdk/src/jsx/validation.test.tsx | 2 +- packages/snaps-sdk/src/jsx/validation.ts | 27 +- .../src/types/handlers/user-input.test.ts | 2 +- .../src/types/handlers/user-input.ts | 4 +- .../snaps-sdk/src/types/interface.test.ts | 2 +- packages/snaps-sdk/src/types/interface.ts | 10 +- packages/snaps-sdk/src/ui/builder.ts | 2 +- packages/snaps-sdk/src/ui/component.ts | 2 +- .../snaps-sdk/src/ui/components/address.ts | 4 +- .../snaps-sdk/src/ui/components/button.ts | 11 +- .../snaps-sdk/src/ui/components/copyable.ts | 4 +- .../snaps-sdk/src/ui/components/divider.ts | 4 +- packages/snaps-sdk/src/ui/components/form.ts | 11 +- .../snaps-sdk/src/ui/components/heading.ts | 4 +- .../snaps-sdk/src/ui/components/image.test.ts | 4 +- packages/snaps-sdk/src/ui/components/image.ts | 4 +- packages/snaps-sdk/src/ui/components/input.ts | 11 +- .../snaps-sdk/src/ui/components/panel.test.ts | 2 +- packages/snaps-sdk/src/ui/components/panel.ts | 4 +- packages/snaps-sdk/src/ui/components/row.ts | 11 +- .../snaps-sdk/src/ui/components/spinner.ts | 4 +- packages/snaps-sdk/src/ui/components/text.ts | 4 +- packages/snaps-sdk/src/ui/nodes.ts | 4 +- packages/snaps-simulator/package.json | 12 +- .../src/features/builder/utils.ts | 2 +- packages/snaps-utils/package.json | 14 +- packages/snaps-utils/src/cronjob.ts | 11 +- packages/snaps-utils/src/handlers.ts | 2 +- packages/snaps-utils/src/json-rpc.ts | 11 +- packages/snaps-utils/src/localization.ts | 4 +- .../src/manifest/validation.test.ts | 2 +- .../snaps-utils/src/manifest/validation.ts | 20 +- packages/snaps-utils/src/namespace.ts | 4 +- packages/snaps-utils/src/snaps.test.ts | 2 +- packages/snaps-utils/src/snaps.ts | 12 +- packages/snaps-utils/src/structs.test.ts | 27 +- packages/snaps-utils/src/structs.ts | 24 +- packages/snaps-utils/src/types.test.ts | 2 +- packages/snaps-utils/src/types.ts | 8 +- packages/snaps-utils/src/versions.ts | 2 +- packages/snaps-webpack-plugin/package.json | 2 +- packages/test-snaps/package.json | 4 +- yarn.lock | 233 +++++++++--------- 127 files changed, 490 insertions(+), 452 deletions(-) diff --git a/package.json b/package.json index 4172649262..c2511795a7 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "@babel/core": "patch:@babel/core@npm%3A7.23.2#./.yarn/patches/@babel-core-npm-7.23.2-b93f586907.patch", "@esbuild-plugins/node-modules-polyfill@^0.2.2": "patch:@esbuild-plugins/node-modules-polyfill@npm%3A0.2.2#./.yarn/patches/@esbuild-plugins-node-modules-polyfill-npm-0.2.2-f612681798.patch", "@lavamoat/lavapack@^6.1.1": "patch:@lavamoat/lavapack@npm%3A6.1.1#./.yarn/patches/@lavamoat-lavapack-npm-6.1.1-b81af21193.patch", + "@metamask/utils": "9.1.0", "@puppeteer/browsers@1.4.6": "patch:@puppeteer/browsers@npm%3A1.7.0#./.yarn/patches/@puppeteer-browsers-npm-1.7.0-203cb4f44b.patch", "@puppeteer/browsers@^1.6.0": "patch:@puppeteer/browsers@npm%3A1.7.0#./.yarn/patches/@puppeteer-browsers-npm-1.7.0-203cb4f44b.patch", "@types/glob@*": "patch:@types/glob@npm%3A7.1.4#./.yarn/patches/@types-glob-npm-7.1.4-d45247eaa2.patch", @@ -76,7 +77,7 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@swc/core": "1.3.78", "@types/jest": "^27.5.1", "@types/node": "18.14.2", diff --git a/packages/examples/packages/bip32/package.json b/packages/examples/packages/bip32/package.json index 990d8b1b1b..6a41088169 100644 --- a/packages/examples/packages/bip32/package.json +++ b/packages/examples/packages/bip32/package.json @@ -30,9 +30,9 @@ "lint:dependencies": "depcheck" }, "dependencies": { - "@metamask/key-tree": "^9.1.1", + "@metamask/key-tree": "^9.1.2", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@noble/ed25519": "^1.6.0", "@noble/secp256k1": "^1.7.1" }, diff --git a/packages/examples/packages/bip32/snap.manifest.json b/packages/examples/packages/bip32/snap.manifest.json index 50e29b8f16..f9cda97597 100644 --- a/packages/examples/packages/bip32/snap.manifest.json +++ b/packages/examples/packages/bip32/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "cG78m4B2d8yHgKq1rKrZsbGZApWbJyd3MNoBPGcjKUQ=", + "shasum": "+iXB4ursqJMaWWR3fHJYNCxM8di9xvLeYoTv9jjMfjI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/bip44/package.json b/packages/examples/packages/bip44/package.json index a8697c693b..bd7df453be 100644 --- a/packages/examples/packages/bip44/package.json +++ b/packages/examples/packages/bip44/package.json @@ -30,9 +30,9 @@ "lint:dependencies": "depcheck" }, "dependencies": { - "@metamask/key-tree": "^9.1.1", + "@metamask/key-tree": "^9.1.2", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@noble/bls12-381": "^1.2.0" }, "devDependencies": { diff --git a/packages/examples/packages/bip44/snap.manifest.json b/packages/examples/packages/bip44/snap.manifest.json index 0edcccd845..54d67f2d99 100644 --- a/packages/examples/packages/bip44/snap.manifest.json +++ b/packages/examples/packages/bip44/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "YvyYRUgAVoeYPTzZRjxKRYNAjJe5usTDyqQkKbGTFTo=", + "shasum": "j9P+pv0vxS6MqADtGzIpFQsTTZjhiKxpXp1MlfGvgMo=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/browserify-plugin/snap.manifest.json b/packages/examples/packages/browserify-plugin/snap.manifest.json index 0b81df8052..37ecb6bdda 100644 --- a/packages/examples/packages/browserify-plugin/snap.manifest.json +++ b/packages/examples/packages/browserify-plugin/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "FQwKp8UTAOjE30njzUvGS2OElCud9Hyj2+xkfRGeqIk=", + "shasum": "Q9txBAsd1Ti3Wkp+0S1Ra5Pr5/E6XDvK9Y7VNKh5gkI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/browserify/snap.manifest.json b/packages/examples/packages/browserify/snap.manifest.json index 8a1474a74b..bfd68ccb61 100644 --- a/packages/examples/packages/browserify/snap.manifest.json +++ b/packages/examples/packages/browserify/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "VglMoBJGhWpq4P+2P0DXMHVL3oF5+W2D4tlJtH8kdvw=", + "shasum": "VCkeaa154OzOdAlNLhXItNXIlGyUaGP/7Emwe3SGrs8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/client-status/snap.manifest.json b/packages/examples/packages/client-status/snap.manifest.json index 5a1fd660dc..a6fabd9368 100644 --- a/packages/examples/packages/client-status/snap.manifest.json +++ b/packages/examples/packages/client-status/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "FHyz1K8TqeKyGniGR77kZFwRcm7IkjBuQ1zBifDPHvo=", + "shasum": "bxdSLOnvbn6YB+sx+gO7/m3TJ1H6n0HtdZqF79ivwwc=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/cronjobs/snap.manifest.json b/packages/examples/packages/cronjobs/snap.manifest.json index 2b571e309e..f3151b6584 100644 --- a/packages/examples/packages/cronjobs/snap.manifest.json +++ b/packages/examples/packages/cronjobs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "9bT28snShrLQ7/OHDWJT6qDXdlc/asYH7x8o6zqfuUo=", + "shasum": "w8joIp3iT9niOPMTEkIFF90dvWweOEv0dOa3VRg4EaY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/dialogs/snap.manifest.json b/packages/examples/packages/dialogs/snap.manifest.json index d65a4cf207..f26d25e7f7 100644 --- a/packages/examples/packages/dialogs/snap.manifest.json +++ b/packages/examples/packages/dialogs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "bozHl8e7Md1GuWvLOXtPbKGejiE2gBOGV0cIg6M7zFc=", + "shasum": "nv4HftdM7pplaozX8SvKzW2yovcXRtrHbhpIDVxYbWk=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethereum-provider/package.json b/packages/examples/packages/ethereum-provider/package.json index 14266df8a8..0c0a5c86f1 100644 --- a/packages/examples/packages/ethereum-provider/package.json +++ b/packages/examples/packages/ethereum-provider/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^9.1.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/ethereum-provider/snap.manifest.json b/packages/examples/packages/ethereum-provider/snap.manifest.json index 6ddcc0cbeb..d9d6a2f03d 100644 --- a/packages/examples/packages/ethereum-provider/snap.manifest.json +++ b/packages/examples/packages/ethereum-provider/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "AKvlBnNv0PrE8VfPCdxMmbTMq451QKo9ggsERIMPEZc=", + "shasum": "zga2LbSptxEp2jKJjYW7cbX6Rce31AFDCE6+Vw28Rtg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethers-js/snap.manifest.json b/packages/examples/packages/ethers-js/snap.manifest.json index ee235d0c31..57de1b5a14 100644 --- a/packages/examples/packages/ethers-js/snap.manifest.json +++ b/packages/examples/packages/ethers-js/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "60LZXNvbDxyYnWy5qP43Tj8UZTfnmUsjItCOpnLTju0=", + "shasum": "qWsfSE/q+SOlwVXpWQPbo138eu8Lr+bZdGE4q8rDJkE=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/file-upload/package.json b/packages/examples/packages/file-upload/package.json index 64fed7c78a..089ce945c3 100644 --- a/packages/examples/packages/file-upload/package.json +++ b/packages/examples/packages/file-upload/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^9.1.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/file-upload/snap.manifest.json b/packages/examples/packages/file-upload/snap.manifest.json index 49e5585e57..c1fb0fc505 100644 --- a/packages/examples/packages/file-upload/snap.manifest.json +++ b/packages/examples/packages/file-upload/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "E6A+dO1EcNp9XYm9M0yEUafFXRM0W72ylmOhbA9FFio=", + "shasum": "0NXBdGNFyI8Nkspox5XlEUpuG2Qq63CujGF7IOoPmEY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-entropy/package.json b/packages/examples/packages/get-entropy/package.json index 5e910596ff..f0de69a797 100644 --- a/packages/examples/packages/get-entropy/package.json +++ b/packages/examples/packages/get-entropy/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@noble/bls12-381": "^1.2.0" }, "devDependencies": { diff --git a/packages/examples/packages/get-entropy/snap.manifest.json b/packages/examples/packages/get-entropy/snap.manifest.json index 591f066658..6adf53e21b 100644 --- a/packages/examples/packages/get-entropy/snap.manifest.json +++ b/packages/examples/packages/get-entropy/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "GFAjUWW8q9iX+2J/wKFlVRjq1oJ377NW5qSVTbkYtIQ=", + "shasum": "rySr4yZWGGLVvJVfSJ3Jj0xFl5+KpdxeSAdzmo5gyME=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-file/snap.manifest.json b/packages/examples/packages/get-file/snap.manifest.json index 2903902c62..854114cc2c 100644 --- a/packages/examples/packages/get-file/snap.manifest.json +++ b/packages/examples/packages/get-file/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "37wMtBqKrmWF3CUdyQHZ3Ey86NpGnffqIq6GnqTf+Ro=", + "shasum": "ryPz8htXh8QeSFf/drty6QNVnXueollOwytqqeYVCnw=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/home-page/snap.manifest.json b/packages/examples/packages/home-page/snap.manifest.json index 44d22d2841..02b7d8a46b 100644 --- a/packages/examples/packages/home-page/snap.manifest.json +++ b/packages/examples/packages/home-page/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "9eJQJL4e2McSiHzayvby/1zLdHvf7Uc9ppUUw7v+rHQ=", + "shasum": "+sH7ONT+9GTYsxUjZzJED7hM7IIz/ney/rQqY8sMbug=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/images/snap.manifest.json b/packages/examples/packages/images/snap.manifest.json index bf2054eeb4..95d4caf786 100644 --- a/packages/examples/packages/images/snap.manifest.json +++ b/packages/examples/packages/images/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "oyaKZ7cbZisTYS6p9+ol9+tbjfq2Yly3G5UDvIwDLOQ=", + "shasum": "21gXIQI2uKjbuCEoMLwemFH0Ib4jMgQqiIE3La5sl9k=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/interactive-ui/package.json b/packages/examples/packages/interactive-ui/package.json index 038063beb1..452bb90180 100644 --- a/packages/examples/packages/interactive-ui/package.json +++ b/packages/examples/packages/interactive-ui/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^9.1.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/interactive-ui/snap.manifest.json b/packages/examples/packages/interactive-ui/snap.manifest.json index f0440bb7ec..6d4ad7f681 100644 --- a/packages/examples/packages/interactive-ui/snap.manifest.json +++ b/packages/examples/packages/interactive-ui/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "LfydCMo1VRRXKdciizK7HPLso/tVufqM0JGpWSts/os=", + "shasum": "pb48uILYeb7mT0LcsxDZPrc0KUw+lxoSwO/e26xKALQ=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json b/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json index 32f06a84fb..4da889be62 100644 --- a/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json @@ -30,9 +30,9 @@ "lint:dependencies": "depcheck" }, "dependencies": { - "@metamask/key-tree": "^9.1.1", + "@metamask/key-tree": "^9.1.2", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@noble/hashes": "^1.3.1" }, "devDependencies": { diff --git a/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json b/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json index 5f9b25affd..9284815e38 100644 --- a/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json +++ b/packages/examples/packages/invoke-snap/packages/consumer-signer/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "8MoLqit0ldP9dXby0k6nOsNPcfTVhHFwD+NDkGTLWpE=", + "shasum": "mQB3xpSBlUUoaBHaVO3mbWHJJBt5isBbhgC++s6arFU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/invoke-snap/packages/core-signer/package.json b/packages/examples/packages/invoke-snap/packages/core-signer/package.json index 0f88700a8f..803725e62d 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/package.json @@ -30,9 +30,9 @@ "lint:dependencies": "depcheck" }, "dependencies": { - "@metamask/key-tree": "^9.1.1", + "@metamask/key-tree": "^9.1.2", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@noble/curves": "^1.1.0", "async-mutex": "^0.4.0" }, diff --git a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json index 3afeb23165..858e77739a 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "dd2RRHpmyhOtK2A1mWqgzYz+AI/UG2gyFWUsuCjW/QY=", + "shasum": "O2Sb2t0ADBZPopPAyweSHQV69tnsfnqu8KM2iaPxVqQ=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/json-rpc/snap.manifest.json b/packages/examples/packages/json-rpc/snap.manifest.json index cb70769db2..2aed26e453 100644 --- a/packages/examples/packages/json-rpc/snap.manifest.json +++ b/packages/examples/packages/json-rpc/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "wXoG3PQ8lhJu5MCXOoFXPd/eEzrkMzdCYNL5YKCzOXg=", + "shasum": "SxLNMg1eeEVVwuoJLRaSJNIICRqMZzL8rI3WAnJvJdI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/jsx/package.json b/packages/examples/packages/jsx/package.json index fc66a19f7c..c8550d7382 100644 --- a/packages/examples/packages/jsx/package.json +++ b/packages/examples/packages/jsx/package.json @@ -30,7 +30,7 @@ "lint:dependencies": "depcheck" }, "dependencies": { - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^" }, "devDependencies": { @@ -43,7 +43,7 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/jsx/snap.manifest.json b/packages/examples/packages/jsx/snap.manifest.json index 52164100bc..e00adf9386 100644 --- a/packages/examples/packages/jsx/snap.manifest.json +++ b/packages/examples/packages/jsx/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "8CWhVcRMrN0tSMtxV0UXNvvS6kwVVJ+xJxADZ1AMkxY=", + "shasum": "hSBuaInB3v2p5r2tg+DPgvrtIeiP35TD34ZFNAfDqbQ=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/lifecycle-hooks/snap.manifest.json b/packages/examples/packages/lifecycle-hooks/snap.manifest.json index 05842992da..1b9135bda1 100644 --- a/packages/examples/packages/lifecycle-hooks/snap.manifest.json +++ b/packages/examples/packages/lifecycle-hooks/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "+bfsURFNxni7MV/98u6zHjp9QgzWIAXI2wud9ClfejM=", + "shasum": "RL+zdZP3hJWPZRNmLZErYwF4/cFoBjQCdreEQRXfTNI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/localization/snap.manifest.json b/packages/examples/packages/localization/snap.manifest.json index 4d51936f4f..8c8ca371e9 100644 --- a/packages/examples/packages/localization/snap.manifest.json +++ b/packages/examples/packages/localization/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "U5POJ0kzznk+u1A4xxgFQX3LIU8QoVUqYYUylOUmUhs=", + "shasum": "wTfijFIQOBHX5z4VPL4uYkO1+qmCREzPZjTxh2+zYek=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/manage-state/snap.manifest.json b/packages/examples/packages/manage-state/snap.manifest.json index 5c670ce520..99074eeedc 100644 --- a/packages/examples/packages/manage-state/snap.manifest.json +++ b/packages/examples/packages/manage-state/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nP0QOJ+vurTLPgKtiYq2zWMxoBBfgZ4VkcQ8svyU1Sk=", + "shasum": "twnP7bpowAlGmbmsnKc32/usTUGCPkvPxP4eCdWMaeU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/network-access/package.json b/packages/examples/packages/network-access/package.json index 277f21840c..016b8571ec 100644 --- a/packages/examples/packages/network-access/package.json +++ b/packages/examples/packages/network-access/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^9.1.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/network-access/snap.manifest.json b/packages/examples/packages/network-access/snap.manifest.json index 592b6d22ac..30f9405ef6 100644 --- a/packages/examples/packages/network-access/snap.manifest.json +++ b/packages/examples/packages/network-access/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "VSXdhOsUAKupm4JXWCZcQ4HFKNrmxD3LySAmJlRQkGQ=", + "shasum": "1XllDrzhXP6aHrtyVKdA6jgPhwSCIM0zjPgXsFMOvkE=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/notifications/snap.manifest.json b/packages/examples/packages/notifications/snap.manifest.json index 249d61be3f..2e76022734 100644 --- a/packages/examples/packages/notifications/snap.manifest.json +++ b/packages/examples/packages/notifications/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "AP1xFEuyMDWaiey+kkUzjlMl1tt4ey26cntnHHNix/s=", + "shasum": "pCV/1BuNHzZ4LoDxTYiFcZ2TYnP4juq0v2zWvCY2xEU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/rollup-plugin/snap.manifest.json b/packages/examples/packages/rollup-plugin/snap.manifest.json index b2e96e7812..ad94dcbed6 100644 --- a/packages/examples/packages/rollup-plugin/snap.manifest.json +++ b/packages/examples/packages/rollup-plugin/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "R6xONAf4IA5HXDU2oyL732pa5T+Nhc6idkEr9Zo/fDo=", + "shasum": "K9RWfqiDh1J35IDNzK8m3zAMKsE8CmigX++Un0mBOKA=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/signature-insights/snap.manifest.json b/packages/examples/packages/signature-insights/snap.manifest.json index 3b9b2464fb..0d40826ee5 100644 --- a/packages/examples/packages/signature-insights/snap.manifest.json +++ b/packages/examples/packages/signature-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nOHygj95R/T+NtgyXLdS5YNxom7bflJoLGaSqAiLZNU=", + "shasum": "PP5YB3peSBGqqydQltx3dolGtD36y/cj+V79HUk/dK0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/transaction-insights/package.json b/packages/examples/packages/transaction-insights/package.json index 3a2de117e7..f79e1891cc 100644 --- a/packages/examples/packages/transaction-insights/package.json +++ b/packages/examples/packages/transaction-insights/package.json @@ -31,7 +31,7 @@ }, "dependencies": { "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^9.1.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/transaction-insights/snap.manifest.json b/packages/examples/packages/transaction-insights/snap.manifest.json index d5c487b6ef..59b3f7299c 100644 --- a/packages/examples/packages/transaction-insights/snap.manifest.json +++ b/packages/examples/packages/transaction-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "z18RzBaiNCS+tdOltE3CD6s/S+nTZTVHjLotmaVgKN8=", + "shasum": "/In50uvFLDRJh4Vrb9EyhPF/kPKFA9htS1jroO3aDLg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/wasm/snap.manifest.json b/packages/examples/packages/wasm/snap.manifest.json index 3498ce2b03..2df4f059be 100644 --- a/packages/examples/packages/wasm/snap.manifest.json +++ b/packages/examples/packages/wasm/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "ZQJV6BNeSLTrnxxnbT+P+I1O9/novFlZcKVJuTxnRRM=", + "shasum": "MLP+ENE5E95zSiZZTD0b4XEtPFPRyOnUkvVodG1fzuI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/webpack-plugin/snap.manifest.json b/packages/examples/packages/webpack-plugin/snap.manifest.json index 2498e0f7bd..a93a85c5f6 100644 --- a/packages/examples/packages/webpack-plugin/snap.manifest.json +++ b/packages/examples/packages/webpack-plugin/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nXyQsrdxb0igyATQImUC4UyAw598ldkJCRuu/OZTvss=", + "shasum": "zHjmX/AyXEOrW2WZZUUbn7oFrZJBQp0+zuK4Q2s6DcE=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snaps-cli/package.json b/packages/snaps-cli/package.json index 91588cc334..0e9e202916 100644 --- a/packages/snaps-cli/package.json +++ b/packages/snaps-cli/package.json @@ -60,7 +60,8 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/snaps-webpack-plugin": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0", "@swc/core": "1.3.78", "assert": "^2.0.0", "babelify": "^10.0.0", @@ -87,7 +88,6 @@ "stream-http": "^3.2.0", "string_decoder": "^1.3.0", "strip-ansi": "^6.0.1", - "superstruct": "^1.0.3", "swc-loader": "^0.2.3", "terser-webpack-plugin": "^5.3.9", "timers-browserify": "^2.0.12", diff --git a/packages/snaps-cli/src/config.ts b/packages/snaps-cli/src/config.ts index 4c5c8afe82..bae1537966 100644 --- a/packages/snaps-cli/src/config.ts +++ b/packages/snaps-cli/src/config.ts @@ -6,13 +6,6 @@ import { SnapsStructError, named, } from '@metamask/snaps-utils/node'; -import { hasProperty } from '@metamask/utils'; -import { transform } from '@swc/core'; -import type { BrowserifyObject } from 'browserify'; -import { dim } from 'chalk'; -import { readFile } from 'fs/promises'; -import Module from 'module'; -import { basename, dirname, resolve } from 'path'; import { array, boolean, @@ -28,8 +21,15 @@ import { type, unknown, empty, -} from 'superstruct'; -import type { Infer } from 'superstruct'; +} from '@metamask/superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { hasProperty } from '@metamask/utils'; +import { transform } from '@swc/core'; +import type { BrowserifyObject } from 'browserify'; +import { dim } from 'chalk'; +import { readFile } from 'fs/promises'; +import Module from 'module'; +import { basename, dirname, resolve } from 'path'; import type { Configuration as WebpackConfiguration } from 'webpack'; import { TranspilationModes } from './builders'; diff --git a/packages/snaps-cli/src/structs.test.ts b/packages/snaps-cli/src/structs.test.ts index f2b722cdf1..534fd569fd 100644 --- a/packages/snaps-cli/src/structs.test.ts +++ b/packages/snaps-cli/src/structs.test.ts @@ -1,5 +1,5 @@ +import { create, is } from '@metamask/superstruct'; import { resolve } from 'path/posix'; -import { create, is } from 'superstruct'; import { file } from './structs'; diff --git a/packages/snaps-cli/src/structs.ts b/packages/snaps-cli/src/structs.ts index 5b67d870ce..c6bd57ec59 100644 --- a/packages/snaps-cli/src/structs.ts +++ b/packages/snaps-cli/src/structs.ts @@ -1,5 +1,5 @@ +import { coerce, string } from '@metamask/superstruct'; import { resolve } from 'path'; -import { coerce, string } from 'superstruct'; /** * A wrapper of `superstruct`'s `string` struct that coerces a value to a string diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index 5c99399277..08b77c70f9 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -54,19 +54,19 @@ }, "dependencies": { "@metamask/approval-controller": "^7.0.0", - "@metamask/base-controller": "^6.0.0", + "@metamask/base-controller": "^6.0.1", "@metamask/json-rpc-engine": "^9.0.0", "@metamask/json-rpc-middleware-stream": "^8.0.0", "@metamask/object-multiplex": "^2.0.0", - "@metamask/permission-controller": "^10.0.0", + "@metamask/permission-controller": "^10.0.1", "@metamask/phishing-controller": "^10.0.0", "@metamask/post-message-stream": "^8.1.0", - "@metamask/rpc-errors": "^6.2.1", - "@metamask/snaps-registry": "^3.1.0", + "@metamask/rpc-errors": "^6.3.1", + "@metamask/snaps-registry": "^3.2.1", "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@xstate/fsm": "^2.0.0", "browserify-zlib": "^0.2.0", "concat-stream": "^2.0.0", diff --git a/packages/snaps-controllers/src/services/AbstractExecutionService.ts b/packages/snaps-controllers/src/services/AbstractExecutionService.ts index 6b5f9c57d2..31c6e0d9cf 100644 --- a/packages/snaps-controllers/src/services/AbstractExecutionService.ts +++ b/packages/snaps-controllers/src/services/AbstractExecutionService.ts @@ -9,12 +9,12 @@ import type { Json, JsonRpcNotification, JsonRpcRequest, - PendingJsonRpcResponse, } from '@metamask/utils'; import { Duration, assertIsJsonRpcRequest, inMilliseconds, + isJsonRpcFailure, isJsonRpcNotification, isObject, } from '@metamask/utils'; @@ -441,11 +441,11 @@ export abstract class AbstractExecutionService } log('Parent: Sending Command', message); - const response: PendingJsonRpcResponse = await job.rpcEngine.handle( - message, - ); + // eslint is blocking `await` usage even though `handle` overload returns a promise. + // eslint-disable-next-line @typescript-eslint/await-thenable + const response = await job.rpcEngine.handle(message); - if (response.error) { + if (isJsonRpcFailure(response)) { throw new JsonRpcError( response.error.code, response.error.message, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index c0c0f35f59..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -89,8 +89,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/snaps-utils": { @@ -105,8 +105,8 @@ "packages": { "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/utils": { @@ -115,12 +115,12 @@ "TextEncoder": true }, "packages": { + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "browserify>buffer": true, "depcheck>semver": true, - "superstruct": true, "tsup>debug": true } }, @@ -198,12 +198,6 @@ "localStorage": true } }, - "superstruct": { - "globals": { - "console.warn": true, - "define": true - } - }, "tsup>debug": { "globals": { "console": true, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json index 33380cfd1d..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -99,8 +99,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/snaps-utils": { @@ -115,8 +115,8 @@ "packages": { "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/utils": { @@ -128,12 +128,12 @@ "TextEncoder": true }, "packages": { + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "buffer": true, "depcheck>semver": true, - "superstruct": true, "tsup>debug": true } }, @@ -235,12 +235,6 @@ "util": true } }, - "superstruct": { - "globals": { - "console.warn": true, - "define": true - } - }, "tsup>debug": { "builtin": { "tty.isatty": true, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json index 33380cfd1d..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -99,8 +99,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/snaps-utils": { @@ -115,8 +115,8 @@ "packages": { "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/utils": { @@ -128,12 +128,12 @@ "TextEncoder": true }, "packages": { + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "buffer": true, "depcheck>semver": true, - "superstruct": true, "tsup>debug": true } }, @@ -235,12 +235,6 @@ "util": true } }, - "superstruct": { - "globals": { - "console.warn": true, - "define": true - } - }, "tsup>debug": { "builtin": { "tty.isatty": true, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 31bf63a082..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -28,8 +28,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/snaps-utils": { @@ -44,8 +44,8 @@ "packages": { "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/utils": { @@ -54,12 +54,12 @@ "TextEncoder": true }, "packages": { + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "browserify>buffer": true, "depcheck>semver": true, - "superstruct": true, "tsup>debug": true } }, @@ -137,12 +137,6 @@ "localStorage": true } }, - "superstruct": { - "globals": { - "console.warn": true, - "define": true - } - }, "tsup>debug": { "globals": { "console": true, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json index c0c0f35f59..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -89,8 +89,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/snaps-utils": { @@ -105,8 +105,8 @@ "packages": { "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/utils": { @@ -115,12 +115,12 @@ "TextEncoder": true }, "packages": { + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "browserify>buffer": true, "depcheck>semver": true, - "superstruct": true, "tsup>debug": true } }, @@ -198,12 +198,6 @@ "localStorage": true } }, - "superstruct": { - "globals": { - "console.warn": true, - "define": true - } - }, "tsup>debug": { "globals": { "console": true, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json index 31bf63a082..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -28,8 +28,8 @@ }, "packages": { "@metamask/rpc-errors": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/snaps-utils": { @@ -44,8 +44,8 @@ "packages": { "@metamask/rpc-errors": true, "@metamask/snaps-sdk": true, - "@metamask/utils": true, - "superstruct": true + "@metamask/superstruct": true, + "@metamask/utils": true } }, "@metamask/utils": { @@ -54,12 +54,12 @@ "TextEncoder": true }, "packages": { + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "browserify>buffer": true, "depcheck>semver": true, - "superstruct": true, "tsup>debug": true } }, @@ -137,12 +137,6 @@ "localStorage": true } }, - "superstruct": { - "globals": { - "console.warn": true, - "define": true - } - }, "tsup>debug": { "globals": { "console": true, diff --git a/packages/snaps-execution-environments/lavamoat/build-system/policy.json b/packages/snaps-execution-environments/lavamoat/build-system/policy.json index f0cf64f764..41f03af11f 100644 --- a/packages/snaps-execution-environments/lavamoat/build-system/policy.json +++ b/packages/snaps-execution-environments/lavamoat/build-system/policy.json @@ -1014,11 +1014,11 @@ "TextEncoder": true }, "packages": { + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, "depcheck>semver": true, - "superstruct": true, "tsup>debug": true } }, @@ -2341,12 +2341,6 @@ "util.deprecate": true } }, - "superstruct": { - "globals": { - "console.warn": true, - "define": true - } - }, "terser": { "globals": { "Buffer": true, diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 67bd69cfe5..9f61432cea 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -54,14 +54,14 @@ "@metamask/json-rpc-engine": "^9.0.0", "@metamask/object-multiplex": "^2.0.0", "@metamask/post-message-stream": "^8.1.0", - "@metamask/providers": "^17.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/providers": "17.0.0", + "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0", "nanoid": "^3.1.31", - "readable-stream": "^3.6.2", - "superstruct": "^1.0.3" + "readable-stream": "^3.6.2" }, "devDependencies": { "@babel/core": "^7.23.2", diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index b6ee90843c..cabd40c57d 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -19,6 +19,7 @@ import { unwrapError, logInfo, } from '@metamask/snaps-utils'; +import { validate, is } from '@metamask/superstruct'; import type { JsonRpcNotification, JsonRpcId, @@ -33,7 +34,6 @@ import { JsonRpcIdStruct, } from '@metamask/utils'; import type { Duplex } from 'readable-stream'; -import { validate, is } from 'superstruct'; import { log } from '../logging'; import type { CommandMethodsMapping } from './commands'; diff --git a/packages/snaps-execution-environments/src/common/validation.ts b/packages/snaps-execution-environments/src/common/validation.ts index 28316d4f33..e28c6c3f62 100644 --- a/packages/snaps-execution-environments/src/common/validation.ts +++ b/packages/snaps-execution-environments/src/common/validation.ts @@ -4,16 +4,7 @@ import { UserInputEventStruct, } from '@metamask/snaps-sdk'; import { ChainIdStruct, HandlerType } from '@metamask/snaps-utils'; -import type { Json, JsonRpcSuccess } from '@metamask/utils'; -import { - assertStruct, - JsonRpcIdStruct, - JsonRpcParamsStruct, - JsonRpcSuccessStruct, - JsonRpcVersionStruct, - JsonStruct, -} from '@metamask/utils'; -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { array, assign, @@ -27,7 +18,16 @@ import { string, tuple, union, -} from 'superstruct'; +} from '@metamask/superstruct'; +import type { Json, JsonRpcSuccess } from '@metamask/utils'; +import { + assertStruct, + JsonRpcIdStruct, + JsonRpcParamsStruct, + JsonRpcSuccessStruct, + JsonRpcVersionStruct, + JsonStruct, +} from '@metamask/utils'; export const JsonRpcRequestWithoutIdStruct = object({ jsonrpc: optional(JsonRpcVersionStruct), diff --git a/packages/snaps-jest/package.json b/packages/snaps-jest/package.json index 0d133b7f09..d44ac19858 100644 --- a/packages/snaps-jest/package.json +++ b/packages/snaps-jest/package.json @@ -40,18 +40,19 @@ "@jest/environment": "^29.5.0", "@jest/expect": "^29.5.0", "@jest/globals": "^29.5.0", - "@metamask/base-controller": "^6.0.0", + "@metamask/base-controller": "^6.0.1", "@metamask/eth-json-rpc-middleware": "^12.1.2", "@metamask/json-rpc-engine": "^9.0.0", "@metamask/json-rpc-middleware-stream": "^8.0.0", - "@metamask/key-tree": "^9.1.1", - "@metamask/permission-controller": "^10.0.0", + "@metamask/key-tree": "^9.1.2", + "@metamask/permission-controller": "^10.0.1", "@metamask/snaps-controllers": "workspace:^", "@metamask/snaps-execution-environments": "workspace:^", "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0", "@reduxjs/toolkit": "^1.9.5", "express": "^4.18.2", "jest-environment-node": "^29.5.0", @@ -59,8 +60,7 @@ "mime": "^3.0.0", "readable-stream": "^3.6.2", "redux": "^4.2.1", - "redux-saga": "^1.2.3", - "superstruct": "^1.0.3" + "redux-saga": "^1.2.3" }, "devDependencies": { "@jest/types": "^29.6.3", diff --git a/packages/snaps-jest/src/helpers.ts b/packages/snaps-jest/src/helpers.ts index 16869acdce..4c6c8f454a 100644 --- a/packages/snaps-jest/src/helpers.ts +++ b/packages/snaps-jest/src/helpers.ts @@ -1,14 +1,15 @@ import type { AbstractExecutionService } from '@metamask/snaps-controllers'; -import { DialogType, type SnapId } from '@metamask/snaps-sdk'; +import type { SnapId } from '@metamask/snaps-sdk'; +import { DialogType } from '@metamask/snaps-sdk'; import type { FooterElement } from '@metamask/snaps-sdk/jsx'; import { HandlerType, getJsxChildren, logInfo } from '@metamask/snaps-utils'; +import { create } from '@metamask/superstruct'; import { + assert, assertStruct, createModuleLogger, hasProperty, - assert, } from '@metamask/utils'; -import { create } from 'superstruct'; import { rootLogger, diff --git a/packages/snaps-jest/src/internals/request.ts b/packages/snaps-jest/src/internals/request.ts index 44c4da8db1..95f8e6d808 100644 --- a/packages/snaps-jest/src/internals/request.ts +++ b/packages/snaps-jest/src/internals/request.ts @@ -7,6 +7,7 @@ import { } from '@metamask/snaps-sdk'; import type { HandlerType } from '@metamask/snaps-utils'; import { unwrapError } from '@metamask/snaps-utils'; +import { is } from '@metamask/superstruct'; import { assert, getSafeJson, @@ -14,7 +15,6 @@ import { isPlainObject, } from '@metamask/utils'; import { nanoid } from '@reduxjs/toolkit'; -import { is } from 'superstruct'; import type { RequestOptions, diff --git a/packages/snaps-jest/src/internals/simulation/options.ts b/packages/snaps-jest/src/internals/simulation/options.ts index cb4e848afc..2ea0be940f 100644 --- a/packages/snaps-jest/src/internals/simulation/options.ts +++ b/packages/snaps-jest/src/internals/simulation/options.ts @@ -1,5 +1,4 @@ -import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { create, defaulted, @@ -8,7 +7,8 @@ import { optional, record, string, -} from 'superstruct'; +} from '@metamask/superstruct'; +import { JsonStruct } from '@metamask/utils'; import { DEFAULT_LOCALE, DEFAULT_SRP } from './constants'; diff --git a/packages/snaps-jest/src/internals/structs.test.tsx b/packages/snaps-jest/src/internals/structs.test.tsx index 8b03d5d47c..cc88a27a1d 100644 --- a/packages/snaps-jest/src/internals/structs.test.tsx +++ b/packages/snaps-jest/src/internals/structs.test.tsx @@ -1,5 +1,5 @@ import { Box, Text } from '@metamask/snaps-sdk/jsx'; -import { create } from 'superstruct'; +import { create } from '@metamask/superstruct'; import { InterfaceStruct, diff --git a/packages/snaps-jest/src/internals/structs.ts b/packages/snaps-jest/src/internals/structs.ts index 96ca2b07ee..1d19d6a67a 100644 --- a/packages/snaps-jest/src/internals/structs.ts +++ b/packages/snaps-jest/src/internals/structs.ts @@ -1,12 +1,5 @@ import { NotificationType, enumValue } from '@metamask/snaps-sdk'; import { JSXElementStruct } from '@metamask/snaps-sdk/jsx'; -import { - bytesToHex, - JsonStruct, - StrictHexStruct, - valueToBytes, -} from '@metamask/utils'; -import { randomBytes } from 'crypto'; import { array, assign, @@ -24,7 +17,14 @@ import { any, func, type, -} from 'superstruct'; +} from '@metamask/superstruct'; +import { + bytesToHex, + JsonStruct, + StrictHexStruct, + valueToBytes, +} from '@metamask/utils'; +import { randomBytes } from 'crypto'; // TODO: Export this from `@metamask/utils` instead. const BytesLikeStruct = union([ diff --git a/packages/snaps-jest/src/matchers.ts b/packages/snaps-jest/src/matchers.ts index fe72c2ded2..f4a38e3156 100644 --- a/packages/snaps-jest/src/matchers.ts +++ b/packages/snaps-jest/src/matchers.ts @@ -17,6 +17,7 @@ import { getJsxElementFromComponent, serialiseJsx, } from '@metamask/snaps-utils'; +import { is } from '@metamask/superstruct'; import type { Json } from '@metamask/utils'; import { hasProperty } from '@metamask/utils'; import type { MatcherHintOptions } from 'jest-matcher-utils'; @@ -29,7 +30,6 @@ import { printWithType, RECEIVED_COLOR, } from 'jest-matcher-utils'; -import { is } from 'superstruct'; import { InterfaceStruct, SnapResponseStruct } from './internals'; import type { SnapResponse } from './types'; diff --git a/packages/snaps-jest/src/options.ts b/packages/snaps-jest/src/options.ts index 2f8e95c086..44c0b06d56 100644 --- a/packages/snaps-jest/src/options.ts +++ b/packages/snaps-jest/src/options.ts @@ -1,4 +1,4 @@ -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { boolean, create, @@ -7,7 +7,7 @@ import { object, string, type, -} from 'superstruct'; +} from '@metamask/superstruct'; const SnapsEnvironmentOptionsStruct = type({ server: defaulted( diff --git a/packages/snaps-jest/src/types.ts b/packages/snaps-jest/src/types.ts index 81ba68520e..25ab45c6bd 100644 --- a/packages/snaps-jest/src/types.ts +++ b/packages/snaps-jest/src/types.ts @@ -1,8 +1,8 @@ import type { NotificationType, EnumToUnion } from '@metamask/snaps-sdk'; import type { JSXElement } from '@metamask/snaps-sdk/jsx'; import type { InferMatching } from '@metamask/snaps-utils'; +import type { Infer } from '@metamask/superstruct'; import type { Json, JsonRpcId, JsonRpcParams } from '@metamask/utils'; -import type { Infer } from 'superstruct'; import type { SignatureOptionsStruct, diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index 8a37435662..c9c57bca51 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -39,14 +39,14 @@ "build:ci": "tsup --clean" }, "dependencies": { - "@metamask/key-tree": "^9.1.1", - "@metamask/permission-controller": "^10.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/key-tree": "^9.1.2", + "@metamask/permission-controller": "^10.0.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", - "@noble/hashes": "^1.3.1", - "superstruct": "^1.0.3" + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0", + "@noble/hashes": "^1.3.1" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/snaps-rpc-methods/src/permitted/createInterface.ts b/packages/snaps-rpc-methods/src/permitted/createInterface.ts index dd16be83ab..6dc66c53fb 100644 --- a/packages/snaps-rpc-methods/src/permitted/createInterface.ts +++ b/packages/snaps-rpc-methods/src/permitted/createInterface.ts @@ -13,8 +13,8 @@ import { InterfaceContextStruct, } from '@metamask/snaps-sdk'; import { type InferMatching } from '@metamask/snaps-utils'; +import { StructError, create, object, optional } from '@metamask/superstruct'; import type { PendingJsonRpcResponse } from '@metamask/utils'; -import { StructError, create, object, optional } from 'superstruct'; import type { MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/permitted/getFile.ts b/packages/snaps-rpc-methods/src/permitted/getFile.ts index a50295dd68..f256677a9f 100644 --- a/packages/snaps-rpc-methods/src/permitted/getFile.ts +++ b/packages/snaps-rpc-methods/src/permitted/getFile.ts @@ -4,9 +4,9 @@ import { rpcErrors } from '@metamask/rpc-errors'; import type { GetFileParams, GetFileResult } from '@metamask/snaps-sdk'; import { AuxiliaryFileEncoding, enumValue } from '@metamask/snaps-sdk'; import type { InferMatching } from '@metamask/snaps-utils'; +import { object, optional, string, union } from '@metamask/superstruct'; import type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils'; import { assertStruct } from '@metamask/utils'; -import { object, optional, string, union } from 'superstruct'; import type { MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/permitted/getInterfaceState.ts b/packages/snaps-rpc-methods/src/permitted/getInterfaceState.ts index 55a2fe22f5..acd1568cb7 100644 --- a/packages/snaps-rpc-methods/src/permitted/getInterfaceState.ts +++ b/packages/snaps-rpc-methods/src/permitted/getInterfaceState.ts @@ -8,8 +8,8 @@ import type { JsonRpcRequest, } from '@metamask/snaps-sdk'; import { type InferMatching } from '@metamask/snaps-utils'; +import { StructError, create, object, string } from '@metamask/superstruct'; import type { PendingJsonRpcResponse } from '@metamask/utils'; -import { StructError, create, object, string } from 'superstruct'; import type { MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts b/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts index 44898d69ce..3401f30129 100644 --- a/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts +++ b/packages/snaps-rpc-methods/src/permitted/resolveInterface.ts @@ -7,9 +7,9 @@ import type { ResolveInterfaceResult, } from '@metamask/snaps-sdk'; import type { InferMatching } from '@metamask/snaps-utils'; +import { StructError, create, object, string } from '@metamask/superstruct'; import type { PendingJsonRpcResponse } from '@metamask/utils'; import { JsonStruct, type Json } from '@metamask/utils'; -import { StructError, create, object, string } from 'superstruct'; import type { MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/permitted/updateInterface.ts b/packages/snaps-rpc-methods/src/permitted/updateInterface.ts index 93e575c7d0..13c6bf0c4b 100644 --- a/packages/snaps-rpc-methods/src/permitted/updateInterface.ts +++ b/packages/snaps-rpc-methods/src/permitted/updateInterface.ts @@ -9,8 +9,8 @@ import type { } from '@metamask/snaps-sdk'; import { ComponentOrElementStruct } from '@metamask/snaps-sdk'; import { type InferMatching } from '@metamask/snaps-utils'; +import { StructError, create, object, string } from '@metamask/superstruct'; import type { PendingJsonRpcResponse } from '@metamask/utils'; -import { StructError, create, object, string } from 'superstruct'; import type { MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/restricted/caveats/permittedDerivationPaths.ts b/packages/snaps-rpc-methods/src/restricted/caveats/permittedDerivationPaths.ts index adeecf2790..7b856425a0 100644 --- a/packages/snaps-rpc-methods/src/restricted/caveats/permittedDerivationPaths.ts +++ b/packages/snaps-rpc-methods/src/restricted/caveats/permittedDerivationPaths.ts @@ -10,9 +10,9 @@ import { Bip32EntropyStruct, isEqual, } from '@metamask/snaps-utils'; +import { array, size, type } from '@metamask/superstruct'; import type { Json } from '@metamask/utils'; import { assertStruct } from '@metamask/utils'; -import { array, size, type } from 'superstruct'; /** * Map a raw value from the `initialPermissions` to a caveat specification. diff --git a/packages/snaps-rpc-methods/src/restricted/caveats/snapIds.ts b/packages/snaps-rpc-methods/src/restricted/caveats/snapIds.ts index 192bb07822..f0923e9b8e 100644 --- a/packages/snaps-rpc-methods/src/restricted/caveats/snapIds.ts +++ b/packages/snaps-rpc-methods/src/restricted/caveats/snapIds.ts @@ -8,9 +8,9 @@ import type { import { rpcErrors } from '@metamask/rpc-errors'; import type { SnapIds } from '@metamask/snaps-utils'; import { SnapCaveatType, SnapIdsStruct } from '@metamask/snaps-utils'; +import { type } from '@metamask/superstruct'; import type { Json } from '@metamask/utils'; import { hasProperty, assertStruct } from '@metamask/utils'; -import { type } from 'superstruct'; import type { InvokeSnapParams } from '../invokeSnap'; diff --git a/packages/snaps-rpc-methods/src/restricted/dialog.ts b/packages/snaps-rpc-methods/src/restricted/dialog.ts index a2fa9bce0f..9f359b68a3 100644 --- a/packages/snaps-rpc-methods/src/restricted/dialog.ts +++ b/packages/snaps-rpc-methods/src/restricted/dialog.ts @@ -21,9 +21,7 @@ import type { } from '@metamask/snaps-sdk'; import type { InferMatching } from '@metamask/snaps-utils'; import { createUnion } from '@metamask/snaps-utils'; -import type { Json } from '@metamask/utils'; -import { hasProperty, isObject, type NonEmptyArray } from '@metamask/utils'; -import type { Infer, Struct } from 'superstruct'; +import type { Infer, Struct } from '@metamask/superstruct'; import { create, enums, @@ -32,7 +30,9 @@ import { size, string, type, -} from 'superstruct'; +} from '@metamask/superstruct'; +import type { Json, NonEmptyArray } from '@metamask/utils'; +import { hasProperty, isObject } from '@metamask/utils'; import { type MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/restricted/getBip32PublicKey.ts b/packages/snaps-rpc-methods/src/restricted/getBip32PublicKey.ts index 7a49570c03..7f8ee3b746 100644 --- a/packages/snaps-rpc-methods/src/restricted/getBip32PublicKey.ts +++ b/packages/snaps-rpc-methods/src/restricted/getBip32PublicKey.ts @@ -16,9 +16,9 @@ import { CurveStruct, SnapCaveatType, } from '@metamask/snaps-utils'; +import { boolean, object, optional } from '@metamask/superstruct'; import type { NonEmptyArray } from '@metamask/utils'; import { assertStruct } from '@metamask/utils'; -import { boolean, object, optional } from 'superstruct'; import type { MethodHooksObject } from '../utils'; import { getNode } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/restricted/getEntropy.ts b/packages/snaps-rpc-methods/src/restricted/getEntropy.ts index a481056568..ecf9709ff1 100644 --- a/packages/snaps-rpc-methods/src/restricted/getEntropy.ts +++ b/packages/snaps-rpc-methods/src/restricted/getEntropy.ts @@ -7,10 +7,10 @@ import { PermissionType, SubjectType } from '@metamask/permission-controller'; import { rpcErrors } from '@metamask/rpc-errors'; import type { GetEntropyParams, GetEntropyResult } from '@metamask/snaps-sdk'; import { SIP_6_MAGIC_VALUE } from '@metamask/snaps-utils'; +import type { Infer } from '@metamask/superstruct'; +import { literal, object, optional, string } from '@metamask/superstruct'; import type { NonEmptyArray } from '@metamask/utils'; import { assertStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { literal, object, optional, string } from 'superstruct'; import type { MethodHooksObject } from '../utils'; import { deriveEntropy } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts b/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts index 17d05f08ad..220fa25ba2 100644 --- a/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts +++ b/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts @@ -9,9 +9,16 @@ import type { ManageAccountsResult, } from '@metamask/snaps-sdk'; import type { InferMatching } from '@metamask/snaps-utils'; +import { + assert, + string, + object, + union, + array, + record, +} from '@metamask/superstruct'; import type { Json, NonEmptyArray } from '@metamask/utils'; import { JsonStruct } from '@metamask/utils'; -import { assert, string, object, union, array, record } from 'superstruct'; const SnapMessageStruct = union([ object({ diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 95bba09e87..02180b98d2 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -59,11 +59,11 @@ "build:ci": "tsup --clean" }, "dependencies": { - "@metamask/key-tree": "^9.1.1", - "@metamask/providers": "^17.0.0", - "@metamask/rpc-errors": "^6.2.1", - "@metamask/utils": "^8.3.0", - "superstruct": "^1.0.3" + "@metamask/key-tree": "^9.1.2", + "@metamask/providers": "17.0.0", + "@metamask/rpc-errors": "^6.3.1", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/snaps-sdk/src/internals/jsx.ts b/packages/snaps-sdk/src/internals/jsx.ts index ea9350bbf8..cf8ae331c2 100644 --- a/packages/snaps-sdk/src/internals/jsx.ts +++ b/packages/snaps-sdk/src/internals/jsx.ts @@ -1,14 +1,15 @@ -import type { Infer, Struct } from 'superstruct'; import type { AnyStruct, EnumSchema, + Infer, InferStructTuple, IsExactMatch, IsMatch, IsRecord, IsTuple, + Struct, UnionToIntersection, -} from 'superstruct/dist/utils'; +} from '@metamask/superstruct'; import type { EmptyObject } from '../types'; import { union } from './structs'; diff --git a/packages/snaps-sdk/src/internals/structs.test.ts b/packages/snaps-sdk/src/internals/structs.test.ts index fae3bd9747..e6903fbfde 100644 --- a/packages/snaps-sdk/src/internals/structs.test.ts +++ b/packages/snaps-sdk/src/internals/structs.test.ts @@ -1,4 +1,4 @@ -import { is, validate } from 'superstruct'; +import { is, validate } from '@metamask/superstruct'; import { Text } from '../jsx'; import { BoxStruct, FieldStruct, TextStruct } from '../jsx/validation'; diff --git a/packages/snaps-sdk/src/internals/structs.ts b/packages/snaps-sdk/src/internals/structs.ts index a9641791f2..82dced7ad3 100644 --- a/packages/snaps-sdk/src/internals/structs.ts +++ b/packages/snaps-sdk/src/internals/structs.ts @@ -1,13 +1,12 @@ -import { hasProperty, isPlainObject } from '@metamask/utils'; -import type { Infer } from 'superstruct'; +import type { AnyStruct, Infer, InferStructTuple } from '@metamask/superstruct'; import { Struct, define, is, literal as superstructLiteral, union as superstructUnion, -} from 'superstruct'; -import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; +} from '@metamask/superstruct'; +import { hasProperty, isPlainObject } from '@metamask/utils'; import type { EnumToUnion } from './helpers'; diff --git a/packages/snaps-sdk/src/internals/svg.test.ts b/packages/snaps-sdk/src/internals/svg.test.ts index f6bc2caf06..571a4f604a 100644 --- a/packages/snaps-sdk/src/internals/svg.test.ts +++ b/packages/snaps-sdk/src/internals/svg.test.ts @@ -1,4 +1,4 @@ -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { svg } from './svg'; diff --git a/packages/snaps-sdk/src/internals/svg.ts b/packages/snaps-sdk/src/internals/svg.ts index 3911b1cec2..20bbd0e8e5 100644 --- a/packages/snaps-sdk/src/internals/svg.ts +++ b/packages/snaps-sdk/src/internals/svg.ts @@ -1,4 +1,4 @@ -import { refine, string } from 'superstruct'; +import { refine, string } from '@metamask/superstruct'; /** * Get a Struct that validates a string as a valid SVG. diff --git a/packages/snaps-sdk/src/jsx/validation.test.tsx b/packages/snaps-sdk/src/jsx/validation.test.tsx index 9cb0c285ef..a4f1ff43af 100644 --- a/packages/snaps-sdk/src/jsx/validation.test.tsx +++ b/packages/snaps-sdk/src/jsx/validation.test.tsx @@ -1,4 +1,4 @@ -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { Address, diff --git a/packages/snaps-sdk/src/jsx/validation.ts b/packages/snaps-sdk/src/jsx/validation.ts index bab3a1b0b9..665608a584 100644 --- a/packages/snaps-sdk/src/jsx/validation.ts +++ b/packages/snaps-sdk/src/jsx/validation.ts @@ -1,10 +1,10 @@ -import { - hasProperty, - HexChecksumAddressStruct, - isPlainObject, - JsonStruct, -} from '@metamask/utils'; -import type { Infer, Struct } from 'superstruct'; +import type { + AnyStruct, + Infer, + InferStructTuple, + ObjectSchema, + Struct, +} from '@metamask/superstruct'; import { is, boolean, @@ -17,12 +17,13 @@ import { record, string, tuple, -} from 'superstruct'; -import type { - AnyStruct, - InferStructTuple, - ObjectSchema, -} from 'superstruct/dist/utils'; +} from '@metamask/superstruct'; +import { + hasProperty, + HexChecksumAddressStruct, + isPlainObject, + JsonStruct, +} from '@metamask/utils'; import type { Describe } from '../internals'; import { literal, nullUnion, svg, typedUnion } from '../internals'; diff --git a/packages/snaps-sdk/src/types/handlers/user-input.test.ts b/packages/snaps-sdk/src/types/handlers/user-input.test.ts index 591b827f26..f1a9a120d6 100644 --- a/packages/snaps-sdk/src/types/handlers/user-input.test.ts +++ b/packages/snaps-sdk/src/types/handlers/user-input.test.ts @@ -1,4 +1,4 @@ -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { FormSubmitEventStruct, diff --git a/packages/snaps-sdk/src/types/handlers/user-input.ts b/packages/snaps-sdk/src/types/handlers/user-input.ts index 126604d70f..fb2bdb477f 100644 --- a/packages/snaps-sdk/src/types/handlers/user-input.ts +++ b/packages/snaps-sdk/src/types/handlers/user-input.ts @@ -1,4 +1,4 @@ -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { number, assign, @@ -10,7 +10,7 @@ import { string, union, boolean, -} from 'superstruct'; +} from '@metamask/superstruct'; import type { InterfaceContext } from '../interface'; diff --git a/packages/snaps-sdk/src/types/interface.test.ts b/packages/snaps-sdk/src/types/interface.test.ts index 1bce8da22b..6c2a1a44e0 100644 --- a/packages/snaps-sdk/src/types/interface.test.ts +++ b/packages/snaps-sdk/src/types/interface.test.ts @@ -1,4 +1,4 @@ -import { assert } from 'superstruct'; +import { assert } from '@metamask/superstruct'; import { FormStateStruct, InterfaceStateStruct } from './interface'; diff --git a/packages/snaps-sdk/src/types/interface.ts b/packages/snaps-sdk/src/types/interface.ts index 624bc06b1a..86d2ed311c 100644 --- a/packages/snaps-sdk/src/types/interface.ts +++ b/packages/snaps-sdk/src/types/interface.ts @@ -1,6 +1,12 @@ +import type { Infer } from '@metamask/superstruct'; +import { + boolean, + nullable, + record, + string, + union, +} from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { boolean, nullable, record, string, union } from 'superstruct'; import type { JSXElement } from '../jsx'; import { RootJSXElementStruct } from '../jsx'; diff --git a/packages/snaps-sdk/src/ui/builder.ts b/packages/snaps-sdk/src/ui/builder.ts index 74369b12d3..03514b2533 100644 --- a/packages/snaps-sdk/src/ui/builder.ts +++ b/packages/snaps-sdk/src/ui/builder.ts @@ -1,5 +1,5 @@ +import type { Struct } from '@metamask/superstruct'; import { assertStruct, isPlainObject } from '@metamask/utils'; -import type { Struct } from 'superstruct'; import type { Component } from './components'; import type { NodeType } from './nodes'; diff --git a/packages/snaps-sdk/src/ui/component.ts b/packages/snaps-sdk/src/ui/component.ts index f976e93e60..a482e99ce2 100644 --- a/packages/snaps-sdk/src/ui/component.ts +++ b/packages/snaps-sdk/src/ui/component.ts @@ -1,5 +1,5 @@ +import { is } from '@metamask/superstruct'; import { assertStruct } from '@metamask/utils'; -import { is } from 'superstruct'; import { ComponentStruct } from './components'; import type { Component } from './components'; diff --git a/packages/snaps-sdk/src/ui/components/address.ts b/packages/snaps-sdk/src/ui/components/address.ts index a8b69d7209..b90871e54a 100644 --- a/packages/snaps-sdk/src/ui/components/address.ts +++ b/packages/snaps-sdk/src/ui/components/address.ts @@ -1,6 +1,6 @@ +import type { Infer } from '@metamask/superstruct'; +import { assign, literal, object } from '@metamask/superstruct'; import { HexChecksumAddressStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { assign, literal, object } from 'superstruct'; import { createBuilder } from '../builder'; import { LiteralStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-sdk/src/ui/components/button.ts b/packages/snaps-sdk/src/ui/components/button.ts index ccedcb148d..6103999e19 100644 --- a/packages/snaps-sdk/src/ui/components/button.ts +++ b/packages/snaps-sdk/src/ui/components/button.ts @@ -1,5 +1,12 @@ -import type { Infer } from 'superstruct'; -import { assign, literal, object, optional, string, union } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { + assign, + literal, + object, + optional, + string, + union, +} from '@metamask/superstruct'; import { enumValue } from '../../internals'; import { createBuilder } from '../builder'; diff --git a/packages/snaps-sdk/src/ui/components/copyable.ts b/packages/snaps-sdk/src/ui/components/copyable.ts index 7d916537bc..1825dc127f 100644 --- a/packages/snaps-sdk/src/ui/components/copyable.ts +++ b/packages/snaps-sdk/src/ui/components/copyable.ts @@ -1,4 +1,4 @@ -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { assign, boolean, @@ -6,7 +6,7 @@ import { object, optional, string, -} from 'superstruct'; +} from '@metamask/superstruct'; import { createBuilder } from '../builder'; import { LiteralStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-sdk/src/ui/components/divider.ts b/packages/snaps-sdk/src/ui/components/divider.ts index ebe630ab52..31e2896f6f 100644 --- a/packages/snaps-sdk/src/ui/components/divider.ts +++ b/packages/snaps-sdk/src/ui/components/divider.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { assign, literal, object } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { assign, literal, object } from '@metamask/superstruct'; import { createBuilder } from '../builder'; import { NodeStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-sdk/src/ui/components/form.ts b/packages/snaps-sdk/src/ui/components/form.ts index 0514bd2dbc..5d9381a4e4 100644 --- a/packages/snaps-sdk/src/ui/components/form.ts +++ b/packages/snaps-sdk/src/ui/components/form.ts @@ -1,5 +1,12 @@ -import type { Infer } from 'superstruct'; -import { array, assign, literal, object, string, union } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { + array, + assign, + literal, + object, + string, + union, +} from '@metamask/superstruct'; import { createBuilder } from '../builder'; import { NodeStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-sdk/src/ui/components/heading.ts b/packages/snaps-sdk/src/ui/components/heading.ts index f790140c12..2c8384b69d 100644 --- a/packages/snaps-sdk/src/ui/components/heading.ts +++ b/packages/snaps-sdk/src/ui/components/heading.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { assign, literal, object, string } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { assign, literal, object, string } from '@metamask/superstruct'; import { createBuilder } from '../builder'; import { LiteralStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-sdk/src/ui/components/image.test.ts b/packages/snaps-sdk/src/ui/components/image.test.ts index 6ae0acced0..76619ec467 100644 --- a/packages/snaps-sdk/src/ui/components/image.test.ts +++ b/packages/snaps-sdk/src/ui/components/image.test.ts @@ -23,12 +23,12 @@ describe('image', () => { 'Invalid image component: At path: value -- Value is not a valid SVG.', ); - // @ts-expect-error - Invalid args. + // @ts-expect-error - Suppressing type error to test runtime handling of invalid input expect(() => image({ value: MOCK_SVG, bar: 'baz' })).toThrow( 'Invalid image component: At path: bar -- Expected a value of type `never`, but received: `"baz"`.', ); - // @ts-expect-error - Invalid args. + // @ts-expect-error - Suppressing type error to test runtime handling of invalid input expect(() => image({})).toThrow( 'Invalid image component: At path: value -- Expected a string, but received: undefined.', ); diff --git a/packages/snaps-sdk/src/ui/components/image.ts b/packages/snaps-sdk/src/ui/components/image.ts index 1e8815327b..a3639b8fb5 100644 --- a/packages/snaps-sdk/src/ui/components/image.ts +++ b/packages/snaps-sdk/src/ui/components/image.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { assign, literal, object } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { assign, literal, object } from '@metamask/superstruct'; import { svg } from '../../internals'; import { createBuilder } from '../builder'; diff --git a/packages/snaps-sdk/src/ui/components/input.ts b/packages/snaps-sdk/src/ui/components/input.ts index 5bc0db11eb..484b358683 100644 --- a/packages/snaps-sdk/src/ui/components/input.ts +++ b/packages/snaps-sdk/src/ui/components/input.ts @@ -1,5 +1,12 @@ -import type { Infer } from 'superstruct'; -import { assign, literal, object, optional, string, union } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { + assign, + literal, + object, + optional, + string, + union, +} from '@metamask/superstruct'; import { enumValue } from '../../internals'; import { createBuilder } from '../builder'; diff --git a/packages/snaps-sdk/src/ui/components/panel.test.ts b/packages/snaps-sdk/src/ui/components/panel.test.ts index 2fe41ef735..2ce14fec68 100644 --- a/packages/snaps-sdk/src/ui/components/panel.test.ts +++ b/packages/snaps-sdk/src/ui/components/panel.test.ts @@ -1,4 +1,4 @@ -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { NodeType } from '../nodes'; import { heading } from './heading'; diff --git a/packages/snaps-sdk/src/ui/components/panel.ts b/packages/snaps-sdk/src/ui/components/panel.ts index 17cc915440..90b8d71ae5 100644 --- a/packages/snaps-sdk/src/ui/components/panel.ts +++ b/packages/snaps-sdk/src/ui/components/panel.ts @@ -1,5 +1,5 @@ -import type { Infer, Struct } from 'superstruct'; -import { array, assign, lazy, literal, object } from 'superstruct'; +import type { Infer, Struct } from '@metamask/superstruct'; +import { array, assign, lazy, literal, object } from '@metamask/superstruct'; import { typedUnion } from '../../internals'; import { createBuilder } from '../builder'; diff --git a/packages/snaps-sdk/src/ui/components/row.ts b/packages/snaps-sdk/src/ui/components/row.ts index b13c5d0e53..80a886fca8 100644 --- a/packages/snaps-sdk/src/ui/components/row.ts +++ b/packages/snaps-sdk/src/ui/components/row.ts @@ -1,5 +1,12 @@ -import type { Infer } from 'superstruct'; -import { assign, literal, object, string, optional, union } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { + assign, + literal, + object, + string, + optional, + union, +} from '@metamask/superstruct'; import { enumValue } from '../../internals'; import { createBuilder } from '../builder'; diff --git a/packages/snaps-sdk/src/ui/components/spinner.ts b/packages/snaps-sdk/src/ui/components/spinner.ts index 4b2698bbf6..8494e48484 100644 --- a/packages/snaps-sdk/src/ui/components/spinner.ts +++ b/packages/snaps-sdk/src/ui/components/spinner.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { assign, literal, object } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { assign, literal, object } from '@metamask/superstruct'; import { createBuilder } from '../builder'; import { NodeStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-sdk/src/ui/components/text.ts b/packages/snaps-sdk/src/ui/components/text.ts index 7b0c16d40c..c6dc6522ca 100644 --- a/packages/snaps-sdk/src/ui/components/text.ts +++ b/packages/snaps-sdk/src/ui/components/text.ts @@ -1,4 +1,4 @@ -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { assign, boolean, @@ -6,7 +6,7 @@ import { object, optional, string, -} from 'superstruct'; +} from '@metamask/superstruct'; import { createBuilder } from '../builder'; import { LiteralStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-sdk/src/ui/nodes.ts b/packages/snaps-sdk/src/ui/nodes.ts index 6daa430153..74e40a232d 100644 --- a/packages/snaps-sdk/src/ui/nodes.ts +++ b/packages/snaps-sdk/src/ui/nodes.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { assign, object, string, unknown } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { assign, object, string, unknown } from '@metamask/superstruct'; /** * The supported node types. This is based on SIP-7. diff --git a/packages/snaps-simulator/package.json b/packages/snaps-simulator/package.json index c8cd964a3d..1fb03f5187 100644 --- a/packages/snaps-simulator/package.json +++ b/packages/snaps-simulator/package.json @@ -30,18 +30,19 @@ "@emotion/react": "^11.10.8", "@emotion/styled": "^11.10.8", "@ethersproject/units": "^5.7.0", - "@metamask/base-controller": "^6.0.0", + "@metamask/base-controller": "^6.0.1", "@metamask/eth-json-rpc-middleware": "^12.1.2", "@metamask/json-rpc-engine": "^9.0.0", "@metamask/json-rpc-middleware-stream": "^8.0.0", - "@metamask/key-tree": "^9.1.1", - "@metamask/permission-controller": "^10.0.0", + "@metamask/key-tree": "^9.1.2", + "@metamask/permission-controller": "^10.0.1", "@metamask/snaps-controllers": "workspace:^", "@metamask/snaps-execution-environments": "workspace:^", "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0", "@minoru/react-dnd-treeview": "^3.4.4", "@noble/hashes": "^1.3.1", "@reduxjs/toolkit": "^1.9.5", @@ -61,8 +62,7 @@ "react-redux": "^8.0.5", "react-router-dom": "^6.11.1", "redux": "^4.2.1", - "redux-saga": "^1.2.3", - "superstruct": "^1.0.3" + "redux-saga": "^1.2.3" }, "devDependencies": { "@metamask/auto-changelog": "^3.4.4", diff --git a/packages/snaps-simulator/src/features/builder/utils.ts b/packages/snaps-simulator/src/features/builder/utils.ts index cd3e63cbd4..a27d11a1e0 100644 --- a/packages/snaps-simulator/src/features/builder/utils.ts +++ b/packages/snaps-simulator/src/features/builder/utils.ts @@ -13,11 +13,11 @@ import { hasChildren, serialiseJsx, } from '@metamask/snaps-utils'; +import { is } from '@metamask/superstruct'; import { assert, hasProperty } from '@metamask/utils'; import type { NodeModel } from '@minoru/react-dnd-treeview'; import typescript from 'prettier/parser-typescript'; import prettier from 'prettier/standalone'; -import { is } from 'superstruct'; /** * Get the text of a node model. diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 7500aefd54..dc4ba6ef4e 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -52,14 +52,15 @@ "dependencies": { "@babel/core": "^7.23.2", "@babel/types": "^7.23.0", - "@metamask/base-controller": "^6.0.0", - "@metamask/key-tree": "^9.1.1", - "@metamask/permission-controller": "^10.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/base-controller": "^6.0.1", + "@metamask/key-tree": "^9.1.2", + "@metamask/permission-controller": "^10.0.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/slip44": "^3.1.0", - "@metamask/snaps-registry": "^3.1.0", + "@metamask/snaps-registry": "^3.2.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.1", "chalk": "^4.1.2", @@ -71,7 +72,6 @@ "rfdc": "^1.3.0", "semver": "^7.5.4", "ses": "^1.1.0", - "superstruct": "^1.0.3", "validate-npm-package-name": "^5.0.0" }, "devDependencies": { diff --git a/packages/snaps-utils/src/cronjob.ts b/packages/snaps-utils/src/cronjob.ts index 419d39edf3..694ce762c0 100644 --- a/packages/snaps-utils/src/cronjob.ts +++ b/packages/snaps-utils/src/cronjob.ts @@ -1,11 +1,18 @@ +import type { Infer } from '@metamask/superstruct'; +import { + array, + create, + object, + optional, + refine, + string, +} from '@metamask/superstruct'; import { JsonRpcIdStruct, JsonRpcParamsStruct, JsonRpcVersionStruct, } from '@metamask/utils'; import { parseExpression } from 'cron-parser'; -import type { Infer } from 'superstruct'; -import { array, create, object, optional, refine, string } from 'superstruct'; export const CronjobRpcRequestStruct = object({ jsonrpc: optional(JsonRpcVersionStruct), diff --git a/packages/snaps-utils/src/handlers.ts b/packages/snaps-utils/src/handlers.ts index 07816d82e0..6c4e37a9e6 100644 --- a/packages/snaps-utils/src/handlers.ts +++ b/packages/snaps-utils/src/handlers.ts @@ -21,7 +21,7 @@ import { array, size, union, -} from 'superstruct'; +} from '@metamask/superstruct'; import type { SnapHandler } from './handler-types'; import { HandlerType } from './handler-types'; diff --git a/packages/snaps-utils/src/json-rpc.ts b/packages/snaps-utils/src/json-rpc.ts index c9157f0362..26e5b7411e 100644 --- a/packages/snaps-utils/src/json-rpc.ts +++ b/packages/snaps-utils/src/json-rpc.ts @@ -1,4 +1,13 @@ import { SubjectType } from '@metamask/permission-controller'; +import type { Infer } from '@metamask/superstruct'; +import { + array, + boolean, + object, + optional, + refine, + string, +} from '@metamask/superstruct'; import type { AssertionErrorConstructor, Json, @@ -9,8 +18,6 @@ import { isJsonRpcFailure, isJsonRpcSuccess, } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { array, boolean, object, optional, refine, string } from 'superstruct'; const AllowedOriginsStruct = array( refine(string(), 'Allowed origin', (value) => { diff --git a/packages/snaps-utils/src/localization.ts b/packages/snaps-utils/src/localization.ts index d5e9fb875c..e3b1a78b35 100644 --- a/packages/snaps-utils/src/localization.ts +++ b/packages/snaps-utils/src/localization.ts @@ -1,5 +1,5 @@ import { getErrorMessage } from '@metamask/snaps-sdk'; -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { create, object, @@ -7,7 +7,7 @@ import { record, string, StructError, -} from 'superstruct'; +} from '@metamask/superstruct'; import { parseJson } from './json'; import type { SnapManifest } from './manifest'; diff --git a/packages/snaps-utils/src/manifest/validation.test.ts b/packages/snaps-utils/src/manifest/validation.test.ts index 0a17c7e860..082552d01b 100644 --- a/packages/snaps-utils/src/manifest/validation.test.ts +++ b/packages/snaps-utils/src/manifest/validation.test.ts @@ -1,4 +1,4 @@ -import { assert, is, StructError } from 'superstruct'; +import { assert, is, StructError } from '@metamask/superstruct'; import { getSnapManifest, MOCK_SNAP_ID } from '../test-utils'; import { diff --git a/packages/snaps-utils/src/manifest/validation.ts b/packages/snaps-utils/src/manifest/validation.ts index a85cffd101..3f8deef7ab 100644 --- a/packages/snaps-utils/src/manifest/validation.ts +++ b/packages/snaps-utils/src/manifest/validation.ts @@ -1,15 +1,7 @@ import type { SupportedCurve } from '@metamask/key-tree'; import { isValidBIP32PathSegment } from '@metamask/key-tree'; import type { EmptyObject, InitialPermissions } from '@metamask/snaps-sdk'; -import { - assertStruct, - ChecksumStruct, - VersionStruct, - isValidSemVerRange, - inMilliseconds, - Duration, -} from '@metamask/utils'; -import type { Describe, Infer, Struct } from 'superstruct'; +import type { Describe, Infer, Struct } from '@metamask/superstruct'; import { array, boolean, @@ -27,7 +19,15 @@ import { type, union, intersection, -} from 'superstruct'; +} from '@metamask/superstruct'; +import { + assertStruct, + ChecksumStruct, + VersionStruct, + isValidSemVerRange, + inMilliseconds, + Duration, +} from '@metamask/utils'; import { isEqual } from '../array'; import { CronjobSpecificationArrayStruct } from '../cronjob'; diff --git a/packages/snaps-utils/src/namespace.ts b/packages/snaps-utils/src/namespace.ts index 5f28b023d7..b656223ad4 100644 --- a/packages/snaps-utils/src/namespace.ts +++ b/packages/snaps-utils/src/namespace.ts @@ -1,5 +1,5 @@ import type { AccountId, ChainId } from '@metamask/snaps-sdk'; -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { array, define, @@ -9,7 +9,7 @@ import { pattern, size, string, -} from 'superstruct'; +} from '@metamask/superstruct'; import type { InferMatching } from './structs'; diff --git a/packages/snaps-utils/src/snaps.test.ts b/packages/snaps-utils/src/snaps.test.ts index 588987a7ca..20e642c690 100644 --- a/packages/snaps-utils/src/snaps.test.ts +++ b/packages/snaps-utils/src/snaps.test.ts @@ -2,7 +2,7 @@ import type { SubjectPermissions, PermissionConstraint, } from '@metamask/permission-controller'; -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { SnapCaveatType } from './caveats'; import { diff --git a/packages/snaps-utils/src/snaps.ts b/packages/snaps-utils/src/snaps.ts index 91c8f7bb44..5db313e993 100644 --- a/packages/snaps-utils/src/snaps.ts +++ b/packages/snaps-utils/src/snaps.ts @@ -5,11 +5,7 @@ import type { } from '@metamask/permission-controller'; import type { BlockReason } from '@metamask/snaps-registry'; import type { SnapId, Snap as TruncatedSnap } from '@metamask/snaps-sdk'; -import type { Json } from '@metamask/utils'; -import { assert, isObject, assertStruct } from '@metamask/utils'; -import { base64 } from '@scure/base'; -import stableStringify from 'fast-json-stable-stringify'; -import type { Struct } from 'superstruct'; +import type { Struct } from '@metamask/superstruct'; import { empty, enums, @@ -20,7 +16,11 @@ import { string, union, validate, -} from 'superstruct'; +} from '@metamask/superstruct'; +import type { Json } from '@metamask/utils'; +import { assert, isObject, assertStruct } from '@metamask/utils'; +import { base64 } from '@scure/base'; +import stableStringify from 'fast-json-stable-stringify'; import validateNPMPackage from 'validate-npm-package-name'; import { SnapCaveatType } from './caveats'; diff --git a/packages/snaps-utils/src/structs.test.ts b/packages/snaps-utils/src/structs.test.ts index da86e2f153..f67b6d9cef 100644 --- a/packages/snaps-utils/src/structs.test.ts +++ b/packages/snaps-utils/src/structs.test.ts @@ -1,8 +1,7 @@ import { union, literal } from '@metamask/snaps-sdk'; -import { assert } from '@metamask/utils'; -import { bold, green, red } from 'chalk'; -import type { Struct } from 'superstruct'; -import superstruct, { +import type { Struct } from '@metamask/superstruct'; +import { + create, size, defaulted, number, @@ -12,7 +11,9 @@ import superstruct, { union as superstructUnion, array, is, -} from 'superstruct'; +} from '@metamask/superstruct'; +import { assert } from '@metamask/utils'; +import { bold, green, red } from 'chalk'; import { RpcOriginsStruct } from './json-rpc'; import { HandlerCaveatsStruct } from './manifest'; @@ -32,6 +33,14 @@ import { mergeStructs, } from './structs'; +jest.mock('@metamask/superstruct', () => { + return { + ...jest.requireActual('@metamask/superstruct'), + create: jest.fn(), + }; +}); +const createMock = jest.mocked(create); + /** * Get an error from a struct, for testing. * @@ -133,6 +142,12 @@ describe('createFromStruct', () => { {}, ); + beforeEach(() => { + createMock.mockImplementation( + jest.requireActual('@metamask/superstruct').create, + ); + }); + it('creates a value from a struct', () => { const value = createFromStruct(undefined, DEFAULT_STRUCT, 'Foo'); expect(value).toStrictEqual({ @@ -157,7 +172,7 @@ describe('createFromStruct', () => { }); it('throws the raw error if an unknown error is thrown', () => { - jest.spyOn(superstruct, 'create').mockImplementation(() => { + createMock.mockImplementationOnce(() => { throw new Error('Unknown error.'); }); diff --git a/packages/snaps-utils/src/structs.ts b/packages/snaps-utils/src/structs.ts index f2449e54f3..f6e548712d 100644 --- a/packages/snaps-utils/src/structs.ts +++ b/packages/snaps-utils/src/structs.ts @@ -1,23 +1,23 @@ import { union } from '@metamask/snaps-sdk'; -import type { NonEmptyArray } from '@metamask/utils'; -import { assert, isObject } from '@metamask/utils'; -import { bold, green, red } from 'chalk'; -import type { Failure } from 'superstruct'; +import type { + AnyStruct, + Assign, + Failure, + ObjectSchema, + ObjectType, +} from '@metamask/superstruct'; import { + assign, is, validate, type as superstructType, Struct, StructError, create, - assign, -} from 'superstruct'; -import type { - AnyStruct, - Assign, - ObjectSchema, - ObjectType, -} from 'superstruct/dist/utils'; +} from '@metamask/superstruct'; +import type { NonEmptyArray } from '@metamask/utils'; +import { assert, isObject } from '@metamask/utils'; +import { bold, green, red } from 'chalk'; import { indent } from './strings'; diff --git a/packages/snaps-utils/src/types.test.ts b/packages/snaps-utils/src/types.test.ts index 879d42d995..61751765b1 100644 --- a/packages/snaps-utils/src/types.test.ts +++ b/packages/snaps-utils/src/types.test.ts @@ -1,4 +1,4 @@ -import { enums, is, literal } from 'superstruct'; +import { enums, is, literal } from '@metamask/superstruct'; import { getPackageJson } from './test-utils'; import { diff --git a/packages/snaps-utils/src/types.ts b/packages/snaps-utils/src/types.ts index f4e945cad4..8aed6bd340 100644 --- a/packages/snaps-utils/src/types.ts +++ b/packages/snaps-utils/src/types.ts @@ -1,6 +1,4 @@ -import type { Json } from '@metamask/utils'; -import { assertStruct, VersionStruct } from '@metamask/utils'; -import type { Infer, Struct } from 'superstruct'; +import type { Infer, Struct } from '@metamask/superstruct'; import { instance, is, @@ -13,7 +11,9 @@ import { type, union, assert as assertSuperstruct, -} from 'superstruct'; +} from '@metamask/superstruct'; +import type { Json } from '@metamask/utils'; +import { assertStruct, VersionStruct } from '@metamask/utils'; import type { SnapCaveatType } from './caveats'; import type { SnapFunctionExports, SnapRpcHookArgs } from './handlers'; diff --git a/packages/snaps-utils/src/versions.ts b/packages/snaps-utils/src/versions.ts index 07a9193f16..0eaf0f32bb 100644 --- a/packages/snaps-utils/src/versions.ts +++ b/packages/snaps-utils/src/versions.ts @@ -1,7 +1,7 @@ +import { validate } from '@metamask/superstruct'; import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils'; import { VersionRangeStruct } from '@metamask/utils'; import { maxSatisfying as maxSatisfyingSemver } from 'semver'; -import { validate } from 'superstruct'; export const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange; diff --git a/packages/snaps-webpack-plugin/package.json b/packages/snaps-webpack-plugin/package.json index 69e92de043..dee7eb6d25 100644 --- a/packages/snaps-webpack-plugin/package.json +++ b/packages/snaps-webpack-plugin/package.json @@ -44,7 +44,7 @@ "dependencies": { "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "webpack-sources": "^3.2.3" }, "devDependencies": { diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index 4aae47be7a..7139eead37 100644 --- a/packages/test-snaps/package.json +++ b/packages/test-snaps/package.json @@ -53,7 +53,7 @@ "@metamask/notification-example-snap": "workspace:^", "@metamask/signature-insights-example-snap": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^9.1.0", "@metamask/wasm-example-snap": "workspace:^", "@popperjs/core": "^2.11.8", "@reduxjs/toolkit": "^1.9.5", @@ -71,7 +71,7 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@metamask/providers": "^17.0.0", + "@metamask/providers": "17.0.0", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", diff --git a/yarn.lock b/yarn.lock index 2c52d7f368..02047c1d79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3864,13 +3864,13 @@ __metadata: languageName: node linkType: hard -"@metamask/base-controller@npm:^6.0.0": - version: 6.0.0 - resolution: "@metamask/base-controller@npm:6.0.0" +"@metamask/base-controller@npm:^6.0.0, @metamask/base-controller@npm:^6.0.1": + version: 6.0.1 + resolution: "@metamask/base-controller@npm:6.0.1" dependencies: - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.0.0 immer: ^9.0.6 - checksum: ff5c4acedc698e2477f1d719f64363d8763b21836dcea4675214c078457cd47dde068aa336b249663f3c7fb3c0f536ce420870811e00ca3a410646740a9f5934 + checksum: c5dc9ce53dbb65190462e269dff78f5f2a789a787246bf4f7b2f4867da5ac11c54a67db530db5ba520f64f5a124f58983f36f9c6a4ab032e86cd3058a1b3e864 languageName: node linkType: hard @@ -3885,11 +3885,11 @@ __metadata: "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/key-tree": ^9.1.1 + "@metamask/key-tree": ^9.1.2 "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@noble/ed25519": ^1.6.0 "@noble/secp256k1": ^1.7.1 "@swc/core": 1.3.78 @@ -3925,11 +3925,11 @@ __metadata: "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/key-tree": ^9.1.1 + "@metamask/key-tree": ^9.1.2 "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@noble/bls12-381": ^1.2.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4086,11 +4086,11 @@ __metadata: "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/key-tree": ^9.1.1 + "@metamask/key-tree": ^9.1.2 "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4114,20 +4114,20 @@ __metadata: languageName: unknown linkType: soft -"@metamask/controller-utils@npm:^11.0.0": - version: 11.0.0 - resolution: "@metamask/controller-utils@npm:11.0.0" +"@metamask/controller-utils@npm:^11.0.0, @metamask/controller-utils@npm:^11.0.1": + version: 11.0.1 + resolution: "@metamask/controller-utils@npm:11.0.1" dependencies: "@ethereumjs/util": ^8.1.0 "@metamask/eth-query": ^4.0.0 "@metamask/ethjs-unit": ^0.3.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.0.0 "@spruceid/siwe-parser": 2.1.0 "@types/bn.js": ^5.1.5 bn.js: ^5.2.1 eth-ens-namehash: ^2.0.8 fast-deep-equal: ^3.1.3 - checksum: ce77d9006c34109d78787d91036b605c2e401f51bae58a60cfd955905ebd63ebe5a007b93861a1fcc51bb7e57b69ec2a6dd6142656c1ee2d87d74e397752dffa + checksum: 1e3adfa9544723e9d9cb76ed5f881d853c25544bb37aa521347fdbaaa9ab9b1e37d87167a4bdd1083f00fae32b6b4a9597ad756f348b4de0d627bf8742fa2b73 languageName: node linkType: hard @@ -4142,11 +4142,11 @@ __metadata: "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/key-tree": ^9.1.1 + "@metamask/key-tree": ^9.1.2 "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@noble/curves": ^1.1.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 @@ -4488,7 +4488,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4603,7 +4603,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4641,7 +4641,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@noble/bls12-381": ^1.2.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4788,7 +4788,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4825,7 +4825,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4888,14 +4888,14 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-engine@npm:^9.0.0": - version: 9.0.0 - resolution: "@metamask/json-rpc-engine@npm:9.0.0" +"@metamask/json-rpc-engine@npm:^9.0.0, @metamask/json-rpc-engine@npm:^9.0.1": + version: 9.0.1 + resolution: "@metamask/json-rpc-engine@npm:9.0.1" dependencies: - "@metamask/rpc-errors": ^6.2.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 - checksum: b97170b36843145361015dabc5651df1d2c7f28f0756d3c9c05aef6a483098d562a9983cbe0e15f7fd1a66aa26481132b03ccb9061a2c48f0d3249c1f2348e97 + "@metamask/utils": ^9.0.0 + checksum: 60889825a633f2ae8f5998c3c426c52e580d761871983eb4e25bedc868fad1c367b496b3bd6913274b118444987eda64669a1eb49acda1a7fc2e2a0d75dd1e9a languageName: node linkType: hard @@ -4948,14 +4948,14 @@ __metadata: linkType: hard "@metamask/json-rpc-middleware-stream@npm:^8.0.0": - version: 8.0.0 - resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.0" + version: 8.0.1 + resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.1" dependencies: - "@metamask/json-rpc-engine": ^9.0.0 + "@metamask/json-rpc-engine": ^9.0.1 "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.0.0 readable-stream: ^3.6.2 - checksum: 4bf809366da41744c841dd50d68cf126e1cccda0d78a812154489faa2b0a56bbd511a7bb4e9ccc7c68f2a9a6437f00561bc9423a5b5596badd511a4ff6244c9e + checksum: 7f9b43bb171aed6ba1b3fbad1420224cf505fc1cc8f79bff8e3da404f9b835fe660efee0a538565f035f00c8de811979d2921afd9c756dbba91366d558f2fdef languageName: node linkType: hard @@ -4970,11 +4970,11 @@ __metadata: "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4997,16 +4997,16 @@ __metadata: languageName: unknown linkType: soft -"@metamask/key-tree@npm:^9.1.1": - version: 9.1.1 - resolution: "@metamask/key-tree@npm:9.1.1" +"@metamask/key-tree@npm:^9.1.2": + version: 9.1.2 + resolution: "@metamask/key-tree@npm:9.1.2" dependencies: "@metamask/scure-bip39": ^2.1.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.0.0 "@noble/curves": ^1.2.0 "@noble/hashes": ^1.3.2 "@scure/base": ^1.0.0 - checksum: 4de5f92e4d9408829552bb569b998613ed940f289613fe86f9a5f0a66e392ec386d70b2365943c216b83c9ff249877fd731f2f791240a622ff186fd047d81f9e + checksum: eb60bdbfa1806c2f248bf2602cd242e21b0fbe8bbb00ec97c3891739956a81e26c0dae125282a6207dbbe0643e727ff3574067b48210a0b01f12aae7b3159b77 languageName: node linkType: hard @@ -5169,7 +5169,7 @@ __metadata: "@metamask/snaps-controllers": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5248,22 +5248,22 @@ __metadata: languageName: node linkType: hard -"@metamask/permission-controller@npm:^10.0.0": - version: 10.0.0 - resolution: "@metamask/permission-controller@npm:10.0.0" +"@metamask/permission-controller@npm:^10.0.1": + version: 10.0.1 + resolution: "@metamask/permission-controller@npm:10.0.1" dependencies: - "@metamask/base-controller": ^6.0.0 - "@metamask/controller-utils": ^11.0.0 - "@metamask/json-rpc-engine": ^9.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/base-controller": ^6.0.1 + "@metamask/controller-utils": ^11.0.1 + "@metamask/json-rpc-engine": ^9.0.1 + "@metamask/rpc-errors": ^6.3.1 + "@metamask/utils": ^9.0.0 "@types/deep-freeze-strict": ^1.1.0 deep-freeze-strict: ^1.1.1 immer: ^9.0.6 nanoid: ^3.1.31 peerDependencies: "@metamask/approval-controller": ^7.0.0 - checksum: 9b05ebac86a5d028388eca35861357561298ea938f3adb5e134566f5d16a9a01cc582cffdc14f3680f103ba770827f108a066bc48fcb13da984a04da0af178f7 + checksum: 0dd9daad694a4decdb7849ef48fce517bd975e3fbbaa50e549cfe16a7d1b0e607fed1f109948b7e28c7edb84b3276d68e3c3c0bef8befdad03671bacaaeacad2 languageName: node linkType: hard @@ -5290,7 +5290,7 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^17.0.0": +"@metamask/providers@npm:17.0.0": version: 17.0.0 resolution: "@metamask/providers@npm:17.0.0" dependencies: @@ -5355,13 +5355,13 @@ __metadata: languageName: unknown linkType: soft -"@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.2.1": - version: 6.2.1 - resolution: "@metamask/rpc-errors@npm:6.2.1" +"@metamask/rpc-errors@npm:^6.0.0, @metamask/rpc-errors@npm:^6.2.1, @metamask/rpc-errors@npm:^6.3.1": + version: 6.3.1 + resolution: "@metamask/rpc-errors@npm:6.3.1" dependencies: - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.0.0 fast-safe-stringify: ^2.0.6 - checksum: a9223c3cb9ab05734ea0dda990597f90a7cdb143efa0c026b1a970f2094fe5fa3c341ed39b1e7623be13a96b98fb2c697ef51a2e2b87d8f048114841d35ee0a9 + checksum: 8761f5c0161cb3b342abd3ccccbd7b792f36a987e1f22c3f89b1bd29f72a2e35a2c91b58164fdd9dc3e5b67157500dcbdb5d04245117c14310c34cf42f7b8463 languageName: node linkType: hard @@ -5489,7 +5489,8 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/snaps-webpack-plugin": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/browserify": ^12.0.37 @@ -5543,7 +5544,6 @@ __metadata: stream-http: ^3.2.0 string_decoder: ^1.3.0 strip-ansi: ^6.0.1 - superstruct: ^1.0.3 swc-loader: ^0.2.3 terser-webpack-plugin: ^5.3.9 timers-browserify: ^2.0.12 @@ -5572,7 +5572,7 @@ __metadata: "@lavamoat/allow-scripts": ^3.0.4 "@metamask/approval-controller": ^7.0.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^6.0.0 + "@metamask/base-controller": ^6.0.1 "@metamask/browser-passworder": ^5.0.0 "@metamask/eslint-config": ^12.1.0 "@metamask/eslint-config-jest": ^12.1.0 @@ -5581,16 +5581,16 @@ __metadata: "@metamask/json-rpc-engine": ^9.0.0 "@metamask/json-rpc-middleware-stream": ^8.0.0 "@metamask/object-multiplex": ^2.0.0 - "@metamask/permission-controller": ^10.0.0 + "@metamask/permission-controller": ^10.0.1 "@metamask/phishing-controller": ^10.0.0 "@metamask/post-message-stream": ^8.1.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/snaps-registry": ^3.1.0 + "@metamask/rpc-errors": ^6.3.1 + "@metamask/snaps-registry": ^3.2.1 "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/template-snap": ^0.7.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/chrome": ^0.0.237 @@ -5676,11 +5676,12 @@ __metadata: "@metamask/json-rpc-engine": ^9.0.0 "@metamask/object-multiplex": ^2.0.0 "@metamask/post-message-stream": ^8.1.0 - "@metamask/providers": ^17.0.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/providers": 17.0.0 + "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/express": ^4.17.17 @@ -5724,7 +5725,6 @@ __metadata: rimraf: ^4.1.2 serve-handler: ^6.1.5 ses: ^1.1.0 - superstruct: ^1.0.3 terser: ^5.17.7 ts-node: ^10.9.1 tsup: ^8.0.1 @@ -5748,7 +5748,7 @@ __metadata: "@jest/types": ^29.6.3 "@lavamoat/allow-scripts": ^3.0.4 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^6.0.0 + "@metamask/base-controller": ^6.0.1 "@metamask/eslint-config": ^12.1.0 "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 @@ -5756,14 +5756,15 @@ __metadata: "@metamask/eth-json-rpc-middleware": ^12.1.2 "@metamask/json-rpc-engine": ^9.0.0 "@metamask/json-rpc-middleware-stream": ^8.0.0 - "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^10.0.0 + "@metamask/key-tree": ^9.1.2 + "@metamask/permission-controller": ^10.0.1 "@metamask/snaps-controllers": "workspace:^" "@metamask/snaps-execution-environments": "workspace:^" "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@reduxjs/toolkit": ^1.9.5 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5794,21 +5795,20 @@ __metadata: redux: ^4.2.1 redux-saga: ^1.2.3 rimraf: ^4.1.2 - superstruct: ^1.0.3 tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown linkType: soft -"@metamask/snaps-registry@npm:^3.1.0": - version: 3.1.0 - resolution: "@metamask/snaps-registry@npm:3.1.0" +"@metamask/snaps-registry@npm:^3.2.1": + version: 3.2.1 + resolution: "@metamask/snaps-registry@npm:3.2.1" dependencies: - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.0.0 "@noble/curves": ^1.2.0 "@noble/hashes": ^1.3.2 - superstruct: ^1.0.3 - checksum: 019cb47134c2ad4724f4f392385d4e81ab61dfefb12e66a88a2480a178502190e2d5d99cf269b906e4acda1b88de3fe356c80e71dc32c6c3f0fada9461c9bc49 + checksum: d91f71ea1c8284b728c469adce60b771e683a5bd189f26742839e7948bc9a3bb1e9414275c579e0cab4042850122b78fcbd83c4a558fea6a3682eef4cc653b67 languageName: node linkType: hard @@ -5862,12 +5862,13 @@ __metadata: "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/json-rpc-engine": ^9.0.0 - "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^10.0.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/key-tree": ^9.1.2 + "@metamask/permission-controller": ^10.0.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5889,7 +5890,6 @@ __metadata: prettier: ^2.7.1 prettier-plugin-packagejson: ^2.2.11 rimraf: ^4.1.2 - superstruct: ^1.0.3 tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown @@ -5905,10 +5905,11 @@ __metadata: "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/key-tree": ^9.1.1 - "@metamask/providers": ^17.0.0 - "@metamask/rpc-errors": ^6.2.1 - "@metamask/utils": ^8.3.0 + "@metamask/key-tree": ^9.1.2 + "@metamask/providers": 17.0.0 + "@metamask/rpc-errors": ^6.3.1 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5930,7 +5931,6 @@ __metadata: prettier: ^2.7.1 prettier-plugin-packagejson: ^2.2.11 rimraf: ^4.1.2 - superstruct: ^1.0.3 ts-jest: ^29.1.1 tsup: ^8.0.1 typescript: ~4.8.4 @@ -5947,7 +5947,7 @@ __metadata: "@emotion/styled": ^11.10.8 "@ethersproject/units": ^5.7.0 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^6.0.0 + "@metamask/base-controller": ^6.0.1 "@metamask/eslint-config": ^12.1.0 "@metamask/eslint-config-browser": ^11.1.0 "@metamask/eslint-config-jest": ^12.1.0 @@ -5956,14 +5956,15 @@ __metadata: "@metamask/eth-json-rpc-middleware": ^12.1.2 "@metamask/json-rpc-engine": ^9.0.0 "@metamask/json-rpc-middleware-stream": ^8.0.0 - "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^10.0.0 + "@metamask/key-tree": ^9.1.2 + "@metamask/permission-controller": ^10.0.1 "@metamask/snaps-controllers": "workspace:^" "@metamask/snaps-execution-environments": "workspace:^" "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@minoru/react-dnd-treeview": ^3.4.4 "@noble/hashes": ^1.3.1 "@pmmmwh/react-refresh-webpack-plugin": ^0.5.10 @@ -6034,7 +6035,6 @@ __metadata: rimraf: ^4.1.2 stream-browserify: ^3.0.0 style-loader: ^3.3.2 - superstruct: ^1.0.3 swc-loader: ^0.2.3 terser-webpack-plugin: ^5.3.9 ts-node: ^10.9.1 @@ -6058,19 +6058,20 @@ __metadata: "@esbuild-plugins/node-modules-polyfill": ^0.2.2 "@lavamoat/allow-scripts": ^3.0.4 "@metamask/auto-changelog": ^3.4.4 - "@metamask/base-controller": ^6.0.0 + "@metamask/base-controller": ^6.0.1 "@metamask/eslint-config": ^12.1.0 "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/key-tree": ^9.1.1 - "@metamask/permission-controller": ^10.0.0 + "@metamask/key-tree": ^9.1.2 + "@metamask/permission-controller": ^10.0.1 "@metamask/post-message-stream": ^8.1.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/slip44": ^3.1.0 - "@metamask/snaps-registry": ^3.1.0 + "@metamask/snaps-registry": ^3.2.1 "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 "@swc/core": 1.3.78 @@ -6118,7 +6119,6 @@ __metadata: rimraf: ^4.1.2 semver: ^7.5.4 ses: ^1.1.0 - superstruct: ^1.0.3 ts-node: ^10.9.1 tsup: ^8.0.1 typescript: ~4.8.4 @@ -6143,7 +6143,7 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -6173,6 +6173,13 @@ __metadata: languageName: unknown linkType: soft +"@metamask/superstruct@npm:^3.1.0": + version: 3.1.0 + resolution: "@metamask/superstruct@npm:3.1.0" + checksum: 00e4d0c0aae8b25ccc1885c1db0bb4ed1590010570140c255e4deee3bf8a10c859c8fce5e475b4ae09c8a56316207af87585b91f7f5a5c028d668ccd111f19e3 + languageName: node + linkType: hard + "@metamask/template-snap@npm:^0.7.0": version: 0.7.0 resolution: "@metamask/template-snap@npm:0.7.0" @@ -6212,10 +6219,10 @@ __metadata: "@metamask/name-lookup-example-snap": "workspace:^" "@metamask/network-example-snap": "workspace:^" "@metamask/notification-example-snap": "workspace:^" - "@metamask/providers": ^17.0.0 + "@metamask/providers": 17.0.0 "@metamask/signature-insights-example-snap": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@metamask/wasm-example-snap": "workspace:^" "@pmmmwh/react-refresh-webpack-plugin": ^0.5.10 "@popperjs/core": ^2.11.8 @@ -6266,20 +6273,20 @@ __metadata: languageName: unknown linkType: soft -"@metamask/utils@npm:^8.0.0, @metamask/utils@npm:^8.1.0, @metamask/utils@npm:^8.2.0, @metamask/utils@npm:^8.2.1, @metamask/utils@npm:^8.3.0": - version: 8.4.0 - resolution: "@metamask/utils@npm:8.4.0" +"@metamask/utils@npm:9.1.0": + version: 9.1.0 + resolution: "@metamask/utils@npm:9.1.0" dependencies: "@ethereumjs/tx": ^4.2.0 + "@metamask/superstruct": ^3.1.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.3 "@types/debug": ^4.1.7 debug: ^4.3.4 pony-cause: ^2.1.10 semver: ^7.5.4 - superstruct: ^1.0.3 uuid: ^9.0.1 - checksum: b0397e97bac7192f6189a8625a2dfcb56d3c2cf4dd2cb3d4e012a7e9786f04f59f6917805544bc131a6dacd2c8344e237ae43ad47429bb5eb35c6cf1248440b4 + checksum: 01f2c71a8f06158d5335bfe96bfd2f3aa39ec6b2323c5d0ff1d3136071a3e8ff7c1804d640ba1d4e07f96f3e68a95ff7729ddfcd34b373e5fefd86d6ef12d034 languageName: node linkType: hard @@ -17723,11 +17730,11 @@ __metadata: linkType: hard "nanoid@npm:^3.1.31, nanoid@npm:^3.3.6": - version: 3.3.6 - resolution: "nanoid@npm:3.3.6" + version: 3.3.7 + resolution: "nanoid@npm:3.3.7" bin: nanoid: bin/nanoid.cjs - checksum: 7d0eda657002738aa5206107bd0580aead6c95c460ef1bdd0b1a87a9c7ae6277ac2e9b945306aaa5b32c6dcb7feaf462d0f552e7f8b5718abfc6ead5c94a71b3 + checksum: d36c427e530713e4ac6567d488b489a36582ef89da1d6d4e3b87eded11eb10d7042a877958c6f104929809b2ab0bafa17652b076cdf84324aa75b30b722204f2 languageName: node linkType: hard @@ -20293,7 +20300,7 @@ __metadata: "@metamask/eslint-config-jest": ^12.1.0 "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.1.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@types/node": 18.14.2