Skip to content

feat(4337): add toUserOperation utility to convert PackedUserOperation to UserOperation #3806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jeanregisser
Copy link
Contributor

@jeanregisser jeanregisser commented Jul 16, 2025

Why this is needed

Real user need: When analyzing account abstraction transactions, or working with existing PackedUserOperation data, you often need the unpacked format to use with functions that expect the standard UserOperation format (e.g. getUserOperationHash).

The gap: Bundlers and newer EntryPoints use packed format for efficiency, but there's no built-in way to convert back to the unpacked format when needed for analysis or compatibility.

What it does

Converts packed user operations to standard unpacked format by splitting combined fields:

  • accountGasLimits → separate verificationGasLimit + callGasLimit
  • gasFees → separate maxPriorityFeePerGas + maxFeePerGas
  • paymasterAndData → separate paymaster fields
  • initCode → separate factory + factoryData

Works across all EntryPoint versions and safe to call on already unpacked data. This completes the conversion utilities - now you can go both ways between packed and unpacked formats.

Copy link

vercel bot commented Jul 16, 2025

@jeanregisser is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

changeset-bot bot commented Jul 16, 2025

🦋 Changeset detected

Latest commit: bcb74b1

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

This PR includes changesets to release 1 package
Name Type
viem Minor

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

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