hdk/info.rs
1use crate::prelude::*;
2pub use hdi::info::*;
3
4/// Trivial wrapper for `__agent_info` host function.
5/// Agent info input struct is `()` so the function call simply looks like this:
6///
7/// ```ignore
8/// let agent_info = agent_info()?;
9/// ```
10///
11/// the [AgentInfo] is the current agent's original pubkey/address that they joined the network with
12/// and their most recent pubkey/address.
13pub fn agent_info() -> ExternResult<AgentInfo> {
14 HDK.with(|h| h.borrow().agent_info(()))
15}
16
17/// Get the context for a zome call, including the provenance and chain head.
18///
19/// See [CallInfo] for more details of what is returned.
20///
21/// Call info input struct is `()` so the function call simply looks like this:
22///
23/// ```ignore
24/// let call_info = call_info()?;
25/// ```
26pub fn call_info() -> ExternResult<CallInfo> {
27 HDK.with(|h| h.borrow().call_info(()))
28}