diff --git a/.changeset/selfish-goats-appear.md b/.changeset/selfish-goats-appear.md new file mode 100644 index 0000000000..dea1bc8045 --- /dev/null +++ b/.changeset/selfish-goats-appear.md @@ -0,0 +1,5 @@ +--- +"viem": patch +--- + +**Account Abstraction**: Added `toUserOperation` utility to convert `PackedUserOperation` to `UserOperation`. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 24fbba6fb4..f21ddf90ee 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -571,8 +571,8 @@ importers: specifier: 1.0.7 version: 1.0.7(ws@8.18.2) ox: - specifier: 0.8.1 - version: 0.8.1(typescript@5.8.3)(zod@3.23.8) + specifier: 0.8.6 + version: 0.8.6(typescript@5.8.3)(zod@3.23.8) ws: specifier: 8.18.2 version: 8.18.2 @@ -5105,6 +5105,14 @@ packages: typescript: optional: true + ox@0.8.6: + resolution: {integrity: sha512-eiKcgiVVEGDtEpEdFi1EGoVVI48j6icXHce9nFwCNM7CKG3uoCXKdr4TPhS00Iy1TR2aWSF1ltPD0x/YgqIL9w==} + peerDependencies: + typescript: '>=5.4.0' + peerDependenciesMeta: + typescript: + optional: true + p-filter@2.1.0: resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} engines: {node: '>=8'} @@ -6241,8 +6249,8 @@ packages: typescript: optional: true - viem@2.31.7: - resolution: {integrity: sha512-mpB8Hp6xK77E/b/yJmpAIQcxcOfpbrwWNItjnXaIA8lxZYt4JS433Pge2gg6Hp3PwyFtaUMh01j5L8EXnLTjQQ==} + viem@2.33.1: + resolution: {integrity: sha512-++Dkj8HvSOLPMKEs+ZBNNcWbBRlUHcXNWktjIU22hgr6YmbUldV1sPTGLZa6BYRm06WViMjXj6HIsHt8rD+ZKQ==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -7779,7 +7787,7 @@ snapshots: pino-pretty: 10.3.1 prom-client: 14.2.0 type-fest: 4.39.0 - viem: 2.33.0(typescript@5.8.3)(zod@3.23.8) + viem: 2.33.1(typescript@5.8.3)(zod@3.23.8) yargs: 17.7.2 zod: 3.23.8 zod-validation-error: 1.5.0(zod@3.23.8) @@ -11707,6 +11715,36 @@ snapshots: transitivePeerDependencies: - zod + ox@0.8.6(typescript@5.6.2)(zod@3.23.8): + dependencies: + '@adraffy/ens-normalize': 1.11.0 + '@noble/ciphers': 1.3.0 + '@noble/curves': 1.9.2 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 + abitype: 1.0.8(typescript@5.6.2)(zod@3.23.8) + eventemitter3: 5.0.1 + optionalDependencies: + typescript: 5.6.2 + transitivePeerDependencies: + - zod + + ox@0.8.6(typescript@5.8.3)(zod@3.23.8): + dependencies: + '@adraffy/ens-normalize': 1.11.0 + '@noble/ciphers': 1.3.0 + '@noble/curves': 1.9.2 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 + abitype: 1.0.8(typescript@5.8.3)(zod@3.23.8) + eventemitter3: 5.0.1 + optionalDependencies: + typescript: 5.8.3 + transitivePeerDependencies: + - zod + p-filter@2.1.0: dependencies: p-map: 2.1.0 @@ -13039,7 +13077,7 @@ snapshots: - utf-8-validate - zod - viem@2.33.0(typescript@5.8.3)(zod@3.23.8): + viem@2.33.1(typescript@5.8.3)(zod@3.23.8): dependencies: '@noble/curves': 1.9.2 '@noble/hashes': 1.8.0 @@ -13064,7 +13102,7 @@ snapshots: '@scure/bip39': 1.6.0 abitype: 1.0.8(typescript@5.6.2)(zod@3.23.8) isows: 1.0.7(ws@8.18.2) - ox: 0.8.1(typescript@5.6.2)(zod@3.23.8) + ox: 0.8.6(typescript@5.6.2)(zod@3.23.8) ws: 8.18.2 optionalDependencies: typescript: 5.6.2 diff --git a/src/account-abstraction/index.ts b/src/account-abstraction/index.ts index 76ad7f38d8..978c5459c1 100644 --- a/src/account-abstraction/index.ts +++ b/src/account-abstraction/index.ts @@ -253,3 +253,4 @@ export { getUserOperationTypedData, } from './utils/userOperation/getUserOperationTypedData.js' export { toPackedUserOperation } from './utils/userOperation/toPackedUserOperation.js' +export { toUserOperation } from './utils/userOperation/toUserOperation.js' diff --git a/src/account-abstraction/utils/userOperation/toUserOperation.ts b/src/account-abstraction/utils/userOperation/toUserOperation.ts new file mode 100644 index 0000000000..0de18c5a65 --- /dev/null +++ b/src/account-abstraction/utils/userOperation/toUserOperation.ts @@ -0,0 +1,3 @@ +import * as UserOperation from 'ox/erc4337/UserOperation' + +export const toUserOperation = UserOperation.from diff --git a/src/package.json b/src/package.json index f9eda3da08..ab2cd60554 100644 --- a/src/package.json +++ b/src/package.json @@ -163,7 +163,7 @@ "@scure/bip39": "1.6.0", "abitype": "1.0.8", "isows": "1.0.7", - "ox": "0.8.1", + "ox": "0.8.6", "ws": "8.18.2" }, "license": "MIT",