useSmartWalletClient

1function useSmartWalletClient<TAccount>(
2 params,
3): GetSmartWalletClientResult<TAccount>;

Defined in: account-kit/react/src/hooks/useSmartWalletClient.ts:42

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.

Example

import { 
function useSmartWalletClient<TAccount extends Address | undefined = `0x${string}` | undefined>(params: GetSmartWalletClientParams<TAccount>): GetSmartWalletClientResult<TAccount>

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.

useSmartWalletClient
} from "@account-kit/react";
function
function MyComponent(): JSX.Element
MyComponent
() {
const
const client: GetSmartWalletClientResult<`0x${string}` | undefined>
client
=
useSmartWalletClient<`0x${string}` | undefined>(params: GetSmartWalletClientParams<`0x${string}` | undefined>): GetSmartWalletClientResult<`0x${string}` | undefined>

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.

useSmartWalletClient
();
// With specific account address const
const clientWithAccount: GetSmartWalletClientResult<"0x1234...">
clientWithAccount
=
useSmartWalletClient<"0x1234...">(params: GetSmartWalletClientParams<"0x1234...">): GetSmartWalletClientResult<"0x1234...">

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.

useSmartWalletClient
({
account?: "0x1234..." | undefined
account
: "0x1234...",
}); if (
const client: GetSmartWalletClientResult<`0x${string}` | undefined>
client
) {
// Use the client for wallet operations
var console: Console

The console module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.

The module exports two specific components:

  • A Console class with methods such as console.log(), console.error() and console.warn() that can be used to write to any Node.js stream. * A global console instance configured to write to process.stdout and process.stderr. The global console can be used without importing the node:console module.

Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O for more information.

Example using the global console:


const name = 'Will Robinson'; console.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ```

Example using the `Console` class:

```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err);

myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err

const name = 'Will Robinson'; myConsole.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
console
.
Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)

Prints to stdout with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3) (the arguments are all passed to util.format()).

js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout

See util.format() for more information.

log
("Smart Wallet Client ready:",
const client: SmartWalletClient<`0x${string}` | undefined>
client
);
} return <
React.JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div
>...</
React.JSX.IntrinsicElements.div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>
div
>;
}

Type Parameters

Type ParameterDefault type

TAccount extends undefined | `0x${string}`

undefined | `0x${string}`

Parameters

ParameterTypeDescription

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