1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use crate::{
error::{ZomeApiError, ZomeApiResult},
Dispatch,
};
use holochain_wasm_utils::api_serialization::meta::{MetaArgs, MetaMethod, MetaResult};
pub fn version() -> ZomeApiResult<String> {
let meta = Dispatch::Meta.with_input(MetaArgs {
method: MetaMethod::Version,
})?;
let version = match meta {
MetaResult::Version(ver) => Ok(ver),
_ => Err(ZomeApiError::Internal(
"Wrong MetaMethod/Result Type; Problem In Core".to_string(),
)),
}?;
Ok(version)
}
pub fn version_hash() -> ZomeApiResult<String> {
let meta = Dispatch::Meta.with_input(MetaArgs {
method: MetaMethod::Hash,
})?;
let hash = match meta {
MetaResult::Hash(hash) => Ok(hash),
_ => Err(ZomeApiError::Internal(
"Wrong MetaMethod/Result Type; Problem In Core".to_string(),
)),
}?;
Ok(hash)
}