Skip to content

Commit

Permalink
[fix] hyperledger-iroha#168: added 'query_all_assets'
Browse files Browse the repository at this point in the history
Signed-off-by: Sam H. Smith <[email protected]>
  • Loading branch information
SamHSmith committed Apr 10, 2024
1 parent 49b209a commit 34f4a57
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,24 @@ impl Client {
}
Ok(items)
}

fn query_all_assets(&self) -> PyResult<Vec<String>> {
let query = iroha_data_model::query::prelude::FindAllAssets;

let val = self
.client
.request(query)
.map_err(|e| PyRuntimeError::new_err(format!("{e:?}")))?;

let mut items = Vec::new();
for item in val {
items.push(
item.map(|d| d.id.to_string())
.map_err(|e| PyRuntimeError::new_err(format!("{e:?}")))?,
);
}
Ok(items)
}
}

macro_rules! register_query {
Expand Down

0 comments on commit 34f4a57

Please sign in to comment.