diff --git a/Cargo.lock b/Cargo.lock index 9d730dbb..1b1fc613 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1646,7 +1646,7 @@ dependencies = [ [[package]] name = "injective-std" -version = "0.1.7" +version = "1.12.10-testnet" dependencies = [ "chrono", "cosmwasm-std", diff --git a/packages/injective-protobuf/src/proto/mod.rs b/packages/injective-protobuf/src/proto/mod.rs index de0fb666..de6005c4 100644 --- a/packages/injective-protobuf/src/proto/mod.rs +++ b/packages/injective-protobuf/src/proto/mod.rs @@ -1,9 +1,9 @@ // @generated -pub mod account; pub mod auth; pub mod coin; pub mod distribution; pub mod exchange; -pub mod oracle; pub mod tx; +pub mod oracle; +pub mod account; diff --git a/packages/injective-std/Cargo.toml b/packages/injective-std/Cargo.toml index baf49b6a..7535a9d1 100644 --- a/packages/injective-std/Cargo.toml +++ b/packages/injective-std/Cargo.toml @@ -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.7" +version = "1.12.10-testnet" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/packages/injective-std/README.md b/packages/injective-std/README.md index 1a2d472b..d8b8d94b 100644 --- a/packages/injective-std/README.md +++ b/packages/injective-std/README.md @@ -8,7 +8,7 @@ Injective's proto-generated types and helpers built using [Buf](https://github.c ## Supported Version -- Injective-Core@e38d508c746a9b90d6e8a261ec2b03f99cc49351 +- Injective-Core@aa61552b5225f76f284811004925d83531e23311 ## Build Instructions @@ -46,7 +46,7 @@ Lets try to create the bindings for First create a directory with the dependencies as below: -``` +```bash ├── README.md └── dependencies    ├── cosmos-sdk @@ -56,10 +56,10 @@ First create a directory with the dependencies as below: Next generate the proto: -``` +```shell 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 ``` -``` +```shell 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 ``` diff --git a/packages/injective-std/src/types/cosmos/base/query/v1beta1.rs b/packages/injective-std/src/types/cosmos/base/query/v1beta1.rs index 461591a0..70d66010 100644 --- a/packages/injective-std/src/types/cosmos/base/query/v1beta1.rs +++ b/packages/injective-std/src/types/cosmos/base/query/v1beta1.rs @@ -8,7 +8,7 @@ use osmosis_std_derive::CosmwasmExt; /// } #[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.base.query.v1beta1.PageRequestPageRequest")] +#[proto_message(type_url = "/cosmos.base.query.v1beta1.PageRequest")] pub struct PageRequest { /// key is a value returned in PageResponse.next_key to begin /// querying the next page most efficiently. Only one of offset or key @@ -53,7 +53,7 @@ pub struct PageRequest { /// } #[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.base.query.v1beta1.PageResponsePageResponse")] +#[proto_message(type_url = "/cosmos.base.query.v1beta1.PageResponse")] pub struct PageResponse { /// next_key is the key to be passed to PageRequest.key to /// query the next page most efficiently. It will be empty if diff --git a/packages/injective-std/src/types/cosmos/base/v1beta1.rs b/packages/injective-std/src/types/cosmos/base/v1beta1.rs index 977771a2..faa6e769 100644 --- a/packages/injective-std/src/types/cosmos/base/v1beta1.rs +++ b/packages/injective-std/src/types/cosmos/base/v1beta1.rs @@ -5,7 +5,7 @@ use osmosis_std_derive::CosmwasmExt; /// signatures required by gogoproto. #[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.base.v1beta1.CoinCoin")] +#[proto_message(type_url = "/cosmos.base.v1beta1.Coin")] pub struct Coin { #[prost(string, tag = "1")] pub denom: ::prost::alloc::string::String, @@ -18,7 +18,7 @@ pub struct Coin { /// signatures required by gogoproto. #[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.base.v1beta1.DecCoinDecCoin")] +#[proto_message(type_url = "/cosmos.base.v1beta1.DecCoin")] pub struct DecCoin { #[prost(string, tag = "1")] pub denom: ::prost::alloc::string::String, @@ -28,7 +28,7 @@ pub struct DecCoin { /// IntProto defines a Protobuf wrapper around an Int object. #[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.base.v1beta1.IntProtoIntProto")] +#[proto_message(type_url = "/cosmos.base.v1beta1.IntProto")] pub struct IntProto { #[prost(string, tag = "1")] pub int: ::prost::alloc::string::String, @@ -36,7 +36,7 @@ pub struct IntProto { /// DecProto defines a Protobuf wrapper around a Dec object. #[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.base.v1beta1.DecProtoDecProto")] +#[proto_message(type_url = "/cosmos.base.v1beta1.DecProto")] pub struct DecProto { #[prost(string, tag = "1")] pub dec: ::prost::alloc::string::String, diff --git a/packages/injective-std/src/types/cosmos/feegrant/mod.rs b/packages/injective-std/src/types/cosmos/feegrant/mod.rs new file mode 100644 index 00000000..537a3360 --- /dev/null +++ b/packages/injective-std/src/types/cosmos/feegrant/mod.rs @@ -0,0 +1,2 @@ +pub mod module; +pub mod v1beta1; diff --git a/packages/injective-std/src/types/cosmos/feegrant/module/mod.rs b/packages/injective-std/src/types/cosmos/feegrant/module/mod.rs new file mode 100644 index 00000000..a3a6d96c --- /dev/null +++ b/packages/injective-std/src/types/cosmos/feegrant/module/mod.rs @@ -0,0 +1 @@ +pub mod v1; diff --git a/packages/injective-std/src/types/cosmos/feegrant/module/v1.rs b/packages/injective-std/src/types/cosmos/feegrant/module/v1.rs new file mode 100644 index 00000000..78dfd5a2 --- /dev/null +++ b/packages/injective-std/src/types/cosmos/feegrant/module/v1.rs @@ -0,0 +1,6 @@ +use osmosis_std_derive::CosmwasmExt; +/// Module is the config object of the feegrant module. +#[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.feegrant.module.v1.Module")] +pub struct Module {} diff --git a/packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs b/packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs new file mode 100644 index 00000000..ad30e627 --- /dev/null +++ b/packages/injective-std/src/types/cosmos/feegrant/v1beta1.rs @@ -0,0 +1,227 @@ +use osmosis_std_derive::CosmwasmExt; +/// BasicAllowance implements Allowance with a one-time grant of coins +/// that optionally expires. The grantee can use up to SpendLimit to cover fees. +#[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.feegrant.v1beta1.BasicAllowance")] +pub struct BasicAllowance { + /// spend_limit specifies the maximum amount of coins that can be spent + /// by this allowance and will be updated as coins are spent. If it is + /// empty, there is no spend limit and any amount of coins can be spent. + #[prost(message, repeated, tag = "1")] + pub spend_limit: ::prost::alloc::vec::Vec, + /// expiration specifies an optional time when this allowance expires + #[prost(message, optional, tag = "2")] + pub expiration: ::core::option::Option, +} +/// PeriodicAllowance extends Allowance to allow for both a maximum cap, +/// as well as a limit per time period. +#[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.feegrant.v1beta1.PeriodicAllowance")] +pub struct PeriodicAllowance { + /// basic specifies a struct of `BasicAllowance` + #[prost(message, optional, tag = "1")] + pub basic: ::core::option::Option, + /// period specifies the time duration in which period_spend_limit coins can + /// be spent before that allowance is reset + #[prost(message, optional, tag = "2")] + pub period: ::core::option::Option, + /// period_spend_limit specifies the maximum number of coins that can be spent + /// in the period + #[prost(message, repeated, tag = "3")] + pub period_spend_limit: ::prost::alloc::vec::Vec, + /// period_can_spend is the number of coins left to be spent before the period_reset time + #[prost(message, repeated, tag = "4")] + pub period_can_spend: ::prost::alloc::vec::Vec, + /// period_reset is the time at which this period resets and a new one begins, + /// it is calculated from the start time of the first transaction after the + /// last period ended + #[prost(message, optional, tag = "5")] + pub period_reset: ::core::option::Option, +} +/// AllowedMsgAllowance creates allowance only for specified message types. +#[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.feegrant.v1beta1.AllowedMsgAllowance")] +pub struct AllowedMsgAllowance { + /// allowance can be any of basic and periodic fee allowance. + #[prost(message, optional, tag = "1")] + pub allowance: ::core::option::Option, + /// allowed_messages are the messages for which the grantee has the access. + #[prost(string, repeated, tag = "2")] + pub allowed_messages: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, +} +/// Grant is stored in the KVStore to record a grant with full context +#[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.feegrant.v1beta1.Grant")] +pub struct Grant { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + /// allowance can be any of basic, periodic, allowed fee allowance. + #[prost(message, optional, tag = "3")] + pub allowance: ::core::option::Option, +} +/// GenesisState contains a set of fee allowances, persisted from the store +#[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.feegrant.v1beta1.GenesisState")] +pub struct GenesisState { + #[prost(message, repeated, tag = "1")] + pub allowances: ::prost::alloc::vec::Vec, +} +/// QueryAllowanceRequest is the request type for the Query/Allowance RPC method. +#[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.feegrant.v1beta1.QueryAllowanceRequest")] +#[proto_query( + path = "/cosmos.feegrant.v1beta1.Query/Allowance", + response_type = QueryAllowanceResponse +)] +pub struct QueryAllowanceRequest { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, +} +/// QueryAllowanceResponse is the response type for the Query/Allowance RPC method. +#[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.feegrant.v1beta1.QueryAllowanceResponse")] +pub struct QueryAllowanceResponse { + /// allowance is a allowance granted for grantee by granter. + #[prost(message, optional, tag = "1")] + pub allowance: ::core::option::Option, +} +/// QueryAllowancesRequest is the request type for the Query/Allowances RPC method. +#[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.feegrant.v1beta1.QueryAllowancesRequest")] +#[proto_query( + path = "/cosmos.feegrant.v1beta1.Query/Allowances", + response_type = QueryAllowancesResponse +)] +pub struct QueryAllowancesRequest { + #[prost(string, tag = "1")] + pub grantee: ::prost::alloc::string::String, + /// pagination defines an pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option, +} +/// QueryAllowancesResponse is the response type for the Query/Allowances RPC method. +#[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.feegrant.v1beta1.QueryAllowancesResponse")] +pub struct QueryAllowancesResponse { + /// allowances are allowance's granted for grantee by granter. + #[prost(message, repeated, tag = "1")] + pub allowances: ::prost::alloc::vec::Vec, + /// pagination defines an pagination for the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option, +} +/// QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. +/// +/// Since: cosmos-sdk 0.46 +#[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.feegrant.v1beta1.QueryAllowancesByGranterRequest")] +#[proto_query( + path = "/cosmos.feegrant.v1beta1.Query/AllowancesByGranter", + response_type = QueryAllowancesByGranterResponse +)] +pub struct QueryAllowancesByGranterRequest { + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// pagination defines an pagination for the request. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option, +} +/// QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. +/// +/// Since: cosmos-sdk 0.46 +#[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.feegrant.v1beta1.QueryAllowancesByGranterResponse")] +pub struct QueryAllowancesByGranterResponse { + /// allowances that have been issued by the granter. + #[prost(message, repeated, tag = "1")] + pub allowances: ::prost::alloc::vec::Vec, + /// pagination defines an pagination for the response. + #[prost(message, optional, tag = "2")] + pub pagination: ::core::option::Option, +} +/// MsgGrantAllowance adds permission for Grantee to spend up to Allowance +/// of fees from the account of Granter. +#[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.feegrant.v1beta1.MsgGrantAllowance")] +pub struct MsgGrantAllowance { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, + /// allowance can be any of basic, periodic, allowed fee allowance. + #[prost(message, optional, tag = "3")] + pub allowance: ::core::option::Option, +} +/// MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. +#[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.feegrant.v1beta1.MsgGrantAllowanceResponse")] +pub struct MsgGrantAllowanceResponse {} +/// MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. +#[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.feegrant.v1beta1.MsgRevokeAllowance")] +pub struct MsgRevokeAllowance { + /// granter is the address of the user granting an allowance of their funds. + #[prost(string, tag = "1")] + pub granter: ::prost::alloc::string::String, + /// grantee is the address of the user being granted an allowance of another user's funds. + #[prost(string, tag = "2")] + pub grantee: ::prost::alloc::string::String, +} +/// MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. +#[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.feegrant.v1beta1.MsgRevokeAllowanceResponse")] +pub struct MsgRevokeAllowanceResponse {} +pub struct FeegrantQuerier<'a, Q: cosmwasm_std::CustomQuery> { + querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>, +} +impl<'a, Q: cosmwasm_std::CustomQuery> FeegrantQuerier<'a, Q> { + pub fn new(querier: &'a cosmwasm_std::QuerierWrapper<'a, Q>) -> Self { + Self { querier } + } + pub fn allowance( + &self, + granter: ::prost::alloc::string::String, + grantee: ::prost::alloc::string::String, + ) -> Result { + QueryAllowanceRequest { granter, grantee }.query(self.querier) + } + pub fn allowances( + &self, + grantee: ::prost::alloc::string::String, + pagination: ::core::option::Option, + ) -> Result { + QueryAllowancesRequest { grantee, pagination }.query(self.querier) + } + pub fn allowances_by_granter( + &self, + granter: ::prost::alloc::string::String, + pagination: ::core::option::Option, + ) -> Result { + QueryAllowancesByGranterRequest { granter, pagination }.query(self.querier) + } +} diff --git a/packages/injective-std/src/types/cosmos/mod.rs b/packages/injective-std/src/types/cosmos/mod.rs index f5ac795e..55f1af72 100644 --- a/packages/injective-std/src/types/cosmos/mod.rs +++ b/packages/injective-std/src/types/cosmos/mod.rs @@ -3,6 +3,7 @@ pub mod authz; pub mod bank; pub mod base; pub mod distribution; +pub mod feegrant; pub mod gov; pub mod params; pub mod staking; diff --git a/packages/injective-std/src/types/injective/insurance/v1beta1.rs b/packages/injective-std/src/types/injective/insurance/v1beta1.rs index 69278333..a74d980e 100644 --- a/packages/injective-std/src/types/injective/insurance/v1beta1.rs +++ b/packages/injective-std/src/types/injective/insurance/v1beta1.rs @@ -130,18 +130,6 @@ pub struct EventUnderwrite { #[prost(message, optional, tag = "4")] pub shares: ::core::option::Option, } -#[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)] -#[proto_message(type_url = "/injective.insurance.v1beta1.EventInsuranceWithdraw")] -pub struct EventInsuranceWithdraw { - #[prost(string, tag = "1")] - #[serde(alias = "marketID")] - pub market_id: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub market_ticker: ::prost::alloc::string::String, - #[prost(message, optional, tag = "3")] - pub withdrawal: ::core::option::Option, -} /// GenesisState defines the insurance module's genesis state. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]