Getting the State
The state of the Merkle tree: relayer and contract
The privacy pool's state is a set of the Merkle tree root and its current index ( additional details here). The state is described by the TreeState interface. In normal operations the client's local state should match both the relayer and the pool contract state. However there is no local state in the accountless mode, but we can monitor relayer and pool states.
The relayer node has two different states: the regular state (which should match the pool contract) and the optimistic one. The optimistic state contain transactions which will be included into the state but are not processed yet. In other words the optimistic state is a most likely future Merkle tree state. The optimistic index should always be greater or equal to the normal state.
The client local state should be up to date with the relayer state. Use the associated full-mode method getLocalState(index?) to retrieve.
Get Pool Contract State
This is the primary state. All subsystems (relayer, client) must be synced with the pool state.
Parameters
index
- the index of the merkle tree root to retrieve (use the latest index if undefined)
Returns
Promise
returns TreeState
Example
Get Relayer State
This should match the pool state. Only the latest state can be requested, there is no way to specify an index.
Returns
Promise
returns TreeState
Example
Get Relayer Optimistic State
The forcasted state by the relayer. This can be used to monitor transaction queue length. The index of the optimistic state should be greater or equal the index of the current state.
Returns
Promise
returns TreeState
Example
Last updated