useSmartAccountClient
Hook that uses the provided smart account client parameters to create or retrieve an existing smart account client, handling different types of accounts including LightAccount, MultiOwnerLightAccount, and MultiOwnerModularAccount. Under the hood, Smart Account Client takes care of all the necessary middleware operations needed to populate a user operation such as gas estimation and paymaster data.
If passing in an undefined client, Smart Account Client will treat the connected account as an EOA.
If using with an EOA, Smart Account Client won’t throw an error, but the client itself will stay undefined forever. We recommend useBundlerClient instead when using an EOA. The EOA must also be connected or authenticated with a signer.
Import
import { useSmartAccountClient } from "@account-kit/react";
Usage
import { useSmartAccountClient } from "@account-kit/react";
const { client, address, isLoadingClient } = useSmartAccountClient({});
Parameters
props
UseSmartAccountClientProps
The properties required to use the smart account client, including optional account parameters, type, and additional client parameters. ref
Returns
UseSmartAccountClientResult
An object containing the smart account client, the address, and a loading state. ref