Skip to content

watchSmartAccountClient

Watches for changes to the smart account client and triggers the provided callback when a change is detected.

Import

import { watchSmartAccountClient } from "@account-kit/core";

Usage

import { watchSmartAccountClient } from "@account-kit/core";
// see createConfig for more information on how to create a config
import { config } from "./config";
 
watchSmartAccountClient({ type: "LightAccount" }, config)(console.log);

Parameters

params

GetSmartAccountClientParams<TTransport, TChain, TAccount> the parameters needed to get the smart account client

config

AlchemyAccountsConfig the configuration containing the client store and other settings

Returns

(onChange: (client: GetSmartAccountClientResult<TTransport, TChain, SupportedAccount<TAccount>>) => void) => (() => void) a function that accepts a callback to be called when the client changes and returns a function to unsubscribe from the store