Skip to Content
API referenceSatellite EvmSrcComponentscreateEVMConnectionsWatcher()

@tuwaio/satellite-connect-monorepo


createEVMConnectionsWatcher()

createEVMConnectionsWatcher(config, callbacks): () => void

Defined in: packages/satellite-evm/src/utils/createEVMConnectionsWatcher.ts:60 

Creates and initializes an EVM connections watcher that monitors wagmi connection changes and synchronizes them with the global state store.

This function provides a pure, framework-agnostic way to watch EVM connections without being tied to React hooks or components.

Parameters

config

EVMWatcherConfig

Configuration object containing wagmi config and optional SIWE settings

callbacks

EVMWatcherCallbacks

Callback functions for interacting with the global state

Returns

A cleanup function to stop watching connections

(): void

Returns

void

Example

const unwatch = createEVMConnectionsWatcher( { wagmiConfig, siwe: { enabled: true, isSignedIn: true, isRejected: false } }, { activeConnection, disconnect, connectionError, updateActiveConnection } ); // Later, when you need to stop watching: unwatch();
Last updated on