This is a GRPC client package of osmosis-labs/osmosis for Rust.
Depended libraries
proto files
- see osmosis/go.mod at v13.1.0 for listing related packages versions.
- and also cosmos-sdk/go.mod at v0.45.1
- osmosis/proto/osmosis at v13.1.0
- cosmos-sdk/proto at v0.45.1
- ibc-go/proto at v3.4.0
- tendermint/proto/tendermint at v0.34.22
- cosmos/cosmos-proto
- ics23/proofs.proto at v0.7.0
- protobuf/gogo.proto at v1.3.3-alpha.regen.1
- google/api
% find src/proto/cosmos -type f -follow -print | awk '{print "\""$0"\","}'
% find src/proto/ibc -type f -follow -print | awk '{print "\""$0"\","}'
% find src/proto/osmosis -type f -regex ".*\.proto" -follow -print | awk '{print "\""$0"\","}'
Cargo.toml
[dependencies]
osmosis-grpc-client = { version = "13.1.0", git = "https://github.com/kumanote/osmosis-grpc-client-rs", branch = "main" }
rust files
use osmosis_grpc_client::{cosmos, tonic};
Here's a basic example:
use osmosis_grpc_client::{cosmos, tonic};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "http://localhost:9090";
let mut client =
cosmos::base::tendermint::v1beta1::service_client::ServiceClient::connect(addr).await?;
let request = tonic::Request::new(cosmos::base::tendermint::v1beta1::GetLatestBlockRequest {});
let response = client.get_latest_block(request).await?;
let latest_height = response.into_inner().block.unwrap().header.unwrap().height;
let request = tonic::Request::new(cosmos::base::tendermint::v1beta1::GetBlockByHeightRequest {
height: latest_height,
});
let response = client.get_block_by_height(request).await?;
assert_eq!(
latest_height,
response.into_inner().block.unwrap().header.unwrap().height
);
Ok(())
}