Next
Devnet
Coreum Rust Protobuf
This repository contains a tool to generate the Rust protobuf structures used to interact with the Coreum blockchain using gRPC and Rust.
How it works
What the tool does is:
- Clones the repository of the Cosmos-SDK, WASMD and Coreum.
- Extracts the protos of the modules that we want to generate.
- Generates the initial Rust protobuf structures using
buf build
andbuf generate
commands. - Applies transformation to the generated Rust protobuf structures to make them compatible with tools that will use our coreum-wasm-sdk.
How to use
The usage is very simple, you just need to close this repository and run the command cargo run
in the root of the repository. This will generate the Rust protobuf structures in the OUT_DIR
folder specified in main.rs
.
//The directory where proto files will be generated
const OUT_DIR: &str = "transformed-protos";
If you want to use a different branch/version of the Cosmos-SDK or Wasmd module you can just modify the constants in main.rs
:
// version of the Cosmos SDK that we are using
const COSMOS_SDK_VERSION: &str = "v0.47.5";
// version of the WASMD version that we are using
const WASMD_VERSION: &str = "v0.41.0";
If you want to generate protobuf for additional modules, you just need to add them in the INCLUDE_MODS constant in main.rs
.
const INCLUDE_MODS: [&str; 10] = [
"/cosmos/auth",
"/cosmos/authz",
"/cosmos/bank",
"/cosmos/base",
"/cosmos/gov",
"/cosmos/feegrant",
"/cosmos/staking",
"/coreum/asset",
"/coreum/nft",
"/cosmwasm/wasm",
];