From 2c8ead53bd47bd714461010cbef5131292de3a4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 07:04:00 +0000 Subject: [PATCH 1/5] chore(deps): bump @metamask/utils from 8.4.0 to 9.0.0 Bumps [@metamask/utils](https://github.com/MetaMask/utils) from 8.4.0 to 9.0.0. - [Release notes](https://github.com/MetaMask/utils/releases) - [Changelog](https://github.com/MetaMask/utils/blob/main/CHANGELOG.md) - [Commits](https://github.com/MetaMask/utils/compare/v8.4.0...v9.0.0) --- updated-dependencies: - dependency-name: "@metamask/utils" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index aa215525..d4eba8a5 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ }, "dependencies": { "@metamask/snaps-sdk": "^6.0.0", - "@metamask/utils": "^8.4.0", + "@metamask/utils": "^9.0.0", "@types/uuid": "^9.0.8", "bech32": "^2.0.0", "superstruct": "^1.0.3", diff --git a/yarn.lock b/yarn.lock index 412ba399..68f5576a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1063,7 +1063,7 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/providers": ^17.0.0 "@metamask/snaps-sdk": ^6.0.0 - "@metamask/utils": ^8.4.0 + "@metamask/utils": ^9.0.0 "@types/jest": ^29.5.12 "@types/node": ^20.12.12 "@types/uuid": ^9.0.8 @@ -1174,7 +1174,14 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0": +"@metamask/superstruct@npm:^3.1.0": + version: 3.1.0 + resolution: "@metamask/superstruct@npm:3.1.0" + checksum: 00e4d0c0aae8b25ccc1885c1db0bb4ed1590010570140c255e4deee3bf8a10c859c8fce5e475b4ae09c8a56316207af87585b91f7f5a5c028d668ccd111f19e3 + languageName: node + linkType: hard + +"@metamask/utils@npm:^8.3.0": version: 8.4.0 resolution: "@metamask/utils@npm:8.4.0" dependencies: From 2ef8dd0413170885b06953e35803b658f38babef Mon Sep 17 00:00:00 2001 From: Daniel Rocha <68558152+danroc@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:14:58 +0200 Subject: [PATCH 2/5] chore: migrate to '@metamask/superstruct' --- package.json | 2 +- src/JsonRpcRequest.test.ts | 2 +- src/JsonRpcRequest.ts | 11 +++++++++-- src/KeyringClient.ts | 2 +- src/api/account.test.ts | 2 +- src/api/account.ts | 4 ++-- src/api/balance.ts | 4 ++-- src/api/caip.ts | 2 +- src/api/export.ts | 4 ++-- src/api/request.ts | 4 ++-- src/api/response.ts | 4 ++-- src/btc/types.ts | 4 ++-- src/eth/erc4337/types.test.ts | 2 +- src/eth/erc4337/types.ts | 2 +- src/eth/types.ts | 4 ++-- src/internal/api.ts | 11 +++++++++-- src/internal/events.test.ts | 2 +- src/internal/events.ts | 2 +- src/internal/types.test.ts | 2 +- src/internal/types.ts | 4 ++-- src/rpc-handler.ts | 2 +- src/superstruct.test-d.ts | 4 ++-- src/superstruct.test.ts | 4 ++-- src/superstruct.ts | 12 +++++++++--- src/utils/types.test.ts | 2 +- src/utils/types.ts | 2 +- yarn.lock | 2 +- 27 files changed, 61 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index d4eba8a5..daf93775 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,10 @@ }, "dependencies": { "@metamask/snaps-sdk": "^6.0.0", + "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.0.0", "@types/uuid": "^9.0.8", "bech32": "^2.0.0", - "superstruct": "^1.0.3", "uuid": "^9.0.1" }, "devDependencies": { diff --git a/src/JsonRpcRequest.test.ts b/src/JsonRpcRequest.test.ts index f7d521aa..80af264e 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 9e9f258c..16f80c81 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 9b6b16c5..9e51079a 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 14d81a0d..f1e3b455 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 0eb33e92..28b7d1e1 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 4a592592..609108e8 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 b526c0be..2008200d 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 ef810fe1..86134e15 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 aebed676..db2609af 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 fbe0af33..dbe2e0b4 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 7fcf02ad..01e131e1 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 b7c065d7..ff73ea55 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 de5a27dc..5a7db8f4 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 f1ffce95..2d28926b 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 fdefb447..7e6bc9ba 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 dc33ae9e..7b902cc2 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 271d4f32..9047ae26 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 5e396f28..7d8ae838 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 f79acf0b..d4db1842 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 495f2c42..4edf5901 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 601c9da1..1b42a4b0 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 dd0c5582..1eb944a5 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 15032083..01e3e427 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 7aef6117..7cf685ce 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 5416c41a..c8e72b76 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 68f5576a..732959d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1063,6 +1063,7 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/providers": ^17.0.0 "@metamask/snaps-sdk": ^6.0.0 + "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^9.0.0 "@types/jest": ^29.5.12 "@types/node": ^20.12.12 @@ -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 From 8b9a2c824868276c0117f4f1c468db5eb32864c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Jul 2024 17:22:01 +0200 Subject: [PATCH 3/5] chore(deps): bump @metamask/rpc-errors from 6.3.0 to 6.3.1 (#350) Bumps [@metamask/rpc-errors](https://github.com/MetaMask/rpc-errors) from 6.3.0 to 6.3.1. - [Release notes](https://github.com/MetaMask/rpc-errors/releases) - [Changelog](https://github.com/MetaMask/rpc-errors/blob/main/CHANGELOG.md) - [Commits](https://github.com/MetaMask/rpc-errors/compare/v6.3.0...v6.3.1) --- updated-dependencies: - dependency-name: "@metamask/rpc-errors" dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 732959d3..8e3f384e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1181,7 +1181,7 @@ __metadata: languageName: node linkType: hard -"@metamask/utils@npm:^8.3.0": +"@metamask/utils@npm:^8.3.0, @metamask/utils@npm:^8.4.0": version: 8.4.0 resolution: "@metamask/utils@npm:8.4.0" dependencies: From fd50bd2475b50f169b2ffa892e5e1e06ebcb98e2 Mon Sep 17 00:00:00 2001 From: Daniel Rocha <68558152+danroc@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:23:11 +0200 Subject: [PATCH 4/5] chore: update `yarn.lock` --- yarn.lock | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8e3f384e..e3981aa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1174,14 +1174,7 @@ __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/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: From 93aea20c6115be4b686c901c6c709377ee8bbc20 Mon Sep 17 00:00:00 2001 From: Daniel Rocha <68558152+danroc@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:45:58 +0200 Subject: [PATCH 5/5] chore: update dependencies --- package.json | 4 ++-- yarn.lock | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index daf93775..08f26147 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "dependencies": { "@metamask/snaps-sdk": "^6.0.0", "@metamask/superstruct": "^3.1.0", - "@metamask/utils": "^9.0.0", + "@metamask/utils": "^9.1.0", "@types/uuid": "^9.0.8", "bech32": "^2.0.0", "uuid": "^9.0.1" @@ -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/yarn.lock b/yarn.lock index e3981aa5..728e5b16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1061,10 +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/superstruct": ^3.1.0 - "@metamask/utils": ^9.0.0 + "@metamask/utils": ^9.1.0 "@types/jest": ^29.5.12 "@types/node": ^20.12.12 "@types/uuid": ^9.0.8 @@ -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: @@ -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