cycles-quartz/crates/utils/cw-client/src/lib.rs
Shoaib Ahmed 7133ea5e36
Neutron client in pure rust (#234)
Implements the following:
- grpc based cw client (alsmost chain agnostic, but not fully yet)
- All URL based CLI args now use reqwest::Url type.
- An almost 'Bin agnostic CliClient'
- SSL and DNS resolution support in gramine
- Implement generic attestation support for transfers enclave
- Misc cleanup
2024-10-03 13:50:54 -04:00

61 lines
1.4 KiB
Rust

pub use cli::CliClient;
use cosmrs::tendermint::chain::Id;
pub use grpc::GrpcClient;
use hex::ToHex;
use serde::de::DeserializeOwned;
pub mod cli;
pub mod grpc;
#[async_trait::async_trait]
pub trait CwClient {
type Address: AsRef<str>;
type Query: ToString;
type RawQuery: ToHex;
type ChainId: AsRef<str>;
type Error;
async fn query_smart<R: DeserializeOwned + Send>(
&self,
contract: &Self::Address,
query: Self::Query,
) -> Result<R, Self::Error>;
fn query_raw<R: DeserializeOwned + Default>(
&self,
contract: &Self::Address,
query: Self::RawQuery,
) -> Result<R, Self::Error>;
fn query_tx<R: DeserializeOwned + Default>(&self, txhash: &str) -> Result<R, Self::Error>;
async fn tx_execute<M: ToString + Send>(
&self,
contract: &Self::Address,
chain_id: &Id,
gas: u64,
sender: &str,
msg: M,
fees: &str,
) -> Result<String, Self::Error>;
fn deploy<M: ToString>(
&self,
chain_id: &Id,
sender: &str, // what should this type be
wasm_path: M,
) -> Result<String, Self::Error>;
fn init<M: ToString>(
&self,
chain_id: &Id,
sender: &str,
code_id: u64,
init_msg: M,
label: &str,
) -> Result<String, Self::Error>;
fn trusted_height_hash(&self) -> Result<(u64, String), Self::Error>;
}