watchChain

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

Defined in: account-kit/core/src/actions/watchChain.ts:19

Allows you to subscribe to changes of the chain in the client store.

Example

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

Parameters

ParameterTypeDescription

config

AlchemyAccountsConfig

the account config object

Returns

a function which accepts an onChange callback that will be fired when the chain changes and returns a function to unsubscribe from the store

1(onChange): any;

Parameters

ParameterType

onChange

(chain) => void

Returns

any