Skip to content

chore(deps): upgrade zod to 4.4.3#5656

Open
CipherSight wants to merge 1 commit into
reown-com:mainfrom
CipherSight:chore/upgrade-zod-v4
Open

chore(deps): upgrade zod to 4.4.3#5656
CipherSight wants to merge 1 commit into
reown-com:mainfrom
CipherSight:chore/upgrade-zod-v4

Conversation

@CipherSight
Copy link
Copy Markdown

Summary

Upgrades zod from 3.22.4 (pinned ~2 years ago) to 4.4.3 in the two packages that consume it: @reown/appkit-wallet and @reown/appkit-experimental.

Why

  • Zod 4 brings significantly better TypeScript inference performance (~10×) and clearer error messages.
  • 3.22.4 was strictly pinned and is now far behind upstream.
  • Reduces friction for downstream apps that already use a newer zod and end up with two copies in their bundle.

Changes

@reown/appkit-wallet

  • Refactor W3mFrameSchema from long chained .or().or()...and() calls (~110 across the file) to z.discriminatedUnion('type', [...]) + z.intersection(...). Required — Zod 4's stricter generics raise TS2589: Type instantiation is excessively deep on the original chains. Bonus: faster runtime parsing and better validation error messages.
  • z.string().email() → top-level z.email() (Zod 4 API).

@reown/appkit-experimental

  • errorMap / invalid_type_error → unified error parameter.
  • z.nativeEnum(X)z.enum(X) (now accepts native enums directly).
  • z.record(V)z.record(K, V) (single-arg form removed).
  • ZodError.errorsZodError.issues.
  • Updated ERROR_MESSAGES constants and test expectations to match Zod 4's Invalid input: expected X, received Y format.

Compatibility

  • Public types (W3mFrameTypes.AppEvent, FrameEvent, RPCRequest, etc.) remain structurally equivalent — they're still discriminated unions on type / method.
  • Runtime behavior of safeParse for postMessage validation is preserved.

Test plan

  • pnpm install
  • turbo build for wallet, experimental, appkit, scaffold-ui, ui, controllers, utils, pay, siwe → 11/11 OK
  • turbo typecheck for wallet, experimental, appkit, adapters (wagmi, ethers, solana, bitcoin) → 17/17 OK
  • turbo lint for wallet & experimental → OK
  • pnpm --filter @reown/appkit-experimental test → 126/126 OK
  • pnpm --filter @reown/appkit-wallet test → no new failures (the 25 pre-existing failures from localStorage.getItem is not a function in jsdom also fail on main)
  • pnpm prettier:format → no pending changes
  • Changeset added (patch for both packages)

- Migrate W3mFrameSchema to z.discriminatedUnion to avoid TS2589
- Update z.string().email() -> z.email()
- Replace errorMap/invalid_type_error with unified error parameter
- Replace z.nativeEnum with z.enum (now accepts native enums in v4)
- Update z.record(V) -> z.record(K, V) signature
- Update ZodError.errors -> ZodError.issues
- Update test expectations for new "Invalid input: ..." error format

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: 59ec888

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@reown/appkit-wallet Patch
@reown/appkit-experimental Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit Patch
@reown/appkit-ui Patch
@reown/appkit-controllers Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-siwe Patch
@reown/appkit-cdn Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-tron Patch
@reown/appkit-universal-connector Patch
@reown/appkit-testing Patch
@reown/appkit-wallet-button Patch
@reown/appkit-pay Patch
@reown/appkit-core Patch
@reown/appkit-siwx Patch
@reown/appkit-common Patch
@reown/appkit-polyfills Patch
@reown/appkit-cli Patch
@reown/appkit-codemod Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

@CipherSight is attempting to deploy a commit to the Reown Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@socket-security
Copy link
Copy Markdown

@socket-security
Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm entities is 91.0% likely obfuscated

Confidence: 0.91

Location: Package overview

From: pnpm-lock.yamlnpm/entities@4.5.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/entities@4.5.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@CipherSight
Copy link
Copy Markdown
Author

I have read the CTA Document and I hereby sign the CTA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant