Skip to Content
API referenceSatellite SolanaSrcComponentscreateSolanaConnectionsWatcher()

@tuwaio/satellite-connect-monorepo


createSolanaConnectionsWatcher()

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

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

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

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

Unlike EVM connections, Solana uses the Wallet Standard which doesn’t provide native watchers, so this function implements the watching logic directly.

Parameters

config

SolanaWatcherConfig

Configuration object containing wallets array from Wallet Standard

callbacks

SolanaWatcherCallbacks

Callback functions for interacting with the global state

Returns

A cleanup function to stop watching connections (currently a no-op as Wallet Standard doesn’t provide native watchers)

(): void

Returns

void

Example

const unwatch = createSolanaConnectionsWatcher( { wallets }, { activeConnection, disconnect, connectionError, updateActiveConnection } ); // Later, when you need to stop watching (currently no cleanup needed): unwatch();

Remarks

The Solana watcher works differently from the EVM watcher because:

  • It relies on the Wallet Standard’s wallets array changes
  • It doesn’t have native connection event listeners like wagmi
  • The watching is done by comparing wallet state changes in the wallets array
Last updated on