Skip to content

Commit

Permalink
proto update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
joldie777 authored and jcompagni10 committed Aug 5, 2024
1 parent 81ddf95 commit 38fc8db
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 53 deletions.
75 changes: 59 additions & 16 deletions packages/neutron-sdk/schema/neutron_query.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -734,9 +726,7 @@
"type": "object",
"required": [
"amount_in",
"creator",
"order_type",
"receiver",
"tick_index_in_to_out",
"token_in",
"token_out"
Expand All @@ -745,9 +735,6 @@
"amount_in": {
"$ref": "#/definitions/Int128"
},
"creator": {
"type": "string"
},
"expiration_time": {
"type": [
"integer",
Expand All @@ -769,9 +756,6 @@
"order_type": {
"$ref": "#/definitions/LimitOrderType"
},
"receiver": {
"type": "string"
},
"tick_index_in_to_out": {
"type": "integer",
"format": "int64"
Expand Down Expand Up @@ -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": [
Expand Down
4 changes: 0 additions & 4 deletions packages/neutron-sdk/src/bindings/dex/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,13 @@ pub enum DexQuery {
},
/// Queries the simulated result of a multihop swap
EstimateMultiHopSwap {
creator: String,
receiver: String,
routes: Vec<MultiHopRoute>,
amount_in: Int128,
exit_limit_price: PrecDec,
pick_best_route: bool,
},
/// 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,
Expand Down
2 changes: 1 addition & 1 deletion packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7bfbbe2c88648620bde41b80e3d9ce41883115a4
7bfbbe2c88648620bde41b80e3d9ce41883115a4
8 changes: 0 additions & 8 deletions packages/neutron-sdk/src/proto_types/neutron.dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<MultiHopRoute>,
#[prost(string, tag = "4")]
Expand All @@ -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")]
Expand Down
15 changes: 8 additions & 7 deletions packages/neutron-sdk/src/stargate/dex/query.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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),
)
}

Expand Down
29 changes: 12 additions & 17 deletions packages/neutron-sdk/src/stargate/dex/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -328,9 +329,9 @@ pub struct AllUserLimitOrdersResponse {
pub pagination: Option<PageResponse>,
}

impl From<AllUserLimitOrdersRequest> for QueryAllUserLimitOrdersRequest {
fn from(v: AllUserLimitOrdersRequest) -> QueryAllUserLimitOrdersRequest {
QueryAllUserLimitOrdersRequest {
impl From<AllUserLimitOrdersRequest> for QueryAllLimitOrderTrancheUserByAddressRequest {
fn from(v: AllUserLimitOrdersRequest) -> QueryAllLimitOrderTrancheUserByAddressRequest {
QueryAllLimitOrderTrancheUserByAddressRequest {
address: v.address,
pagination: convert_page_request(v.pagination),
}
Expand Down Expand Up @@ -540,8 +541,6 @@ impl From<GetPoolReservesRequest> for QueryGetPoolReservesRequest {

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
pub struct EstimateMultiHopSwapRequest {
pub creator: String,
pub receiver: String,
pub routes: Vec<Vec<String>>,
pub amount_in: String,
pub exit_limit_price: String,
Expand All @@ -556,8 +555,6 @@ pub struct EstimateMultiHopSwapResponse {
impl From<EstimateMultiHopSwapRequest> for QueryEstimateMultiHopSwapRequest {
fn from(v: EstimateMultiHopSwapRequest) -> QueryEstimateMultiHopSwapRequest {
QueryEstimateMultiHopSwapRequest {
creator: v.creator,
receiver: v.receiver,
routes: v
.routes
.into_iter()
Expand All @@ -574,8 +571,6 @@ impl From<EstimateMultiHopSwapRequest> 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,
Expand All @@ -601,8 +596,6 @@ pub struct EstimatePlaceLimitOrderResponse {
impl From<EstimatePlaceLimitOrderRequest> 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,
Expand Down Expand Up @@ -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<DepositOptions> for DepositOptionsGen {
fn from(o: DepositOptions) -> DepositOptionsGen {
DepositOptionsGen {
disable_autoswap: o.disable_autoswap,
fail_tx_on_bel: o.fail_tx_on_bel,
}
}
}
Expand Down

0 comments on commit 38fc8db

Please sign in to comment.