Skip to content

useClientActions

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.

Import

import { useClientActions } from "@account-kit/react";

Usage

const Foo = () => {
  const { client } = useSmartAccountClient({
    type: "MultiOwnerModularAccount",
  });
  const { executeAction } = useClientActions({
    client,
    pluginActions: sessionKeyPluginActions,
  });
 
  executeAction({
    functionName: "isAccountSessionKey",
    args: [{ key: "0x0" }],
  });
};

Parameters

args

UseClientActionsProps<TTransport, TChain, TActions> the hooks arguments highlighted below

args.client

SmartAccountClient the smart account client returned from useSmartAccountClient

args.actions

object the smart account client decorator you want to execute actions from

Returns

UseClientActionsResult<TActions> an object containing methods to execute the actions as well loading and error states