useClientActions
Defined in: account-kit/react/dist/types/hooks/useClientActions.d.ts:77
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
import React from "react"; import { function useSmartAccountClient<TChain extends Chain | undefined = Chain | undefined, TAccount extends SupportedAccountTypes | undefined = "ModularAccountV2">(args: UseSmartAccountClientProps<TChain, TAccount>): UseSmartAccountClientResult<TChain, SupportedAccount<TAccount extends undefined ? "ModularAccountV2" : TAccount>>useSmartAccountClient } from "@account-kit/react"; import { const sessionKeyPluginActions: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>) => SessionKeyPluginActions<TAccount>Creates actions for managing session keys in a smart contract associated with a client, including adding, removing, rotating, and updating session key permissions.
sessionKeyPluginActions } from "@account-kit/smart-contracts"; import { function useClientActions<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TActions extends { [x: string]: (...args: any[]) => any; } = { [x: string]: (...args: any[]) => any; }>(args: UseClientActionsProps<TTransport, TChain, TActions>): UseClientActionsResult<TActions>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.
useClientActions } from "@account-kit/react"; const const Foo: () => voidFoo = () => { const { const client: { account: MultiOwnerModularAccount<AlchemySigner>; batch?: { multicall?: boolean | Prettify<MulticallBatchOptions> | undefined; } | undefined; ... 99 more ...; extend: <const client extends { ...; } & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>; } | undefinedclient } = useSmartAccountClient<Chain | undefined, "MultiOwnerModularAccount">(args: UseSmartAccountClientProps<Chain | undefined, "MultiOwnerModularAccount">): UseSmartAccountClientResult<...>useSmartAccountClient({ type?: "MultiOwnerModularAccount" | undefinedtype: "MultiOwnerModularAccount", }); const { const executeAction: <TFunctionName extends "removeSessionKey" | "addSessionKey" | "rotateSessionKey" | "executeWithSessionKey" | "installSessionKeyPlugin" | keyof ReadAndEncodeActions | "isAccountSessionKey" | "getAccountSessionKeys" | "updateSessionKeyPermissions">(params: ClientActionParameters<...>) => voidexecuteAction } = useClientActions<Transport, Chain | undefined, SessionKeyPluginActions<SupportedAccounts, keyof EntryPointRegistryBase<unknown>>>(args: UseClientActionsProps<...>): UseClientActionsResult<...>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.
useClientActions({ client?: { account: SupportedAccounts; batch?: { multicall?: boolean | Prettify<MulticallBatchOptions> | undefined; } | undefined; ... 84 more ...; extend: <const client extends { ...; } & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>; } | { ...; } | { ...; } | { ...; } | undefinedclient: const client: { account: MultiOwnerModularAccount<AlchemySigner>; batch?: { multicall?: boolean | Prettify<MulticallBatchOptions> | undefined; } | undefined; ... 99 more ...; extend: <const client extends { ...; } & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>; } | undefinedclient, actions: (client: Client<Transport, Chain | undefined, SupportedAccounts>) => SessionKeyPluginActions<SupportedAccounts, keyof EntryPointRegistryBase<unknown>>actions: const sessionKeyPluginActions: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartContractAccount | undefined = SmartContractAccount | undefined>(client: Client<TTransport, TChain, TAccount>) => SessionKeyPluginActions<TAccount>Creates actions for managing session keys in a smart contract associated with a client, including adding, removing, rotating, and updating session key permissions.
sessionKeyPluginActions, }); const executeAction: <"isAccountSessionKey">(params: ClientActionParameters<SessionKeyPluginActions<SupportedAccounts, keyof EntryPointRegistryBase<unknown>>, "isAccountSessionKey", [args: ...]>) => voidexecuteAction({ functionName: "isAccountSessionKey"functionName: "isAccountSessionKey", args: [args: { key: Address; } & GetPluginAddressParameter & { account?: SmartContractAccount<string, keyof EntryPointRegistryBase<unknown>> | undefined; }]args: [{ key: `0x${string}`key: "0x0" }], }); };
Type Parameters
Parameters
Returns
UseClientActionsResult
<TActions
>
an object containing methods to execute the actions as well loading and error states ref