From 037210e6cfe960b543934545443928d287902a53 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 30 May 2024 16:39:26 -0400 Subject: [PATCH 01/47] Replace 'superstruct' imports with '@metamask/superstruct' --- packages/snaps-cli/src/config.ts | 18 +++++++-------- packages/snaps-cli/src/structs.test.ts | 2 +- packages/snaps-cli/src/structs.ts | 2 +- .../src/common/BaseSnapExecutor.ts | 2 +- .../src/common/validation.ts | 2 +- packages/snaps-jest/src/helpers.ts | 2 +- .../src/internals/simulation/options.ts | 2 +- .../snaps-jest/src/internals/structs.test.tsx | 4 ++-- packages/snaps-jest/src/matchers.ts | 2 +- packages/snaps-jest/src/options.ts | 2 +- packages/snaps-jest/src/types.ts | 2 +- .../src/permitted/createInterface.ts | 2 +- .../src/permitted/getFile.ts | 2 +- .../src/permitted/getInterfaceState.ts | 2 +- .../src/permitted/updateInterface.ts | 2 +- .../caveats/permittedDerivationPaths.ts | 2 +- .../src/restricted/caveats/snapIds.ts | 2 +- .../src/restricted/dialog.ts | 2 +- .../src/restricted/getBip32PublicKey.ts | 2 +- .../src/restricted/getEntropy.ts | 4 ++-- .../src/restricted/manageAccounts.ts | 9 +++++++- .../snaps-sdk/src/internals/structs.test.ts | 2 +- packages/snaps-sdk/src/internals/structs.ts | 2 +- .../src/types/handlers/user-input.ts | 2 +- .../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 | 2 +- .../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 | 2 -- 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 | 11 ++++++++-- 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 | 2 +- packages/snaps-sdk/src/ui/nodes.ts | 4 ++-- packages/snaps-utils/src/cronjob.ts | 11 ++++++++-- packages/snaps-utils/src/json-rpc.ts | 11 ++++++++-- packages/snaps-utils/src/localization.ts | 2 +- .../src/manifest/validation.test.ts | 2 +- .../snaps-utils/src/manifest/validation.ts | 20 ++++++++--------- packages/snaps-utils/src/namespace.ts | 2 +- packages/snaps-utils/src/snaps.test.ts | 2 +- packages/snaps-utils/src/snaps.ts | 2 +- packages/snaps-utils/src/structs.test.ts | 2 +- packages/snaps-utils/src/structs.ts | 22 +++++++++---------- packages/snaps-utils/src/types.test.ts | 2 +- packages/snaps-utils/src/types.ts | 2 +- packages/snaps-utils/src/versions.ts | 2 +- 56 files changed, 160 insertions(+), 100 deletions(-) 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..42c1106119 100644 --- a/packages/snaps-cli/src/structs.test.ts +++ b/packages/snaps-cli/src/structs.test.ts @@ -1,5 +1,5 @@ import { resolve } from 'path/posix'; -import { create, is } from 'superstruct'; +import { create, is } from '@metamask/superstruct'; import { file } from './structs'; diff --git a/packages/snaps-cli/src/structs.ts b/packages/snaps-cli/src/structs.ts index 5b67d870ce..4acb094a81 100644 --- a/packages/snaps-cli/src/structs.ts +++ b/packages/snaps-cli/src/structs.ts @@ -1,5 +1,5 @@ import { resolve } from 'path'; -import { coerce, string } from 'superstruct'; +import { coerce, string } from '@metamask/superstruct'; /** * A wrapper of `superstruct`'s `string` struct that coerces a value to a string diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index b6ee90843c..e2ccd1d865 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -33,7 +33,7 @@ import { JsonRpcIdStruct, } from '@metamask/utils'; import type { Duplex } from 'readable-stream'; -import { validate, is } from 'superstruct'; +import { validate, is } from '@metamask/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..35971d9e62 100644 --- a/packages/snaps-execution-environments/src/common/validation.ts +++ b/packages/snaps-execution-environments/src/common/validation.ts @@ -13,7 +13,7 @@ import { JsonRpcVersionStruct, JsonStruct, } from '@metamask/utils'; -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { array, assign, diff --git a/packages/snaps-jest/src/helpers.ts b/packages/snaps-jest/src/helpers.ts index 438c892dac..184635bf8d 100644 --- a/packages/snaps-jest/src/helpers.ts +++ b/packages/snaps-jest/src/helpers.ts @@ -1,8 +1,8 @@ import type { AbstractExecutionService } from '@metamask/snaps-controllers'; import type { SnapId } from '@metamask/snaps-sdk'; import { HandlerType, logInfo } from '@metamask/snaps-utils'; +import { create } from '@metamask/superstruct'; import { assertStruct, createModuleLogger } from '@metamask/utils'; -import { create } from 'superstruct'; import { rootLogger, diff --git a/packages/snaps-jest/src/internals/simulation/options.ts b/packages/snaps-jest/src/internals/simulation/options.ts index cb4e848afc..150d93615f 100644 --- a/packages/snaps-jest/src/internals/simulation/options.ts +++ b/packages/snaps-jest/src/internals/simulation/options.ts @@ -1,5 +1,5 @@ import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { create, defaulted, diff --git a/packages/snaps-jest/src/internals/structs.test.tsx b/packages/snaps-jest/src/internals/structs.test.tsx index 8b03d5d47c..43ae0c6b20 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 { Box, Text } from '@metamask/snaps-sdk'; +import { create } from '@metamask/superstruct'; import { InterfaceStruct, diff --git a/packages/snaps-jest/src/matchers.ts b/packages/snaps-jest/src/matchers.ts index e5702ec68a..a43c38cf6b 100644 --- a/packages/snaps-jest/src/matchers.ts +++ b/packages/snaps-jest/src/matchers.ts @@ -30,7 +30,7 @@ import { printWithType, RECEIVED_COLOR, } from 'jest-matcher-utils'; -import { is } from 'superstruct'; +import { is } from '@metamask/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..cf6dd1603f 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, diff --git a/packages/snaps-jest/src/types.ts b/packages/snaps-jest/src/types.ts index 5cd9be62fd..270a26ff36 100644 --- a/packages/snaps-jest/src/types.ts +++ b/packages/snaps-jest/src/types.ts @@ -2,7 +2,7 @@ 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 { Json, JsonRpcId, JsonRpcParams } from '@metamask/utils'; -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import type { SignatureOptionsStruct, 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..c2785596c7 100644 --- a/packages/snaps-rpc-methods/src/permitted/getFile.ts +++ b/packages/snaps-rpc-methods/src/permitted/getFile.ts @@ -6,7 +6,7 @@ import { AuxiliaryFileEncoding, enumValue } from '@metamask/snaps-sdk'; import type { InferMatching } from '@metamask/snaps-utils'; import type { PendingJsonRpcResponse, JsonRpcRequest } from '@metamask/utils'; import { assertStruct } from '@metamask/utils'; -import { object, optional, string, union } from 'superstruct'; +import { object, optional, string, union } from '@metamask/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..c2d8b3f35f 100644 --- a/packages/snaps-rpc-methods/src/permitted/getInterfaceState.ts +++ b/packages/snaps-rpc-methods/src/permitted/getInterfaceState.ts @@ -9,7 +9,7 @@ import type { } from '@metamask/snaps-sdk'; import { type InferMatching } from '@metamask/snaps-utils'; import type { PendingJsonRpcResponse } from '@metamask/utils'; -import { StructError, create, object, string } from 'superstruct'; +import { StructError, create, object, string } from '@metamask/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..e7acd44f00 100644 --- a/packages/snaps-rpc-methods/src/permitted/updateInterface.ts +++ b/packages/snaps-rpc-methods/src/permitted/updateInterface.ts @@ -10,7 +10,7 @@ import type { import { ComponentOrElementStruct } from '@metamask/snaps-sdk'; import { type InferMatching } from '@metamask/snaps-utils'; import type { PendingJsonRpcResponse } from '@metamask/utils'; -import { StructError, create, object, string } from 'superstruct'; +import { StructError, create, object, string } from '@metamask/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..074f9cb5d5 100644 --- a/packages/snaps-rpc-methods/src/restricted/caveats/permittedDerivationPaths.ts +++ b/packages/snaps-rpc-methods/src/restricted/caveats/permittedDerivationPaths.ts @@ -12,7 +12,7 @@ import { } from '@metamask/snaps-utils'; import type { Json } from '@metamask/utils'; import { assertStruct } from '@metamask/utils'; -import { array, size, type } from 'superstruct'; +import { array, size, type } from '@metamask/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..61ad66642d 100644 --- a/packages/snaps-rpc-methods/src/restricted/caveats/snapIds.ts +++ b/packages/snaps-rpc-methods/src/restricted/caveats/snapIds.ts @@ -10,7 +10,7 @@ import type { SnapIds } from '@metamask/snaps-utils'; import { SnapCaveatType, SnapIdsStruct } from '@metamask/snaps-utils'; import type { Json } from '@metamask/utils'; import { hasProperty, assertStruct } from '@metamask/utils'; -import { type } from 'superstruct'; +import { type } from '@metamask/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 021cdcb6f1..dac05b09ed 100644 --- a/packages/snaps-rpc-methods/src/restricted/dialog.ts +++ b/packages/snaps-rpc-methods/src/restricted/dialog.ts @@ -22,7 +22,7 @@ import type { import { createUnion } from '@metamask/snaps-utils'; import type { InferMatching } from '@metamask/snaps-utils'; import { hasProperty, type NonEmptyArray } from '@metamask/utils'; -import type { Infer, Struct } from 'superstruct'; +import type { Infer, Struct } from '@metamask/superstruct'; import { create, enums, 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..5570242648 100644 --- a/packages/snaps-rpc-methods/src/restricted/getEntropy.ts +++ b/packages/snaps-rpc-methods/src/restricted/getEntropy.ts @@ -9,8 +9,8 @@ import type { GetEntropyParams, GetEntropyResult } from '@metamask/snaps-sdk'; import { SIP_6_MAGIC_VALUE } from '@metamask/snaps-utils'; 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 { Infer } from '@metamask/superstruct'; +import { literal, object, optional, string } from '@metamask/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..9c382e2fb9 100644 --- a/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts +++ b/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts @@ -11,7 +11,14 @@ import type { import type { InferMatching } from '@metamask/snaps-utils'; import type { Json, NonEmptyArray } from '@metamask/utils'; import { JsonStruct } from '@metamask/utils'; -import { assert, string, object, union, array, record } from 'superstruct'; +import { + assert, + string, + object, + union, + array, + record, +} from '@metamask/superstruct'; const SnapMessageStruct = union([ object({ diff --git a/packages/snaps-sdk/src/internals/structs.test.ts b/packages/snaps-sdk/src/internals/structs.test.ts index 64cef4cb33..33686427ca 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 { enumValue, literal, union } from './structs'; diff --git a/packages/snaps-sdk/src/internals/structs.ts b/packages/snaps-sdk/src/internals/structs.ts index 5c6bd2aa51..929911e3c0 100644 --- a/packages/snaps-sdk/src/internals/structs.ts +++ b/packages/snaps-sdk/src/internals/structs.ts @@ -1,4 +1,4 @@ -import type { Infer } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; import { Struct, define, diff --git a/packages/snaps-sdk/src/types/handlers/user-input.ts b/packages/snaps-sdk/src/types/handlers/user-input.ts index 126604d70f..990ecb68a3 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, 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..a40e7fb621 100644 --- a/packages/snaps-sdk/src/ui/builder.ts +++ b/packages/snaps-sdk/src/ui/builder.ts @@ -1,5 +1,5 @@ import { assertStruct, isPlainObject } from '@metamask/utils'; -import type { Struct } from 'superstruct'; +import type { Struct } from '@metamask/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..66628c0348 100644 --- a/packages/snaps-sdk/src/ui/component.ts +++ b/packages/snaps-sdk/src/ui/component.ts @@ -1,5 +1,5 @@ import { assertStruct } from '@metamask/utils'; -import { is } from 'superstruct'; +import { is } from '@metamask/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..90317283fc 100644 --- a/packages/snaps-sdk/src/ui/components/address.ts +++ b/packages/snaps-sdk/src/ui/components/address.ts @@ -1,6 +1,6 @@ import { HexChecksumAddressStruct } from '@metamask/utils'; -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 { 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..1db9675767 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, 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..c5f2a05287 100644 --- a/packages/snaps-sdk/src/ui/components/image.test.ts +++ b/packages/snaps-sdk/src/ui/components/image.test.ts @@ -23,12 +23,10 @@ describe('image', () => { 'Invalid image component: At path: value -- Value is not a valid SVG.', ); - // @ts-expect-error - Invalid args. 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. 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 fa0949b2c5..ab1b209940 100644 --- a/packages/snaps-sdk/src/ui/components/panel.ts +++ b/packages/snaps-sdk/src/ui/components/panel.ts @@ -1,5 +1,12 @@ -import type { Infer, Struct } from 'superstruct'; -import { array, assign, lazy, literal, object, union } from 'superstruct'; +import type { Infer, Struct } from '@metamask/superstruct'; +import { + array, + assign, + lazy, + literal, + object, + union, +} from '@metamask/superstruct'; import { createBuilder } from '../builder'; import { NodeStruct, NodeType } from '../nodes'; 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..ea36b9649f 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, 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-utils/src/cronjob.ts b/packages/snaps-utils/src/cronjob.ts index 419d39edf3..9f613bf1ae 100644 --- a/packages/snaps-utils/src/cronjob.ts +++ b/packages/snaps-utils/src/cronjob.ts @@ -4,8 +4,15 @@ import { JsonRpcVersionStruct, } from '@metamask/utils'; import { parseExpression } from 'cron-parser'; -import type { Infer } from 'superstruct'; -import { array, create, object, optional, refine, string } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { + array, + create, + object, + optional, + refine, + string, +} from '@metamask/superstruct'; export const CronjobRpcRequestStruct = object({ jsonrpc: optional(JsonRpcVersionStruct), diff --git a/packages/snaps-utils/src/json-rpc.ts b/packages/snaps-utils/src/json-rpc.ts index 83f351fae1..8c1275f3ad 100644 --- a/packages/snaps-utils/src/json-rpc.ts +++ b/packages/snaps-utils/src/json-rpc.ts @@ -9,8 +9,15 @@ import { isJsonRpcFailure, isJsonRpcSuccess, } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { array, boolean, object, optional, refine, string } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { + array, + boolean, + object, + optional, + refine, + string, +} from '@metamask/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..217e1511c5 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, 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..305db22c40 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, 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..5260a4d5be 100644 --- a/packages/snaps-utils/src/snaps.ts +++ b/packages/snaps-utils/src/snaps.ts @@ -9,7 +9,7 @@ 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, diff --git a/packages/snaps-utils/src/structs.test.ts b/packages/snaps-utils/src/structs.test.ts index da86e2f153..1c58b50f40 100644 --- a/packages/snaps-utils/src/structs.test.ts +++ b/packages/snaps-utils/src/structs.test.ts @@ -1,7 +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 type { Struct } from '@metamask/superstruct'; import superstruct, { size, defaulted, diff --git a/packages/snaps-utils/src/structs.ts b/packages/snaps-utils/src/structs.ts index f2449e54f3..8a307b50ae 100644 --- a/packages/snaps-utils/src/structs.ts +++ b/packages/snaps-utils/src/structs.ts @@ -1,8 +1,11 @@ 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 { is, validate, @@ -11,13 +14,10 @@ import { 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..df1372136b 100644 --- a/packages/snaps-utils/src/types.ts +++ b/packages/snaps-utils/src/types.ts @@ -1,6 +1,6 @@ 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, diff --git a/packages/snaps-utils/src/versions.ts b/packages/snaps-utils/src/versions.ts index 07a9193f16..399bd84a58 100644 --- a/packages/snaps-utils/src/versions.ts +++ b/packages/snaps-utils/src/versions.ts @@ -1,7 +1,7 @@ import type { Json, SemVerVersion, SemVerRange } from '@metamask/utils'; import { VersionRangeStruct } from '@metamask/utils'; import { maxSatisfying as maxSatisfyingSemver } from 'semver'; -import { validate } from 'superstruct'; +import { validate } from '@metamask/superstruct'; export const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange; From c8602a49c52c49b856d1f70129ba10872032e1c8 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 30 May 2024 16:49:05 -0400 Subject: [PATCH 02/47] Remove 'superstruct' and add '@metamask/superstruct' v3.0.0 as dependency --- packages/snaps-cli/package.json | 2 +- .../snaps-execution-environments/package.json | 4 ++-- packages/snaps-jest/package.json | 4 ++-- packages/snaps-rpc-methods/package.json | 4 ++-- packages/snaps-sdk/package.json | 4 ++-- packages/snaps-utils/package.json | 2 +- yarn.lock | 19 +++++++++++++------ 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/packages/snaps-cli/package.json b/packages/snaps-cli/package.json index 91588cc334..1a1bfef583 100644 --- a/packages/snaps-cli/package.json +++ b/packages/snaps-cli/package.json @@ -60,6 +60,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/snaps-webpack-plugin": "workspace:^", + "@metamask/superstruct": "^3.0.0", "@metamask/utils": "^8.3.0", "@swc/core": "1.3.78", "assert": "^2.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-execution-environments/package.json b/packages/snaps-execution-environments/package.json index a277a350a0..c55b631cbc 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -58,10 +58,10 @@ "@metamask/rpc-errors": "^6.2.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", + "@metamask/superstruct": "^3.0.0", "@metamask/utils": "^8.3.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-jest/package.json b/packages/snaps-jest/package.json index 0d133b7f09..5d6fe62943 100644 --- a/packages/snaps-jest/package.json +++ b/packages/snaps-jest/package.json @@ -51,6 +51,7 @@ "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", + "@metamask/superstruct": "^3.0.0", "@metamask/utils": "^8.3.0", "@reduxjs/toolkit": "^1.9.5", "express": "^4.18.2", @@ -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-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index 8a37435662..0bc5448cf3 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -44,9 +44,9 @@ "@metamask/rpc-errors": "^6.2.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", + "@metamask/superstruct": "^3.0.0", "@metamask/utils": "^8.3.0", - "@noble/hashes": "^1.3.1", - "superstruct": "^1.0.3" + "@noble/hashes": "^1.3.1" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 95bba09e87..3041a38c94 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -62,8 +62,8 @@ "@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/superstruct": "^3.0.0", + "@metamask/utils": "^8.3.0" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 7500aefd54..bf2bf53f91 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -59,6 +59,7 @@ "@metamask/slip44": "^3.1.0", "@metamask/snaps-registry": "^3.1.0", "@metamask/snaps-sdk": "workspace:^", + "@metamask/superstruct": "^3.0.0", "@metamask/utils": "^8.3.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.1", @@ -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/yarn.lock b/yarn.lock index afca094488..5dda50d4ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5491,6 +5491,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/snaps-webpack-plugin": "workspace:^" + "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.3.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5545,7 +5546,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 @@ -5682,6 +5682,7 @@ __metadata: "@metamask/rpc-errors": ^6.2.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" + "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.3.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5726,7 +5727,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 @@ -5765,6 +5765,7 @@ __metadata: "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" + "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.3.0 "@reduxjs/toolkit": ^1.9.5 "@swc/core": 1.3.78 @@ -5796,7 +5797,6 @@ __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 @@ -5869,6 +5869,7 @@ __metadata: "@metamask/rpc-errors": ^6.2.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" + "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.3.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 @@ -5891,7 +5892,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 @@ -5910,6 +5910,7 @@ __metadata: "@metamask/key-tree": ^9.1.1 "@metamask/providers": ^17.0.0 "@metamask/rpc-errors": ^6.2.1 + "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.3.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 @@ -5932,7 +5933,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 @@ -6063,6 +6063,7 @@ __metadata: "@metamask/slip44": ^3.1.0 "@metamask/snaps-registry": ^3.1.0 "@metamask/snaps-sdk": "workspace:^" + "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.3.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 @@ -6111,7 +6112,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 @@ -6166,6 +6166,13 @@ __metadata: languageName: unknown linkType: soft +"@metamask/superstruct@npm:^3.0.0": + version: 3.0.0 + resolution: "@metamask/superstruct@npm:3.0.0" + checksum: 667f8f2947186972516bb72b4ba215eaeede257c8beb0450583dd4c8b00c28729ff938267ca8804a3a351277fd627b8607cafeb71eb7045a2b6930639bb6a341 + languageName: node + linkType: hard + "@metamask/template-snap@npm:^0.7.0": version: 0.7.0 resolution: "@metamask/template-snap@npm:0.7.0" From 7d12972c5e7b01bf48ba9887411f9a08cf8ee470 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 30 May 2024 17:14:27 -0400 Subject: [PATCH 03/47] Bump dependency `@metamask/utils` to `^8.5.0` in all packages --- package.json | 2 +- packages/examples/packages/bip32/package.json | 2 +- packages/examples/packages/bip44/package.json | 2 +- .../examples/packages/dialogs/package.json | 2 +- .../examples/packages/ethers-js/package.json | 2 +- .../packages/get-entropy/package.json | 2 +- .../packages/consumer-signer/package.json | 2 +- .../packages/core-signer/package.json | 2 +- packages/snaps-cli/package.json | 2 +- packages/snaps-controllers/package.json | 2 +- .../snaps-execution-environments/package.json | 2 +- packages/snaps-jest/package.json | 2 +- packages/snaps-rpc-methods/package.json | 2 +- packages/snaps-sdk/package.json | 2 +- packages/snaps-simulator/package.json | 2 +- packages/snaps-utils/package.json | 2 +- packages/snaps-webpack-plugin/package.json | 2 +- packages/test-snaps/package.json | 2 +- yarn.lock | 53 ++++++++++++------- 19 files changed, 53 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 5f59cc90f1..b3a3ed843c 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,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": "^8.5.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..c78eccc5c6 100644 --- a/packages/examples/packages/bip32/package.json +++ b/packages/examples/packages/bip32/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@noble/ed25519": "^1.6.0", "@noble/secp256k1": "^1.7.1" }, diff --git a/packages/examples/packages/bip44/package.json b/packages/examples/packages/bip44/package.json index a8697c693b..5a85d6a449 100644 --- a/packages/examples/packages/bip44/package.json +++ b/packages/examples/packages/bip44/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@noble/bls12-381": "^1.2.0" }, "devDependencies": { diff --git a/packages/examples/packages/dialogs/package.json b/packages/examples/packages/dialogs/package.json index 229d73fd8b..4d56a0d8b8 100644 --- a/packages/examples/packages/dialogs/package.json +++ b/packages/examples/packages/dialogs/package.json @@ -42,7 +42,7 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/ethers-js/package.json b/packages/examples/packages/ethers-js/package.json index 3289714eca..2a29838693 100644 --- a/packages/examples/packages/ethers-js/package.json +++ b/packages/examples/packages/ethers-js/package.json @@ -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": "^8.5.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/get-entropy/package.json b/packages/examples/packages/get-entropy/package.json index 5e910596ff..a8fafbab12 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": "^8.5.0", "@noble/bls12-381": "^1.2.0" }, "devDependencies": { 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..c7105e439e 100644 --- a/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@noble/hashes": "^1.3.1" }, "devDependencies": { 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..1aaef2bb31 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@noble/curves": "^1.1.0", "async-mutex": "^0.4.0" }, diff --git a/packages/snaps-cli/package.json b/packages/snaps-cli/package.json index 1a1bfef583..46fba671d9 100644 --- a/packages/snaps-cli/package.json +++ b/packages/snaps-cli/package.json @@ -61,7 +61,7 @@ "@metamask/snaps-utils": "workspace:^", "@metamask/snaps-webpack-plugin": "workspace:^", "@metamask/superstruct": "^3.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@swc/core": "1.3.78", "assert": "^2.0.0", "babelify": "^10.0.0", diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index 16314cc3af..565e578be5 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -66,7 +66,7 @@ "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@xstate/fsm": "^2.0.0", "browserify-zlib": "^0.2.0", "concat-stream": "^2.0.0", diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index c55b631cbc..0cde0c2117 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -59,7 +59,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "nanoid": "^3.1.31", "readable-stream": "^3.6.2" }, diff --git a/packages/snaps-jest/package.json b/packages/snaps-jest/package.json index 5d6fe62943..3f95125b9f 100644 --- a/packages/snaps-jest/package.json +++ b/packages/snaps-jest/package.json @@ -52,7 +52,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@reduxjs/toolkit": "^1.9.5", "express": "^4.18.2", "jest-environment-node": "^29.5.0", diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index 0bc5448cf3..c3430b3c31 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -45,7 +45,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@noble/hashes": "^1.3.1" }, "devDependencies": { diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 3041a38c94..2056b55e63 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -63,7 +63,7 @@ "@metamask/providers": "^17.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/superstruct": "^3.0.0", - "@metamask/utils": "^8.3.0" + "@metamask/utils": "^8.5.0" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/snaps-simulator/package.json b/packages/snaps-simulator/package.json index 6e4f174720..88f88cbf67 100644 --- a/packages/snaps-simulator/package.json +++ b/packages/snaps-simulator/package.json @@ -41,7 +41,7 @@ "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@minoru/react-dnd-treeview": "^3.4.4", "@reduxjs/toolkit": "^1.9.5", "date-fns": "^2.30.0", diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index bf2bf53f91..13c9c6e942 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -60,7 +60,7 @@ "@metamask/snaps-registry": "^3.1.0", "@metamask/snaps-sdk": "workspace:^", "@metamask/superstruct": "^3.0.0", - "@metamask/utils": "^8.3.0", + "@metamask/utils": "^8.5.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.1", "chalk": "^4.1.2", diff --git a/packages/snaps-webpack-plugin/package.json b/packages/snaps-webpack-plugin/package.json index 69e92de043..44a0f813a8 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": "^8.5.0", "webpack-sources": "^3.2.3" }, "devDependencies": { diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index cfbc9f8649..4ae5d8a740 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": "^8.5.0", "@metamask/wasm-example-snap": "workspace:^", "@popperjs/core": "^2.11.8", "@reduxjs/toolkit": "^1.9.5", diff --git a/yarn.lock b/yarn.lock index 5dda50d4ad..c05bbd0ec3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3889,7 +3889,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@noble/ed25519": ^1.6.0 "@noble/secp256k1": ^1.7.1 "@swc/core": 1.3.78 @@ -3929,7 +3929,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@noble/bls12-381": ^1.2.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4090,7 +4090,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4146,7 +4146,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@noble/curves": ^1.1.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 @@ -4291,7 +4291,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4526,7 +4526,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4643,7 +4643,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@noble/bls12-381": ^1.2.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5492,7 +5492,7 @@ __metadata: "@metamask/snaps-utils": "workspace:^" "@metamask/snaps-webpack-plugin": "workspace:^" "@metamask/superstruct": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/browserify": ^12.0.37 @@ -5592,7 +5592,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/template-snap": ^0.7.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/chrome": ^0.0.237 @@ -5683,7 +5683,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/express": ^4.17.17 @@ -5766,7 +5766,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@reduxjs/toolkit": ^1.9.5 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5870,7 +5870,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5911,7 +5911,7 @@ __metadata: "@metamask/providers": ^17.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/superstruct": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5965,7 +5965,7 @@ __metadata: "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@minoru/react-dnd-treeview": ^3.4.4 "@pmmmwh/react-refresh-webpack-plugin": ^0.5.10 "@redux-saga/is": ^1.1.3 @@ -6064,7 +6064,7 @@ __metadata: "@metamask/snaps-registry": ^3.1.0 "@metamask/snaps-sdk": "workspace:^" "@metamask/superstruct": ^3.0.0 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 "@swc/core": 1.3.78 @@ -6136,7 +6136,7 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -6215,7 +6215,7 @@ __metadata: "@metamask/providers": ^17.0.0 "@metamask/signature-insights-example-snap": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@metamask/wasm-example-snap": "workspace:^" "@pmmmwh/react-refresh-webpack-plugin": ^0.5.10 "@popperjs/core": ^2.11.8 @@ -6283,6 +6283,23 @@ __metadata: languageName: node linkType: hard +"@metamask/utils@npm:^8.5.0": + version: 8.5.0 + resolution: "@metamask/utils@npm:8.5.0" + dependencies: + "@ethereumjs/tx": ^4.2.0 + "@metamask/superstruct": ^3.0.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 + uuid: ^9.0.1 + checksum: e8eac1c796c3f6b623be3c2736e8682248620f666b180f5c12ce56ee09587d4e28b6811862139a05c7a1bec91415f10ccf0516f3cdf342f88b0189d2a057c24b + languageName: node + linkType: hard + "@metamask/wasm-example-snap@workspace:^, @metamask/wasm-example-snap@workspace:packages/examples/packages/wasm": version: 0.0.0-use.local resolution: "@metamask/wasm-example-snap@workspace:packages/examples/packages/wasm" @@ -20491,7 +20508,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": ^8.5.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@types/node": 18.14.2 From 04da74733bbf50ce4c42187ea16eb8053dfc7328 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 6 Jun 2024 20:31:39 -0400 Subject: [PATCH 04/47] Fix more `superstruct` imports to `@metamask/superstruct` --- .../src/common/validation.ts | 20 +++++++------- packages/snaps-jest/src/internals/request.ts | 2 +- .../src/internals/simulation/options.ts | 2 +- packages/snaps-jest/src/internals/structs.ts | 2 +- packages/snaps-jest/src/options.ts | 2 +- .../src/restricted/dialog.ts | 2 +- packages/snaps-sdk/src/internals/jsx.ts | 5 ++-- packages/snaps-sdk/src/internals/structs.ts | 5 ++-- .../snaps-sdk/src/jsx/validation.test.tsx | 2 +- packages/snaps-sdk/src/jsx/validation.ts | 27 ++++++++++--------- .../src/types/handlers/user-input.ts | 2 +- .../snaps-sdk/src/ui/components/copyable.ts | 2 +- packages/snaps-sdk/src/ui/components/text.ts | 2 +- packages/snaps-utils/src/handlers.ts | 2 +- packages/snaps-utils/src/localization.ts | 2 +- packages/snaps-utils/src/namespace.ts | 2 +- packages/snaps-utils/src/snaps.ts | 2 +- packages/snaps-utils/src/structs.test.ts | 6 ++--- packages/snaps-utils/src/structs.ts | 2 +- packages/snaps-utils/src/types.ts | 2 +- 20 files changed, 47 insertions(+), 46 deletions(-) diff --git a/packages/snaps-execution-environments/src/common/validation.ts b/packages/snaps-execution-environments/src/common/validation.ts index 35971d9e62..e28c6c3f62 100644 --- a/packages/snaps-execution-environments/src/common/validation.ts +++ b/packages/snaps-execution-environments/src/common/validation.ts @@ -4,15 +4,6 @@ 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 '@metamask/superstruct'; import { array, @@ -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/src/internals/request.ts b/packages/snaps-jest/src/internals/request.ts index 44c4da8db1..05d0a94bcc 100644 --- a/packages/snaps-jest/src/internals/request.ts +++ b/packages/snaps-jest/src/internals/request.ts @@ -14,7 +14,7 @@ import { isPlainObject, } from '@metamask/utils'; import { nanoid } from '@reduxjs/toolkit'; -import { is } from 'superstruct'; +import { is } from '@metamask/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 150d93615f..e090e68ab1 100644 --- a/packages/snaps-jest/src/internals/simulation/options.ts +++ b/packages/snaps-jest/src/internals/simulation/options.ts @@ -8,7 +8,7 @@ import { optional, record, string, -} from 'superstruct'; +} from '@metamask/superstruct'; import { DEFAULT_LOCALE, DEFAULT_SRP } from './constants'; diff --git a/packages/snaps-jest/src/internals/structs.ts b/packages/snaps-jest/src/internals/structs.ts index 96ca2b07ee..1a886e95ba 100644 --- a/packages/snaps-jest/src/internals/structs.ts +++ b/packages/snaps-jest/src/internals/structs.ts @@ -24,7 +24,7 @@ import { any, func, type, -} from 'superstruct'; +} from '@metamask/superstruct'; // TODO: Export this from `@metamask/utils` instead. const BytesLikeStruct = union([ diff --git a/packages/snaps-jest/src/options.ts b/packages/snaps-jest/src/options.ts index cf6dd1603f..44c0b06d56 100644 --- a/packages/snaps-jest/src/options.ts +++ b/packages/snaps-jest/src/options.ts @@ -7,7 +7,7 @@ import { object, string, type, -} from 'superstruct'; +} from '@metamask/superstruct'; const SnapsEnvironmentOptionsStruct = type({ server: defaulted( diff --git a/packages/snaps-rpc-methods/src/restricted/dialog.ts b/packages/snaps-rpc-methods/src/restricted/dialog.ts index dac05b09ed..f1630d340f 100644 --- a/packages/snaps-rpc-methods/src/restricted/dialog.ts +++ b/packages/snaps-rpc-methods/src/restricted/dialog.ts @@ -31,7 +31,7 @@ import { size, string, type, -} from 'superstruct'; +} from '@metamask/superstruct'; import { type MethodHooksObject } from '../utils'; 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.ts b/packages/snaps-sdk/src/internals/structs.ts index 929911e3c0..cbe4453e23 100644 --- a/packages/snaps-sdk/src/internals/structs.ts +++ b/packages/snaps-sdk/src/internals/structs.ts @@ -1,11 +1,10 @@ -import type { Infer } from '@metamask/superstruct'; +import type { AnyStruct, Infer, InferStructTuple } from '@metamask/superstruct'; import { Struct, define, literal as superstructLiteral, union as superstructUnion, -} from 'superstruct'; -import type { AnyStruct, InferStructTuple } from 'superstruct/dist/utils'; +} from '@metamask/superstruct'; import type { EnumToUnion } from './helpers'; diff --git a/packages/snaps-sdk/src/jsx/validation.test.tsx b/packages/snaps-sdk/src/jsx/validation.test.tsx index a2db491599..420e6a6835 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 64a38ac4ef..7a752ce401 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 } from '../internals'; diff --git a/packages/snaps-sdk/src/types/handlers/user-input.ts b/packages/snaps-sdk/src/types/handlers/user-input.ts index 990ecb68a3..fb2bdb477f 100644 --- a/packages/snaps-sdk/src/types/handlers/user-input.ts +++ b/packages/snaps-sdk/src/types/handlers/user-input.ts @@ -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/ui/components/copyable.ts b/packages/snaps-sdk/src/ui/components/copyable.ts index 1db9675767..1825dc127f 100644 --- a/packages/snaps-sdk/src/ui/components/copyable.ts +++ b/packages/snaps-sdk/src/ui/components/copyable.ts @@ -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/text.ts b/packages/snaps-sdk/src/ui/components/text.ts index ea36b9649f..c6dc6522ca 100644 --- a/packages/snaps-sdk/src/ui/components/text.ts +++ b/packages/snaps-sdk/src/ui/components/text.ts @@ -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-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/localization.ts b/packages/snaps-utils/src/localization.ts index 217e1511c5..e3b1a78b35 100644 --- a/packages/snaps-utils/src/localization.ts +++ b/packages/snaps-utils/src/localization.ts @@ -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/namespace.ts b/packages/snaps-utils/src/namespace.ts index 305db22c40..b656223ad4 100644 --- a/packages/snaps-utils/src/namespace.ts +++ b/packages/snaps-utils/src/namespace.ts @@ -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.ts b/packages/snaps-utils/src/snaps.ts index 5260a4d5be..f720d89912 100644 --- a/packages/snaps-utils/src/snaps.ts +++ b/packages/snaps-utils/src/snaps.ts @@ -20,7 +20,7 @@ import { string, union, validate, -} from 'superstruct'; +} from '@metamask/superstruct'; 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 1c58b50f40..1be13733e1 100644 --- a/packages/snaps-utils/src/structs.test.ts +++ b/packages/snaps-utils/src/structs.test.ts @@ -1,6 +1,4 @@ import { union, literal } from '@metamask/snaps-sdk'; -import { assert } from '@metamask/utils'; -import { bold, green, red } from 'chalk'; import type { Struct } from '@metamask/superstruct'; import superstruct, { size, @@ -12,7 +10,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'; diff --git a/packages/snaps-utils/src/structs.ts b/packages/snaps-utils/src/structs.ts index 8a307b50ae..f6e548712d 100644 --- a/packages/snaps-utils/src/structs.ts +++ b/packages/snaps-utils/src/structs.ts @@ -7,13 +7,13 @@ import type { ObjectType, } from '@metamask/superstruct'; import { + assign, is, validate, type as superstructType, Struct, StructError, create, - assign, } from '@metamask/superstruct'; import type { NonEmptyArray } from '@metamask/utils'; import { assert, isObject } from '@metamask/utils'; diff --git a/packages/snaps-utils/src/types.ts b/packages/snaps-utils/src/types.ts index df1372136b..a1adad7e68 100644 --- a/packages/snaps-utils/src/types.ts +++ b/packages/snaps-utils/src/types.ts @@ -13,7 +13,7 @@ import { type, union, assert as assertSuperstruct, -} from 'superstruct'; +} from '@metamask/superstruct'; import type { SnapCaveatType } from './caveats'; import type { SnapFunctionExports, SnapRpcHookArgs } from './handlers'; From 0ef9a63a6c0bd82e9e09ce25fb82a8b3d9902f5f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 6 Jun 2024 20:38:03 -0400 Subject: [PATCH 05/47] Linter fixes --- packages/snaps-cli/src/structs.test.ts | 2 +- packages/snaps-cli/src/structs.ts | 2 +- .../src/services/AbstractExecutionService.ts | 5 ++--- .../src/common/BaseSnapExecutor.ts | 2 +- packages/snaps-jest/src/internals/request.ts | 2 +- .../src/internals/simulation/options.ts | 2 +- packages/snaps-jest/src/internals/structs.ts | 14 +++++++------- packages/snaps-jest/src/matchers.ts | 2 +- packages/snaps-jest/src/types.ts | 2 +- .../snaps-rpc-methods/src/permitted/getFile.ts | 2 +- .../src/permitted/getInterfaceState.ts | 2 +- .../src/permitted/updateInterface.ts | 2 +- .../caveats/permittedDerivationPaths.ts | 2 +- .../src/restricted/caveats/snapIds.ts | 2 +- .../snaps-rpc-methods/src/restricted/dialog.ts | 2 +- .../src/restricted/getEntropy.ts | 4 ++-- .../src/restricted/manageAccounts.ts | 4 ++-- packages/snaps-sdk/src/ui/builder.ts | 2 +- packages/snaps-sdk/src/ui/component.ts | 2 +- .../snaps-sdk/src/ui/components/address.ts | 2 +- packages/snaps-utils/src/cronjob.ts | 12 ++++++------ packages/snaps-utils/src/json-rpc.ts | 18 +++++++++--------- packages/snaps-utils/src/snaps.ts | 8 ++++---- packages/snaps-utils/src/types.ts | 4 ++-- packages/snaps-utils/src/versions.ts | 2 +- 25 files changed, 51 insertions(+), 52 deletions(-) diff --git a/packages/snaps-cli/src/structs.test.ts b/packages/snaps-cli/src/structs.test.ts index 42c1106119..534fd569fd 100644 --- a/packages/snaps-cli/src/structs.test.ts +++ b/packages/snaps-cli/src/structs.test.ts @@ -1,5 +1,5 @@ -import { resolve } from 'path/posix'; import { create, is } from '@metamask/superstruct'; +import { resolve } from 'path/posix'; import { file } from './structs'; diff --git a/packages/snaps-cli/src/structs.ts b/packages/snaps-cli/src/structs.ts index 4acb094a81..c6bd57ec59 100644 --- a/packages/snaps-cli/src/structs.ts +++ b/packages/snaps-cli/src/structs.ts @@ -1,5 +1,5 @@ -import { resolve } from 'path'; import { coerce, string } from '@metamask/superstruct'; +import { resolve } from 'path'; /** * A wrapper of `superstruct`'s `string` struct that coerces a value to a string diff --git a/packages/snaps-controllers/src/services/AbstractExecutionService.ts b/packages/snaps-controllers/src/services/AbstractExecutionService.ts index 6b5f9c57d2..c0b0d102a6 100644 --- a/packages/snaps-controllers/src/services/AbstractExecutionService.ts +++ b/packages/snaps-controllers/src/services/AbstractExecutionService.ts @@ -441,9 +441,8 @@ export abstract class AbstractExecutionService } log('Parent: Sending Command', message); - const response: PendingJsonRpcResponse = await job.rpcEngine.handle( - message, - ); + const response: PendingJsonRpcResponse = + job.rpcEngine.handle(message); if (response.error) { throw new JsonRpcError( diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index e2ccd1d865..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 '@metamask/superstruct'; import { log } from '../logging'; import type { CommandMethodsMapping } from './commands'; diff --git a/packages/snaps-jest/src/internals/request.ts b/packages/snaps-jest/src/internals/request.ts index 05d0a94bcc..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 '@metamask/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 e090e68ab1..2ea0be940f 100644 --- a/packages/snaps-jest/src/internals/simulation/options.ts +++ b/packages/snaps-jest/src/internals/simulation/options.ts @@ -1,4 +1,3 @@ -import { JsonStruct } from '@metamask/utils'; import type { Infer } from '@metamask/superstruct'; import { create, @@ -9,6 +8,7 @@ import { record, string, } from '@metamask/superstruct'; +import { JsonStruct } from '@metamask/utils'; import { DEFAULT_LOCALE, DEFAULT_SRP } from './constants'; diff --git a/packages/snaps-jest/src/internals/structs.ts b/packages/snaps-jest/src/internals/structs.ts index 1a886e95ba..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, @@ -25,6 +18,13 @@ import { func, type, } 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 a43c38cf6b..094835a1eb 100644 --- a/packages/snaps-jest/src/matchers.ts +++ b/packages/snaps-jest/src/matchers.ts @@ -18,6 +18,7 @@ import type { } from '@metamask/snaps-sdk/jsx'; import { isJSXElementUnsafe } from '@metamask/snaps-sdk/jsx'; import { getJsxElementFromComponent } 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'; @@ -30,7 +31,6 @@ import { printWithType, RECEIVED_COLOR, } from 'jest-matcher-utils'; -import { is } from '@metamask/superstruct'; import { InterfaceStruct, SnapResponseStruct } from './internals'; import type { SnapResponse } from './types'; diff --git a/packages/snaps-jest/src/types.ts b/packages/snaps-jest/src/types.ts index 270a26ff36..6f6c42a122 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 { Json, JsonRpcId, JsonRpcParams } from '@metamask/utils'; import type { Infer } from '@metamask/superstruct'; +import type { Json, JsonRpcId, JsonRpcParams } from '@metamask/utils'; import type { SignatureOptionsStruct, diff --git a/packages/snaps-rpc-methods/src/permitted/getFile.ts b/packages/snaps-rpc-methods/src/permitted/getFile.ts index c2785596c7..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 '@metamask/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 c2d8b3f35f..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 type { PendingJsonRpcResponse } from '@metamask/utils'; import { StructError, create, object, string } from '@metamask/superstruct'; +import type { PendingJsonRpcResponse } from '@metamask/utils'; 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 e7acd44f00..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 type { PendingJsonRpcResponse } from '@metamask/utils'; import { StructError, create, object, string } from '@metamask/superstruct'; +import type { PendingJsonRpcResponse } from '@metamask/utils'; 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 074f9cb5d5..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 '@metamask/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 61ad66642d..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 '@metamask/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 f1630d340f..f10389f8ec 100644 --- a/packages/snaps-rpc-methods/src/restricted/dialog.ts +++ b/packages/snaps-rpc-methods/src/restricted/dialog.ts @@ -21,7 +21,6 @@ import type { } from '@metamask/snaps-sdk'; import { createUnion } from '@metamask/snaps-utils'; import type { InferMatching } from '@metamask/snaps-utils'; -import { hasProperty, type NonEmptyArray } from '@metamask/utils'; import type { Infer, Struct } from '@metamask/superstruct'; import { create, @@ -32,6 +31,7 @@ import { string, type, } from '@metamask/superstruct'; +import { hasProperty, type NonEmptyArray } from '@metamask/utils'; import { type MethodHooksObject } from '../utils'; diff --git a/packages/snaps-rpc-methods/src/restricted/getEntropy.ts b/packages/snaps-rpc-methods/src/restricted/getEntropy.ts index 5570242648..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 { NonEmptyArray } from '@metamask/utils'; -import { assertStruct } from '@metamask/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 { 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 9c382e2fb9..220fa25ba2 100644 --- a/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts +++ b/packages/snaps-rpc-methods/src/restricted/manageAccounts.ts @@ -9,8 +9,6 @@ import type { ManageAccountsResult, } from '@metamask/snaps-sdk'; import type { InferMatching } from '@metamask/snaps-utils'; -import type { Json, NonEmptyArray } from '@metamask/utils'; -import { JsonStruct } from '@metamask/utils'; import { assert, string, @@ -19,6 +17,8 @@ import { array, record, } from '@metamask/superstruct'; +import type { Json, NonEmptyArray } from '@metamask/utils'; +import { JsonStruct } from '@metamask/utils'; const SnapMessageStruct = union([ object({ diff --git a/packages/snaps-sdk/src/ui/builder.ts b/packages/snaps-sdk/src/ui/builder.ts index a40e7fb621..03514b2533 100644 --- a/packages/snaps-sdk/src/ui/builder.ts +++ b/packages/snaps-sdk/src/ui/builder.ts @@ -1,5 +1,5 @@ -import { assertStruct, isPlainObject } from '@metamask/utils'; import type { Struct } from '@metamask/superstruct'; +import { assertStruct, isPlainObject } from '@metamask/utils'; 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 66628c0348..a482e99ce2 100644 --- a/packages/snaps-sdk/src/ui/component.ts +++ b/packages/snaps-sdk/src/ui/component.ts @@ -1,5 +1,5 @@ -import { assertStruct } from '@metamask/utils'; import { is } from '@metamask/superstruct'; +import { assertStruct } from '@metamask/utils'; 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 90317283fc..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 { HexChecksumAddressStruct } from '@metamask/utils'; import type { Infer } from '@metamask/superstruct'; import { assign, literal, object } from '@metamask/superstruct'; +import { HexChecksumAddressStruct } from '@metamask/utils'; import { createBuilder } from '../builder'; import { LiteralStruct, NodeType } from '../nodes'; diff --git a/packages/snaps-utils/src/cronjob.ts b/packages/snaps-utils/src/cronjob.ts index 9f613bf1ae..694ce762c0 100644 --- a/packages/snaps-utils/src/cronjob.ts +++ b/packages/snaps-utils/src/cronjob.ts @@ -1,9 +1,3 @@ -import { - JsonRpcIdStruct, - JsonRpcParamsStruct, - JsonRpcVersionStruct, -} from '@metamask/utils'; -import { parseExpression } from 'cron-parser'; import type { Infer } from '@metamask/superstruct'; import { array, @@ -13,6 +7,12 @@ import { refine, string, } from '@metamask/superstruct'; +import { + JsonRpcIdStruct, + JsonRpcParamsStruct, + JsonRpcVersionStruct, +} from '@metamask/utils'; +import { parseExpression } from 'cron-parser'; export const CronjobRpcRequestStruct = object({ jsonrpc: optional(JsonRpcVersionStruct), diff --git a/packages/snaps-utils/src/json-rpc.ts b/packages/snaps-utils/src/json-rpc.ts index 8c1275f3ad..4792eecc3d 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,15 +18,6 @@ import { isJsonRpcFailure, isJsonRpcSuccess, } from '@metamask/utils'; -import type { Infer } from '@metamask/superstruct'; -import { - array, - boolean, - object, - optional, - refine, - string, -} from '@metamask/superstruct'; const AllowedOriginsStruct = array( refine(string(), 'Allowed origin', (value) => { diff --git a/packages/snaps-utils/src/snaps.ts b/packages/snaps-utils/src/snaps.ts index f720d89912..5db313e993 100644 --- a/packages/snaps-utils/src/snaps.ts +++ b/packages/snaps-utils/src/snaps.ts @@ -5,10 +5,6 @@ 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 '@metamask/superstruct'; import { empty, @@ -21,6 +17,10 @@ import { union, validate, } 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/types.ts b/packages/snaps-utils/src/types.ts index a1adad7e68..8aed6bd340 100644 --- a/packages/snaps-utils/src/types.ts +++ b/packages/snaps-utils/src/types.ts @@ -1,5 +1,3 @@ -import type { Json } from '@metamask/utils'; -import { assertStruct, VersionStruct } from '@metamask/utils'; import type { Infer, Struct } from '@metamask/superstruct'; import { instance, @@ -14,6 +12,8 @@ import { union, assert as assertSuperstruct, } 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 399bd84a58..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 '@metamask/superstruct'; export const DEFAULT_REQUESTED_SNAP_VERSION = '*' as SemVerRange; From ac8e786da0e2fb642d4998b5fe50b2834a0bb7f5 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 7 Jun 2024 10:57:10 -0400 Subject: [PATCH 06/47] Add lavamoat policy allowlisting `@metamask/superstruct` for `@metamask/utils` --- .../lavamoat/browserify/iframe/policy.json | 18 ++++++------------ .../browserify/node-process/policy.json | 18 ++++++------------ .../browserify/node-thread/policy.json | 18 ++++++------------ .../lavamoat/browserify/webview/policy.json | 18 ++++++------------ .../browserify/worker-executor/policy.json | 18 ++++++------------ .../browserify/worker-pool/policy.json | 18 ++++++------------ .../lavamoat/build-system/policy.json | 8 +------- yarn.lock | 19 +------------------ 8 files changed, 38 insertions(+), 97 deletions(-) diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index c0c0f35f59..7d8165dfa6 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, @@ -218,4 +212,4 @@ } } } -} \ No newline at end of file +} 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..25970c1f1a 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, @@ -263,4 +257,4 @@ } } } -} \ No newline at end of file +} 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..25970c1f1a 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, @@ -263,4 +257,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 31bf63a082..9eb5d3970e 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, @@ -157,4 +151,4 @@ } } } -} \ No newline at end of file +} 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..7d8165dfa6 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, @@ -218,4 +212,4 @@ } } } -} \ No newline at end of file +} 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..9eb5d3970e 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, @@ -157,4 +151,4 @@ } } } -} \ No newline at end of file +} 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/yarn.lock b/yarn.lock index c05bbd0ec3..d60c8cb826 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6266,24 +6266,7 @@ __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" - dependencies: - "@ethereumjs/tx": ^4.2.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 - languageName: node - linkType: hard - -"@metamask/utils@npm:^8.5.0": +"@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, @metamask/utils@npm:^8.5.0": version: 8.5.0 resolution: "@metamask/utils@npm:8.5.0" dependencies: From b522f181ef25f26bcd02c0494bf8fd9e6ecb5047 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 7 Jun 2024 14:25:57 -0400 Subject: [PATCH 07/47] Bump dependency `@metamask/utils` to `^8.5.0` in example packages to satisfy yarn constraints --- .../examples/packages/ethereum-provider/package.json | 2 +- packages/examples/packages/interactive-ui/package.json | 2 +- packages/examples/packages/jsx/package.json | 2 +- packages/examples/packages/network-access/package.json | 2 +- .../packages/transaction-insights/package.json | 2 +- yarn.lock | 10 +++++----- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/examples/packages/ethereum-provider/package.json b/packages/examples/packages/ethereum-provider/package.json index 14266df8a8..d876645c1c 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": "^8.5.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/interactive-ui/package.json b/packages/examples/packages/interactive-ui/package.json index 038063beb1..c4e2299805 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": "^8.5.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/jsx/package.json b/packages/examples/packages/jsx/package.json index 6bd9553006..d2a12beb46 100644 --- a/packages/examples/packages/jsx/package.json +++ b/packages/examples/packages/jsx/package.json @@ -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": "^8.5.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/network-access/package.json b/packages/examples/packages/network-access/package.json index 277f21840c..0cbc766910 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": "^8.5.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/transaction-insights/package.json b/packages/examples/packages/transaction-insights/package.json index 3a2de117e7..7ee623e8a3 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": "^8.5.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/yarn.lock b/yarn.lock index d60c8cb826..426b684eda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4489,7 +4489,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4790,7 +4790,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4827,7 +4827,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4976,7 +4976,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5171,7 +5171,7 @@ __metadata: "@metamask/snaps-controllers": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 From c7d2a6ca2c9d781c549627d655189924382f050f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 14 Jun 2024 11:14:18 -0400 Subject: [PATCH 08/47] Fix `superstruct` imports introduced from main branch --- packages/snaps-sdk/src/internals/svg.test.ts | 2 +- packages/snaps-sdk/src/internals/svg.ts | 2 +- packages/snaps-sdk/src/types/handlers/user-input.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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/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, From ce6b2d46e4342b0680e83a6910dbe9312be5be9e Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 14 Jun 2024 11:16:58 -0400 Subject: [PATCH 09/47] Bump dependency `@metamask/utils` to `^8.5.0` in new example package --- packages/examples/packages/file-upload/package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/examples/packages/file-upload/package.json b/packages/examples/packages/file-upload/package.json index 64fed7c78a..26931f6049 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": "^8.5.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/yarn.lock b/yarn.lock index 426b684eda..b17b931fa9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4605,7 +4605,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 From 03517e365245b1f42c046ee3a5cbcdd4d036bb5e Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 14 Jun 2024 13:04:22 -0400 Subject: [PATCH 10/47] Fix incorrect typing of `JsonRpcEngine.handle` return value, and improve type narrowing with type guard --- .../src/services/AbstractExecutionService.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/snaps-controllers/src/services/AbstractExecutionService.ts b/packages/snaps-controllers/src/services/AbstractExecutionService.ts index c0b0d102a6..de400b18ec 100644 --- a/packages/snaps-controllers/src/services/AbstractExecutionService.ts +++ b/packages/snaps-controllers/src/services/AbstractExecutionService.ts @@ -7,9 +7,9 @@ import type { SnapRpcHook, SnapRpcHookArgs } from '@metamask/snaps-utils'; import { SNAP_STREAM_NAMES, logError } from '@metamask/snaps-utils'; import type { Json, + JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, - PendingJsonRpcResponse, } from '@metamask/utils'; import { Duration, @@ -441,10 +441,14 @@ export abstract class AbstractExecutionService } log('Parent: Sending Command', message); - const response: PendingJsonRpcResponse = - job.rpcEngine.handle(message); - - if (response.error) { + // eslint is blocking `await` usage even though `handle` returns a promise. + // eslint-disable-next-line @typescript-eslint/await-thenable + const response = await job.rpcEngine.handle(message); + + if ( + ((res): res is JsonRpcFailure => + 'error' in res && res.error !== undefined)(response) + ) { throw new JsonRpcError( response.error.code, response.error.message, From 4a0c7a15121b787282c944a6d73b877e6e9cd85a Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 14 Jun 2024 13:09:00 -0400 Subject: [PATCH 11/47] Fix `snaps-sdk` tests by applying `@ts-expect-error` annotations to deliberately invalid inputs --- packages/snaps-sdk/src/ui/components/image.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/snaps-sdk/src/ui/components/image.test.ts b/packages/snaps-sdk/src/ui/components/image.test.ts index c5f2a05287..76619ec467 100644 --- a/packages/snaps-sdk/src/ui/components/image.test.ts +++ b/packages/snaps-sdk/src/ui/components/image.test.ts @@ -23,10 +23,12 @@ describe('image', () => { 'Invalid image component: At path: value -- Value is not a valid SVG.', ); + // @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 - 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.', ); From 91a1898df01d603969dcb8d20415828aeddc8777 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 24 Jun 2024 10:29:56 -0400 Subject: [PATCH 12/47] Fix subpath import --- packages/snaps-jest/src/internals/structs.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/snaps-jest/src/internals/structs.test.tsx b/packages/snaps-jest/src/internals/structs.test.tsx index 43ae0c6b20..cc88a27a1d 100644 --- a/packages/snaps-jest/src/internals/structs.test.tsx +++ b/packages/snaps-jest/src/internals/structs.test.tsx @@ -1,4 +1,4 @@ -import { Box, Text } from '@metamask/snaps-sdk'; +import { Box, Text } from '@metamask/snaps-sdk/jsx'; import { create } from '@metamask/superstruct'; import { From 3aff7373891bfbc353f5d5703760393e146215d1 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 24 Jun 2024 11:03:38 -0400 Subject: [PATCH 13/47] Update lavamoat policies --- .../lavamoat/browserify/iframe/policy.json | 2 +- .../lavamoat/browserify/node-process/policy.json | 2 +- .../lavamoat/browserify/node-thread/policy.json | 2 +- .../lavamoat/browserify/webview/policy.json | 2 +- .../lavamoat/browserify/worker-executor/policy.json | 2 +- .../lavamoat/browserify/worker-pool/policy.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index 7d8165dfa6..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -212,4 +212,4 @@ } } } -} +} \ No newline at end of file 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 25970c1f1a..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -257,4 +257,4 @@ } } } -} +} \ No newline at end of file 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 25970c1f1a..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -257,4 +257,4 @@ } } } -} +} \ No newline at end of file diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 9eb5d3970e..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -151,4 +151,4 @@ } } } -} +} \ No newline at end of file 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 7d8165dfa6..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -212,4 +212,4 @@ } } } -} +} \ No newline at end of file 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 9eb5d3970e..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -151,4 +151,4 @@ } } } -} +} \ No newline at end of file From 5a56e9b223a33601cae8c0bec3f89c5e6b3629ae Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 24 Jun 2024 17:34:03 -0400 Subject: [PATCH 14/47] [snaps-utils] test: fix mock for `@metamask/superstruct` module --- packages/snaps-utils/src/structs.test.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/snaps-utils/src/structs.test.ts b/packages/snaps-utils/src/structs.test.ts index 1be13733e1..f67b6d9cef 100644 --- a/packages/snaps-utils/src/structs.test.ts +++ b/packages/snaps-utils/src/structs.test.ts @@ -1,6 +1,7 @@ import { union, literal } from '@metamask/snaps-sdk'; import type { Struct } from '@metamask/superstruct'; -import superstruct, { +import { + create, size, defaulted, number, @@ -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.'); }); From a1901c56be5477a90a2e5051224691864c48b456 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Tue, 25 Jun 2024 12:52:50 -0400 Subject: [PATCH 15/47] Update coverage --- packages/snaps-controllers/coverage.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/snaps-controllers/coverage.json b/packages/snaps-controllers/coverage.json index 94c92cee99..0048a288ca 100644 --- a/packages/snaps-controllers/coverage.json +++ b/packages/snaps-controllers/coverage.json @@ -1,6 +1,6 @@ { - "branches": 92.08, - "functions": 96.74, - "lines": 97.95, + "branches": 92.11, + "functions": 96.75, + "lines": 97.96, "statements": 97.63 } From 3eb9330cec79f88d0e30e011fc7aa791a5216e1c Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 26 Jun 2024 10:33:34 -0400 Subject: [PATCH 16/47] Use `isJsonRpcFailure` type guard --- .../src/services/AbstractExecutionService.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/snaps-controllers/src/services/AbstractExecutionService.ts b/packages/snaps-controllers/src/services/AbstractExecutionService.ts index de400b18ec..ccc7c17435 100644 --- a/packages/snaps-controllers/src/services/AbstractExecutionService.ts +++ b/packages/snaps-controllers/src/services/AbstractExecutionService.ts @@ -7,7 +7,6 @@ import type { SnapRpcHook, SnapRpcHookArgs } from '@metamask/snaps-utils'; import { SNAP_STREAM_NAMES, logError } from '@metamask/snaps-utils'; import type { Json, - JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, } from '@metamask/utils'; @@ -15,6 +14,7 @@ import { Duration, assertIsJsonRpcRequest, inMilliseconds, + isJsonRpcFailure, isJsonRpcNotification, isObject, } from '@metamask/utils'; @@ -441,14 +441,9 @@ export abstract class AbstractExecutionService } log('Parent: Sending Command', message); - // eslint is blocking `await` usage even though `handle` returns a promise. - // eslint-disable-next-line @typescript-eslint/await-thenable const response = await job.rpcEngine.handle(message); - if ( - ((res): res is JsonRpcFailure => - 'error' in res && res.error !== undefined)(response) - ) { + if (isJsonRpcFailure(response)) { throw new JsonRpcError( response.error.code, response.error.message, From b7d8daa55c230f5658b3267785050acf90d75c19 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 26 Jun 2024 11:56:41 -0400 Subject: [PATCH 17/47] Bump dependency `@metamask/snaps-registry` from `^3.1.0` to `^3.2.0` in `snaps-controllers` and `snaps-utils` --- packages/snaps-controllers/package.json | 2 +- packages/snaps-utils/package.json | 2 +- yarn.lock | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index 2c45642b75..01d06c76b1 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -62,7 +62,7 @@ "@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/snaps-registry": "^3.2.0", "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 13c9c6e942..8657e9d15f 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -57,7 +57,7 @@ "@metamask/permission-controller": "^10.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/slip44": "^3.1.0", - "@metamask/snaps-registry": "^3.1.0", + "@metamask/snaps-registry": "^3.2.0", "@metamask/snaps-sdk": "workspace:^", "@metamask/superstruct": "^3.0.0", "@metamask/utils": "^8.5.0", diff --git a/yarn.lock b/yarn.lock index b17b931fa9..66229f7370 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5587,7 +5587,7 @@ __metadata: "@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/snaps-registry": ^3.2.0 "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" @@ -5802,15 +5802,15 @@ __metadata: 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.0": + version: 3.2.0 + resolution: "@metamask/snaps-registry@npm:3.2.0" dependencies: - "@metamask/utils": ^8.3.0 + "@metamask/superstruct": ^3.0.0 + "@metamask/utils": ^8.5.0 "@noble/curves": ^1.2.0 "@noble/hashes": ^1.3.2 - superstruct: ^1.0.3 - checksum: 019cb47134c2ad4724f4f392385d4e81ab61dfefb12e66a88a2480a178502190e2d5d99cf269b906e4acda1b88de3fe356c80e71dc32c6c3f0fada9461c9bc49 + checksum: ac3537cda6454f461e6d00623aefa29ee3e7f7c68003c7629fc550c1f27694115c475d626c89172bd7ecb52de2a0b75db64aa9fe9e8625492e335337d3f579f7 languageName: node linkType: hard @@ -6061,7 +6061,7 @@ __metadata: "@metamask/post-message-stream": ^8.1.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/slip44": ^3.1.0 - "@metamask/snaps-registry": ^3.1.0 + "@metamask/snaps-registry": ^3.2.0 "@metamask/snaps-sdk": "workspace:^" "@metamask/superstruct": ^3.0.0 "@metamask/utils": ^8.5.0 From 664711bf64c12d12ffecf363789809fd466892dd Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 26 Jun 2024 12:57:27 -0400 Subject: [PATCH 18/47] Update coverage --- packages/snaps-controllers/coverage.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/snaps-controllers/coverage.json b/packages/snaps-controllers/coverage.json index 148227a105..b6f03051c8 100644 --- a/packages/snaps-controllers/coverage.json +++ b/packages/snaps-controllers/coverage.json @@ -1,6 +1,6 @@ { - "branches": 92.11, - "functions": 96.75, + "branches": 92.08, + "functions": 96.74, "lines": 97.96, "statements": 97.64 } From 734d29c0bf5149e9af005f58075c436c4a2ddc72 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:20:40 -0400 Subject: [PATCH 19/47] Fix import from `superstruct` --- packages/snaps-rpc-methods/src/permitted/resolveInterface.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'; From ca11f484b5e393c2fc4a5c2c1521d5d560d734f0 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:21:28 -0400 Subject: [PATCH 20/47] Bump `@metamask/superstruct` from `^3.0.0` to `^3.1.0` in all packages --- packages/snaps-cli/package.json | 2 +- .../snaps-execution-environments/package.json | 2 +- packages/snaps-jest/package.json | 2 +- packages/snaps-rpc-methods/package.json | 2 +- packages/snaps-sdk/package.json | 2 +- packages/snaps-utils/package.json | 2 +- yarn.lock | 19 +++++++++++++------ 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/snaps-cli/package.json b/packages/snaps-cli/package.json index 46fba671d9..84a5682918 100644 --- a/packages/snaps-cli/package.json +++ b/packages/snaps-cli/package.json @@ -60,7 +60,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/snaps-webpack-plugin": "workspace:^", - "@metamask/superstruct": "^3.0.0", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^8.5.0", "@swc/core": "1.3.78", "assert": "^2.0.0", diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 0cde0c2117..bfde2d1930 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -58,7 +58,7 @@ "@metamask/rpc-errors": "^6.2.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/superstruct": "^3.0.0", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^8.5.0", "nanoid": "^3.1.31", "readable-stream": "^3.6.2" diff --git a/packages/snaps-jest/package.json b/packages/snaps-jest/package.json index 3f95125b9f..6e1d3d476d 100644 --- a/packages/snaps-jest/package.json +++ b/packages/snaps-jest/package.json @@ -51,7 +51,7 @@ "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/superstruct": "^3.0.0", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^8.5.0", "@reduxjs/toolkit": "^1.9.5", "express": "^4.18.2", diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index c3430b3c31..b959058070 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -44,7 +44,7 @@ "@metamask/rpc-errors": "^6.2.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/superstruct": "^3.0.0", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^8.5.0", "@noble/hashes": "^1.3.1" }, diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 2056b55e63..43a54095b3 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -62,7 +62,7 @@ "@metamask/key-tree": "^9.1.1", "@metamask/providers": "^17.0.0", "@metamask/rpc-errors": "^6.2.1", - "@metamask/superstruct": "^3.0.0", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^8.5.0" }, "devDependencies": { diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 8657e9d15f..31ebc42a39 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -59,7 +59,7 @@ "@metamask/slip44": "^3.1.0", "@metamask/snaps-registry": "^3.2.0", "@metamask/snaps-sdk": "workspace:^", - "@metamask/superstruct": "^3.0.0", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^8.5.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.1", diff --git a/yarn.lock b/yarn.lock index 8b3667cb42..46c6226cef 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5491,7 +5491,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/snaps-webpack-plugin": "workspace:^" - "@metamask/superstruct": ^3.0.0 + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5682,7 +5682,7 @@ __metadata: "@metamask/rpc-errors": ^6.2.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/superstruct": ^3.0.0 + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5765,7 +5765,7 @@ __metadata: "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/superstruct": ^3.0.0 + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^8.5.0 "@reduxjs/toolkit": ^1.9.5 "@swc/core": 1.3.78 @@ -5869,7 +5869,7 @@ __metadata: "@metamask/rpc-errors": ^6.2.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/superstruct": ^3.0.0 + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^8.5.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 @@ -5910,7 +5910,7 @@ __metadata: "@metamask/key-tree": ^9.1.1 "@metamask/providers": ^17.0.0 "@metamask/rpc-errors": ^6.2.1 - "@metamask/superstruct": ^3.0.0 + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^8.5.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 @@ -6072,7 +6072,7 @@ __metadata: "@metamask/slip44": ^3.1.0 "@metamask/snaps-registry": ^3.2.0 "@metamask/snaps-sdk": "workspace:^" - "@metamask/superstruct": ^3.0.0 + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^8.5.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 @@ -6182,6 +6182,13 @@ __metadata: languageName: node linkType: hard +"@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" From d5f4c10050602bd0b71048be1d51d63951b7dc36 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:30:57 -0400 Subject: [PATCH 21/47] Update lavamoat policies --- .../lavamoat/browserify/iframe/policy.json | 2 +- .../lavamoat/browserify/node-process/policy.json | 2 +- .../lavamoat/browserify/node-thread/policy.json | 2 +- .../lavamoat/browserify/webview/policy.json | 2 +- .../lavamoat/browserify/worker-executor/policy.json | 2 +- .../lavamoat/browserify/worker-pool/policy.json | 2 +- .../lavamoat/build-system/policy.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index b251904ff1..8b8434bba4 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -115,7 +115,7 @@ "TextEncoder": true }, "packages": { - "@metamask/superstruct": true, + "@metamask/utils>@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 760ede1af5..e8c0b5b3b4 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -128,7 +128,7 @@ "TextEncoder": true }, "packages": { - "@metamask/superstruct": true, + "@metamask/utils>@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 760ede1af5..e8c0b5b3b4 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -128,7 +128,7 @@ "TextEncoder": true }, "packages": { - "@metamask/superstruct": true, + "@metamask/utils>@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 67f5890896..2a562026c2 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -54,7 +54,7 @@ "TextEncoder": true }, "packages": { - "@metamask/superstruct": true, + "@metamask/utils>@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 b251904ff1..8b8434bba4 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -115,7 +115,7 @@ "TextEncoder": true }, "packages": { - "@metamask/superstruct": true, + "@metamask/utils>@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 67f5890896..2a562026c2 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -54,7 +54,7 @@ "TextEncoder": true }, "packages": { - "@metamask/superstruct": true, + "@metamask/utils>@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, diff --git a/packages/snaps-execution-environments/lavamoat/build-system/policy.json b/packages/snaps-execution-environments/lavamoat/build-system/policy.json index 41f03af11f..abdfe52e40 100644 --- a/packages/snaps-execution-environments/lavamoat/build-system/policy.json +++ b/packages/snaps-execution-environments/lavamoat/build-system/policy.json @@ -1014,7 +1014,7 @@ "TextEncoder": true }, "packages": { - "@metamask/superstruct": true, + "@metamask/utils>@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, From 9e29439cebee05e968bab1f3ce30d06b0c7774df Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:43:26 -0400 Subject: [PATCH 22/47] Force yarn resolution to use `@metamask/superstruct` `3.1.0` --- package.json | 1 + .../lavamoat/browserify/iframe/policy.json | 2 +- .../lavamoat/browserify/node-process/policy.json | 2 +- .../lavamoat/browserify/node-thread/policy.json | 2 +- .../lavamoat/browserify/webview/policy.json | 2 +- .../lavamoat/browserify/worker-executor/policy.json | 2 +- .../lavamoat/browserify/worker-pool/policy.json | 2 +- .../lavamoat/build-system/policy.json | 2 +- yarn.lock | 9 +-------- 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index cbdaee0e44..4649c48770 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/superstruct": "3.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", diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index 8b8434bba4..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -115,7 +115,7 @@ "TextEncoder": true }, "packages": { - "@metamask/utils>@metamask/superstruct": true, + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 e8c0b5b3b4..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -128,7 +128,7 @@ "TextEncoder": true }, "packages": { - "@metamask/utils>@metamask/superstruct": true, + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 e8c0b5b3b4..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -128,7 +128,7 @@ "TextEncoder": true }, "packages": { - "@metamask/utils>@metamask/superstruct": true, + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 2a562026c2..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -54,7 +54,7 @@ "TextEncoder": true }, "packages": { - "@metamask/utils>@metamask/superstruct": true, + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 8b8434bba4..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -115,7 +115,7 @@ "TextEncoder": true }, "packages": { - "@metamask/utils>@metamask/superstruct": true, + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": 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 2a562026c2..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -54,7 +54,7 @@ "TextEncoder": true }, "packages": { - "@metamask/utils>@metamask/superstruct": true, + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, diff --git a/packages/snaps-execution-environments/lavamoat/build-system/policy.json b/packages/snaps-execution-environments/lavamoat/build-system/policy.json index abdfe52e40..41f03af11f 100644 --- a/packages/snaps-execution-environments/lavamoat/build-system/policy.json +++ b/packages/snaps-execution-environments/lavamoat/build-system/policy.json @@ -1014,7 +1014,7 @@ "TextEncoder": true }, "packages": { - "@metamask/utils>@metamask/superstruct": true, + "@metamask/superstruct": true, "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, diff --git a/yarn.lock b/yarn.lock index 46c6226cef..d24777d4ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6175,14 +6175,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/superstruct@npm:^3.0.0": - version: 3.0.0 - resolution: "@metamask/superstruct@npm:3.0.0" - checksum: 667f8f2947186972516bb72b4ba215eaeede257c8beb0450583dd4c8b00c28729ff938267ca8804a3a351277fd627b8607cafeb71eb7045a2b6930639bb6a341 - languageName: node - linkType: hard - -"@metamask/superstruct@npm:^3.1.0": +"@metamask/superstruct@npm:3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" checksum: 00e4d0c0aae8b25ccc1885c1db0bb4ed1590010570140c255e4deee3bf8a10c859c8fce5e475b4ae09c8a56316207af87585b91f7f5a5c028d668ccd111f19e3 From c835e8b0bf7e3fc8d547911505208d640461ed41 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 27 Jun 2024 13:45:47 -0400 Subject: [PATCH 23/47] Update snap manifests --- packages/examples/packages/bip32/snap.manifest.json | 2 +- packages/examples/packages/bip44/snap.manifest.json | 2 +- packages/examples/packages/browserify-plugin/snap.manifest.json | 2 +- packages/examples/packages/browserify/snap.manifest.json | 2 +- packages/examples/packages/client-status/snap.manifest.json | 2 +- packages/examples/packages/cronjobs/snap.manifest.json | 2 +- packages/examples/packages/dialogs/snap.manifest.json | 2 +- packages/examples/packages/ethereum-provider/snap.manifest.json | 2 +- packages/examples/packages/ethers-js/snap.manifest.json | 2 +- packages/examples/packages/file-upload/snap.manifest.json | 2 +- packages/examples/packages/get-entropy/snap.manifest.json | 2 +- packages/examples/packages/get-file/snap.manifest.json | 2 +- packages/examples/packages/home-page/snap.manifest.json | 2 +- packages/examples/packages/images/snap.manifest.json | 2 +- packages/examples/packages/interactive-ui/snap.manifest.json | 2 +- .../invoke-snap/packages/consumer-signer/snap.manifest.json | 2 +- .../invoke-snap/packages/core-signer/snap.manifest.json | 2 +- packages/examples/packages/json-rpc/snap.manifest.json | 2 +- packages/examples/packages/jsx/snap.manifest.json | 2 +- packages/examples/packages/lifecycle-hooks/snap.manifest.json | 2 +- packages/examples/packages/localization/snap.manifest.json | 2 +- packages/examples/packages/manage-state/snap.manifest.json | 2 +- packages/examples/packages/network-access/snap.manifest.json | 2 +- packages/examples/packages/notifications/snap.manifest.json | 2 +- packages/examples/packages/rollup-plugin/snap.manifest.json | 2 +- .../examples/packages/signature-insights/snap.manifest.json | 2 +- .../examples/packages/transaction-insights/snap.manifest.json | 2 +- packages/examples/packages/wasm/snap.manifest.json | 2 +- packages/examples/packages/webpack-plugin/snap.manifest.json | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/examples/packages/bip32/snap.manifest.json b/packages/examples/packages/bip32/snap.manifest.json index f296af262e..92ed9d942d 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": "Ard/F/8RqOYcKlxb3xx6OB5XLtmv7t/Asrn8bhkCooQ=", + "shasum": "Exh7Oh9VvpTgjU5sFnE3Qifq2jQjOguVZ18qPkVVR9k=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/bip44/snap.manifest.json b/packages/examples/packages/bip44/snap.manifest.json index 919ec21e0f..6d592707bf 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": "jJuoqF4p++cEfWb3YdEfuwlOEw7bByfpEMh6adH8sOI=", + "shasum": "j2UHr5xRCB9MU1EO5uGxHt2ZQYUjlCl5y/k0YSR60Po=", "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 b27aa6c458..14217af947 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": "nBoIUO4s8aakybthHavEuRjxCoNVzevKVv1mr1u2uNM=", + "shasum": "eQgk5wHWu7E4ZXbKBJCBX7tC5XVZYvmsgDziCsLeujA=", "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 3209fa4f40..727026e520 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": "Kq4I9q6BdkSUrUsjysqqsfjlQ1gu6vM4sXSo7pgNruI=", + "shasum": "lCIYGGQH2aM9Uq+PFUM5uSCxctEugxEDDawfWydAfzU=", "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 e418f0e16b..f9b0469679 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": "RNHnGSZaZRAEkH7h4eqFfmic8Ixq30CXj4JWnhWkQbI=", + "shasum": "bKsCkJjmXKjeaPkxkav0G6qhkzuqkWurqw0TGdWCJqc=", "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 214ad6018a..1025e5a4d8 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": "0YLZlM7w5GpjDWYmmJFxiYB2kJnNG55ru3/8ywKVT9I=", + "shasum": "PhdkF75o0zY1Sx9rpt8IsBw9dOL6Mm4k7BgSG5M9Y8M=", "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 d2dec66ab4..2d4ef62280 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": "5cc1fSlz4S5sDjlkjWhBUNjOQu6VdCqS5ln/DJjssSk=", + "shasum": "wVdSqtzJLdOqc/krdcQKbmxq/5z0KISla86nKDditqw=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethereum-provider/snap.manifest.json b/packages/examples/packages/ethereum-provider/snap.manifest.json index 18ae1cb98d..ee1c0c0503 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": "8L6HiuUzKAQVeog5uIIYiqBOuEb2Qm3+9HH+fXs5PlM=", + "shasum": "WLs+t5ESh70DTUFjHN0mRmlCqfdMq7lefLVscbRIOgY=", "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 9b4c451f4a..1228c4818f 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": "5fi+IIMm/FubpDnpYP+YGW/dCUgTT4bVIxxDmcuybr8=", + "shasum": "FPDyUBLuLZWO3QPyqRajRHrHwI+ohfJhsELnUUY+Ils=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/file-upload/snap.manifest.json b/packages/examples/packages/file-upload/snap.manifest.json index 003b56b552..989ae2cf90 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": "+yioSnJPHDQRsStHxbK9pm9bUTAgvCFrpWjwvWZNWqE=", + "shasum": "cIEaMkj8hKgQF0CmgIBRrI9P5/vLWX/Tux+STAjw1ZY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-entropy/snap.manifest.json b/packages/examples/packages/get-entropy/snap.manifest.json index f04ad0eeaa..b6a0266ede 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": "nlhNiocqRC/yaz73W2wMGxIXswHm6YCCigdd6X/maeU=", + "shasum": "8sR2XC7ercozwqP/lpdTCaS/fzTFG8g9z3Pl1nv/b7I=", "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 b64a2641b0..fd3b7cfbeb 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": "opNYkgiLjqm7OBH2Wi4eAewEntFg0trEfw8yk8sQJGk=", + "shasum": "aJ+RTe3aIqjdLl//RAnt1Rr//6WQGQ0clarlwKh8uLE=", "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 3c686aeb78..79ff9c12dc 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": "undUBL7PBSvSR81E5AfodCp7nY0658OuaCe6eY2Xjaw=", + "shasum": "8JPDJ2tFMIXhKpdFrMiLbri9BAAboWtMYOwjXo4JUcM=", "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 a080b64903..7eb2a96de7 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": "yOiOfKpriNZCSbXVfddcEw8EOkKd+bjPlvtl/yowGNo=", + "shasum": "h7dh+J6Y4FPEVVXpAbuArfmOkNmw4EvSpl1m3Ajc9Q8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/interactive-ui/snap.manifest.json b/packages/examples/packages/interactive-ui/snap.manifest.json index 58c199dd59..24379be807 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": "qonHJAYzv7XPR96X+J3qOs5wxnWkfmWkUqK3ooYdkGI=", + "shasum": "/HPVYPpvsaDKJ/cDtiDoYjJTMMr00fxKKcV/PMkGgWQ=", "location": { "npm": { "filePath": "dist/bundle.js", 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 0eb1d78e5f..d19471a80e 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": "OHys23ojjMrAsFyeQwDQqaa1EFHn3etlJHegD4UeS8I=", + "shasum": "wHVGeV5LwFg7D9JSN4Y6K8lAynCHsf3amAdTRgG559Q=", "location": { "npm": { "filePath": "dist/bundle.js", 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 09e990624e..301922bb18 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": "HJh4l8PwtDUgt1RENdhuHAFexpl7waVkztKP4AjvrNY=", + "shasum": "84bNsQub/WPFzLj9X9cLXyMGQ9gOzDb2GPAvfNbJaTo=", "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 bad8697c9f..7ec5e0715a 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": "TWiDk1fuzRMAhmlkKuiSUSDvKCz9xcI5WSWW3iy34Mc=", + "shasum": "o/xlqha3e8lKSBzFpbc9WmzHvxUHLamGT9xzkRP7cSQ=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/jsx/snap.manifest.json b/packages/examples/packages/jsx/snap.manifest.json index bd84938a1e..7ed7ac64db 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": "4gXdMd04QGteEKq+8ybmEUZMZ7rp8VhznbIsLbwJt2M=", + "shasum": "8Dm2Jlg22wuJQHndwLBSF2Q5oPDm55hqLf3YxS+15M4=", "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 06a15c13d1..3440f90fae 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": "1KncbhFxNyySOUIYyT6hjm2cAYJjVfz2nqO+F27UKHk=", + "shasum": "xkCmj40G4+UbkwFdXm84onyO4flw2qKDeK1o7ykYZZM=", "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 1076850be1..970ff7038d 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": "y/xbICamUYIgA9PTdRJZFqrrsEvfwU6QnyLPRkar8yY=", + "shasum": "7Tlo3G3c0VGoqX8ta9r4O15mZ9jEHTLUCT2H+AXRyJE=", "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 9c32b21f17..d76afd293f 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": "t2caVEw3o6ogsMMTYazugSPYT7LUwnEVm5h1c0C6PJU=", + "shasum": "u3ce2wMpi6uGS+V4Kf0GGm0rA6kMDJrOwDt5Y61MidM=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/network-access/snap.manifest.json b/packages/examples/packages/network-access/snap.manifest.json index 13e5a79fa3..117a6cb52a 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": "VOl9PL2wEitwk002uFI31Dtqam+n31V3hjsJZyH0c7g=", + "shasum": "EFLU5p3OEj1ChLd3IaiX2FqhC1RgwgoCMihYTtpZJz4=", "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 d1cd016d1f..847735575c 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": "TSKQNGgt1ihK1sMYWCyeSRbnq4LhHfWPI1OcemzK5jw=", + "shasum": "MA1nXPvaY2ayuCOE+VG+vnZ9DDkA6nmXmffmnIjhDEw=", "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 38fb7e7768..1e21c7423e 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": "bwd1Enr1AhLtstNX7BZ6ZYkZEhY0I6wKUSYufb1eu1M=", + "shasum": "RxjQmPnQBtog5nb8JEnpnZvAoJuU1x7JSgtgOKuDoUk=", "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 9f78bcf8ee..af00909dba 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": "oscX5enhoOZdKEwZr/6XNwMiNe0bnIqUDkpYwmmgBeo=", + "shasum": "0JuGZeM+9nTS0KDx1SOOfrgjvjMYrY/SHp4Vjpw5+n4=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/transaction-insights/snap.manifest.json b/packages/examples/packages/transaction-insights/snap.manifest.json index cd2ab89f90..231aaa6101 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": "CReSrcACFurEbxlGTm3aw4MQOo+CFs/XvgZ4mY+Cn/I=", + "shasum": "JLCXxX4043uz3252E8BM+gpyVgwON3akkZPZVNXM1II=", "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 7f57cf8b22..02c4660220 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": "M5dLjvmrk86SNv9ZFRUOz5hcPW24aAfS7rGm/UHO0k0=", + "shasum": "ktAIJ05bUGEesg5VIbDwBPUAZoUxoomxtmUu+IECki0=", "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 a2f1749ce9..706bb488ef 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": "BeAg29ZE55KRGNJiaZpT3y/tdo4D6alWxCzsw8z4k64=", + "shasum": "BGt2dANEgEKdBLaAVX28KGpp9fQj4qWn/FF5xsOUlIU=", "location": { "npm": { "filePath": "dist/bundle.js", From 1928ce2716d101fc2ade29f753343898c2da7db6 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 28 Jun 2024 22:10:30 -0400 Subject: [PATCH 24/47] Bump `@metamask/utils` from `^8.5.0` to `^9.0.0` in all packages --- package.json | 3 +- packages/examples/packages/bip32/package.json | 2 +- packages/examples/packages/bip44/package.json | 2 +- .../examples/packages/dialogs/package.json | 2 +- .../packages/ethereum-provider/package.json | 2 +- .../examples/packages/ethers-js/package.json | 2 +- .../packages/file-upload/package.json | 2 +- .../packages/get-entropy/package.json | 2 +- .../packages/interactive-ui/package.json | 2 +- .../packages/consumer-signer/package.json | 2 +- .../packages/core-signer/package.json | 2 +- packages/examples/packages/jsx/package.json | 2 +- .../packages/network-access/package.json | 2 +- .../transaction-insights/package.json | 2 +- packages/snaps-cli/package.json | 2 +- packages/snaps-controllers/package.json | 2 +- .../lavamoat/browserify/iframe/policy.json | 74 ++++++++++++++-- .../browserify/node-process/policy.json | 86 +++++++++++++++++-- .../browserify/node-thread/policy.json | 86 +++++++++++++++++-- .../lavamoat/browserify/webview/policy.json | 36 +++++++- .../browserify/worker-executor/policy.json | 74 ++++++++++++++-- .../browserify/worker-pool/policy.json | 36 +++++++- .../snaps-execution-environments/package.json | 2 +- packages/snaps-jest/package.json | 2 +- packages/snaps-rpc-methods/package.json | 2 +- packages/snaps-sdk/package.json | 2 +- packages/snaps-simulator/package.json | 2 +- packages/snaps-utils/package.json | 2 +- packages/snaps-webpack-plugin/package.json | 2 +- packages/test-snaps/package.json | 2 +- yarn.lock | 73 ++++++++++------ 31 files changed, 427 insertions(+), 87 deletions(-) diff --git a/package.json b/package.json index 4649c48770..9a28d59011 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "@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/superstruct": "3.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", @@ -77,7 +76,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.5.0", + "@metamask/utils": "^9.0.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 c78eccc5c6..a76269553a 100644 --- a/packages/examples/packages/bip32/package.json +++ b/packages/examples/packages/bip32/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@noble/ed25519": "^1.6.0", "@noble/secp256k1": "^1.7.1" }, diff --git a/packages/examples/packages/bip44/package.json b/packages/examples/packages/bip44/package.json index 5a85d6a449..7468a57882 100644 --- a/packages/examples/packages/bip44/package.json +++ b/packages/examples/packages/bip44/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@noble/bls12-381": "^1.2.0" }, "devDependencies": { diff --git a/packages/examples/packages/dialogs/package.json b/packages/examples/packages/dialogs/package.json index 4d56a0d8b8..ba8d060690 100644 --- a/packages/examples/packages/dialogs/package.json +++ b/packages/examples/packages/dialogs/package.json @@ -42,7 +42,7 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/ethereum-provider/package.json b/packages/examples/packages/ethereum-provider/package.json index d876645c1c..7b0af81f0f 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.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/ethers-js/package.json b/packages/examples/packages/ethers-js/package.json index 2a29838693..28877f909f 100644 --- a/packages/examples/packages/ethers-js/package.json +++ b/packages/examples/packages/ethers-js/package.json @@ -43,7 +43,7 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/file-upload/package.json b/packages/examples/packages/file-upload/package.json index 26931f6049..a3acbeb0de 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.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/get-entropy/package.json b/packages/examples/packages/get-entropy/package.json index a8fafbab12..c95f842c59 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.5.0", + "@metamask/utils": "^9.0.0", "@noble/bls12-381": "^1.2.0" }, "devDependencies": { diff --git a/packages/examples/packages/interactive-ui/package.json b/packages/examples/packages/interactive-ui/package.json index c4e2299805..b452b52c57 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.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@jest/globals": "^29.5.0", 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 c7105e439e..08111ace25 100644 --- a/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@noble/hashes": "^1.3.1" }, "devDependencies": { 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 1aaef2bb31..b408ed31e0 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/package.json @@ -32,7 +32,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/snaps-sdk": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@noble/curves": "^1.1.0", "async-mutex": "^0.4.0" }, diff --git a/packages/examples/packages/jsx/package.json b/packages/examples/packages/jsx/package.json index a9965f3ba7..eb64d0990a 100644 --- a/packages/examples/packages/jsx/package.json +++ b/packages/examples/packages/jsx/package.json @@ -43,7 +43,7 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/network-access/package.json b/packages/examples/packages/network-access/package.json index 0cbc766910..cfc0234763 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.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/examples/packages/transaction-insights/package.json b/packages/examples/packages/transaction-insights/package.json index 7ee623e8a3..10391f33ef 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.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@jest/globals": "^29.5.0", diff --git a/packages/snaps-cli/package.json b/packages/snaps-cli/package.json index 84a5682918..7ac449964b 100644 --- a/packages/snaps-cli/package.json +++ b/packages/snaps-cli/package.json @@ -61,7 +61,7 @@ "@metamask/snaps-utils": "workspace:^", "@metamask/snaps-webpack-plugin": "workspace:^", "@metamask/superstruct": "^3.1.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "assert": "^2.0.0", "babelify": "^10.0.0", diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index 01d06c76b1..ce6fd3ee25 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -66,7 +66,7 @@ "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@xstate/fsm": "^2.0.0", "browserify-zlib": "^0.2.0", "concat-stream": "^2.0.0", diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index b251904ff1..7c7e9b2d68 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -2,9 +2,24 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/rpc-errors": true + } + }, + "@metamask/json-rpc-engine>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/object-multiplex": { @@ -33,10 +48,25 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/providers": { "globals": { "console": true @@ -55,8 +85,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/providers>@metamask/utils": true, + "@metamask/rpc-errors": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -77,10 +107,40 @@ "browserify>events": true } }, + "@metamask/providers>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true + "@metamask/rpc-errors>@metamask/utils": true, + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, + "@metamask/rpc-errors>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/snaps-sdk": { 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 760ede1af5..b4af2cbd3f 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -2,9 +2,27 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/rpc-errors": true + } + }, + "@metamask/json-rpc-engine>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/object-multiplex": { @@ -39,11 +57,29 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true, "worker_threads": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/providers": { "globals": { "console": true @@ -62,8 +98,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/providers>@metamask/utils": true, + "@metamask/rpc-errors": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -87,10 +123,46 @@ "events": true } }, + "@metamask/providers>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true + "@metamask/rpc-errors>@metamask/utils": true, + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, + "@metamask/rpc-errors>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/snaps-sdk": { 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 760ede1af5..b4af2cbd3f 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -2,9 +2,27 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/rpc-errors": true + } + }, + "@metamask/json-rpc-engine>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/object-multiplex": { @@ -39,11 +57,29 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true, "worker_threads": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/providers": { "globals": { "console": true @@ -62,8 +98,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/providers>@metamask/utils": true, + "@metamask/rpc-errors": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -87,10 +123,46 @@ "events": true } }, + "@metamask/providers>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true + "@metamask/rpc-errors>@metamask/utils": true, + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, + "@metamask/rpc-errors>@metamask/utils": { + "builtin": { + "buffer.Buffer": true + }, + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/snaps-sdk": { diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 67f5890896..036f28c9b4 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -12,14 +12,44 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true + "@metamask/rpc-errors>@metamask/utils": true, + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, + "@metamask/rpc-errors>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/snaps-sdk": { 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 b251904ff1..7c7e9b2d68 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -2,9 +2,24 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/rpc-errors": true + } + }, + "@metamask/json-rpc-engine>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/object-multiplex": { @@ -33,10 +48,25 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/providers": { "globals": { "console": true @@ -55,8 +85,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true + "@metamask/providers>@metamask/utils": true, + "@metamask/rpc-errors": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -77,10 +107,40 @@ "browserify>events": true } }, + "@metamask/providers>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true + "@metamask/rpc-errors>@metamask/utils": true, + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, + "@metamask/rpc-errors>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/snaps-sdk": { 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 67f5890896..036f28c9b4 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -12,14 +12,44 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true + "@metamask/rpc-errors>@metamask/utils": true, + "@metamask/rpc-errors>fast-safe-stringify": true + } + }, + "@metamask/rpc-errors>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true } }, "@metamask/snaps-sdk": { diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index bfde2d1930..7cf254d121 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -59,7 +59,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.1.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "nanoid": "^3.1.31", "readable-stream": "^3.6.2" }, diff --git a/packages/snaps-jest/package.json b/packages/snaps-jest/package.json index 6e1d3d476d..f7cedd8cb2 100644 --- a/packages/snaps-jest/package.json +++ b/packages/snaps-jest/package.json @@ -52,7 +52,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.1.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@reduxjs/toolkit": "^1.9.5", "express": "^4.18.2", "jest-environment-node": "^29.5.0", diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index b959058070..d6e838de6d 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -45,7 +45,7 @@ "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.1.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@noble/hashes": "^1.3.1" }, "devDependencies": { diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 43a54095b3..8426883592 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -63,7 +63,7 @@ "@metamask/providers": "^17.0.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/superstruct": "^3.1.0", - "@metamask/utils": "^8.5.0" + "@metamask/utils": "^9.0.0" }, "devDependencies": { "@lavamoat/allow-scripts": "^3.0.4", diff --git a/packages/snaps-simulator/package.json b/packages/snaps-simulator/package.json index f38ed5a17f..195ea2fc3c 100644 --- a/packages/snaps-simulator/package.json +++ b/packages/snaps-simulator/package.json @@ -41,7 +41,7 @@ "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@minoru/react-dnd-treeview": "^3.4.4", "@noble/hashes": "^1.3.1", "@reduxjs/toolkit": "^1.9.5", diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 31ebc42a39..b8efa2f94f 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -60,7 +60,7 @@ "@metamask/snaps-registry": "^3.2.0", "@metamask/snaps-sdk": "workspace:^", "@metamask/superstruct": "^3.1.0", - "@metamask/utils": "^8.5.0", + "@metamask/utils": "^9.0.0", "@noble/hashes": "^1.3.1", "@scure/base": "^1.1.1", "chalk": "^4.1.2", diff --git a/packages/snaps-webpack-plugin/package.json b/packages/snaps-webpack-plugin/package.json index 44a0f813a8..a7aa7d5f30 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.5.0", + "@metamask/utils": "^9.0.0", "webpack-sources": "^3.2.3" }, "devDependencies": { diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index 2123c0ad7e..676949dddc 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.5.0", + "@metamask/utils": "^9.0.0", "@metamask/wasm-example-snap": "workspace:^", "@popperjs/core": "^2.11.8", "@reduxjs/toolkit": "^1.9.5", diff --git a/yarn.lock b/yarn.lock index d24777d4ec..ff5ec50a69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3889,7 +3889,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@noble/ed25519": ^1.6.0 "@noble/secp256k1": ^1.7.1 "@swc/core": 1.3.78 @@ -3929,7 +3929,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@noble/bls12-381": ^1.2.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4090,7 +4090,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4146,7 +4146,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@noble/curves": ^1.1.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 @@ -4291,7 +4291,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4489,7 +4489,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4526,7 +4526,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4605,7 +4605,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4643,7 +4643,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@noble/bls12-381": ^1.2.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -4790,7 +4790,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4827,7 +4827,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4976,7 +4976,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5171,7 +5171,7 @@ __metadata: "@metamask/snaps-controllers": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5492,7 +5492,7 @@ __metadata: "@metamask/snaps-utils": "workspace:^" "@metamask/snaps-webpack-plugin": "workspace:^" "@metamask/superstruct": ^3.1.0 - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/browserify": ^12.0.37 @@ -5592,7 +5592,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/template-snap": ^0.7.0 - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/chrome": ^0.0.237 @@ -5683,7 +5683,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.1.0 - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/express": ^4.17.17 @@ -5766,7 +5766,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.1.0 - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@reduxjs/toolkit": ^1.9.5 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5870,7 +5870,7 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.1.0 - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@noble/hashes": ^1.3.1 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 @@ -5911,7 +5911,7 @@ __metadata: "@metamask/providers": ^17.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/superstruct": ^3.1.0 - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5965,7 +5965,7 @@ __metadata: "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@minoru/react-dnd-treeview": ^3.4.4 "@noble/hashes": ^1.3.1 "@pmmmwh/react-refresh-webpack-plugin": ^0.5.10 @@ -6073,7 +6073,7 @@ __metadata: "@metamask/snaps-registry": ^3.2.0 "@metamask/snaps-sdk": "workspace:^" "@metamask/superstruct": ^3.1.0 - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 "@swc/core": 1.3.78 @@ -6145,7 +6145,7 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -6175,7 +6175,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/superstruct@npm:3.1.0": +"@metamask/superstruct@npm:^3.0.0, @metamask/superstruct@npm:^3.1.0": version: 3.1.0 resolution: "@metamask/superstruct@npm:3.1.0" checksum: 00e4d0c0aae8b25ccc1885c1db0bb4ed1590010570140c255e4deee3bf8a10c859c8fce5e475b4ae09c8a56316207af87585b91f7f5a5c028d668ccd111f19e3 @@ -6224,7 +6224,7 @@ __metadata: "@metamask/providers": ^17.0.0 "@metamask/signature-insights-example-snap": "workspace:^" "@metamask/snaps-utils": "workspace:^" - "@metamask/utils": ^8.5.0 + "@metamask/utils": ^9.0.0 "@metamask/wasm-example-snap": "workspace:^" "@pmmmwh/react-refresh-webpack-plugin": ^0.5.10 "@popperjs/core": ^2.11.8 @@ -6292,6 +6292,23 @@ __metadata: languageName: node linkType: hard +"@metamask/utils@npm:^9.0.0": + version: 9.0.0 + resolution: "@metamask/utils@npm:9.0.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 + uuid: ^9.0.1 + checksum: 5dcb9d47c4768c33d451cc74c83207726c68b1340be1d091ca44105564f0ba0703026d357de7996de4459ac41cd420a0eb1f06db32f5ebbeeee581393f45fd44 + languageName: node + linkType: hard + "@metamask/wasm-example-snap@workspace:^, @metamask/wasm-example-snap@workspace:packages/examples/packages/wasm": version: 0.0.0-use.local resolution: "@metamask/wasm-example-snap@workspace:packages/examples/packages/wasm" @@ -17732,11 +17749,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 @@ -20302,7 +20319,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.5.0 + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@types/node": 18.14.2 From b54a891094ccdad92d2ab0ebbcae81ea4b938149 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 28 Jun 2024 23:10:49 -0400 Subject: [PATCH 25/47] Force yarn resolution for `@metamask/utils` to `9.0.0` --- package.json | 1 + .../lavamoat/browserify/iframe/policy.json | 74 ++-------------- .../browserify/node-process/policy.json | 86 ++----------------- .../browserify/node-thread/policy.json | 86 ++----------------- .../lavamoat/browserify/webview/policy.json | 36 +------- .../browserify/worker-executor/policy.json | 74 ++-------------- .../browserify/worker-pool/policy.json | 36 +------- yarn.lock | 19 +--- 8 files changed, 36 insertions(+), 376 deletions(-) diff --git a/package.json b/package.json index 9a28d59011..e619a1cd55 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.0.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", diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index 7c7e9b2d68..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -2,24 +2,9 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true - } - }, - "@metamask/json-rpc-engine>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/object-multiplex": { @@ -48,25 +33,10 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/providers": { "globals": { "console": true @@ -85,8 +55,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/utils": true, - "@metamask/rpc-errors": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -107,40 +77,10 @@ "browserify>events": true } }, - "@metamask/providers>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>@metamask/utils": true, - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, - "@metamask/rpc-errors>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true } }, "@metamask/snaps-sdk": { 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 b4af2cbd3f..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -2,27 +2,9 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true - } - }, - "@metamask/json-rpc-engine>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/object-multiplex": { @@ -57,29 +39,11 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true, "worker_threads": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/providers": { "globals": { "console": true @@ -98,8 +62,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/utils": true, - "@metamask/rpc-errors": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -123,46 +87,10 @@ "events": true } }, - "@metamask/providers>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>@metamask/utils": true, - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, - "@metamask/rpc-errors>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true } }, "@metamask/snaps-sdk": { 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 b4af2cbd3f..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -2,27 +2,9 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true - } - }, - "@metamask/json-rpc-engine>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/object-multiplex": { @@ -57,29 +39,11 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true, "worker_threads": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/providers": { "globals": { "console": true @@ -98,8 +62,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/utils": true, - "@metamask/rpc-errors": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -123,46 +87,10 @@ "events": true } }, - "@metamask/providers>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>@metamask/utils": true, - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, - "@metamask/rpc-errors>@metamask/utils": { - "builtin": { - "buffer.Buffer": true - }, - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true } }, "@metamask/snaps-sdk": { diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 036f28c9b4..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -12,44 +12,14 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>@metamask/utils": true, - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, - "@metamask/rpc-errors>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true } }, "@metamask/snaps-sdk": { 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 7c7e9b2d68..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -2,24 +2,9 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/utils": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true - } - }, - "@metamask/json-rpc-engine>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/object-multiplex": { @@ -48,25 +33,10 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/providers": { "globals": { "console": true @@ -85,8 +55,8 @@ "@metamask/providers>@metamask/json-rpc-engine": { "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>@metamask/utils": true, - "@metamask/rpc-errors": true + "@metamask/rpc-errors": true, + "@metamask/utils": true } }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { @@ -107,40 +77,10 @@ "browserify>events": true } }, - "@metamask/providers>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>@metamask/utils": true, - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, - "@metamask/rpc-errors>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true } }, "@metamask/snaps-sdk": { 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 036f28c9b4..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -12,44 +12,14 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { - "@metamask/rpc-errors>@metamask/utils": true, - "@metamask/rpc-errors>fast-safe-stringify": true - } - }, - "@metamask/rpc-errors>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true } }, "@metamask/snaps-sdk": { diff --git a/yarn.lock b/yarn.lock index ff5ec50a69..f79c46edfd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6275,24 +6275,7 @@ __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, @metamask/utils@npm:^8.5.0": - version: 8.5.0 - resolution: "@metamask/utils@npm:8.5.0" - dependencies: - "@ethereumjs/tx": ^4.2.0 - "@metamask/superstruct": ^3.0.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 - uuid: ^9.0.1 - checksum: e8eac1c796c3f6b623be3c2736e8682248620f666b180f5c12ce56ee09587d4e28b6811862139a05c7a1bec91415f10ccf0516f3cdf342f88b0189d2a057c24b - languageName: node - linkType: hard - -"@metamask/utils@npm:^9.0.0": +"@metamask/utils@npm:9.0.0": version: 9.0.0 resolution: "@metamask/utils@npm:9.0.0" dependencies: From 2c85ca8453c4cf620586c704734777493677bc6f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 28 Jun 2024 23:14:59 -0400 Subject: [PATCH 26/47] Restore eslint-disable directive previously added in 03517e365245b1f42c046ee3a5cbcdd4d036bb5e --- .../snaps-controllers/src/services/AbstractExecutionService.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/snaps-controllers/src/services/AbstractExecutionService.ts b/packages/snaps-controllers/src/services/AbstractExecutionService.ts index ccc7c17435..31c6e0d9cf 100644 --- a/packages/snaps-controllers/src/services/AbstractExecutionService.ts +++ b/packages/snaps-controllers/src/services/AbstractExecutionService.ts @@ -441,6 +441,8 @@ export abstract class AbstractExecutionService } log('Parent: Sending Command', 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 (isJsonRpcFailure(response)) { From 68fe41947c7c1a5a5d356780f88ddbb3ff2765e4 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 1 Jul 2024 10:12:40 -0400 Subject: [PATCH 27/47] Update manifest files --- packages/examples/packages/bip32/snap.manifest.json | 2 +- packages/examples/packages/bip44/snap.manifest.json | 2 +- packages/examples/packages/browserify-plugin/snap.manifest.json | 2 +- packages/examples/packages/browserify/snap.manifest.json | 2 +- packages/examples/packages/client-status/snap.manifest.json | 2 +- packages/examples/packages/cronjobs/snap.manifest.json | 2 +- packages/examples/packages/dialogs/snap.manifest.json | 2 +- packages/examples/packages/ethereum-provider/snap.manifest.json | 2 +- packages/examples/packages/ethers-js/snap.manifest.json | 2 +- packages/examples/packages/file-upload/snap.manifest.json | 2 +- packages/examples/packages/get-entropy/snap.manifest.json | 2 +- packages/examples/packages/get-file/snap.manifest.json | 2 +- packages/examples/packages/home-page/snap.manifest.json | 2 +- packages/examples/packages/images/snap.manifest.json | 2 +- packages/examples/packages/interactive-ui/snap.manifest.json | 2 +- .../invoke-snap/packages/consumer-signer/snap.manifest.json | 2 +- .../invoke-snap/packages/core-signer/snap.manifest.json | 2 +- packages/examples/packages/json-rpc/snap.manifest.json | 2 +- packages/examples/packages/jsx/snap.manifest.json | 2 +- packages/examples/packages/lifecycle-hooks/snap.manifest.json | 2 +- packages/examples/packages/localization/snap.manifest.json | 2 +- packages/examples/packages/manage-state/snap.manifest.json | 2 +- packages/examples/packages/network-access/snap.manifest.json | 2 +- packages/examples/packages/notifications/snap.manifest.json | 2 +- packages/examples/packages/rollup-plugin/snap.manifest.json | 2 +- .../examples/packages/signature-insights/snap.manifest.json | 2 +- .../examples/packages/transaction-insights/snap.manifest.json | 2 +- packages/examples/packages/wasm/snap.manifest.json | 2 +- packages/examples/packages/webpack-plugin/snap.manifest.json | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/examples/packages/bip32/snap.manifest.json b/packages/examples/packages/bip32/snap.manifest.json index d16700c9aa..7140916571 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": "te1oZPWHfniZ/ST6D/blxr8w6yhoR4qaJeeNoOP7O6A=", + "shasum": "rIBua9SBvumNY61S24M77jHCTcoxe5LYfdymK3QJaXU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/bip44/snap.manifest.json b/packages/examples/packages/bip44/snap.manifest.json index 4b507f1c3b..b10d8115c7 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": "yzw5UM4aWmD8vLglR9gazcNC0yKntyPp5A5sPSmouL4=", + "shasum": "qtrVxDILymYCCKGvdcLfZ4S1jWHgY5U/puoFKAsn4po=", "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 ab2c6affa9..6ada742fd7 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": "a+jOIwfxC3ITF6MbF5ltQvM0ZvCJ5/NQJlbEsqWTQrk=", + "shasum": "I4wPteP+ySOFlRk2aCNgxfuHB7v+anAV9B/+7RCEdOM=", "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 a7cb3b7d50..eabbab21c9 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": "HPCtZ7reZrbut7cl09SnaoAHkzrvlvjc60leUfkcsVI=", + "shasum": "hznxFs/o6ICyAAMG1J6Tgisy/QfWq+Xsr08vuzuGHQ4=", "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 cbaa5b762a..2edb78d0e2 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": "7BLeIk79FlkIK9fNKHcCdX8UChmjU7kOkGVLxOc29Kw=", + "shasum": "NLFRwCdLiRwRdwSIDeX0jr3+pVzcZD0oIU0HgvRJqUE=", "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 39a629f55f..7a1b33d4dc 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": "DMmgoUR+Q1/eYJTjZQ96jI406CpgObFs454UR1nKGM4=", + "shasum": "RAj6fPB0ZgU8OXJP60whTQn8Vnaq1XrdEFB5qI8QDlE=", "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 a7eecfb84d..4cc311d76d 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": "F5K30FZGcmERlgvw8D8v4Vuqh2FP2fxSeq0KVOT4LYg=", + "shasum": "z4xQLZ7pODluCUGl8nvc1i1pYPXV13n3ecD9zje1uA4=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethereum-provider/snap.manifest.json b/packages/examples/packages/ethereum-provider/snap.manifest.json index b1fd03740b..8d6fda6dbc 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": "iHt9Se2I/fFZeIQW6p5qyNGt+wD7S2NKlNPLYjSTZMc=", + "shasum": "CVfWemw0qin73d68K9S4z3WYa2T3pX/q4KJTQX6NuTc=", "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 881b8871b0..d150e36c04 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": "K1gDsaTcrhG5vRH5Tb1uswHg6QnxYIqKjynyvzLlbfM=", + "shasum": "asSsZmkIxhNiTVntJiyRGbRnhhL/6hF9ljOGnx5YjQU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/file-upload/snap.manifest.json b/packages/examples/packages/file-upload/snap.manifest.json index 36d27cf828..e27f8c0380 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": "XWQyeVfzXAXLSNiE9je6OjMU8dqlDw0Mw4q6QApCgFo=", + "shasum": "+vYA1cjdFVjuW0eUHrf4atdxSG1Z+m89IPTv8+QUCH8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-entropy/snap.manifest.json b/packages/examples/packages/get-entropy/snap.manifest.json index e157546178..e421e08ff0 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": "WXUTcCOLbtQnTMVKVz2X2IeQG8ICXkmDozXlil/Z3rI=", + "shasum": "84ncVSsZo1z+hf/69TLWDtNN1CZGZMY/hM5wq4uNlbo=", "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 ac0669a257..1657c02caf 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": "dhEHU8KvnRAcZlEq4cnrhaVaEeRux9b0HA8LrA5GPnI=", + "shasum": "4SJKXTrn089x72FouheOjJpwiLxorXZIDIDcwOOstI4=", "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 8f21ca554b..79aafc195e 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": "YYz045/kftDaFs5MVv7EJzcMOtu7KBZa9RgceCoD9Gc=", + "shasum": "9Ce5WnPGv+2y+pOjdsYQHurm7mQZgiMWOn7L2V9kU7c=", "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 b86659ec87..6ec7e43b10 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": "17xibkzbvbonxdKRhYc1/hcy07SMuF1kUnWTww01Wh8=", + "shasum": "ARnygOUctt+aRLi4CegoS23GTv3ZFzJcJSKbdsuSpz0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/interactive-ui/snap.manifest.json b/packages/examples/packages/interactive-ui/snap.manifest.json index c3551b8670..c960b822f5 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": "RjotFvCYvRLQkQh0/MfN+KnVdoYaX/iG5xJ72hgea+8=", + "shasum": "HXNAfiGYn1gn/LyCYDz3UaKwDwxfA3cTgFyiRmtUOqo=", "location": { "npm": { "filePath": "dist/bundle.js", 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 56061a4ede..34ee7a9c9d 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": "x2DFl/pD2oP4tX1xA+nGRlMKygBxECdsoUEuv+SIDCg=", + "shasum": "JqZC+dlxgsS+Cb4RnSButreU2mPI7zXQoXE0Bi5E04Y=", "location": { "npm": { "filePath": "dist/bundle.js", 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 a14eb7ab4b..9c7476a207 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": "/Jd80mRS0sRtJkysLijC+nFivuYFcpJN88c+0uPEAmE=", + "shasum": "qHKGKr2u7HSxj1tZYFTrsaf+BMwLP0BJbZG/bMjCB78=", "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 ebe5a5e943..a52068aafa 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": "k38ku5e19Ma18bw8Fj7X7EdplcNcNUYGe1YSvMXSFFc=", + "shasum": "84qJUYjusbsst+2fXpBFngGke2oYGNCMwK0ZZrGNnUI=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/jsx/snap.manifest.json b/packages/examples/packages/jsx/snap.manifest.json index 7c3038892d..71940ccc36 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": "sG6nzWp3egu6KVdzrrx/xDnZxoHoropwbpw16VWRq1I=", + "shasum": "oR1vkuI/ZhNyhxxqKQtKJtDfxEy2CmikqFB7/i/vvhU=", "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 025c1d50a7..0765bada8d 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": "5GnkRgxSJ31ZrC88L5YT4085IXAtEW/ssOzb3vKdhGk=", + "shasum": "/6ZV7+I5iqfXnFB9KsDn5oslt8FVrdEGH3Dohs4fi5s=", "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 63cab478c2..544b925a73 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": "gEbnqa/dhseAw+m5voKOPmZU3RtrsAMzVv71TGgyrSI=", + "shasum": "BIgKTHpiJlGf989AIapTaDP40Uo2dB5LLqo4/TTKJSA=", "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 3c230300cf..33283fe6de 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": "QYVpepzwJ55thY051dZjkO+FK/WTsIYoG/pH46PHz34=", + "shasum": "C/H5RbiGFgmU1MwYePeqbJQkJteInVWCH0uMlSv7iz0=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/network-access/snap.manifest.json b/packages/examples/packages/network-access/snap.manifest.json index dcaf007896..4a68caf209 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": "pIiNNUSwbqXQsniqxkj40MNPi4Clf6mlfq1VIZAzfIM=", + "shasum": "tZRSVvUPatD4j0ICOIBxlIOoASo8MUtaW59WDe90A7I=", "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 9cd7f6684f..71ae4111be 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": "IoRhxK1wXSXko6nMqmkAUePNyMgVpWowoAWzjiPw5HE=", + "shasum": "p86vLeEnlbTcEhvFd5E52okTQO5WgngjzEp5GVhqoxU=", "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 776890cd15..c635d47f1d 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": "YkohC4woUwiIwSOsXUvhrL9g5xMQ4f094tVwtTmQQ0Y=", + "shasum": "OrvLh+ynj55V2wBEXFCve9ahuV3UyKXRZadpwOLvaec=", "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 4da5a712ac..e455fcc258 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": "pP2JIcm3hGBQ2qpQHZUZckKEM/k6IJU2MEy0hm02HQg=", + "shasum": "YTr5eZhiY6dzUtKuHKhyoCDnNo3N6dVPsZIE6VH8zJ4=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/transaction-insights/snap.manifest.json b/packages/examples/packages/transaction-insights/snap.manifest.json index 136a442c0d..d20e7d4b74 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": "mHNCDPJXx/vNcx6bHIuU4yqGl6MI8MkGO2WDGTWORJI=", + "shasum": "3lV8Dh81WMtN7wS7xlBeDZDLtclv/I5W6n3l0Y3oWho=", "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 5d2090a25c..be3e61ce57 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": "up4UE5+k0FrYVyONu3Nf11+ngzt9DqW/0TxrUd45380=", + "shasum": "yYmlnYmPHzZFJ7DAmuf18wZA8p7gLZDTzzyfjQF7+T8=", "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 d19c0c219b..1bef63ac46 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": "zN8Dkb34se77/TXqLyMRINMxX4YfhcjhBHtGLo1kGPU=", + "shasum": "iT4PzMHSnOPQF3n5rPwx7SJIkMK0z6ttlESam48AjP4=", "location": { "npm": { "filePath": "dist/bundle.js", From bbbd1611708cc8ffd7d66fcbcc365e9c939dd434 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 1 Jul 2024 10:20:08 -0400 Subject: [PATCH 28/47] Remove unused devDep --- packages/examples/packages/dialogs/package.json | 1 - packages/examples/packages/ethers-js/package.json | 1 - yarn.lock | 2 -- 3 files changed, 4 deletions(-) diff --git a/packages/examples/packages/dialogs/package.json b/packages/examples/packages/dialogs/package.json index ba8d060690..9a7f03eca1 100644 --- a/packages/examples/packages/dialogs/package.json +++ b/packages/examples/packages/dialogs/package.json @@ -42,7 +42,6 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/ethers-js/package.json b/packages/examples/packages/ethers-js/package.json index 28877f909f..451602ed1d 100644 --- a/packages/examples/packages/ethers-js/package.json +++ b/packages/examples/packages/ethers-js/package.json @@ -43,7 +43,6 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/yarn.lock b/yarn.lock index f79c46edfd..6a79492d84 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4291,7 +4291,6 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4526,7 +4525,6 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 From 2dcab89774179efc9ab7b6a409d29236e88770cd Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 1 Jul 2024 13:38:19 -0400 Subject: [PATCH 29/47] [snaps-simulator] Replace `superstruct` `^1.0.3` with `@metamask/superstruct` `^3.1.0` --- packages/snaps-simulator/package.json | 4 ++-- packages/snaps-simulator/src/features/builder/utils.ts | 2 +- yarn.lock | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/snaps-simulator/package.json b/packages/snaps-simulator/package.json index 195ea2fc3c..5cb11d968a 100644 --- a/packages/snaps-simulator/package.json +++ b/packages/snaps-simulator/package.json @@ -41,6 +41,7 @@ "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.0.0", "@minoru/react-dnd-treeview": "^3.4.4", "@noble/hashes": "^1.3.1", @@ -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/yarn.lock b/yarn.lock index 6a79492d84..011f47029b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5963,6 +5963,7 @@ __metadata: "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^9.0.0 "@minoru/react-dnd-treeview": ^3.4.4 "@noble/hashes": ^1.3.1 @@ -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 From 3ec97bfea327cf3a5aadc0894180d6828da094de Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 1 Jul 2024 14:17:38 -0400 Subject: [PATCH 30/47] Bump `@metamask/providers` from `^17.0.0` to `^17.1.0` --- .../snaps-execution-environments/package.json | 2 +- packages/snaps-sdk/package.json | 2 +- packages/test-snaps/package.json | 2 +- yarn.lock | 52 ++++++------------- 4 files changed, 20 insertions(+), 38 deletions(-) diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 7cf254d121..c21e6db4e2 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -54,7 +54,7 @@ "@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/providers": "^17.1.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 8426883592..ed689d35e5 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "@metamask/key-tree": "^9.1.1", - "@metamask/providers": "^17.0.0", + "@metamask/providers": "^17.1.0", "@metamask/rpc-errors": "^6.2.1", "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.0.0" diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index 676949dddc..a4203e1921 100644 --- a/packages/test-snaps/package.json +++ b/packages/test-snaps/package.json @@ -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.1.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 011f47029b..06a04fe7c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4877,7 +4877,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/json-rpc-engine@npm:^8.0.1, @metamask/json-rpc-engine@npm:^8.0.2": +"@metamask/json-rpc-engine@npm:^8.0.2": version: 8.0.2 resolution: "@metamask/json-rpc-engine@npm:8.0.2" dependencies: @@ -4935,18 +4935,6 @@ __metadata: languageName: unknown linkType: soft -"@metamask/json-rpc-middleware-stream@npm:^7.0.1": - version: 7.0.1 - resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.1" - dependencies: - "@metamask/json-rpc-engine": ^8.0.1 - "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 - readable-stream: ^3.6.2 - checksum: aacf571a906c3c1d5376e9b1f78d47510b568cc64af26f432dfaa6c6d5480d86e0f8af36855c57a0de95c017313d7ff19bfc396c648aa6ee79f689092154d46b - languageName: node - 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" @@ -5290,24 +5278,24 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^17.0.0": - version: 17.0.0 - resolution: "@metamask/providers@npm:17.0.0" +"@metamask/providers@npm:^17.1.0": + version: 17.1.0 + resolution: "@metamask/providers@npm:17.1.0" dependencies: - "@metamask/json-rpc-engine": ^8.0.1 - "@metamask/json-rpc-middleware-stream": ^7.0.1 + "@metamask/json-rpc-engine": ^9.0.0 + "@metamask/json-rpc-middleware-stream": ^8.0.0 "@metamask/object-multiplex": ^2.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/safe-event-emitter": ^3.1.1 "@metamask/utils": ^8.3.0 detect-browser: ^5.2.0 - extension-port-stream: ^3.0.0 + extension-port-stream: ^4.1.0 fast-deep-equal: ^3.1.3 is-stream: ^2.0.0 readable-stream: ^3.6.2 peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 330e369458edc68d743d87b8b2597cdacac58df01b5fc31f565ae5dacee2390ee23693fb10fa451c6146665e87475a4c8f54163407eb05fceeb698900e34f9e6 + checksum: 1378f7e9a5385536e814190f880cd71bbb0a055b8a234012243ba9f54c5eace1d8bb5324732cb46b3046ad22349a698c1ca3c06402e52675b66e55b9b741f820 languageName: node linkType: hard @@ -5676,7 +5664,7 @@ __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/providers": ^17.1.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" @@ -5906,7 +5894,7 @@ __metadata: "@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/providers": ^17.1.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^9.0.0 @@ -6219,7 +6207,7 @@ __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.1.0 "@metamask/signature-insights-example-snap": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^9.0.0 @@ -13262,13 +13250,14 @@ __metadata: languageName: node linkType: hard -"extension-port-stream@npm:^3.0.0": - version: 3.0.0 - resolution: "extension-port-stream@npm:3.0.0" +"extension-port-stream@npm:^4.1.0": + version: 4.1.0 + resolution: "extension-port-stream@npm:4.1.0" dependencies: readable-stream: ^3.6.2 || ^4.4.2 - webextension-polyfill: ">=0.10.0 <1.0" - checksum: 4f51d2258a96154c2d916a8a5425636a2b0817763e9277f7dc378d08b6f050c90d185dbde4313d27cf66ad99d4b3116479f9f699c40358c64cccfa524d2b55bf + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: e349277cf65a89c2a6c4f3611f52e0a97497bd2870a4c25aa4ab11b300c48e3013fd95208e3ff6c8494dfb849eed725e7506e59118b1a69e555fa4b67afdbd83 languageName: node linkType: hard @@ -22928,13 +22917,6 @@ __metadata: languageName: node linkType: hard -"webextension-polyfill@npm:>=0.10.0 <1.0": - version: 0.10.0 - resolution: "webextension-polyfill@npm:0.10.0" - checksum: 4a59036bda571360c2c0b2fb03fe1dc244f233946bcf9a6766f677956c40fd14d270aaa69cdba95e4ac521014afbe4008bfa5959d0ac39f91c990eb206587f91 - languageName: node - linkType: hard - "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" From 9f33e7a0c7b47bd7a70c23a7b1c8be18d5645378 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 1 Jul 2024 14:25:43 -0400 Subject: [PATCH 31/47] Fix import from `@metamask/providers` --- .../snaps-execution-environments/src/common/BaseSnapExecutor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index cabd40c57d..d66cddcf99 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -2,7 +2,7 @@ /// import { createIdRemapMiddleware } from '@metamask/json-rpc-engine'; import type { RequestArguments } from '@metamask/providers'; -import { StreamProvider } from '@metamask/providers/dist/StreamProvider'; +import { StreamProvider } from '@metamask/providers'; import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors'; import type { SnapsProvider } from '@metamask/snaps-sdk'; import { getErrorData } from '@metamask/snaps-sdk'; From ec629f9cefdfecc4fd142202b6835fd531eb65e8 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 3 Jul 2024 15:19:13 -0400 Subject: [PATCH 32/47] Bump `@metamask/rpc-errors` from `^6.2.1` to `^6.3.1` --- packages/examples/packages/jsx/package.json | 2 +- packages/snaps-controllers/package.json | 2 +- .../snaps-execution-environments/package.json | 2 +- packages/snaps-rpc-methods/package.json | 2 +- packages/snaps-sdk/package.json | 2 +- packages/snaps-utils/package.json | 2 +- yarn.lock | 22 ++++++++++++++----- 7 files changed, 22 insertions(+), 12 deletions(-) diff --git a/packages/examples/packages/jsx/package.json b/packages/examples/packages/jsx/package.json index eb64d0990a..fdeedfc5a5 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": { diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index ce6fd3ee25..d891cfcd36 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -61,7 +61,7 @@ "@metamask/permission-controller": "^10.0.0", "@metamask/phishing-controller": "^10.0.0", "@metamask/post-message-stream": "^8.1.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-registry": "^3.2.0", "@metamask/snaps-rpc-methods": "workspace:^", "@metamask/snaps-sdk": "workspace:^", diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index c21e6db4e2..4f52a2b487 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -55,7 +55,7 @@ "@metamask/object-multiplex": "^2.0.0", "@metamask/post-message-stream": "^8.1.0", "@metamask/providers": "^17.1.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.1.0", diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index d6e838de6d..744e37f7ff 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -41,7 +41,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/permission-controller": "^10.0.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.1.0", diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index ed689d35e5..8cd62eee04 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -61,7 +61,7 @@ "dependencies": { "@metamask/key-tree": "^9.1.1", "@metamask/providers": "^17.1.0", - "@metamask/rpc-errors": "^6.2.1", + "@metamask/rpc-errors": "^6.3.1", "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.0.0" }, diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index b8efa2f94f..d3c355f95d 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -55,7 +55,7 @@ "@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/rpc-errors": "^6.3.1", "@metamask/slip44": "^3.1.0", "@metamask/snaps-registry": "^3.2.0", "@metamask/snaps-sdk": "workspace:^", diff --git a/yarn.lock b/yarn.lock index 06a04fe7c6..6a563c5410 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4958,7 +4958,7 @@ __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:^" @@ -5353,6 +5353,16 @@ __metadata: languageName: node linkType: hard +"@metamask/rpc-errors@npm:^6.3.1": + version: 6.3.1 + resolution: "@metamask/rpc-errors@npm:6.3.1" + dependencies: + "@metamask/utils": ^9.0.0 + fast-safe-stringify: ^2.0.6 + checksum: 8761f5c0161cb3b342abd3ccccbd7b792f36a987e1f22c3f89b1bd29f72a2e35a2c91b58164fdd9dc3e5b67157500dcbdb5d04245117c14310c34cf42f7b8463 + languageName: node + linkType: hard + "@metamask/safe-event-emitter@npm:^3.0.0, @metamask/safe-event-emitter@npm:^3.1.1": version: 3.1.1 resolution: "@metamask/safe-event-emitter@npm:3.1.1" @@ -5572,7 +5582,7 @@ __metadata: "@metamask/permission-controller": ^10.0.0 "@metamask/phishing-controller": ^10.0.0 "@metamask/post-message-stream": ^8.1.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-registry": ^3.2.0 "@metamask/snaps-rpc-methods": "workspace:^" "@metamask/snaps-sdk": "workspace:^" @@ -5665,7 +5675,7 @@ __metadata: "@metamask/object-multiplex": ^2.0.0 "@metamask/post-message-stream": ^8.1.0 "@metamask/providers": ^17.1.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.1.0 @@ -5852,7 +5862,7 @@ __metadata: "@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/rpc-errors": ^6.3.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/superstruct": ^3.1.0 @@ -5895,7 +5905,7 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/key-tree": ^9.1.1 "@metamask/providers": ^17.1.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 @@ -6054,7 +6064,7 @@ __metadata: "@metamask/key-tree": ^9.1.1 "@metamask/permission-controller": ^10.0.0 "@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.2.0 "@metamask/snaps-sdk": "workspace:^" From 634a4f48f47b6d4fcb05fd02b468d8d1952bebba Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Wed, 3 Jul 2024 15:30:18 -0400 Subject: [PATCH 33/47] Update lavamoat policy --- .../lavamoat/browserify/webview/policy.json | 17 ++++++++++++++++- .../lavamoat/browserify/worker-pool/policy.json | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 67f5890896..9a320a6b25 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -12,10 +12,25 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": 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 67f5890896..9a320a6b25 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -12,10 +12,25 @@ "removeEventListener": true }, "packages": { - "@metamask/utils": true, + "@metamask/post-message-stream>@metamask/utils": true, "readable-stream": true } }, + "@metamask/post-message-stream>@metamask/utils": { + "globals": { + "TextDecoder": true, + "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, + "tsup>debug": true + } + }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": true, From cb3a1cb323bd1a59c8c84b3157fb1c203d48e77f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 15:07:09 -0400 Subject: [PATCH 34/47] Revert "Bump `@metamask/providers` from `^17.0.0` to `^17.1.0`" This reverts commit 3ec97bfea327cf3a5aadc0894180d6828da094de. --- .../snaps-execution-environments/package.json | 2 +- packages/snaps-sdk/package.json | 2 +- packages/test-snaps/package.json | 2 +- yarn.lock | 52 +++++++++++++------ 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 4f52a2b487..2b9651238c 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -54,7 +54,7 @@ "@metamask/json-rpc-engine": "^9.0.0", "@metamask/object-multiplex": "^2.0.0", "@metamask/post-message-stream": "^8.1.0", - "@metamask/providers": "^17.1.0", + "@metamask/providers": "^17.0.0", "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 8cd62eee04..46cf021189 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "@metamask/key-tree": "^9.1.1", - "@metamask/providers": "^17.1.0", + "@metamask/providers": "^17.0.0", "@metamask/rpc-errors": "^6.3.1", "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.0.0" diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index a4203e1921..676949dddc 100644 --- a/packages/test-snaps/package.json +++ b/packages/test-snaps/package.json @@ -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.1.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 6a563c5410..2f11c64f2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4877,7 +4877,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/json-rpc-engine@npm:^8.0.2": +"@metamask/json-rpc-engine@npm:^8.0.1, @metamask/json-rpc-engine@npm:^8.0.2": version: 8.0.2 resolution: "@metamask/json-rpc-engine@npm:8.0.2" dependencies: @@ -4935,6 +4935,18 @@ __metadata: languageName: unknown linkType: soft +"@metamask/json-rpc-middleware-stream@npm:^7.0.1": + version: 7.0.1 + resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.1" + dependencies: + "@metamask/json-rpc-engine": ^8.0.1 + "@metamask/safe-event-emitter": ^3.0.0 + "@metamask/utils": ^8.3.0 + readable-stream: ^3.6.2 + checksum: aacf571a906c3c1d5376e9b1f78d47510b568cc64af26f432dfaa6c6d5480d86e0f8af36855c57a0de95c017313d7ff19bfc396c648aa6ee79f689092154d46b + languageName: node + 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" @@ -5278,24 +5290,24 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^17.1.0": - version: 17.1.0 - resolution: "@metamask/providers@npm:17.1.0" +"@metamask/providers@npm:^17.0.0": + version: 17.0.0 + resolution: "@metamask/providers@npm:17.0.0" dependencies: - "@metamask/json-rpc-engine": ^9.0.0 - "@metamask/json-rpc-middleware-stream": ^8.0.0 + "@metamask/json-rpc-engine": ^8.0.1 + "@metamask/json-rpc-middleware-stream": ^7.0.1 "@metamask/object-multiplex": ^2.0.0 "@metamask/rpc-errors": ^6.2.1 "@metamask/safe-event-emitter": ^3.1.1 "@metamask/utils": ^8.3.0 detect-browser: ^5.2.0 - extension-port-stream: ^4.1.0 + extension-port-stream: ^3.0.0 fast-deep-equal: ^3.1.3 is-stream: ^2.0.0 readable-stream: ^3.6.2 peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 1378f7e9a5385536e814190f880cd71bbb0a055b8a234012243ba9f54c5eace1d8bb5324732cb46b3046ad22349a698c1ca3c06402e52675b66e55b9b741f820 + checksum: 330e369458edc68d743d87b8b2597cdacac58df01b5fc31f565ae5dacee2390ee23693fb10fa451c6146665e87475a4c8f54163407eb05fceeb698900e34f9e6 languageName: node linkType: hard @@ -5674,7 +5686,7 @@ __metadata: "@metamask/json-rpc-engine": ^9.0.0 "@metamask/object-multiplex": ^2.0.0 "@metamask/post-message-stream": ^8.1.0 - "@metamask/providers": ^17.1.0 + "@metamask/providers": ^17.0.0 "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" @@ -5904,7 +5916,7 @@ __metadata: "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/key-tree": ^9.1.1 - "@metamask/providers": ^17.1.0 + "@metamask/providers": ^17.0.0 "@metamask/rpc-errors": ^6.3.1 "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^9.0.0 @@ -6217,7 +6229,7 @@ __metadata: "@metamask/name-lookup-example-snap": "workspace:^" "@metamask/network-example-snap": "workspace:^" "@metamask/notification-example-snap": "workspace:^" - "@metamask/providers": ^17.1.0 + "@metamask/providers": ^17.0.0 "@metamask/signature-insights-example-snap": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^9.0.0 @@ -13260,14 +13272,13 @@ __metadata: languageName: node linkType: hard -"extension-port-stream@npm:^4.1.0": - version: 4.1.0 - resolution: "extension-port-stream@npm:4.1.0" +"extension-port-stream@npm:^3.0.0": + version: 3.0.0 + resolution: "extension-port-stream@npm:3.0.0" dependencies: readable-stream: ^3.6.2 || ^4.4.2 - peerDependencies: - webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: e349277cf65a89c2a6c4f3611f52e0a97497bd2870a4c25aa4ab11b300c48e3013fd95208e3ff6c8494dfb849eed725e7506e59118b1a69e555fa4b67afdbd83 + webextension-polyfill: ">=0.10.0 <1.0" + checksum: 4f51d2258a96154c2d916a8a5425636a2b0817763e9277f7dc378d08b6f050c90d185dbde4313d27cf66ad99d4b3116479f9f699c40358c64cccfa524d2b55bf languageName: node linkType: hard @@ -22927,6 +22938,13 @@ __metadata: languageName: node linkType: hard +"webextension-polyfill@npm:>=0.10.0 <1.0": + version: 0.10.0 + resolution: "webextension-polyfill@npm:0.10.0" + checksum: 4a59036bda571360c2c0b2fb03fe1dc244f233946bcf9a6766f677956c40fd14d270aaa69cdba95e4ac521014afbe4008bfa5959d0ac39f91c990eb206587f91 + languageName: node + linkType: hard + "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" From ce8a4d3ffe74c559c647a7817e935a8a09f79af4 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 15:13:55 -0400 Subject: [PATCH 35/47] fix(lint): Remove unused import --- packages/snaps-sdk/src/ui/components/panel.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/packages/snaps-sdk/src/ui/components/panel.ts b/packages/snaps-sdk/src/ui/components/panel.ts index 10a841e68a..90b8d71ae5 100644 --- a/packages/snaps-sdk/src/ui/components/panel.ts +++ b/packages/snaps-sdk/src/ui/components/panel.ts @@ -1,12 +1,5 @@ import type { Infer, Struct } from '@metamask/superstruct'; -import { - array, - assign, - lazy, - literal, - object, - union, -} from '@metamask/superstruct'; +import { array, assign, lazy, literal, object } from '@metamask/superstruct'; import { typedUnion } from '../../internals'; import { createBuilder } from '../builder'; From 91e83cd7b9a4db98b500c54a62c305db0c95f1f1 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 15:17:08 -0400 Subject: [PATCH 36/47] Update lavamoat policy and manifest --- .../packages/bip32/snap.manifest.json | 2 +- .../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 +- .../ethereum-provider/snap.manifest.json | 2 +- .../packages/ethers-js/snap.manifest.json | 2 +- .../packages/file-upload/snap.manifest.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 +- .../interactive-ui/snap.manifest.json | 2 +- .../consumer-signer/snap.manifest.json | 2 +- .../packages/core-signer/snap.manifest.json | 2 +- .../packages/json-rpc/snap.manifest.json | 2 +- .../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 +- .../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/snap.manifest.json | 2 +- .../examples/packages/wasm/snap.manifest.json | 2 +- .../webpack-plugin/snap.manifest.json | 2 +- .../lavamoat/browserify/iframe/policy.json | 63 ++++++++++++- .../browserify/node-process/policy.json | 90 ++++++++++++++++++- .../browserify/node-thread/policy.json | 90 ++++++++++++++++++- .../lavamoat/browserify/webview/policy.json | 17 +--- .../browserify/worker-executor/policy.json | 63 ++++++++++++- .../browserify/worker-pool/policy.json | 17 +--- 35 files changed, 321 insertions(+), 77 deletions(-) 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/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/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/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/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/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/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/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/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/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/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-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index b251904ff1..b325c5d945 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -2,8 +2,14 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, "@metamask/utils": true } }, @@ -39,23 +45,37 @@ }, "@metamask/providers": { "globals": { - "console": true + "CustomEvent": true, + "Event": true, + "addEventListener": true, + "chrome.runtime.connect": true, + "console": true, + "dispatchEvent": true, + "document.createElement": true, + "document.readyState": true, + "ethereum": "write", + "location.hostname": true, + "removeEventListener": true, + "web3": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/providers>detect-browser": true, + "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -69,6 +89,12 @@ "readable-stream": true } }, + "@metamask/providers>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true + } + }, "@metamask/providers>@metamask/safe-event-emitter": { "globals": { "setTimeout": true @@ -77,6 +103,35 @@ "browserify>events": true } }, + "@metamask/providers>detect-browser": { + "globals": { + "document": true, + "navigator": true + }, + "packages": { + "browserify>process": true + } + }, + "@metamask/providers>extension-port-stream": { + "packages": { + "@metamask/providers>extension-port-stream>readable-stream": true, + "browserify>buffer": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream": { + "globals": { + "AbortController": true, + "AggregateError": true, + "Blob": true + }, + "packages": { + "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, + "browserify>buffer": true, + "browserify>events": true, + "browserify>process": true, + "browserify>string_decoder": true + } + }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": 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 760ede1af5..9524251a6e 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -2,8 +2,14 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, "@metamask/utils": true } }, @@ -46,23 +52,37 @@ }, "@metamask/providers": { "globals": { - "console": true + "CustomEvent": true, + "Event": true, + "addEventListener": true, + "chrome.runtime.connect": true, + "console": true, + "dispatchEvent": true, + "document.createElement": true, + "document.readyState": true, + "ethereum": "write", + "location.hostname": true, + "removeEventListener": true, + "web3": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/providers>detect-browser": true, + "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -76,6 +96,12 @@ "readable-stream": true } }, + "@metamask/providers>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true + } + }, "@metamask/providers>@metamask/safe-event-emitter": { "builtin": { "events.EventEmitter": true @@ -87,6 +113,57 @@ "events": true } }, + "@metamask/providers>detect-browser": { + "globals": { + "document": true, + "navigator": true, + "process": true + } + }, + "@metamask/providers>extension-port-stream": { + "builtin": { + "buffer.Buffer": true + }, + "packages": { + "@metamask/providers>extension-port-stream>readable-stream": true, + "buffer": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream": { + "builtin": { + "buffer.Blob": true, + "buffer.Buffer": true, + "events.EventEmitter": true, + "stream": true, + "string_decoder.StringDecoder": true + }, + "globals": { + "AbortController": true, + "AggregateError": true, + "Blob": true, + "process.env.READABLE_STREAM": true + }, + "packages": { + "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, + "browserify>process": true, + "buffer": true, + "events": true, + "stream": true, + "string_decoder": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream>abort-controller": { + "packages": { + "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": { + "globals": { + "Event": true, + "EventTarget": true, + "console": true + } + }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": true, @@ -180,6 +257,11 @@ "util": true } }, + "browserify>process": { + "globals": { + "process": true + } + }, "browserify>string_decoder": { "packages": { "browserify>browser-pack>safe-buffer": 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 760ede1af5..9524251a6e 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -2,8 +2,14 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, "@metamask/utils": true } }, @@ -46,23 +52,37 @@ }, "@metamask/providers": { "globals": { - "console": true + "CustomEvent": true, + "Event": true, + "addEventListener": true, + "chrome.runtime.connect": true, + "console": true, + "dispatchEvent": true, + "document.createElement": true, + "document.readyState": true, + "ethereum": "write", + "location.hostname": true, + "removeEventListener": true, + "web3": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/providers>detect-browser": true, + "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -76,6 +96,12 @@ "readable-stream": true } }, + "@metamask/providers>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true + } + }, "@metamask/providers>@metamask/safe-event-emitter": { "builtin": { "events.EventEmitter": true @@ -87,6 +113,57 @@ "events": true } }, + "@metamask/providers>detect-browser": { + "globals": { + "document": true, + "navigator": true, + "process": true + } + }, + "@metamask/providers>extension-port-stream": { + "builtin": { + "buffer.Buffer": true + }, + "packages": { + "@metamask/providers>extension-port-stream>readable-stream": true, + "buffer": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream": { + "builtin": { + "buffer.Blob": true, + "buffer.Buffer": true, + "events.EventEmitter": true, + "stream": true, + "string_decoder.StringDecoder": true + }, + "globals": { + "AbortController": true, + "AggregateError": true, + "Blob": true, + "process.env.READABLE_STREAM": true + }, + "packages": { + "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, + "browserify>process": true, + "buffer": true, + "events": true, + "stream": true, + "string_decoder": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream>abort-controller": { + "packages": { + "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": { + "globals": { + "Event": true, + "EventTarget": true, + "console": true + } + }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": true, @@ -180,6 +257,11 @@ "util": true } }, + "browserify>process": { + "globals": { + "process": true + } + }, "browserify>string_decoder": { "packages": { "browserify>browser-pack>safe-buffer": true diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index 9a320a6b25..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -12,25 +12,10 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": 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 b251904ff1..b325c5d945 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -2,8 +2,14 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { + "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true + } + }, + "@metamask/json-rpc-engine>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, "@metamask/utils": true } }, @@ -39,23 +45,37 @@ }, "@metamask/providers": { "globals": { - "console": true + "CustomEvent": true, + "Event": true, + "addEventListener": true, + "chrome.runtime.connect": true, + "console": true, + "dispatchEvent": true, + "document.createElement": true, + "document.readyState": true, + "ethereum": "write", + "location.hostname": true, + "removeEventListener": true, + "web3": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/providers>detect-browser": true, + "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, - "@metamask/rpc-errors": true, + "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { + "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -69,6 +89,12 @@ "readable-stream": true } }, + "@metamask/providers>@metamask/rpc-errors": { + "packages": { + "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/utils": true + } + }, "@metamask/providers>@metamask/safe-event-emitter": { "globals": { "setTimeout": true @@ -77,6 +103,35 @@ "browserify>events": true } }, + "@metamask/providers>detect-browser": { + "globals": { + "document": true, + "navigator": true + }, + "packages": { + "browserify>process": true + } + }, + "@metamask/providers>extension-port-stream": { + "packages": { + "@metamask/providers>extension-port-stream>readable-stream": true, + "browserify>buffer": true + } + }, + "@metamask/providers>extension-port-stream>readable-stream": { + "globals": { + "AbortController": true, + "AggregateError": true, + "Blob": true + }, + "packages": { + "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, + "browserify>buffer": true, + "browserify>events": true, + "browserify>process": true, + "browserify>string_decoder": true + } + }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": 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 9a320a6b25..67f5890896 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -12,25 +12,10 @@ "removeEventListener": true }, "packages": { - "@metamask/post-message-stream>@metamask/utils": true, + "@metamask/utils": true, "readable-stream": true } }, - "@metamask/post-message-stream>@metamask/utils": { - "globals": { - "TextDecoder": true, - "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, - "tsup>debug": true - } - }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": true, From d97c6f1d9a3acba09f4154aa8faeb5e1f3df5d0f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 15:18:14 -0400 Subject: [PATCH 37/47] Fix lockfile --- yarn.lock | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2f11c64f2e..ec9fab75da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5355,17 +5355,7 @@ __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" - dependencies: - "@metamask/utils": ^8.3.0 - fast-safe-stringify: ^2.0.6 - checksum: a9223c3cb9ab05734ea0dda990597f90a7cdb143efa0c026b1a970f2094fe5fa3c341ed39b1e7623be13a96b98fb2c697ef51a2e2b87d8f048114841d35ee0a9 - languageName: node - linkType: hard - -"@metamask/rpc-errors@npm:^6.3.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: From fa0c2fdc1086fb823028c0bed06b57a906ccf191 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 15:27:52 -0400 Subject: [PATCH 38/47] Update lavamoat policy --- .../lavamoat/browserify/iframe/policy.json | 18 +++--------------- .../browserify/node-process/policy.json | 18 +++--------------- .../browserify/node-thread/policy.json | 18 +++--------------- .../browserify/worker-executor/policy.json | 18 +++--------------- 4 files changed, 12 insertions(+), 60 deletions(-) diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index b325c5d945..25a2077d6b 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -2,14 +2,8 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/utils": true - } - }, - "@metamask/json-rpc-engine>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -62,11 +56,11 @@ "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>detect-browser": true, "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, + "@metamask/rpc-errors": true, "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -74,8 +68,8 @@ }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -89,12 +83,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/safe-event-emitter": { "globals": { "setTimeout": 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 9524251a6e..18a8116dd0 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -2,14 +2,8 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/utils": true - } - }, - "@metamask/json-rpc-engine>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -69,11 +63,11 @@ "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>detect-browser": true, "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, + "@metamask/rpc-errors": true, "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -81,8 +75,8 @@ }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -96,12 +90,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/safe-event-emitter": { "builtin": { "events.EventEmitter": 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 9524251a6e..18a8116dd0 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -2,14 +2,8 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/utils": true - } - }, - "@metamask/json-rpc-engine>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -69,11 +63,11 @@ "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>detect-browser": true, "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, + "@metamask/rpc-errors": true, "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -81,8 +75,8 @@ }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -96,12 +90,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/safe-event-emitter": { "builtin": { "events.EventEmitter": 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 b325c5d945..25a2077d6b 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -2,14 +2,8 @@ "resources": { "@metamask/json-rpc-engine": { "packages": { - "@metamask/json-rpc-engine>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/utils": true - } - }, - "@metamask/json-rpc-engine>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -62,11 +56,11 @@ "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>detect-browser": true, "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, + "@metamask/rpc-errors": true, "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true @@ -74,8 +68,8 @@ }, "@metamask/providers>@metamask/json-rpc-engine": { "packages": { - "@metamask/providers>@metamask/rpc-errors": true, "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/rpc-errors": true, "@metamask/utils": true } }, @@ -89,12 +83,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/rpc-errors": { - "packages": { - "@metamask/rpc-errors>fast-safe-stringify": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/safe-event-emitter": { "globals": { "setTimeout": true From 6a8919f02d8e86f89a6b45f4c3c2c0f498f7a07e Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 22:36:11 -0400 Subject: [PATCH 39/47] Revert "Fix import from `@metamask/providers`" This reverts commit 9f33e7a0c7b47bd7a70c23a7b1c8be18d5645378. --- .../snaps-execution-environments/src/common/BaseSnapExecutor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index d66cddcf99..cabd40c57d 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -2,7 +2,7 @@ /// import { createIdRemapMiddleware } from '@metamask/json-rpc-engine'; import type { RequestArguments } from '@metamask/providers'; -import { StreamProvider } from '@metamask/providers'; +import { StreamProvider } from '@metamask/providers/dist/StreamProvider'; import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors'; import type { SnapsProvider } from '@metamask/snaps-sdk'; import { getErrorData } from '@metamask/snaps-sdk'; From bc7871225f39e7687e5b615abb43c5ae4e315a7a Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 22:50:26 -0400 Subject: [PATCH 40/47] Update lavamoat policy --- .../lavamoat/browserify/iframe/policy.json | 45 +----------- .../browserify/node-process/policy.json | 72 +------------------ .../browserify/node-thread/policy.json | 72 +------------------ .../browserify/worker-executor/policy.json | 45 +----------- 4 files changed, 4 insertions(+), 230 deletions(-) diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index 25a2077d6b..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -39,29 +39,15 @@ }, "@metamask/providers": { "globals": { - "CustomEvent": true, - "Event": true, - "addEventListener": true, - "chrome.runtime.connect": true, - "console": true, - "dispatchEvent": true, - "document.createElement": true, - "document.readyState": true, - "ethereum": "write", - "location.hostname": true, - "removeEventListener": true, - "web3": true + "console": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>detect-browser": true, - "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, "@metamask/rpc-errors": true, - "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } @@ -91,35 +77,6 @@ "browserify>events": true } }, - "@metamask/providers>detect-browser": { - "globals": { - "document": true, - "navigator": true - }, - "packages": { - "browserify>process": true - } - }, - "@metamask/providers>extension-port-stream": { - "packages": { - "@metamask/providers>extension-port-stream>readable-stream": true, - "browserify>buffer": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream": { - "globals": { - "AbortController": true, - "AggregateError": true, - "Blob": true - }, - "packages": { - "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, - "browserify>buffer": true, - "browserify>events": true, - "browserify>process": true, - "browserify>string_decoder": true - } - }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": 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 18a8116dd0..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -46,29 +46,15 @@ }, "@metamask/providers": { "globals": { - "CustomEvent": true, - "Event": true, - "addEventListener": true, - "chrome.runtime.connect": true, - "console": true, - "dispatchEvent": true, - "document.createElement": true, - "document.readyState": true, - "ethereum": "write", - "location.hostname": true, - "removeEventListener": true, - "web3": true + "console": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>detect-browser": true, - "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, "@metamask/rpc-errors": true, - "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } @@ -101,57 +87,6 @@ "events": true } }, - "@metamask/providers>detect-browser": { - "globals": { - "document": true, - "navigator": true, - "process": true - } - }, - "@metamask/providers>extension-port-stream": { - "builtin": { - "buffer.Buffer": true - }, - "packages": { - "@metamask/providers>extension-port-stream>readable-stream": true, - "buffer": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream": { - "builtin": { - "buffer.Blob": true, - "buffer.Buffer": true, - "events.EventEmitter": true, - "stream": true, - "string_decoder.StringDecoder": true - }, - "globals": { - "AbortController": true, - "AggregateError": true, - "Blob": true, - "process.env.READABLE_STREAM": true - }, - "packages": { - "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, - "browserify>process": true, - "buffer": true, - "events": true, - "stream": true, - "string_decoder": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream>abort-controller": { - "packages": { - "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": { - "globals": { - "Event": true, - "EventTarget": true, - "console": true - } - }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": true, @@ -245,11 +180,6 @@ "util": true } }, - "browserify>process": { - "globals": { - "process": true - } - }, "browserify>string_decoder": { "packages": { "browserify>browser-pack>safe-buffer": 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 18a8116dd0..760ede1af5 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -46,29 +46,15 @@ }, "@metamask/providers": { "globals": { - "CustomEvent": true, - "Event": true, - "addEventListener": true, - "chrome.runtime.connect": true, - "console": true, - "dispatchEvent": true, - "document.createElement": true, - "document.readyState": true, - "ethereum": "write", - "location.hostname": true, - "removeEventListener": true, - "web3": true + "console": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>detect-browser": true, - "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, "@metamask/rpc-errors": true, - "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } @@ -101,57 +87,6 @@ "events": true } }, - "@metamask/providers>detect-browser": { - "globals": { - "document": true, - "navigator": true, - "process": true - } - }, - "@metamask/providers>extension-port-stream": { - "builtin": { - "buffer.Buffer": true - }, - "packages": { - "@metamask/providers>extension-port-stream>readable-stream": true, - "buffer": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream": { - "builtin": { - "buffer.Blob": true, - "buffer.Buffer": true, - "events.EventEmitter": true, - "stream": true, - "string_decoder.StringDecoder": true - }, - "globals": { - "AbortController": true, - "AggregateError": true, - "Blob": true, - "process.env.READABLE_STREAM": true - }, - "packages": { - "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, - "browserify>process": true, - "buffer": true, - "events": true, - "stream": true, - "string_decoder": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream>abort-controller": { - "packages": { - "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream>abort-controller>event-target-shim": { - "globals": { - "Event": true, - "EventTarget": true, - "console": true - } - }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": true, @@ -245,11 +180,6 @@ "util": true } }, - "browserify>process": { - "globals": { - "process": true - } - }, "browserify>string_decoder": { "packages": { "browserify>browser-pack>safe-buffer": 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 25a2077d6b..b251904ff1 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -39,29 +39,15 @@ }, "@metamask/providers": { "globals": { - "CustomEvent": true, - "Event": true, - "addEventListener": true, - "chrome.runtime.connect": true, - "console": true, - "dispatchEvent": true, - "document.createElement": true, - "document.readyState": true, - "ethereum": "write", - "location.hostname": true, - "removeEventListener": true, - "web3": true + "console": true }, "packages": { "@metamask/object-multiplex": true, "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/providers>detect-browser": true, - "@metamask/providers>extension-port-stream": true, "@metamask/providers>is-stream": true, "@metamask/rpc-errors": true, - "@metamask/utils": true, "eslint>fast-deep-equal": true, "readable-stream": true } @@ -91,35 +77,6 @@ "browserify>events": true } }, - "@metamask/providers>detect-browser": { - "globals": { - "document": true, - "navigator": true - }, - "packages": { - "browserify>process": true - } - }, - "@metamask/providers>extension-port-stream": { - "packages": { - "@metamask/providers>extension-port-stream>readable-stream": true, - "browserify>buffer": true - } - }, - "@metamask/providers>extension-port-stream>readable-stream": { - "globals": { - "AbortController": true, - "AggregateError": true, - "Blob": true - }, - "packages": { - "@metamask/providers>extension-port-stream>readable-stream>abort-controller": true, - "browserify>buffer": true, - "browserify>events": true, - "browserify>process": true, - "browserify>string_decoder": true - } - }, "@metamask/rpc-errors": { "packages": { "@metamask/rpc-errors>fast-safe-stringify": true, From bcfab01a16c6aa17b1e36d82aa54f36861295231 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Thu, 30 May 2024 16:39:26 -0400 Subject: [PATCH 41/47] Replace 'superstruct' imports with '@metamask/superstruct' --- packages/snaps-sdk/src/ui/components/image.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/snaps-sdk/src/ui/components/image.test.ts b/packages/snaps-sdk/src/ui/components/image.test.ts index 76619ec467..c5f2a05287 100644 --- a/packages/snaps-sdk/src/ui/components/image.test.ts +++ b/packages/snaps-sdk/src/ui/components/image.test.ts @@ -23,12 +23,10 @@ describe('image', () => { 'Invalid image component: At path: value -- Value is not a valid SVG.', ); - // @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 - 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.', ); From 593ff3124dfff51323363a5fb83481f49a6cce47 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 24 Jun 2024 20:08:58 -0400 Subject: [PATCH 42/47] Set tsconfig `module{,Resolution}` options to `NodeNext` --- tsconfig.packages.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.packages.json b/tsconfig.packages.json index b4b99ab09b..32412b2b31 100644 --- a/tsconfig.packages.json +++ b/tsconfig.packages.json @@ -6,8 +6,8 @@ "jsx": "react-jsx", "jsxImportSource": "@metamask/snaps-sdk", "lib": ["DOM", "ES2020"], - "module": "CommonJS", - "moduleResolution": "node", + "module": "NodeNext", + "moduleResolution": "NodeNext", "paths": { "@metamask/*/test-utils": ["../*/src/test-utils"], "@metamask/*/node": ["../*/src/node"], From 1c621d57690a2076486479f7e04b05299b19fca5 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Mon, 24 Jun 2024 20:47:59 -0400 Subject: [PATCH 43/47] Fix ESM module import to use dynamic import --- packages/snaps-utils/src/eval-worker.ts | 64 ++++++++++++++----------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/packages/snaps-utils/src/eval-worker.ts b/packages/snaps-utils/src/eval-worker.ts index 5c7fa4dc2f..5b23ae3b8b 100644 --- a/packages/snaps-utils/src/eval-worker.ts +++ b/packages/snaps-utils/src/eval-worker.ts @@ -1,43 +1,49 @@ -// eslint-disable-next-line import/no-unassigned-import -import 'ses/lockdown'; - import { readFileSync } from 'fs'; import type { HandlerType } from './handler-types'; import { SNAP_EXPORT_NAMES } from './handler-types'; import { generateMockEndowments } from './mock'; -declare let lockdown: any, Compartment: any; - -lockdown({ - consoleTaming: 'unsafe', - errorTaming: 'unsafe', - mathTaming: 'unsafe', - dateTaming: 'unsafe', - overrideTaming: 'severe', - - // We disable domain taming, because it does not work in certain cases when - // running tests. This is unlikely to be a problem in production, because - // Node.js domains are deprecated. - domainTaming: 'unsafe', -}); +import('ses/lockdown') + .then(() => + lockdown({ + consoleTaming: 'unsafe', + errorTaming: 'unsafe', + mathTaming: 'unsafe', + dateTaming: 'unsafe', + overrideTaming: 'severe', + + // We disable domain taming, because it does not work in certain cases when + // running tests. This is unlikely to be a problem in production, because + // Node.js domains are deprecated. + domainTaming: 'unsafe', + }), + ) + .catch((error) => { + throw error; + }); const snapFilePath = process.argv[2]; const snapModule: { exports?: any } = { exports: {} }; -const compartment = new Compartment({ - ...generateMockEndowments(), - module: snapModule, - exports: snapModule.exports, -}); - -// Mirror BaseSnapExecutor -compartment.globalThis.self = compartment.globalThis; -compartment.globalThis.global = compartment.globalThis; -compartment.globalThis.window = compartment.globalThis; - -compartment.evaluate(readFileSync(snapFilePath, 'utf8')); +import('ses/lockdown') + .then(() => { + const compartment = new Compartment({ + ...generateMockEndowments(), + module: snapModule, + exports: snapModule.exports, + }); + // Mirror BaseSnapExecutor + compartment.globalThis.self = compartment.globalThis; + compartment.globalThis.global = compartment.globalThis; + compartment.globalThis.window = compartment.globalThis; + + compartment.evaluate(readFileSync(snapFilePath, 'utf8')); + }) + .catch((error) => { + throw error; + }); const invalidExports = Object.keys(snapModule.exports).filter( (snapExport) => !SNAP_EXPORT_NAMES.includes(snapExport as HandlerType), From ab83a62c2df142b4285f8ac08768fddb3f20cb0f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Tue, 25 Jun 2024 09:50:40 -0400 Subject: [PATCH 44/47] Force yarn resolutions for `@metamask/{abi-utils,snaps-registry}` to include unreleased changes --- yarn.lock | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index ec9fab75da..bd0be926d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3802,12 +3802,12 @@ __metadata: linkType: hard "@metamask/abi-utils@npm:^2.0.2": - version: 2.0.2 - resolution: "@metamask/abi-utils@npm:2.0.2" + version: 2.0.3 + resolution: "@metamask/abi-utils@npm:2.0.3" dependencies: - "@metamask/utils": ^8.0.0 - superstruct: ^1.0.3 - checksum: 5ec153e7691a4e1dc8738a0ba1a99a354ddb13851fa88a40a19f002f6308310e71c2cee28c3a25d9f7f67e839c7dffe4760e93e308dd17fa725b08d0dc73a3d4 + "@metamask/superstruct": ^3.0.0 + "@metamask/utils": ^8.5.0 + checksum: c0d43cd52a6615b32b09ed6786d01e3de764af30b107941a5df134f8a48da344793035dd247f5b38a56f36c436c7131b94b0c71ef004e88e6e00f878ffa4ebbf languageName: node linkType: hard @@ -21477,13 +21477,6 @@ __metadata: languageName: node linkType: hard -"superstruct@npm:^1.0.3": - version: 1.0.3 - resolution: "superstruct@npm:1.0.3" - checksum: 761790bb111e6e21ddd608299c252f3be35df543263a7ebbc004e840d01fcf8046794c274bcb351bdf3eae4600f79d317d085cdbb19ca05803a4361840cc9bb1 - languageName: node - linkType: hard - "supports-color@npm:8.1.1, supports-color@npm:^8.0.0": version: 8.1.1 resolution: "supports-color@npm:8.1.1" From 1dfdc47941cb94b6ad5f4b0ec9f4be2627151d6f Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Tue, 25 Jun 2024 12:12:15 -0400 Subject: [PATCH 45/47] [snaps-controllers] Bump dependency `nanoid` from `^3.1.31` to `^3.3.7` for CJS-compatibility --- packages/snaps-controllers/package.json | 2 +- packages/snaps-execution-environments/package.json | 2 +- yarn.lock | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index d891cfcd36..fbef8bdd09 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -73,7 +73,7 @@ "fast-deep-equal": "^3.1.3", "get-npm-tarball-url": "^2.0.3", "immer": "^9.0.6", - "nanoid": "^3.1.31", + "nanoid": "^3.3.7", "readable-stream": "^3.6.2", "readable-web-to-node-stream": "^3.0.2", "tar-stream": "^3.1.7" diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 2b9651238c..be4b1f865c 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -60,7 +60,7 @@ "@metamask/snaps-utils": "workspace:^", "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.0.0", - "nanoid": "^3.1.31", + "nanoid": "^3.3.7", "readable-stream": "^3.6.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index bd0be926d6..46581d07a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5633,7 +5633,7 @@ __metadata: jest: ^29.0.2 jest-fetch-mock: ^3.0.3 mkdirp: ^1.0.4 - nanoid: ^3.1.31 + nanoid: ^3.3.7 prettier: ^2.7.1 prettier-plugin-packagejson: ^2.2.11 readable-stream: ^3.6.2 @@ -5718,7 +5718,7 @@ __metadata: jest-fetch-mock: ^3.0.3 lavamoat: ^8.0.4 lavamoat-browserify: ^17.0.5 - nanoid: ^3.1.31 + nanoid: ^3.3.7 prettier: ^2.7.1 prettier-plugin-packagejson: ^2.2.11 readable-stream: ^3.6.2 @@ -17729,7 +17729,7 @@ __metadata: languageName: node linkType: hard -"nanoid@npm:^3.1.31, nanoid@npm:^3.3.6": +"nanoid@npm:^3.1.31, nanoid@npm:^3.3.6, nanoid@npm:^3.3.7": version: 3.3.7 resolution: "nanoid@npm:3.3.7" bin: From 1852d63c8e7ad0e6616e09d136c0cd8a25846c56 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 28 Jun 2024 22:01:00 -0400 Subject: [PATCH 46/47] Bump `@metamask/utils` from `^8.5.0` to `^9.0.0` in all packages --- packages/examples/packages/dialogs/package.json | 1 + packages/examples/packages/ethers-js/package.json | 1 + yarn.lock | 2 ++ 3 files changed, 4 insertions(+) diff --git a/packages/examples/packages/dialogs/package.json b/packages/examples/packages/dialogs/package.json index 9a7f03eca1..ba8d060690 100644 --- a/packages/examples/packages/dialogs/package.json +++ b/packages/examples/packages/dialogs/package.json @@ -42,6 +42,7 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", + "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/ethers-js/package.json b/packages/examples/packages/ethers-js/package.json index 451602ed1d..28877f909f 100644 --- a/packages/examples/packages/ethers-js/package.json +++ b/packages/examples/packages/ethers-js/package.json @@ -43,6 +43,7 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", + "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/yarn.lock b/yarn.lock index 46581d07a4..e0dde69a57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4291,6 +4291,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4525,6 +4526,7 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" + "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 From 3c4210e3678c085fccb9a1d734526f0e16723c81 Mon Sep 17 00:00:00 2001 From: Jongsun Suh Date: Fri, 5 Jul 2024 21:08:30 -0400 Subject: [PATCH 47/47] Remove unused `@metamask/utils` from devDeps list --- packages/examples/packages/dialogs/package.json | 1 - packages/examples/packages/ethers-js/package.json | 1 - yarn.lock | 2 -- 3 files changed, 4 deletions(-) diff --git a/packages/examples/packages/dialogs/package.json b/packages/examples/packages/dialogs/package.json index ba8d060690..9a7f03eca1 100644 --- a/packages/examples/packages/dialogs/package.json +++ b/packages/examples/packages/dialogs/package.json @@ -42,7 +42,6 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/packages/examples/packages/ethers-js/package.json b/packages/examples/packages/ethers-js/package.json index 28877f909f..451602ed1d 100644 --- a/packages/examples/packages/ethers-js/package.json +++ b/packages/examples/packages/ethers-js/package.json @@ -43,7 +43,6 @@ "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/snaps-cli": "workspace:^", "@metamask/snaps-jest": "workspace:^", - "@metamask/utils": "^9.0.0", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@typescript-eslint/eslint-plugin": "^5.42.1", diff --git a/yarn.lock b/yarn.lock index e0dde69a57..46581d07a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4291,7 +4291,6 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -4526,7 +4525,6 @@ __metadata: "@metamask/snaps-cli": "workspace:^" "@metamask/snaps-jest": "workspace:^" "@metamask/snaps-sdk": "workspace:^" - "@metamask/utils": ^9.0.0 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@typescript-eslint/eslint-plugin": ^5.42.1