Skip to content

Commit

Permalink
chore: osmosis-std-derive -> injective-std-derive
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrobot committed Jul 30, 2024
1 parent 294da57 commit 2aa16d8
Show file tree
Hide file tree
Showing 31 changed files with 144 additions and 56 deletions.
104 changes: 102 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions packages/injective-protobuf/src/proto/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
32 changes: 10 additions & 22 deletions packages/injective-std-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ pub fn derive_cosmwasm_ext(input: TokenStream) -> TokenStream {
// provided buffer had insufficient capacity. Message encoding is otherwise
// infallible.

let (query_request_conversion, cosmwasm_query) = if get_attr("proto_query", &input.attrs)
.is_some()
{
let (query_request_conversion, cosmwasm_query) = if get_attr("proto_query", &input.attrs).is_some() {
let path = get_query_attrs(&input.attrs, match_kv_attr!("path", Literal));
let res = get_query_attrs(&input.attrs, match_kv_attr!("response_type", Ident));

Expand Down Expand Up @@ -121,7 +119,8 @@ pub fn derive_cosmwasm_ext(input: TokenStream) -> TokenStream {
.try_into()
}
}
}).into()
})
.into()
}

fn get_type_url(attrs: &[syn::Attribute]) -> proc_macro2::TokenStream {
Expand Down Expand Up @@ -158,13 +157,10 @@ where
}

if let Some(TokenTree::Group(group)) = attr.tokens.clone().into_iter().next() {
let kv_groups = group.stream().into_iter().group_by(|t| {
if let TokenTree::Punct(punct) = t {
punct.as_char() != ','
} else {
true
}
});
let kv_groups = group
.stream()
.into_iter()
.group_by(|t| if let TokenTree::Punct(punct) = t { punct.as_char() != ',' } else { true });
let mut key_values: Vec<Vec<TokenTree>> = vec![];

for (non_sep, g) in &kv_groups {
Expand All @@ -173,10 +169,7 @@ where
}
}

return key_values
.iter()
.find_map(f)
.unwrap_or_else(|| proto_query_attr_error(proto_query));
return key_values.iter().find_map(f).unwrap_or_else(|| proto_query_attr_error(proto_query));
}

proto_query_attr_error(proto_query)
Expand All @@ -192,14 +185,9 @@ fn get_attr<'a>(attr_ident: &str, attrs: &'a [syn::Attribute]) -> Option<&'a syn
}

fn proto_message_attr_error<T: quote::ToTokens>(tokens: T) -> proc_macro2::TokenStream {
syn::Error::new_spanned(tokens, "expected `proto_message(type_url = \"...\")`")
.to_compile_error()
syn::Error::new_spanned(tokens, "expected `proto_message(type_url = \"...\")`").to_compile_error()
}

fn proto_query_attr_error<T: quote::ToTokens>(tokens: T) -> proc_macro2::TokenStream {
syn::Error::new_spanned(
tokens,
"expected `proto_query(path = \"...\", response_type = ...)`",
)
.to_compile_error()
syn::Error::new_spanned(tokens, "expected `proto_query(path = \"...\", response_type = ...)`").to_compile_error()
}
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/auth/module/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Module is the config object for the auth module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/auth/v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// BaseAccount defines a base account type. It contains all the necessary fields
/// for basic account functionality. Any custom account type should extend this
/// type for additional functionality (e.g. vesting).
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/authz/module/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Module is the config object of the authz module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/authz/v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// GenericAuthorization gives the grantee unrestricted permissions to execute
/// the provided method on behalf of the granter's account.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/bank/module/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Module is the config object of the bank module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/bank/v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// SendAuthorization allows the grantee to spend up to spend_limit coins from
/// the granter's account.
///
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// ConfigRequest defines the request structure for the Config gRPC query.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// PageRequest is to be embedded in gRPC request messages for efficient
/// pagination. Ex:
///
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/base/v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Coin defines a token with a denomination and an amount.
///
/// NOTE: The amount field is an Int which implements the custom method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Module is the config object of the distribution module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Params defines the set of params for the distribution module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_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)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_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)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/gov/module/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Module is the config object of the gov module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/gov/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// WeightedVoteOption defines a unit of vote for vote split.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/gov/v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// WeightedVoteOption defines a unit of vote for vote split.
///
/// Since: cosmos-sdk 0.43
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Module is the config object of the params module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/params/v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// ParameterChangeProposal defines a proposal to change one or more parameters.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmos/staking/v1beta1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// NOTE: The following type is not implemented due to current limitations of code generator
/// which currently has issue with tendermint_proto.
/// This will be fixed in the upcoming release.
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/cosmwasm/wasm/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// AccessTypeParam
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_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 = "/injective.auction.v1beta1.Params")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// spot authz messages
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Message, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema, CosmwasmExt)]
Expand Down Expand Up @@ -4858,7 +4858,7 @@ pub struct FullDerivativeMarket {
}
/// Nested message and enum types in `FullDerivativeMarket`.
pub mod full_derivative_market {
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, Eq, ::prost::Oneof, ::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)]
pub enum Info {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_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 = "/injective.insurance.v1beta1.Params")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_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 = "/injective.oracle.v1beta1.Params")]
Expand Down
2 changes: 1 addition & 1 deletion packages/injective-std/src/types/injective/peggy/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use osmosis_std_derive::CosmwasmExt;
use injective_std_derive::CosmwasmExt;
/// Attestation is an aggregate of `claims` that eventually becomes `observed` by
/// all orchestrators
/// EVENT_NONCE:
Expand Down
Loading

0 comments on commit 2aa16d8

Please sign in to comment.