useClientActions

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

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: () => void
Foo
= () => {
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<...>; } | undefined
client
} =
useSmartAccountClient<Chain | undefined, "MultiOwnerModularAccount">(args: UseSmartAccountClientProps<Chain | undefined, "MultiOwnerModularAccount">): UseSmartAccountClientResult<...>
useSmartAccountClient
({
type?: "MultiOwnerModularAccount" | undefined
type
: "MultiOwnerModularAccount",
}); const {
const executeAction: <TFunctionName extends "removeSessionKey" | "addSessionKey" | "rotateSessionKey" | "executeWithSessionKey" | "installSessionKeyPlugin" | keyof ReadAndEncodeActions | "isAccountSessionKey" | "getAccountSessionKeys" | "updateSessionKeyPermissions">(params: ClientActionParameters<...>) => void
executeAction
} =
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<...>; } | { ...; } | { ...; } | { ...; } | undefined
client
:
const client: { account: MultiOwnerModularAccount<AlchemySigner>; batch?: { multicall?: boolean | Prettify<MulticallBatchOptions> | undefined; } | undefined; ... 99 more ...; extend: <const client extends { ...; } & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>; } | undefined
client
,
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: ...]>) => void
executeAction
({
functionName: "isAccountSessionKey"
functionName
: "isAccountSessionKey",
args: [args: { key: Address; } & GetPluginAddressParameter & { account?: SmartContractAccount<string, keyof EntryPointRegistryBase<unknown>> | undefined; }]
args
: [{
key: `0x${string}`
key
: "0x0" }],
}); };

Type Parameters

Type ParameterDefault type

TTransport extends Transport

Transport

TChain extends undefined | Chain

undefined | Chain

TActions extends object

object

Parameters

ParameterTypeDescription

args

UseClientActionsProps<TTransport, TChain, TActions>

the hooks arguments highlighted below. ref

Returns

UseClientActionsResult<TActions>

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