import type { Chain, Client, Transport } from "viem"; import type { SupportedAccounts } from "../../config"; import type { UseSmartAccountClientResult } from "./useSmartAccountClient"; export type UseClientActionsProps unknown; } = { [x: string]: (...args: any[]) => unknown; }> = { client?: UseSmartAccountClientResult["client"]; actions: (client: Client) => TActions; }; export type UseClientActionsResult unknown; } = { [x: string]: (...args: any[]) => unknown; }> = { executeAction: >(params: ClientActionParameters) => void; executeActionAsync: >(params: ClientActionParameters) => Promise>; data: ReturnType | undefined; isExecutingAction: boolean; error?: Error | null; }; export type ExecutableFunctionName unknown; } = { [x: string]: (...args: any[]) => unknown; }> = keyof TActions extends infer functionName extends string ? [functionName] extends [never] ? string : functionName : string; export type ExecuteableFunctionResult, TActions extends { [x: string]: (...args: any[]) => unknown; } = { [x: string]: (...args: any[]) => unknown; }> = ReturnType; export type ExecutableFunctionArgs unknown; } = { [x: string]: (...args: any[]) => unknown; }, TFunctionName extends ExecutableFunctionName = ExecutableFunctionName> = Parameters; export type ClientActionParameters unknown; } = { [x: string]: (...args: any[]) => unknown; }, TFunctionName extends ExecutableFunctionName = ExecutableFunctionName, allArgs = ExecutableFunctionArgs ? TFunctionName : ExecutableFunctionName>> = { functionName: TFunctionName; args: allArgs; }; /** * A hook that allows you to leverage client decorators to execute actions * and await them in your UX. This is particularly useful for using Plugins * with Modular Accounts. * * @example * ```tsx * const Foo = () => { * const { client } = useSmartAccountClient({ type: "MultiOwnerModularAccount" }); * const { executeAction } = useClientActions({ * client, * pluginActions: sessionKeyPluginActions, * }); * * executeAction({ * functionName: "isAccountSessionKey", * args: [{ key: "0x0" }], * }); * }; * ``` * * @param args the hooks arguments highlighted below * @param args.client the smart account client returned from {@link useSmartAccountClient} * @param args.actions the smart account client decorator you want to execute actions from * @returns an object containing methods to execute the actions as well loading and error states (see: {@link UseClientActionsResult}) */ export declare function useClientActions any; } = { [x: string]: (...args: any[]) => any; }>(args: UseClientActionsProps): UseClientActionsResult; //# sourceMappingURL=useClientActions.d.ts.map