Skip to Content
API referenceSatellite SolanaSrcComponentscreateSolanaConnectionsWatcher()

API Reference for TUWA Satellite headless wallet connectivity and session state management.


createSolanaConnectionsWatcher()

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

Defined in: packages/satellite-solana/src/utils/createSolanaConnectionsWatcher.ts:64 

Creates and initializes a Solana connections watcher that monitors wallet standard changes and synchronizes them with the global state store.

Parameters

config

SolanaWatcherConfig

Configuration object containing wallets array and optional SIWX settings

callbacks

SolanaWatcherCallbacks

Callback functions for interacting with the global state

Returns

A cleanup function to stop watching connections

() => void

Example

const unwatch = createSolanaConnectionsWatcher( { wallets, siwx: { enabled: true, isSignedIn: true, address: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d' } }, { activeConnection, disconnect, connectionError, updateActiveConnection } ); // Unsubscribe when unmounting unwatch();

Remarks

Evaluates session parity on Solana wallet account changes. If siwx is enabled and the active session address does not match the newly selected account address, it automatically triggers a disconnect() to protect session boundaries.

Last updated on