watchAccount

1function watchAccount<TAccount>(type, config): (onChange) => any;

Defined in: account-kit/core/src/actions/watchAccount.ts:24

Watches for changes to a specific type of account and triggers the provided callback function when changes occur.

Example

1import { watchAccount } from "@account-kit/core";
2// see createConfig for more information on how to create a config
3import { config } from "./config";
4
5watchAccount("LightAccount", config)(console.log);

Type Parameters

Type ParameterDescription

TAccount extends SupportedAccountTypes

The type of account to watch

Parameters

ParameterTypeDescription

type

TAccount

The type of account to watch

config

AlchemyAccountsConfig

The configuration containing client store settings

Returns

A function that accepts a callback to be called when the account changes and returns a function to unsubscribe from the store

1(onChange): any;

Parameters

ParameterType

onChange

(account) => void

Returns

any