diff --git a/package.json b/package.json index aa2155254..08f26147a 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,10 @@ }, "dependencies": { "@metamask/snaps-sdk": "^6.0.0", - "@metamask/utils": "^8.4.0", + "@metamask/superstruct": "^3.1.0", + "@metamask/utils": "^9.1.0", "@types/uuid": "^9.0.8", "bech32": "^2.0.0", - "superstruct": "^1.0.3", "uuid": "^9.0.1" }, "devDependencies": { @@ -53,7 +53,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.1", "@types/jest": "^29.5.12", "@types/node": "^20.12.12", "@typescript-eslint/eslint-plugin": "^5.62.0", diff --git a/src/JsonRpcRequest.test.ts b/src/JsonRpcRequest.test.ts index f7d521aad..80af264e8 100644 --- a/src/JsonRpcRequest.test.ts +++ b/src/JsonRpcRequest.test.ts @@ -1,4 +1,4 @@ -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { JsonRpcRequestStruct } from './JsonRpcRequest'; diff --git a/src/JsonRpcRequest.ts b/src/JsonRpcRequest.ts index 9e9f258c1..16f80c81e 100644 --- a/src/JsonRpcRequest.ts +++ b/src/JsonRpcRequest.ts @@ -1,6 +1,13 @@ +import { + array, + literal, + number, + record, + string, + union, +} from '@metamask/superstruct'; +import type { Infer } from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { array, literal, number, record, string, union } from 'superstruct'; import { exactOptional, object } from './superstruct'; diff --git a/src/KeyringClient.ts b/src/KeyringClient.ts index 9b6b16c5d..9e51079a9 100644 --- a/src/KeyringClient.ts +++ b/src/KeyringClient.ts @@ -1,5 +1,5 @@ +import { assert } from '@metamask/superstruct'; import type { Json } from '@metamask/utils'; -import { assert } from 'superstruct'; import { v4 as uuid } from 'uuid'; import type { diff --git a/src/api/account.test.ts b/src/api/account.test.ts index 14d81a0dd..f1e3b455e 100644 --- a/src/api/account.test.ts +++ b/src/api/account.test.ts @@ -1,4 +1,4 @@ -import { assert } from 'superstruct'; +import { assert } from '@metamask/superstruct'; import { KeyringAccountStruct } from './account'; diff --git a/src/api/account.ts b/src/api/account.ts index 0eb33e927..28b7d1e14 100644 --- a/src/api/account.ts +++ b/src/api/account.ts @@ -1,6 +1,6 @@ +import type { Infer } from '@metamask/superstruct'; +import { array, enums, record, string } from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { array, enums, record, string } from 'superstruct'; import { object } from '../superstruct'; import { UuidStruct } from '../utils'; diff --git a/src/api/balance.ts b/src/api/balance.ts index 4a5925921..609108e80 100644 --- a/src/api/balance.ts +++ b/src/api/balance.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { string } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { string } from '@metamask/superstruct'; import { object } from '../superstruct'; import { StringNumberStruct } from '../utils'; diff --git a/src/api/caip.ts b/src/api/caip.ts index b526c0be8..2008200d8 100644 --- a/src/api/caip.ts +++ b/src/api/caip.ts @@ -1,4 +1,4 @@ -import { is, type Infer } from 'superstruct'; +import { is, type Infer } from '@metamask/superstruct'; import { definePattern } from '../superstruct'; diff --git a/src/api/export.ts b/src/api/export.ts index ef810fe11..86134e15f 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -1,6 +1,6 @@ +import type { Infer } from '@metamask/superstruct'; +import { record, string } from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { record, string } from 'superstruct'; export const KeyringAccountDataStruct = record(string(), JsonStruct); diff --git a/src/api/request.ts b/src/api/request.ts index aebed6769..db2609af6 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -1,6 +1,6 @@ +import type { Infer } from '@metamask/superstruct'; +import { array, record, string, union } from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { array, record, string, union } from 'superstruct'; import { exactOptional, object } from '../superstruct'; import { UuidStruct } from '../utils'; diff --git a/src/api/response.ts b/src/api/response.ts index fbe0af33f..dbe2e0b4a 100644 --- a/src/api/response.ts +++ b/src/api/response.ts @@ -1,6 +1,6 @@ +import type { Infer } from '@metamask/superstruct'; +import { literal, string, union } from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { literal, string, union } from 'superstruct'; import { exactOptional, object } from '../superstruct'; diff --git a/src/btc/types.ts b/src/btc/types.ts index 7fcf02ad0..01e131e12 100644 --- a/src/btc/types.ts +++ b/src/btc/types.ts @@ -1,6 +1,6 @@ +import type { Infer } from '@metamask/superstruct'; +import { string, array, enums, refine, literal } from '@metamask/superstruct'; import { bech32 } from 'bech32'; -import type { Infer } from 'superstruct'; -import { string, array, enums, refine, literal } from 'superstruct'; import { KeyringAccountStruct, BtcAccountType } from '../api'; import { object } from '../superstruct'; diff --git a/src/eth/erc4337/types.test.ts b/src/eth/erc4337/types.test.ts index b7c065d76..ff73ea553 100644 --- a/src/eth/erc4337/types.test.ts +++ b/src/eth/erc4337/types.test.ts @@ -1,4 +1,4 @@ -import { assert } from 'superstruct'; +import { assert } from '@metamask/superstruct'; import { EthUserOperationStruct, EthBaseUserOperationStruct } from './types'; diff --git a/src/eth/erc4337/types.ts b/src/eth/erc4337/types.ts index de5a27dc1..5a7db8f4c 100644 --- a/src/eth/erc4337/types.ts +++ b/src/eth/erc4337/types.ts @@ -1,4 +1,4 @@ -import { type Infer } from 'superstruct'; +import { type Infer } from '@metamask/superstruct'; import { exactOptional, object } from '../../superstruct'; import { UrlStruct } from '../../utils'; diff --git a/src/eth/types.ts b/src/eth/types.ts index f1ffce954..2d28926b3 100644 --- a/src/eth/types.ts +++ b/src/eth/types.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { array, enums, literal } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { array, enums, literal } from '@metamask/superstruct'; import { EthAccountType, KeyringAccountStruct } from '../api'; import { object, definePattern } from '../superstruct'; diff --git a/src/internal/api.ts b/src/internal/api.ts index fdefb4470..7e6bc9ba3 100644 --- a/src/internal/api.ts +++ b/src/internal/api.ts @@ -1,6 +1,13 @@ +import type { Infer } from '@metamask/superstruct'; +import { + array, + literal, + number, + record, + string, + union, +} from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import type { Infer } from 'superstruct'; -import { array, literal, number, record, string, union } from 'superstruct'; import { BalanceStruct, diff --git a/src/internal/events.test.ts b/src/internal/events.test.ts index dc33ae9ec..7b902cc21 100644 --- a/src/internal/events.test.ts +++ b/src/internal/events.test.ts @@ -1,4 +1,4 @@ -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { EthAccountType } from '../api'; import { KeyringEvent } from '../events'; diff --git a/src/internal/events.ts b/src/internal/events.ts index 271d4f32b..9047ae26f 100644 --- a/src/internal/events.ts +++ b/src/internal/events.ts @@ -1,5 +1,5 @@ +import { boolean, literal, string } from '@metamask/superstruct'; import { JsonStruct } from '@metamask/utils'; -import { boolean, literal, string } from 'superstruct'; import { KeyringAccountStruct } from '../api'; import { KeyringEvent } from '../events'; diff --git a/src/internal/types.test.ts b/src/internal/types.test.ts index 5e396f28b..7d8ae838f 100644 --- a/src/internal/types.test.ts +++ b/src/internal/types.test.ts @@ -1,4 +1,4 @@ -import { assert } from 'superstruct'; +import { assert } from '@metamask/superstruct'; import { InternalAccountStruct } from '.'; diff --git a/src/internal/types.ts b/src/internal/types.ts index f79acf0b5..d4db18424 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -1,5 +1,5 @@ -import type { Infer, Struct } from 'superstruct'; -import { boolean, string, number } from 'superstruct'; +import type { Infer, Struct } from '@metamask/superstruct'; +import { boolean, string, number } from '@metamask/superstruct'; import { BtcAccountType, EthAccountType, KeyringAccountStruct } from '../api'; import { BtcP2wpkhAccountStruct } from '../btc/types'; diff --git a/src/rpc-handler.ts b/src/rpc-handler.ts index 495f2c427..4edf59019 100644 --- a/src/rpc-handler.ts +++ b/src/rpc-handler.ts @@ -1,5 +1,5 @@ +import { assert } from '@metamask/superstruct'; import type { Json } from '@metamask/utils'; -import { assert } from 'superstruct'; import type { Keyring } from './api'; import { diff --git a/src/superstruct.test-d.ts b/src/superstruct.test-d.ts index 601c9da13..1b42a4b03 100644 --- a/src/superstruct.test-d.ts +++ b/src/superstruct.test-d.ts @@ -1,5 +1,5 @@ -import type { Infer } from 'superstruct'; -import { boolean, number, optional, string } from 'superstruct'; +import type { Infer } from '@metamask/superstruct'; +import { boolean, number, optional, string } from '@metamask/superstruct'; import { expectAssignable, expectNotAssignable } from 'tsd'; import { exactOptional, object } from '.'; diff --git a/src/superstruct.test.ts b/src/superstruct.test.ts index dd0c5582f..1eb944a56 100644 --- a/src/superstruct.test.ts +++ b/src/superstruct.test.ts @@ -1,8 +1,8 @@ -import { is, literal, max, number, string, union } from 'superstruct'; +import { is, literal, max, number, string, union } from '@metamask/superstruct'; import { exactOptional, object } from '.'; -describe('superstruct', () => { +describe('@metamask/superstruct', () => { describe('exactOptional', () => { const simpleStruct = object({ foo: exactOptional(string()), diff --git a/src/superstruct.ts b/src/superstruct.ts index 150320836..01e3e427c 100644 --- a/src/superstruct.ts +++ b/src/superstruct.ts @@ -1,12 +1,18 @@ -import type { Infer, Context } from 'superstruct'; -import { Struct, assert, define, object as stObject } from 'superstruct'; +import { + Struct, + assert, + define, + object as stObject, +} from '@metamask/superstruct'; import type { + Infer, + Context, ObjectSchema, OmitBy, Optionalize, PickBy, Simplify, -} from 'superstruct/dist/utils'; +} from '@metamask/superstruct'; declare const ExactOptionalSymbol: unique symbol; diff --git a/src/utils/types.test.ts b/src/utils/types.test.ts index 7aef6117a..7cf685ce8 100644 --- a/src/utils/types.test.ts +++ b/src/utils/types.test.ts @@ -1,4 +1,4 @@ -import { is } from 'superstruct'; +import { is } from '@metamask/superstruct'; import { StringNumberStruct } from './types'; diff --git a/src/utils/types.ts b/src/utils/types.ts index 5416c41a8..c8e72b765 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,4 +1,4 @@ -import { define, type Infer } from 'superstruct'; +import { define, type Infer } from '@metamask/superstruct'; import { definePattern } from '../superstruct'; diff --git a/yarn.lock b/yarn.lock index 412ba3994..728e5b16f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1061,9 +1061,10 @@ __metadata: "@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.1 "@metamask/snaps-sdk": ^6.0.0 - "@metamask/utils": ^8.4.0 + "@metamask/superstruct": ^3.1.0 + "@metamask/utils": ^9.1.0 "@types/jest": ^29.5.12 "@types/node": ^20.12.12 "@types/uuid": ^9.0.8 @@ -1084,7 +1085,6 @@ __metadata: prettier: ^2.8.8 prettier-plugin-packagejson: ^2.5.0 rimraf: ^5.0.7 - superstruct: ^1.0.3 ts-jest: ^28.0.8 ts-node: ^10.9.2 tsd: ^0.31.0 @@ -1106,7 +1106,7 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^17.0.0": +"@metamask/providers@npm:^17.0.0, @metamask/providers@npm:^17.1.1": version: 17.1.1 resolution: "@metamask/providers@npm:17.1.1" dependencies: @@ -1174,7 +1174,7 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0": +"@metamask/utils@npm:^8.3.0": version: 8.4.0 resolution: "@metamask/utils@npm:8.4.0" dependencies: @@ -1191,9 +1191,9 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^9.0.0": - version: 9.0.0 - resolution: "@metamask/utils@npm:9.0.0" +"@metamask/utils@npm:^9.0.0, @metamask/utils@npm:^9.1.0": + version: 9.1.0 + resolution: "@metamask/utils@npm:9.1.0" dependencies: "@ethereumjs/tx": ^4.2.0 "@metamask/superstruct": ^3.1.0 @@ -1204,7 +1204,7 @@ __metadata: pony-cause: ^2.1.10 semver: ^7.5.4 uuid: ^9.0.1 - checksum: 5dcb9d47c4768c33d451cc74c83207726c68b1340be1d091ca44105564f0ba0703026d357de7996de4459ac41cd420a0eb1f06db32f5ebbeeee581393f45fd44 + checksum: 01f2c71a8f06158d5335bfe96bfd2f3aa39ec6b2323c5d0ff1d3136071a3e8ff7c1804d640ba1d4e07f96f3e68a95ff7729ddfcd34b373e5fefd86d6ef12d034 languageName: node linkType: hard