cosm-orc 1.3.1

Cosmwasm smart contract orchestration and gas profiling library
Documentation
use serde::{Deserialize, Serialize};
use std::{error::Error, panic::Location};

use crate::client::cosm_client::TendermintRes;

#[derive(PartialEq, Eq, Debug)]
pub enum CommandType {
    Store,
    Instantiate,
    Query,
    Execute,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct Report {
    pub name: String,
    pub json_data: Vec<u8>,
}

pub trait Profiler {
    fn instrument(
        &mut self,
        contract: String,
        op_name: String,
        op_type: CommandType,
        response: &TendermintRes,
        caller_loc: &Location,
    ) -> Result<(), Box<dyn Error>>;
    fn report(&self) -> Result<Report, Box<dyn Error>>;
}