From 6dad33d5ba58eb925f7347babb41262a3617cbc3 Mon Sep 17 00:00:00 2001 From: Alex Gray Date: Tue, 19 Aug 2025 21:39:05 +0200 Subject: [PATCH 1/2] (add): checker for the authorization before sending userOp --- .../actions/smartAccount/sendTransaction.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/permissionless/actions/smartAccount/sendTransaction.ts b/packages/permissionless/actions/smartAccount/sendTransaction.ts index 15a50d38..ef1e8b4d 100644 --- a/packages/permissionless/actions/smartAccount/sendTransaction.ts +++ b/packages/permissionless/actions/smartAccount/sendTransaction.ts @@ -3,7 +3,8 @@ import type { Client, Hash, SendTransactionParameters, - Transport + Transport, + getCode } from "viem" import { type SendUserOperationParameters, @@ -95,6 +96,21 @@ export async function sendTransaction< if (!to) throw new Error("Missing to address") + if ("authorization" in args && args.authorization) { + const bytecode = await getCode(client, { address: account.address }) + + if (bytecode) { + const bc = bytecode.toLowerCase() + // "0x" + "ef0100" + 40 hex (address) + if (bc.startsWith("0xef0100") && bc.length >= 48) { + const attachedAddress = "0x" + bc.slice(8, 48) // <-- exact 20 bytes + const target = (args.authorization as any).address?.toLowerCase?.() + if (target && attachedAddress === target) { + delete (args as any).authorization + } + } + } + } userOpHash = await getAction( client, sendUserOperation, From 191b408e25d57df2304ec4d422b23f5cba26a81f Mon Sep 17 00:00:00 2001 From: 0xKoiner Date: Thu, 21 Aug 2025 14:27:15 +0200 Subject: [PATCH 2/2] Create kip-redundant-7702-auth.md --- .changeset/kip-redundant-7702-auth.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/kip-redundant-7702-auth.md diff --git a/.changeset/kip-redundant-7702-auth.md b/.changeset/kip-redundant-7702-auth.md new file mode 100644 index 00000000..9d3eb1ad --- /dev/null +++ b/.changeset/kip-redundant-7702-auth.md @@ -0,0 +1,6 @@ +--- +"permissionless": patch +--- + +Skip adding `authorization` to `sendTransaction` when the account is already 7702-attached to the same address. +This prevents redundant Type-4 overhead in UserOps and reduces calldata/gas; no changes required for consumers.