Skip to content

Commit

Permalink
Merge pull request #218 from InjectiveLabs/f/bump-injective-std
Browse files Browse the repository at this point in the history
updated to use injective-core v1.12.1 and the matching cosmos-sdk
  • Loading branch information
maxrobot authored May 2, 2024
2 parents 944c0f7 + 4d80824 commit 620bdbf
Show file tree
Hide file tree
Showing 19 changed files with 2,940 additions and 814 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/injective-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = "MIT OR Apache-2.0"
name = "injective-std"
readme = "README.md"
repository = "https://github.com/InjectiveLabs/cw-injective/tree/dev/packages/injective-std"
version = "0.1.6"
version = "0.1.7"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
36 changes: 33 additions & 3 deletions packages/injective-std/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# injective-std

**BETA VERSION:**
**BETA VERSION:**

The bindings are currently tracking an unofficial release of Injective.

Injective's proto-generated types and helpers built using [Buf](https://github.com/bufbuild/buf). Enables interaction with both custom and standard modules.

## Supported Version

* Injective-Core@e38d508c746a9b90d6e8a261ec2b03f99cc49351
- Injective-Core@e38d508c746a9b90d6e8a261ec2b03f99cc49351

## Build Instructions

Expand All @@ -22,6 +22,12 @@ In order to generate an individual proto file run:
buf generate [/path/to/injective-core] --template [/path/to/buf.gen.yaml] --output [output-path] --path [/path/to/module/proto]
```

Follow by:

```shell
buf build [/path/to/injective-core] --as-file-descriptor-set -o [/tmp/path/injective/descriptor_injective.bin] --path [/path/to/module/proto]
```

Example `buf.gen.yaml` file:

```yaml
Expand All @@ -32,4 +38,28 @@ plugins:
- extern_path=.google.protobuf.Timestamp=crate::shim::Timestamp
- extern_path=.google.protobuf.Duration=crate::shim::Duration
- extern_path=.google.protobuf.Any=crate::shim::Any
```
```
### Examples
Lets try to create the bindings for
First create a directory with the dependencies as below:
```
├── README.md
└── dependencies
   ├── cosmos-sdk
   ├── injective-core
   └── wasmd
```

Next generate the proto:

```
buf generate /Users/wandlitz/go/src/github.com/osmosis-labs/osmosis-rust/packages/proto-build-injective/../../dependencies/injective-core/proto --template /Users/wandlitz/go/src/github.com/osmosis-labs/osmosis-rust/packages/proto-build-injective/buf.gen.yaml --output ./tmp/tmp-protobuf/injective --path /Users/wandlitz/go/src/github.com/osmosis-labs/osmosis-rust/packages/proto-build-injective/../../dependencies/injective-core/proto/injective/auction
```

```
buf build /Users/wandlitz/go/src/github.com/osmosis-labs/osmosis-rust/packages/proto-build-injective/../../dependencies/injective-core/proto --path /Users/wandlitz/go/src/github.com/osmosis-labs/osmosis-rust/packages/proto-build-injective/../../dependencies/injective-core/proto/injective/auction
```
1 change: 1 addition & 0 deletions packages/injective-std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![forbid(unsafe_code)]
#![warn(trivial_casts, trivial_numeric_casts, unused_import_braces)]
#![allow(unused_imports, deprecated)]

mod serde;
pub mod shim;
Expand Down
6 changes: 3 additions & 3 deletions packages/injective-std/src/types/cosmos/auth/v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,9 @@ impl<'a, Q: cosmwasm_std::CustomQuery> AuthQuerier<'a, Q> {
pub fn account(&self, address: ::prost::alloc::string::String) -> Result<QueryAccountResponse, cosmwasm_std::StdError> {
QueryAccountRequest { address }.query(self.querier)
}
// pub fn account_address_by_id(&self, id: i64, account_id: u64) -> Result<QueryAccountAddressByIdResponse, cosmwasm_std::StdError> {
// QueryAccountAddressByIdRequest { id, account_id }.query(self.querier)
// }
pub fn account_address_by_id(&self, id: i64, account_id: u64) -> Result<QueryAccountAddressByIdResponse, cosmwasm_std::StdError> {
QueryAccountAddressByIdRequest { id, account_id }.query(self.querier)
}
pub fn params(&self) -> Result<QueryParamsResponse, cosmwasm_std::StdError> {
QueryParamsRequest {}.query(self.querier)
}
Expand Down
16 changes: 8 additions & 8 deletions packages/injective-std/src/types/cosmos/bank/v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ pub struct Output {
/// Supply represents a struct that passively keeps track of the total supply
/// amounts in the network.
/// This message is deprecated now that supply is indexed by denom.
// #[allow(clippy::derive_partial_eq_without_eq)]
// #[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
// #[proto_message(type_url = "/cosmos.bank.v1beta1.SupplySupply")]
// #[deprecated]
// pub struct Supply {
// #[prost(message, repeated, tag = "1")]
// pub total: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
// }
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.bank.v1beta1.SupplySupply")]
#[deprecated]
pub struct Supply {
#[prost(message, repeated, tag = "1")]
pub total: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
}
/// DenomUnit represents a struct that describes a given
/// denomination unit of the basic token.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
28 changes: 14 additions & 14 deletions packages/injective-std/src/types/cosmos/distribution/v1beta1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,20 @@ pub struct FeePool {
/// longer a need for an explicit CommunityPoolSpendProposal. To spend community
/// pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov
/// module via a v1 governance proposal.
// #[allow(clippy::derive_partial_eq_without_eq)]
// #[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
// #[proto_message(type_url = "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalCommunityPoolSpendProposal")]
// #[deprecated]
// pub struct CommunityPoolSpendProposal {
// #[prost(string, tag = "1")]
// pub title: ::prost::alloc::string::String,
// #[prost(string, tag = "2")]
// pub description: ::prost::alloc::string::String,
// #[prost(string, tag = "3")]
// pub recipient: ::prost::alloc::string::String,
// #[prost(message, repeated, tag = "4")]
// pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
// }
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
#[proto_message(type_url = "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalCommunityPoolSpendProposal")]
#[deprecated]
pub struct CommunityPoolSpendProposal {
#[prost(string, tag = "1")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub description: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub recipient: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "4")]
pub amount: ::prost::alloc::vec::Vec<super::super::base::v1beta1::Coin>,
}
/// DelegatorStartingInfo represents the starting info for a delegator reward
/// period. It tracks the previous validator period, the delegation's amount of
/// staking token, and the creation height (to check later on if any slashes have
Expand Down
1 change: 1 addition & 0 deletions packages/injective-std/src/types/cosmwasm/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod wasm;
1 change: 1 addition & 0 deletions packages/injective-std/src/types/cosmwasm/wasm/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod v1;
Loading

0 comments on commit 620bdbf

Please sign in to comment.