Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.42 KB

File metadata and controls

37 lines (25 loc) · 1.42 KB
description
Instantiating the client object

Initializing the client

Before interacting with the privacy pool you must instantiate the ZkBobClient object. Use the static factory method to create a ZkBobClient instance. Using a constructor is not supported.

static async create(
    config: ClientConfig,
    activePoolAlias: string,
    callback?: ClientStateCallback
): Promise<ZkBobClient>

Parameters

config - the client configuration which defines available pools, associated chains and other parameters.

activePoolAlias - the name of the pool which should be activated during instance creation. The names of the pools (aka aliases) are defined in the client configuration. The client should always have an active pool.

callback - is an optional parameter of the type ClientStateCallback which can be helpful to monitor the current library state. You can set it anytime by setting the stateCallback client property.

Returns

An instance of the client in a Promise

Example

The client configuration clientConfig defined in this example.

console.log('Creating ZkBob client...');
const zkClient = await ZkBobClient.create(clientConfig, 'BOB-sepolia');
console.log('You can dive into a privacy pool right now!');