From 38fc8db4dfbea1fcac6c91488668e64a071af0f1 Mon Sep 17 00:00:00 2001 From: Aleksandr Pismenskiy Date: Wed, 19 Jun 2024 13:24:31 +0300 Subject: [PATCH] proto update fixes --- .../neutron-sdk/schema/neutron_query.json | 75 +++++++++++++++---- .../neutron-sdk/src/bindings/dex/query.rs | 4 - .../src/proto_types/NEUTRON_COMMIT | 2 +- .../src/proto_types/neutron.dex.rs | 8 -- .../neutron-sdk/src/stargate/dex/query.rs | 15 ++-- .../neutron-sdk/src/stargate/dex/types.rs | 29 +++---- 6 files changed, 80 insertions(+), 53 deletions(-) diff --git a/packages/neutron-sdk/schema/neutron_query.json b/packages/neutron-sdk/schema/neutron_query.json index 48a911b0..40c35f6f 100644 --- a/packages/neutron-sdk/schema/neutron_query.json +++ b/packages/neutron-sdk/schema/neutron_query.json @@ -689,28 +689,20 @@ "type": "object", "required": [ "amount_in", - "creator", "exit_limit_price", "pick_best_route", - "receiver", "routes" ], "properties": { "amount_in": { "$ref": "#/definitions/Int128" }, - "creator": { - "type": "string" - }, "exit_limit_price": { "$ref": "#/definitions/PrecDec" }, "pick_best_route": { "type": "boolean" }, - "receiver": { - "type": "string" - }, "routes": { "type": "array", "items": { @@ -734,9 +726,7 @@ "type": "object", "required": [ "amount_in", - "creator", "order_type", - "receiver", "tick_index_in_to_out", "token_in", "token_out" @@ -745,9 +735,6 @@ "amount_in": { "$ref": "#/definitions/Int128" }, - "creator": { - "type": "string" - }, "expiration_time": { "type": [ "integer", @@ -769,9 +756,6 @@ "order_type": { "$ref": "#/definitions/LimitOrderType" }, - "receiver": { - "type": "string" - }, "tick_index_in_to_out": { "type": "integer", "format": "int64" @@ -1082,6 +1066,65 @@ } ] }, + "OracleQuery": { + "oneOf": [ + { + "type": "object", + "required": [ + "get_all_currency_pairs" + ], + "properties": { + "get_all_currency_pairs": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_price" + ], + "properties": { + "get_price": { + "type": "object", + "required": [ + "currency_pair" + ], + "properties": { + "currency_pair": { + "$ref": "#/definitions/CurrencyPair" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "get_prices" + ], + "properties": { + "get_prices": { + "type": "object", + "required": [ + "currency_pair_ids" + ], + "properties": { + "currency_pair_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "additionalProperties": false + } + ] + }, "PageRequest": { "type": "object", "required": [ diff --git a/packages/neutron-sdk/src/bindings/dex/query.rs b/packages/neutron-sdk/src/bindings/dex/query.rs index 0f39f74b..ceda8133 100644 --- a/packages/neutron-sdk/src/bindings/dex/query.rs +++ b/packages/neutron-sdk/src/bindings/dex/query.rs @@ -73,8 +73,6 @@ pub enum DexQuery { }, /// Queries the simulated result of a multihop swap EstimateMultiHopSwap { - creator: String, - receiver: String, routes: Vec, amount_in: Int128, exit_limit_price: PrecDec, @@ -82,8 +80,6 @@ pub enum DexQuery { }, /// Queries the simulated result of a PlaceLimit order EstimatePlaceLimitOrder { - creator: String, - receiver: String, token_in: String, token_out: String, tick_index_in_to_out: i64, diff --git a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT index e4db2361..9c8cec07 100644 --- a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT +++ b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT @@ -1 +1 @@ -7bfbbe2c88648620bde41b80e3d9ce41883115a4 \ No newline at end of file +7bfbbe2c88648620bde41b80e3d9ce41883115a4 diff --git a/packages/neutron-sdk/src/proto_types/neutron.dex.rs b/packages/neutron-sdk/src/proto_types/neutron.dex.rs index 8805ac36..b487279a 100644 --- a/packages/neutron-sdk/src/proto_types/neutron.dex.rs +++ b/packages/neutron-sdk/src/proto_types/neutron.dex.rs @@ -559,10 +559,6 @@ pub struct QueryGetPoolReservesResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryEstimateMultiHopSwapRequest { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, #[prost(message, repeated, tag = "3")] pub routes: ::prost::alloc::vec::Vec, #[prost(string, tag = "4")] @@ -581,10 +577,6 @@ pub struct QueryEstimateMultiHopSwapResponse { } #[derive(Clone, PartialEq, ::prost::Message)] pub struct QueryEstimatePlaceLimitOrderRequest { - #[prost(string, tag = "1")] - pub creator: ::prost::alloc::string::String, - #[prost(string, tag = "2")] - pub receiver: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub token_in: ::prost::alloc::string::String, #[prost(string, tag = "4")] diff --git a/packages/neutron-sdk/src/stargate/dex/query.rs b/packages/neutron-sdk/src/stargate/dex/query.rs index c0c30b08..35c01d00 100644 --- a/packages/neutron-sdk/src/stargate/dex/query.rs +++ b/packages/neutron-sdk/src/stargate/dex/query.rs @@ -1,11 +1,12 @@ use crate::proto_types::neutron::dex::{ QueryAllInactiveLimitOrderTrancheRequest, QueryAllLimitOrderTrancheRequest, - QueryAllLimitOrderTrancheUserRequest, QueryAllPoolMetadataRequest, QueryAllPoolReservesRequest, - QueryAllTickLiquidityRequest, QueryAllUserDepositsRequest, QueryAllUserLimitOrdersRequest, - QueryEstimateMultiHopSwapRequest, QueryEstimatePlaceLimitOrderRequest, - QueryGetInactiveLimitOrderTrancheRequest, QueryGetLimitOrderTrancheRequest, - QueryGetLimitOrderTrancheUserRequest, QueryGetPoolMetadataRequest, QueryGetPoolReservesRequest, - QueryParamsRequest, QueryPoolByIdRequest, QueryPoolRequest, + QueryAllLimitOrderTrancheUserByAddressRequest, QueryAllLimitOrderTrancheUserRequest, + QueryAllPoolMetadataRequest, QueryAllPoolReservesRequest, QueryAllTickLiquidityRequest, + QueryAllUserDepositsRequest, QueryEstimateMultiHopSwapRequest, + QueryEstimatePlaceLimitOrderRequest, QueryGetInactiveLimitOrderTrancheRequest, + QueryGetLimitOrderTrancheRequest, QueryGetLimitOrderTrancheUserRequest, + QueryGetPoolMetadataRequest, QueryGetPoolReservesRequest, QueryParamsRequest, + QueryPoolByIdRequest, QueryPoolRequest, }; use crate::stargate::aux::make_stargate_query; use crate::stargate::dex::types::{ @@ -83,7 +84,7 @@ pub fn get_limit_order_tranche_user_all_by_address( make_stargate_query( deps, LIMIT_ORDER_TRANCHE_USER_ALL_BY_ADDRESS_QUERY_PATH, - QueryAllUserLimitOrdersRequest::from(req), + QueryAllLimitOrderTrancheUserByAddressRequest::from(req), ) } diff --git a/packages/neutron-sdk/src/stargate/dex/types.rs b/packages/neutron-sdk/src/stargate/dex/types.rs index 56db1af5..d33b4bb3 100644 --- a/packages/neutron-sdk/src/stargate/dex/types.rs +++ b/packages/neutron-sdk/src/stargate/dex/types.rs @@ -3,12 +3,13 @@ use crate::proto_types::neutron::dex::{ DepositOptions as DepositOptionsGen, MsgCancelLimitOrder, MsgDeposit, MsgMultiHopSwap, MsgPlaceLimitOrder, MsgWithdrawFilledLimitOrder, MsgWithdrawal, MultiHopRoute, QueryAllInactiveLimitOrderTrancheRequest, QueryAllLimitOrderTrancheRequest, - QueryAllLimitOrderTrancheUserRequest, QueryAllPoolMetadataRequest, QueryAllPoolReservesRequest, - QueryAllTickLiquidityRequest, QueryAllUserDepositsRequest, QueryAllUserLimitOrdersRequest, - QueryEstimateMultiHopSwapRequest, QueryEstimatePlaceLimitOrderRequest, - QueryGetInactiveLimitOrderTrancheRequest, QueryGetLimitOrderTrancheRequest, - QueryGetLimitOrderTrancheUserRequest, QueryGetPoolMetadataRequest, QueryGetPoolReservesRequest, - QueryParamsRequest, QueryPoolByIdRequest, QueryPoolRequest, + QueryAllLimitOrderTrancheUserByAddressRequest, QueryAllLimitOrderTrancheUserRequest, + QueryAllPoolMetadataRequest, QueryAllPoolReservesRequest, QueryAllTickLiquidityRequest, + QueryAllUserDepositsRequest, QueryEstimateMultiHopSwapRequest, + QueryEstimatePlaceLimitOrderRequest, QueryGetInactiveLimitOrderTrancheRequest, + QueryGetLimitOrderTrancheRequest, QueryGetLimitOrderTrancheUserRequest, + QueryGetPoolMetadataRequest, QueryGetPoolReservesRequest, QueryParamsRequest, + QueryPoolByIdRequest, QueryPoolRequest, }; use crate::stargate::aux::proto_timestamp_from_i64; use cosmos_sdk_proto::cosmos::base::query::v1beta1::PageRequest as PageRequestGen; @@ -328,9 +329,9 @@ pub struct AllUserLimitOrdersResponse { pub pagination: Option, } -impl From for QueryAllUserLimitOrdersRequest { - fn from(v: AllUserLimitOrdersRequest) -> QueryAllUserLimitOrdersRequest { - QueryAllUserLimitOrdersRequest { +impl From for QueryAllLimitOrderTrancheUserByAddressRequest { + fn from(v: AllUserLimitOrdersRequest) -> QueryAllLimitOrderTrancheUserByAddressRequest { + QueryAllLimitOrderTrancheUserByAddressRequest { address: v.address, pagination: convert_page_request(v.pagination), } @@ -540,8 +541,6 @@ impl From for QueryGetPoolReservesRequest { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] pub struct EstimateMultiHopSwapRequest { - pub creator: String, - pub receiver: String, pub routes: Vec>, pub amount_in: String, pub exit_limit_price: String, @@ -556,8 +555,6 @@ pub struct EstimateMultiHopSwapResponse { impl From for QueryEstimateMultiHopSwapRequest { fn from(v: EstimateMultiHopSwapRequest) -> QueryEstimateMultiHopSwapRequest { QueryEstimateMultiHopSwapRequest { - creator: v.creator, - receiver: v.receiver, routes: v .routes .into_iter() @@ -574,8 +571,6 @@ impl From for QueryEstimateMultiHopSwapRequest { #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] pub struct EstimatePlaceLimitOrderRequest { - pub creator: String, - pub receiver: String, pub token_in: String, pub token_out: String, pub tick_index_in_to_out: i64, @@ -601,8 +596,6 @@ pub struct EstimatePlaceLimitOrderResponse { impl From for QueryEstimatePlaceLimitOrderRequest { fn from(v: EstimatePlaceLimitOrderRequest) -> QueryEstimatePlaceLimitOrderRequest { QueryEstimatePlaceLimitOrderRequest { - creator: v.creator, - receiver: v.receiver, token_in: v.token_in, token_out: v.token_out, tick_index_in_to_out: v.tick_index_in_to_out, @@ -697,12 +690,14 @@ pub struct DepositOptions { /// Autoswap provides a mechanism for users to deposit the entirety of their specified deposit /// amounts by paying a small fee. By default the `autoswap` option is enabled. pub disable_autoswap: bool, + pub fail_tx_on_bel: bool, } impl From for DepositOptionsGen { fn from(o: DepositOptions) -> DepositOptionsGen { DepositOptionsGen { disable_autoswap: o.disable_autoswap, + fail_tx_on_bel: o.fail_tx_on_bel, } } }