Skip to content

Commit 16e106c

Browse files
committed
fixed docstrings for offline query methods
1 parent 46d6f99 commit 16e106c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

wasm/src/programs/offline_query.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,29 @@ pub struct OfflineQuery {
3939
#[wasm_bindgen]
4040
impl OfflineQuery {
4141
/// Creates a new offline query object. The state root is required to be passed in as a string
42+
///
43+
/// @param {u32} block_height The block height.
44+
/// @param {string} state_root The state root of the current network.
45+
///
46+
/// @returns {OfflineQuery} The newly created offline query object.
4247
#[wasm_bindgen(constructor)]
4348
pub fn new(block_height: u32, state_root: &str) -> Result<OfflineQuery, String> {
4449
let state_root = <CurrentNetwork as Network>::StateRoot::from_str(state_root).map_err(|e| e.to_string())?;
4550
Ok(Self { block_height, state_paths: IndexMap::new(), state_root })
4651
}
4752

4853
/// Add a new block height to the offline query object.
54+
///
55+
/// @param {u32} block_height The block height to add.
4956
#[wasm_bindgen(js_name = "addBlockHeight")]
5057
pub fn add_block_height(&mut self, block_height: u32) {
5158
self.block_height = block_height;
5259
}
5360

5461
/// Add a new state path to the offline query object.
5562
///
56-
/// @param {string} commitment: The commitment corresponding to a record inpout
57-
/// @param {string} state_path: The state path corresponding to the commitment
63+
/// @param {string} commitment: The commitment corresponding to a record input.
64+
/// @param {string} state_path: The state path corresponding to the commitment.
5865
#[wasm_bindgen(js_name = "addStatePath")]
5966
pub fn add_state_path(&mut self, commitment: &str, state_path: &str) -> Result<(), String> {
6067
let commitment = Field::from_str(commitment).map_err(|e| e.to_string())?;
@@ -63,18 +70,18 @@ impl OfflineQuery {
6370
Ok(())
6471
}
6572

66-
/// Get a json string representation of the offline query object
73+
/// Get a json string representation of the offline query object.
6774
///
68-
/// @returns {string} JSON string representation of the offline query object
75+
/// @returns {string} JSON string representation of the offline query object.
6976
#[wasm_bindgen(js_name = "toString")]
7077
#[allow(clippy::inherent_to_string)]
7178
pub fn to_string(&self) -> String {
7279
serde_json::to_string(&self).unwrap()
7380
}
7481

75-
/// Create an offline query object from a json string representation
82+
/// Create an offline query object from a json string representation.
7683
///
77-
/// @param {string} s JSON string representation of the offline query object
84+
/// @param {string} JSON string representation of the offline query object.
7885
#[wasm_bindgen(js_name = "fromString")]
7986
pub fn from_string(s: &str) -> Result<OfflineQuery, String> {
8087
serde_json::from_str(s).map_err(|e| e.to_string())

0 commit comments

Comments
 (0)