Skip to main content

OfflineQuery

Overview

An offline query object used to insert the global state root and state paths needed to create a valid inclusion proof offline. This is useful for creating proofs without requiring a live connection to the network.

Constructors

OfflineQuery

Creates a new offline query object. The state root is required to be passed in as a string

OfflineQuery(block_height, state_root)
ParamTypeDescription
block_heightu32The block height
state_rootstringThe state root of the current network
returnOfflineQueryThe newly created offline query object

Methods

addBlockHeight

Add a new block height to the offline query object

addBlockHeight(block_height)void
ParamTypeDescription
block_heightu32The block height to add
returnvoid

addStatePath

Add a new state path to the offline query object

addStatePath(commitment:, state_path:)void
ParamTypeDescription
commitment:stringThe commitment corresponding to a record input
state_path:stringThe state path corresponding to the commitment
returnvoid

toString

Get a json string representation of the offline query object

toString() ► string
ParamType
returnstring

fromString

Create an offline query object from a json string representation

fromString(JSON)OfflineQuery
ParamTypeDescription
JSONstringstring representation of the offline query object
returnOfflineQuery