diff --git a/.changeset/grumpy-readers-invite.md b/.changeset/grumpy-readers-invite.md new file mode 100644 index 00000000..1bc4d7ed --- /dev/null +++ b/.changeset/grumpy-readers-invite.md @@ -0,0 +1,5 @@ +--- +"permissionless": patch +--- + +Deprecated toSafeSmartAccount's setupTransactions field diff --git a/.changeset/old-apples-tell.md b/.changeset/old-apples-tell.md new file mode 100644 index 00000000..84ad8408 --- /dev/null +++ b/.changeset/old-apples-tell.md @@ -0,0 +1,5 @@ +--- +"permissionless": patch +--- + +Added onchainIdentier param for toSafeSmartAccount diff --git a/packages/permissionless-test/src/utils.ts b/packages/permissionless-test/src/utils.ts index 401845c3..6fcdce1a 100644 --- a/packages/permissionless-test/src/utils.ts +++ b/packages/permissionless-test/src/utils.ts @@ -1,12 +1,12 @@ import { http, type Account, + type Hex, createPublicClient, createWalletClient } from "viem" import { type SmartAccount, - createBundlerClient, createPaymasterClient, entryPoint06Address, entryPoint07Address @@ -349,10 +349,12 @@ export const getSafeClient = async ({ anvilRpc, erc7579, privateKey, - owners + owners, + onchainIdentifier }: { erc7579?: boolean owners?: Account[] + onchainIdentifier?: Hex } & AAParamType): Promise< ToSafeSmartAccountReturnType > => { @@ -360,6 +362,7 @@ export const getSafeClient = async ({ return toSafeSmartAccount({ client: publicClient, + onchainIdentifier, entryPoint: { address: entryPoint.version === "0.6" @@ -716,6 +719,22 @@ export const getCoreSmartAccounts = () => [ supportsEntryPointV07: true, isEip1271Compliant: true }, + { + name: "Safe (with onchain identifier)", + getSmartAccountClient: async ( + conf: AAParamType + ) => + getBundlerClient({ + account: await getSafeClient({ + ...conf, + onchainIdentifier: "0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + }), + ...conf + }), + supportsEntryPointV06: true, + supportsEntryPointV07: true, + isEip1271Compliant: true + }, { name: "Safe multiple owners", getSmartAccountClient: async ( diff --git a/packages/permissionless/accounts/safe/toSafeSmartAccount.ts b/packages/permissionless/accounts/safe/toSafeSmartAccount.ts index 024258ed..65b3e574 100644 --- a/packages/permissionless/accounts/safe/toSafeSmartAccount.ts +++ b/packages/permissionless/accounts/safe/toSafeSmartAccount.ts @@ -928,6 +928,7 @@ type GetErc7579Params = safeModuleSetupAddress?: Address multiSendAddress?: Address multiSendCallOnlyAddress?: Address + // @deprecated This field is deprecated. It is recommended to make any setup transactions in the userOperation's calldata. setupTransactions?: { to: Address data: Address @@ -975,6 +976,7 @@ export type ToSafeSmartAccountParameters< paymentToken?: Address payment?: bigint paymentReceiver?: Address + onchainIdentifier?: Hex } & GetErc7579Params function isErc7579Args( @@ -1149,7 +1151,8 @@ export async function toSafeSmartAccount< nonceKey, paymentToken, payment, - paymentReceiver + paymentReceiver, + onchainIdentifier } = parameters const owners = await Promise.all( @@ -1421,11 +1424,17 @@ export async function toSafeSmartAccount< value = call.value ?? 0n } - return encodeFunctionData({ + const calldata = encodeFunctionData({ abi: executeUserOpWithErrorStringAbi, functionName: "executeUserOpWithErrorString", args: [to, value, data, operationType] }) + + if (onchainIdentifier) { + return concat([calldata, onchainIdentifier]) + } + + return calldata }, async decodeCalls(callData) { try {