pub async fn send<T>(&mut self, method: &str, params: serde_json::Value) -> Result<T>
    where
        T: DeserializeOwned,
    {
        let (mut send, recv) = self.quinn_connection.open_bi().await.map_err(|err| {
            Error::ClientError(format!("Failed to open communication stream: {}", err))
        })?;

        let jsonrpc_req = JsonRpcRequest::new(method, params);

        let serialised_req = serde_json::to_string(&jsonrpc_req).map_err(|err| {
            Error::ClientError(format!("Failed to serialise request to be sent: {}", err))
        })?;

        // Send request over QUIC, and await for JSON-RPC response
        send.write_all(serialised_req.as_bytes())
            .await
            .map_err(|err| Error::ClientError(format!("Failed to send request: {}", err)))?;

        send.finish().await.map_err(|err| {
            Error::ClientError(format!(
                "Failed to gracefully shutdown communication stream: {}",
                err
            ))
        })?;

        debug!("Request sent to remote endpoint");
        let received_bytes = recv
            .read_to_end(usize::max_value())
            .await
            .map_err(|err| Error::ClientError(format!("Response not received: {}", err)))?;

        self.quinn_connection.close(0u32.into(), b"");

        parse_jsonrpc_response(received_bytes.as_slice())
    }
// Send a JSON_RPC request to the remote peer on current QUIC connection,
// awaiting for a JSON-RPC response which result is of type T
// method: JSON-RPC request method
// params: JSON-RPC request params
Send a JSON_RPC request to the remote peer on current QUIC connection,
awaiting for a JSON-RPC response which result is of type T
method: JSON-RPC request method
params: JSON-RPC request params
Send a JSON_RPC request to the remote peer on current QUIC connection awaiting for a JSON - RPC response which result is of type T method : JSON - RPC request method params : JSON - RPC request params
pub async fn send<T>(&mut self, method: &str, params: serde_json::Value) -> Result<T>
    where
        T: DeserializeOwned,
    {
        let (mut send, recv) = self.quinn_connection.open_bi().await.map_err(|err| {
            Error::ClientError(format!("Failed to open communication stream: {}", err))
        })?;
        let jsonrpc_req = JsonRpcRequest::new(method, params);
        let serialised_req = serde_json::to_string(&jsonrpc_req).map_err(|err| {
            Error::ClientError(format!("Failed to serialise request to be sent: {}", err))
        })?;
        // Send request over QUIC, and await for JSON-RPC response
        send.write_all(serialised_req.as_bytes())
            .await
            .map_err(|err| Error::ClientError(format!("Failed to send request: {}", err)))?;
        send.finish().await.map_err(|err| {
            Error::ClientError(format!(
                "Failed to gracefully shutdown communication stream: {}",
                err
            ))
        })?;
        debug!("Request sent to remote endpoint");
        let received_bytes = recv
            .read_to_end(usize::max_value())
            .await
            .map_err(|err| Error::ClientError(format!("Response not received: {}", err)))?;
        self.quinn_connection.close(0u32.into(), b"");
        parse_jsonrpc_response(received_bytes.as_slice())
    }
pub async fn send < T > ( & mut self , method : & str , params : serde_json :: Value ) -> Result < T > where T : DeserializeOwned , { let ( mut send , recv ) = self . quinn_connection . open_bi ( ) . await . map_err ( | err | { Error :: ClientError ( format ! ( " " err ) ) } ) ? ; let jsonrpc_req = JsonRpcRequest :: new ( method , params ) ; let serialised_req = serde_json :: to_string ( & jsonrpc_req ) . map_err ( | err | { Error :: ClientError ( format ! ( " " err ) ) } ) ? ; // Send request over QUIC, and await for JSON-RPC response send . write_all ( serialised_req . as_bytes ( ) ) . await . map_err ( | err | Error :: ClientError ( format ! ( " " err ) ) ) ? ; send . finish ( ) . await . map_err ( | err | { Error :: ClientError ( format ! ( " " err ) ) } ) ? ; debug ! ( " " ) ; let received_bytes = recv . read_to_end ( usize :: max_value ( ) ) . await . map_err ( | err | Error :: ClientError ( format ! ( " " err ) ) ) ? ; self . quinn_connection . close ( 0u32 . into ( ) , b" " ) ; parse_jsonrpc_response ( received_bytes . as_slice ( ) ) }
Send a JSON_RPC request to the remote peer on current QUIC connection,
awaiting for a JSON-RPC response which result is of type T
method: JSON-RPC request method
params: JSON-RPC request params
Send a JSON_RPC request to the remote peer on current QUIC connection awaiting for a JSON - RPC response which result is of type T method : JSON - RPC request method params : JSON - RPC request params
&mut self
method
&str
params
serde_json::Value