mod error;
pub use error::QueryCallError;
#[cfg(any(test, feature = "icrc-host", feature = "subnet-catalog-host"))]
pub use error::QueryFailure;
use ic_platform::Principal;
use ic_platform::agent::Agent;
pub async fn query(
agent: &Agent,
canister: &Principal,
method: &str,
argument: Vec<u8>,
) -> Result<Vec<u8>, QueryCallError> {
agent
.query(
&crate::agent_principal::effective_canister_id(canister).as_principal(),
method,
)
.with_arg(argument)
.call()
.await
.map_err(QueryCallError::from)
}
#[cfg(test)]
mod tests;