Skip to content

fix(account-abstraction): format user operation receipt nonce as bigint - #5345

Merged
jxom merged 1 commit into
wevm:mainfrom
Kropiunig:fix/user-operation-receipt-nonce
Nov 1, 2026
Merged

jxom merged 1 commit into
wevm:mainfrom
Kropiunig:fix/user-operation-receipt-nonce

Conversation

@Kropiunig

Copy link
Copy Markdown
Contributor

Summary

getUserOperationReceipt / waitForUserOperationReceipt return the receipt's nonce as the raw hex string from the bundler, even though UserOperationReceipt['nonce'] is typed as bigint:

const receipt = await bundlerClient.waitForUserOperationReceipt({ hash })

typeof receipt.nonce // 'string' ('0x4'), typed as bigint
receipt.nonce === userOperation.nonce // false
receipt.nonce + 1n // TypeError: Cannot mix BigInt and other types

Root cause

src/account-abstraction/utils/formatters/userOperationReceipt.ts converts actualGasCost, actualGasUsed, logs and receipt, but never nonce, so the spread RPC value is returned as-is. The existing unit test snapshot even shows "nonce": "0x4" next to "actualGasCost": 1n. ox's UserOperationReceipt.fromRpc does nonce: BigInt(rpc.nonce).

Fix

Convert nonce with BigInt(...) like the other quantity fields.

Test

Updated the formatUserOperationReceipt snapshot ("0x4" -> 4n) and added a behavior: nonce test with a 2D nonce (0x10000000000000001). The new test fails on main (expected '0x10000000000000001' to be 18446744073709551617n) and passes with the fix.

@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5299860

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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

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