pub async fn execute_query(
        &self,
        canister_id: &CanisterId,
        method: &str,
        arg: Vec<u8>,
    ) -> Result<Option<Vec<u8>>, String> {
        let envelope = self
            .prepare_query(canister_id, method, arg)
            .map_err(|e| format!("Failed to prepare query: {}", e))?;
        let bytes = self
            .http_client
            .post_with_response(
                &self.url,
                &query_path(*canister_id),
                envelope,
                tokio::time::Instant::now() + self.query_timeout,
            )
            .await?;
        let cbor = bytes_to_cbor(bytes)?;

        let call_response = parse_canister_query_response(&cbor)?;
        if call_response.status == "replied" {
            Ok(call_response.reply)
        } else {
            Err(format!(
                "The response of a canister query call contained status '{}' and message '{:?}'",
                call_response.status, call_response.reject_message
            ))
        }
    }
/// Calls the query method 'method' on the given canister,
/// optionally with 'arguments'.
Calls the query method 'method' on the given canister,
optionally with 'arguments'.
Calls the query method ' method ' on the given canister optionally with ' arguments ' .
pub async fn execute_query(
        &self,
        canister_id: &CanisterId,
        method: &str,
        arg: Vec<u8>,
    ) -> Result<Option<Vec<u8>>, String> {
        let envelope = self
            .prepare_query(canister_id, method, arg)
            .map_err(|e| format!("Failed to prepare query: {}", e))?;
        let bytes = self
            .http_client
            .post_with_response(
                &self.url,
                &query_path(*canister_id),
                envelope,
                tokio::time::Instant::now() + self.query_timeout,
            )
            .await?;
        let cbor = bytes_to_cbor(bytes)?;
        let call_response = parse_canister_query_response(&cbor)?;
        if call_response.status == "replied" {
            Ok(call_response.reply)
        } else {
            Err(format!(
                "The response of a canister query call contained status '{}' and message '{:?}'",
                call_response.status, call_response.reject_message
            ))
        }
    }
pub async fn execute_query ( & self , canister_id : & CanisterId , method : & str , arg : Vec < u8 > , ) -> Result < Option < Vec < u8 > > , String > { let envelope = self . prepare_query ( canister_id , method , arg ) . map_err ( | e | format ! ( " " e ) ) ? ; let bytes = self . http_client . post_with_response ( & self . url , & query_path ( * canister_id ) , envelope , tokio :: time :: Instant :: now ( ) + self . query_timeout , ) . await ? ; let cbor = bytes_to_cbor ( bytes ) ? ; let call_response = parse_canister_query_response ( & cbor ) ? ; if call_response . status == " " { Ok ( call_response . reply ) } else { Err ( format ! ( " " call_response status call_response reject_message ) ) } }
Calls the query method 'method' on the given canister,
optionally with 'arguments'.
Calls the query method ' method ' on the given canister optionally with ' arguments ' .
&self
canister_id
&CanisterId
method
&str
arg
Vec<u8>
&self
canister_id
&CanisterId
method
&str
arg
Vec<u8>