diff --git a/.changeset/wise-paws-compete.md b/.changeset/wise-paws-compete.md new file mode 100644 index 00000000..f680dd9d --- /dev/null +++ b/.changeset/wise-paws-compete.md @@ -0,0 +1,5 @@ +--- +"permissionless": patch +--- + +Fixed support viem>=2.21.59 diff --git a/packages/permissionless/accounts/safe/toSafeSmartAccount.ts b/packages/permissionless/accounts/safe/toSafeSmartAccount.ts index b9c6dc72..2e291dfa 100644 --- a/packages/permissionless/accounts/safe/toSafeSmartAccount.ts +++ b/packages/permissionless/accounts/safe/toSafeSmartAccount.ts @@ -1211,8 +1211,8 @@ export async function toSafeSmartAccount< let _multiSendCallOnlyAddress: Address | undefined = undefined let safeModules: Address[] | undefined = undefined let setupTransactions: { - to: `0x${string}` - data: `0x${string}` + to: Address + data: Hex value: bigint }[] = [] let validators: { address: Address; context: Address }[] = [] diff --git a/packages/permissionless/accounts/thirdweb/utils/encodeCallData.ts b/packages/permissionless/accounts/thirdweb/utils/encodeCallData.ts index 4e262259..fa31df25 100644 --- a/packages/permissionless/accounts/thirdweb/utils/encodeCallData.ts +++ b/packages/permissionless/accounts/thirdweb/utils/encodeCallData.ts @@ -1,10 +1,10 @@ -import { encodeFunctionData } from "viem" +import { type Address, type Hex, encodeFunctionData } from "viem" export const encodeCallData = async ( calls: readonly { - to: `0x${string}` + to: Address value?: bigint | undefined - data?: `0x${string}` | undefined + data?: Hex | undefined }[] ) => { if (calls.length > 1) { diff --git a/packages/permissionless/accounts/trust/utils/encodeCallData.ts b/packages/permissionless/accounts/trust/utils/encodeCallData.ts index 4e262259..fa31df25 100644 --- a/packages/permissionless/accounts/trust/utils/encodeCallData.ts +++ b/packages/permissionless/accounts/trust/utils/encodeCallData.ts @@ -1,10 +1,10 @@ -import { encodeFunctionData } from "viem" +import { type Address, type Hex, encodeFunctionData } from "viem" export const encodeCallData = async ( calls: readonly { - to: `0x${string}` + to: Address value?: bigint | undefined - data?: `0x${string}` | undefined + data?: Hex | undefined }[] ) => { if (calls.length > 1) { diff --git a/packages/permissionless/actions/erc7579.ts b/packages/permissionless/actions/erc7579.ts index 68fa1e09..6fe38307 100644 --- a/packages/permissionless/actions/erc7579.ts +++ b/packages/permissionless/actions/erc7579.ts @@ -42,11 +42,11 @@ export type Erc7579Actions = { accountId: ( args?: GetSmartAccountParameter ) => Promise - installModule: ( - args: InstallModuleParameters + installModule: ( + args: InstallModuleParameters ) => Promise - installModules: ( - args: InstallModulesParameters + installModules: ( + args: InstallModulesParameters ) => Promise isModuleInstalled: ( args: IsModuleInstalledParameters @@ -57,11 +57,11 @@ export type Erc7579Actions = { supportsModule: ( args: SupportsModuleParameters ) => Promise - uninstallModule: ( - args: UninstallModuleParameters + uninstallModule: ( + args: UninstallModuleParameters ) => Promise - uninstallModules: ( - args: UninstallModulesParameters + uninstallModules: ( + args: UninstallModulesParameters ) => Promise } diff --git a/packages/permissionless/actions/erc7579/installModule.ts b/packages/permissionless/actions/erc7579/installModule.ts index e34559c3..5eaaf28e 100644 --- a/packages/permissionless/actions/erc7579/installModule.ts +++ b/packages/permissionless/actions/erc7579/installModule.ts @@ -1,9 +1,8 @@ -import type { Address, Client, Hex, Narrow, OneOf } from "viem" +import type { Address, Client, Hex, OneOf } from "viem" import { type GetSmartAccountParameter, type PaymasterActions, type SmartAccount, - type UserOperationCalls, sendUserOperation } from "viem/account-abstraction" import { getAction, parseAccount } from "viem/utils" @@ -12,15 +11,18 @@ import { encodeInstallModule } from "../../utils/encodeInstallModule.js" import type { ModuleType } from "./supportsModule.js" export type InstallModuleParameters< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] + TSmartAccount extends SmartAccount | undefined > = GetSmartAccountParameter & { type: ModuleType address: Address maxFeePerGas?: bigint maxPriorityFeePerGas?: bigint nonce?: bigint - calls?: UserOperationCalls> + calls?: readonly { + to: Address + value?: bigint | undefined + data?: Hex | undefined + }[] paymaster?: | Address | true @@ -46,12 +48,9 @@ export type InstallModuleParameters< } > -export async function installModule< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] ->( +export function installModule( client: Client, - parameters: InstallModuleParameters + parameters: InstallModuleParameters ): Promise { const { account: account_ = client.account, @@ -85,11 +84,7 @@ export async function installModule< account, modules: [{ address, context: context ?? initData, type }] }), - ...((calls ?? []) as readonly { - to: `0x${string}` - value: bigint - data: `0x${string}` - }[]) + ...(calls ?? []) ], paymaster, paymasterContext, diff --git a/packages/permissionless/actions/erc7579/installModules.ts b/packages/permissionless/actions/erc7579/installModules.ts index c82d33ee..0b1dbb1a 100644 --- a/packages/permissionless/actions/erc7579/installModules.ts +++ b/packages/permissionless/actions/erc7579/installModules.ts @@ -1,8 +1,7 @@ -import type { Address, Chain, Client, Hex, Narrow, Transport } from "viem" +import type { Address, Chain, Client, Hex, Transport } from "viem" import { type PaymasterActions, type SmartAccount, - type UserOperationCalls, sendUserOperation } from "viem/account-abstraction" import { getAction, parseAccount } from "viem/utils" @@ -13,13 +12,16 @@ import { } from "../../utils/encodeInstallModule.js" export type InstallModulesParameters< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] + TSmartAccount extends SmartAccount | undefined > = EncodeInstallModuleParameters & { maxFeePerGas?: bigint maxPriorityFeePerGas?: bigint nonce?: bigint - calls?: UserOperationCalls> + calls?: readonly { + to: Address + value?: bigint | undefined + data?: Hex | undefined + }[] paymaster?: | Address | true @@ -39,11 +41,10 @@ export type InstallModulesParameters< } export async function installModules< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] + TSmartAccount extends SmartAccount | undefined >( client: Client, - parameters: InstallModulesParameters + parameters: InstallModulesParameters ): Promise { const { account: account_ = client.account, @@ -73,11 +74,7 @@ export async function installModules< account, modules }), - ...((calls ?? []) as readonly { - to: `0x${string}` - value: bigint - data: `0x${string}` - }[]) + ...(calls ?? []) ], paymaster, paymasterContext, diff --git a/packages/permissionless/actions/erc7579/uninstallModule.ts b/packages/permissionless/actions/erc7579/uninstallModule.ts index d2b55f6f..88896c14 100644 --- a/packages/permissionless/actions/erc7579/uninstallModule.ts +++ b/packages/permissionless/actions/erc7579/uninstallModule.ts @@ -1,17 +1,8 @@ -import type { - Address, - Chain, - Client, - Hex, - Narrow, - OneOf, - Transport -} from "viem" +import type { Address, Chain, Client, Hex, OneOf, Transport } from "viem" import { type GetSmartAccountParameter, type PaymasterActions, type SmartAccount, - type UserOperationCalls, sendUserOperation } from "viem/account-abstraction" import { getAction } from "viem/utils" @@ -21,15 +12,18 @@ import { encodeUninstallModule } from "../../utils/encodeUninstallModule.js" import type { ModuleType } from "./supportsModule.js" export type UninstallModuleParameters< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] + TSmartAccount extends SmartAccount | undefined > = GetSmartAccountParameter & { type: ModuleType address: Address maxFeePerGas?: bigint maxPriorityFeePerGas?: bigint nonce?: bigint - calls?: UserOperationCalls> + calls?: readonly { + to: Address + value?: bigint | undefined + data?: Hex | undefined + }[] paymaster?: | Address | true @@ -56,11 +50,10 @@ export type UninstallModuleParameters< > export async function uninstallModule< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] + TSmartAccount extends SmartAccount | undefined >( client: Client, - parameters: UninstallModuleParameters + parameters: UninstallModuleParameters ): Promise { const { account: account_ = client.account, @@ -94,11 +87,7 @@ export async function uninstallModule< account, modules: [{ type, address, context: context ?? deInitData }] }), - ...((calls ?? []) as readonly { - to: `0x${string}` - value: bigint - data: `0x${string}` - }[]) + ...(calls ?? []) ], paymaster, paymasterContext, diff --git a/packages/permissionless/actions/erc7579/uninstallModules.ts b/packages/permissionless/actions/erc7579/uninstallModules.ts index 7ca3e935..448fa3f1 100644 --- a/packages/permissionless/actions/erc7579/uninstallModules.ts +++ b/packages/permissionless/actions/erc7579/uninstallModules.ts @@ -1,8 +1,7 @@ -import type { Address, Chain, Client, Hex, Narrow, Transport } from "viem" +import type { Address, Chain, Client, Hex, Transport } from "viem" import { type PaymasterActions, type SmartAccount, - type UserOperationCalls, sendUserOperation } from "viem/account-abstraction" import { getAction } from "viem/utils" @@ -14,13 +13,16 @@ import { } from "../../utils/encodeUninstallModule.js" export type UninstallModulesParameters< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] + TSmartAccount extends SmartAccount | undefined > = EncodeUninstallModuleParameters & { maxFeePerGas?: bigint maxPriorityFeePerGas?: bigint nonce?: bigint - calls?: UserOperationCalls> + calls?: readonly { + to: Address + value?: bigint | undefined + data?: Hex | undefined + }[] paymaster?: | Address | true @@ -40,11 +42,10 @@ export type UninstallModulesParameters< } export async function uninstallModules< - TSmartAccount extends SmartAccount | undefined, - calls extends readonly unknown[] + TSmartAccount extends SmartAccount | undefined >( client: Client, - parameters: UninstallModulesParameters + parameters: UninstallModulesParameters ): Promise { const { account: account_ = client.account, @@ -75,11 +76,7 @@ export async function uninstallModules< account, modules }), - ...((calls ?? []) as readonly { - to: `0x${string}` - value: bigint - data: `0x${string}` - }[]) + ...(calls ?? []) ], paymaster, paymasterContext, diff --git a/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts b/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts index e4ea72ce..6fa037a1 100644 --- a/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts +++ b/packages/permissionless/experimental/pimlico/utils/prepareUserOperationForErc20Paymaster.ts @@ -3,6 +3,7 @@ import { type Chain, type Client, type ContractFunctionParameters, + type Hex, RpcError, type Transport, encodeFunctionData, @@ -19,7 +20,6 @@ import { type PrepareUserOperationReturnType, type SmartAccount, type UserOperation, - type UserOperationCall, getPaymasterData as getPaymasterData_, prepareUserOperation } from "viem/account-abstraction" @@ -279,7 +279,11 @@ export const prepareUserOperationForErc20Paymaster = userOperation.callData = await account.encodeCalls( finalCalls.map((call_) => { const call = call_ as - | UserOperationCall + | { + to: Address + value: bigint + data: Hex + } | (ContractFunctionParameters & { to: Address value: bigint @@ -289,8 +293,8 @@ export const prepareUserOperationForErc20Paymaster = data: encodeFunctionData(call), to: call.to, value: call.value - } as UserOperationCall - return call as UserOperationCall + } + return call }) ) parameters.calls = finalCalls