Switching Between Pools
In the multi-pool configurations
The following functions are available in both account-less and full modes
Getting the Current Pool
The ZkBobClient
object always operate on the concrete pool. There are no cases when the pool is undefined. All pools are named by aliases as specified in the client configuration. To obtain the name of the current pool use the following method:
Returns
String alias of the currently activated pool (as defined in the initial config).
Getting Available Pools
You also can get the list of pools specified in the client configuration.
Returns
Array of the all supported pool aliases (as defined in initial config).
Switching to Another Pool
If you initialized the ZkBobClient
object with a multipool configuration you can simply switch between pools using the following routine:
Parameters
poolAlias
: pool's name as defined in the client configuration.birthindex
: optional parameter only applicable in full mode (when account is attached). It equals the index within the Merkle tree when the account was created. There must be no entries belonging to the account below this index. Always useundefined
if you don't know the exact index.
Double check that birthindex is correct. If you switch to another pool with attached account and incorrect birthindex
, the input transfers sent to the account before that index can be lost without the ability to recover.
Returns
No value is returned but you must wait until the switch is completed before the next library interaction.
Example
Last updated