diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4a693bf2..dfcdd0a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,8 +54,8 @@ importers: specifier: ^18.16.3 version: 18.16.3 viem: - specifier: ^2.9.5 - version: 2.9.5(typescript@5.3.3)(zod@3.22.4) + specifier: ^2.21.4 + version: 2.21.4(typescript@5.3.3)(zod@3.22.4) src: dependencies: @@ -138,8 +138,8 @@ importers: specifier: ^14.2.0 version: 14.2.0 viem: - specifier: ^2.9.5 - version: 2.9.5(typescript@5.3.3)(zod@3.22.4) + specifier: ^2.21.4 + version: 2.21.4(typescript@5.3.3)(zod@3.22.4) yargs: specifier: ^17.7.1 version: 17.7.2 @@ -210,7 +210,7 @@ packages: '@babel/traverse': 7.21.5 '@babel/types': 7.21.5 convert-source-map: 1.9.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -370,7 +370,7 @@ packages: '@babel/helper-split-export-declaration': 7.18.6 '@babel/parser': 7.21.5 '@babel/types': 7.21.5 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -849,17 +849,22 @@ packages: read-yaml-file: 1.1.0 dev: true - /@noble/curves@1.2.0: - resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} + /@noble/curves@1.4.0: + resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==} dependencies: - '@noble/hashes': 1.3.2 + '@noble/hashes': 1.4.0 dev: false - /@noble/hashes@1.3.2: - resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==} + /@noble/hashes@1.4.0: + resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} engines: {node: '>= 16'} dev: false + /@noble/hashes@1.5.0: + resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} + engines: {node: ^14.21.3 || >=16} + dev: false + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -1318,23 +1323,23 @@ packages: dev: true optional: true - /@scure/base@1.1.5: - resolution: {integrity: sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==} + /@scure/base@1.1.8: + resolution: {integrity: sha512-6CyAclxj3Nb0XT7GHK6K4zK6k2xJm6E4Ft0Ohjt4WgegiFUHEtFb2CGzmPmGBwoIhrLsqNLYfLr04Y1GePrzZg==} dev: false - /@scure/bip32@1.3.2: - resolution: {integrity: sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==} + /@scure/bip32@1.4.0: + resolution: {integrity: sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==} dependencies: - '@noble/curves': 1.2.0 - '@noble/hashes': 1.3.2 - '@scure/base': 1.1.5 + '@noble/curves': 1.4.0 + '@noble/hashes': 1.4.0 + '@scure/base': 1.1.8 dev: false - /@scure/bip39@1.2.1: - resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==} + /@scure/bip39@1.4.0: + resolution: {integrity: sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==} dependencies: - '@noble/hashes': 1.3.2 - '@scure/base': 1.1.5 + '@noble/hashes': 1.5.0 + '@scure/base': 1.1.8 dev: false /@sentry-internal/tracing@7.100.1: @@ -1575,8 +1580,8 @@ packages: zod: 3.22.4 dev: false - /abitype@1.0.0(typescript@5.3.3)(zod@3.22.4): - resolution: {integrity: sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==} + /abitype@1.0.5(typescript@5.3.3)(zod@3.22.4): + resolution: {integrity: sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==} peerDependencies: typescript: '>=5.0.4' zod: ^3 >=3.22.0 @@ -1786,7 +1791,7 @@ packages: dependencies: '@fastify/error': 3.4.1 archy: 1.0.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) fastq: 1.17.1 transitivePeerDependencies: - supports-color @@ -2126,7 +2131,6 @@ packages: dependencies: ms: 2.1.2 supports-color: 5.5.0 - dev: true /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} @@ -2139,6 +2143,7 @@ packages: dependencies: ms: 2.1.2 supports-color: 8.1.1 + dev: true /debug@4.3.6: resolution: {integrity: sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==} @@ -2755,11 +2760,11 @@ packages: /has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} - dev: true /has-flag@4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} + dev: true /has-property-descriptors@1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} @@ -2892,7 +2897,7 @@ packages: dependencies: '@ioredis/commands': 1.2.0 cluster-key-slot: 1.1.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) denque: 2.1.0 lodash.defaults: 4.2.0 lodash.isarguments: 3.1.0 @@ -3085,12 +3090,12 @@ packages: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true - /isows@1.0.3(ws@8.13.0): - resolution: {integrity: sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==} + /isows@1.0.4(ws@8.17.1): + resolution: {integrity: sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ==} peerDependencies: ws: '*' dependencies: - ws: 8.13.0 + ws: 8.17.1 dev: false /istanbul-lib-coverage@3.2.0: @@ -3142,7 +3147,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4(supports-color@5.5.0) istanbul-lib-coverage: 3.2.0 source-map: 0.6.1 transitivePeerDependencies: @@ -4405,7 +4410,6 @@ packages: engines: {node: '>=4'} dependencies: has-flag: 3.0.0 - dev: true /supports-color@7.2.0: resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} @@ -4419,6 +4423,7 @@ packages: engines: {node: '>=10'} dependencies: has-flag: 4.0.0 + dev: true /supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} @@ -4686,8 +4691,8 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /viem@2.9.5(typescript@5.3.3)(zod@3.22.4): - resolution: {integrity: sha512-IKLmGZJEQkdt9fqvryjR+W1FsPZM+dhALT0pwR8xhBOLvVHM0/lEViGRWDpm2ArNsFszipFhc2EpKp80/PnXkw==} + /viem@2.21.4(typescript@5.3.3)(zod@3.22.4): + resolution: {integrity: sha512-4E61XWhErjuXh5ObEoosKSy4iMvYnkuQq9jGLW5Isod68dNrENnyNV0QlVpn0LB3qunJ4ZMFMhYdfTjETqe7cQ==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: @@ -4695,14 +4700,15 @@ packages: optional: true dependencies: '@adraffy/ens-normalize': 1.10.0 - '@noble/curves': 1.2.0 - '@noble/hashes': 1.3.2 - '@scure/bip32': 1.3.2 - '@scure/bip39': 1.2.1 - abitype: 1.0.0(typescript@5.3.3)(zod@3.22.4) - isows: 1.0.3(ws@8.13.0) + '@noble/curves': 1.4.0 + '@noble/hashes': 1.4.0 + '@scure/bip32': 1.4.0 + '@scure/bip39': 1.4.0 + abitype: 1.0.5(typescript@5.3.3)(zod@3.22.4) + isows: 1.0.4(ws@8.17.1) typescript: 5.3.3 - ws: 8.13.0 + webauthn-p256: 0.0.5 + ws: 8.17.1 transitivePeerDependencies: - bufferutil - utf-8-validate @@ -4715,6 +4721,13 @@ packages: defaults: 1.0.4 dev: true + /webauthn-p256@0.0.5: + resolution: {integrity: sha512-drMGNWKdaixZNobeORVIqq7k5DsRC9FnG201K2QjeOoQLmtSDaSsVZdkg6n5jUALJKcAG++zBPJXmv6hy0nWFg==} + dependencies: + '@noble/curves': 1.4.0 + '@noble/hashes': 1.4.0 + dev: false + /webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} dev: true @@ -4820,6 +4833,19 @@ packages: optional: true dev: false + /ws@8.17.1: + resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + dev: false + /y18n@4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} dev: true diff --git a/scripts/localDeployer/package.json b/scripts/localDeployer/package.json index f3c61210..88f0adc2 100644 --- a/scripts/localDeployer/package.json +++ b/scripts/localDeployer/package.json @@ -7,6 +7,6 @@ }, "dependencies": { "@types/node": "^18.16.3", - "viem": "^2.9.5" + "viem": "^2.21.4" } } diff --git a/src/executor/executor.ts b/src/executor/executor.ts index c721ad55..1164d07a 100644 --- a/src/executor/executor.ts +++ b/src/executor/executor.ts @@ -47,6 +47,7 @@ import { type Transport, type WalletClient } from "viem" +import { Authorization } from "viem/experimental" import { createCompressedCalldata, filterOpsAndEstimateGas, @@ -931,16 +932,6 @@ export class Executor { let transactionHash: HexData32 try { - const gasOptions = this.legacyTransactions - ? { - gasPrice: gasPriceParameters.maxFeePerGas - } - : { - maxFeePerGas: gasPriceParameters.maxFeePerGas, - maxPriorityFeePerGas: - gasPriceParameters.maxPriorityFeePerGas - } - const compressedOpsToBundle = opsToBundle.map( ({ mempoolUserOperation }) => { const compressedOp = mempoolUserOperation @@ -948,8 +939,36 @@ export class Executor { } ) + let authorizationList: Authorization[] | undefined = undefined + for (const compressedOp of compressedOpsToBundle) { + if ("authorizationList" in compressedOp.inflatedOp) { + const opAuthorizationList = compressedOp.inflatedOp.authorizationList + if (opAuthorizationList) { + if (authorizationList !== undefined) { + authorizationList.push(...opAuthorizationList) + } else { + authorizationList = opAuthorizationList + } + } + } + } + + if (authorizationList && this.legacyTransactions) { + throw new Error("AuthorizationList is not supported for legacy transactions") + } + const newGasOptions = { + maxFeePerGas: gasPriceParameters.maxFeePerGas, + maxPriorityFeePerGas: + gasPriceParameters.maxPriorityFeePerGas + } + const gasOptions = this.legacyTransactions + ? { + gasPrice: gasPriceParameters.maxFeePerGas + } + : newGasOptions + // need to use sendTransaction to target BundleBulker's fallback - transactionHash = await this.walletClient.sendTransaction({ + const params = { account: wallet, to: compressionHandler.bundleBulkerAddress, data: createCompressedCalldata( @@ -958,8 +977,18 @@ export class Executor { ), gas: gasLimit, nonce: nonce, - ...gasOptions - }) + } + const sendTransactionParams = authorizationList + ? { + ...params, + ...newGasOptions, + authorizationList + } + : { + ...params, + ...gasOptions + } + transactionHash = await this.walletClient.sendTransaction(sendTransactionParams) opsToBundle.map(({ userOperationHash }) => { this.eventManager.emitSubmitted( diff --git a/src/package.json b/src/package.json index 9ccbe956..a98c24a3 100644 --- a/src/package.json +++ b/src/package.json @@ -57,7 +57,7 @@ "pino-http": "^8.4.0", "pino-pretty": "^10.0.0", "prom-client": "^14.2.0", - "viem": "^2.9.5", + "viem": "^2.21.4", "yargs": "^17.7.1", "zod": "^3.21.4", "zod-validation-error": "^1.3.0" diff --git a/src/types/schemas.ts b/src/types/schemas.ts index 56a5d414..02d13349 100644 --- a/src/types/schemas.ts +++ b/src/types/schemas.ts @@ -88,6 +88,15 @@ const userOperationV07Schema = z .nullable() .optional() .transform((val) => val ?? null), + authorizationList: z.array(z.object({ + contractAddress: addressSchema, + chainId: z.number(), + nonce: z.number(), + yParity: z.number(), + r: hexDataSchema, + s: hexDataSchema, + })) + .optional(), signature: hexDataSchema }) .strict() diff --git a/test/e2e/deploy-contracts/package.json b/test/e2e/deploy-contracts/package.json index 181386ba..5e8932dc 100644 --- a/test/e2e/deploy-contracts/package.json +++ b/test/e2e/deploy-contracts/package.json @@ -5,7 +5,7 @@ "start": "wait-port anvil:8545 && ts-node index.ts" }, "dependencies": { - "viem": "^2.9.5", + "viem": "^2.21.4", "wait-port": "^1.1.0", "ts-node": "^10.9.2" } diff --git a/test/e2e/package.json b/test/e2e/package.json index 22fa81d3..2a7995ad 100644 --- a/test/e2e/package.json +++ b/test/e2e/package.json @@ -11,7 +11,7 @@ "@pimlico/alto": "workspace:./src/", "permissionless": "^0.1.25", "ts-node": "^10.9.2", - "viem": "^2.9.5", + "viem": "^2.21.4", "vitest": "^1.6.0", "wait-port": "^1.1.0" } diff --git a/test/kinto-e2e/package.json b/test/kinto-e2e/package.json index 89796b15..08083562 100644 --- a/test/kinto-e2e/package.json +++ b/test/kinto-e2e/package.json @@ -8,7 +8,7 @@ "kinto-e2e": "link:", "permissionless": "0.0.36", "ts-node": "^10.9.2", - "viem": "^2.0.0", + "viem": "^2.21.4", "wait-port": "^1.1.0" } }