Skip to content

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

Merged
jxom merged 9 commits intowevm:mainfrom
jeanregisser:jeanregisser/fix-user-op-hash
Jul 27, 2025
Merged

feat(4337): add toUserOperation utility to convert PackedUserOperation to UserOperation#3806
jxom merged 9 commits intowevm:mainfrom
jeanregisser:jeanregisser/fix-user-op-hash

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.

@vercel
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.

@changeset-bot
Copy link

changeset-bot bot commented Jul 16, 2025

🦋 Changeset detected

Latest commit: 95750b5

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

This PR includes changesets to release 1 package
Name Type
viem 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

@jxom jxom force-pushed the jeanregisser/fix-user-op-hash branch from bcb74b1 to 729e643 Compare July 27, 2025 15:09
@jxom
Copy link
Member

jxom commented Jul 27, 2025

Let's use UserOperation.from from Ox for this.

@jxom jxom merged commit d3ef08e into wevm:main Jul 27, 2025
2 checks passed
@tmm tmm mentioned this pull request Oct 23, 2025
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.

2 participants