Skip to main content

connectLookupNode

@totemsdk/lookup-client


@totemsdk/lookup-client / connectLookupNode

Function: connectLookupNode()

connectLookupNode(config): Promise<LookupClient>

Create and connect a LookupClient to a personal lookup node.

Parameters

config

LookupClientConfig

Returns

Promise<LookupClient>

Example

// P2P via Hyperswarm (Pear/Bare/Node)
const client = await connectLookupNode({ hyperswarmTopic: 'deadbeef...' });
const coins = await client.getCoins({ address: '0xMx...' });

// Subscribe to real-time coin updates
const unsub = client.subscribeCoinUpdates(ev => console.log('coin event', ev));
await client.watchAddress('0xMx...');

// Clean up
unsub();
client.disconnect();