Skip to content

feat: use @metamask/superstruct exactOptional support#580

Merged
ccharly merged 11 commits into
mainfrom
cc/refactor/use-metamask-superstruct
Jul 2, 2026
Merged

feat: use @metamask/superstruct exactOptional support#580
ccharly merged 11 commits into
mainfrom
cc/refactor/use-metamask-superstruct

Conversation

@ccharly

@ccharly ccharly commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Start using @metamask/superstruct object and exactOptional instead of our local implementation.


Note

Medium Risk
Breaking public API on keyring-utils and wide import changes affect every runtime schema in the monorepo; validation semantics should match @metamask/superstruct 3.3.0 but downstream consumers must update imports.

Overview
Breaking: @metamask/keyring-utils no longer exports object, exactOptional, or type. Callers across keyring-api, keyring-utils, snap packages, and related workspaces now import those helpers directly from @metamask/superstruct, with dependencies bumped to ^3.3.0.

ESLint no-restricted-imports blocks raw superstruct and the removed symbols from @metamask/keyring-utils, steering new code to @metamask/superstruct. Local implementations and their unit tests were deleted; strictMask and selectiveUnion remain in keyring-utils. Type-level exactOptional behavior is covered by retained tsd tests, and KeyringAccountOptionsStruct gains a case asserting entropy: null fails validation.

packages/keyring-api/src/eth/types.ts now imports EthScope from ./constants instead of the package barrel.

Reviewed by Cursor Bugbot for commit bf8779e. Bugbot is set up for automated code reviews on this repo. Configure here.

@ccharly ccharly requested a review from a team as a code owner June 30, 2026 12:19

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6f7f9ce. Configure here.

Comment thread packages/keyring-eth-money/src/money-keyring.ts Outdated
@socket-security

socket-security Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​superstruct@​3.2.1 ⏵ 3.3.010010010085100

View full report

@ccharly

ccharly commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Using no-changelog since most of those changes are internals.

I did add a changelog entry for keyring-utils though!

@ccharly ccharly added this pull request to the merge queue Jul 2, 2026
Merged via the queue into main with commit 97f4634 Jul 2, 2026
41 of 42 checks passed
@ccharly ccharly deleted the cc/refactor/use-metamask-superstruct branch July 2, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants