watchSmartWalletClient

1function watchSmartWalletClient(config): (onChange) => any;

Defined in: account-kit/core/src/actions/watchSmartWalletClient.ts:29

Creates a subscription function that watches for changes to the Smart Wallet Client. Triggers the onChange callback whenever the signer status or chain changes.

Example

1import { watchSmartWalletClient } from "@account-kit/core";
2// see createConfig for more information on how to create a config
3import { config } from "./config.js";
4
5const watchClient = watchSmartWalletClient(config);
6const unsubscribe = watchClient((client) => {
7 console.log("Smart Wallet Client changed:", client);
8});
9
10// Clean up subscription
11unsubscribe();

Parameters

ParameterTypeDescription

config

AlchemyAccountsConfig

The configuration containing the client store and connection information

Returns

A function that accepts an onChange callback and returns an unsubscribe function

1(onChange): any;

Parameters

ParameterType

onChange

(client) => void

Returns

any