useSmartWalletClient

React hook that provides a Smart Wallet Client instance. Returns undefined if an EOA wallet is connected via wagmi, as Smart Wallet Clients are only for smart accounts. The hook automatically subscribes to changes in signer status and chain configuration.

Import

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

Usage

1import { useSmartWalletClient } from "@account-kit/react";
2
3function MyComponent() {
4 const client = useSmartWalletClient();
5
6 // With specific account address
7 const clientWithAccount = useSmartWalletClient({
8 account: "0x1234...",
9 });
10
11 if (client) {
12 // Use the client for wallet operations
13 console.log("Smart Wallet Client ready:", client);
14 }
15
16 return <div>...</div>;
17}

Parameters

params

GetSmartWalletClientParams<TAccount> Parameters for getting the smart wallet client, including optional account address

Returns

GetSmartWalletClientResult<TAccount> The Smart Wallet Client instance or undefined if an EOA is connected or client is unavailable