Skip to content
Alchemy Logo

useClientActions

function useClientActions<TTransport, TChain, TActions>(
  args,
): UseClientActionsResult<TActions>;

Defined in: account-kit/react/src/hooks/useClientActions.ts:111

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 React from "react";
import { useSmartAccountClient } from "@account-kit/react";
import { sessionKeyPluginActions } from "@account-kit/smart-contracts";
import { useClientActions } from "@account-kit/react";
 
const Foo = () => {
  const { client } = useSmartAccountClient({
    type: "MultiOwnerModularAccount",
  });
  const { executeAction } = useClientActions({
    client: client,
    actions: sessionKeyPluginActions,
  });
 
  executeAction({
    functionName: "isAccountSessionKey",
    args: [{ key: "0x0" }],
  });
};

Type ParameterDefault type

TTransport extends Transport

Transport

TChain extends undefined | Chain

undefined | Chain

TActions extends object

object

ParameterTypeDescription

args

UseClientActionsProps<TTransport, TChain, TActions>

the hooks arguments highlighted below. ref

UseClientActionsResult<TActions>

an object containing methods to execute the actions as well loading and error states ref

Was this page helpful?