description |
---|
Instantiating the client object |
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>
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.
An instance of the client in a Promise
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!');