@@ -8,7 +8,7 @@ use crate::proto_types::neutron::dex::{
8
8
QueryEstimateMultiHopSwapRequest , QueryEstimatePlaceLimitOrderRequest ,
9
9
QueryGetInactiveLimitOrderTrancheRequest , QueryGetLimitOrderTrancheRequest ,
10
10
QueryGetLimitOrderTrancheUserRequest , QueryGetPoolMetadataRequest , QueryGetPoolReservesRequest ,
11
- QueryParamsRequest , QueryPoolByIdRequest , QueryPoolRequest ,
11
+ QueryParamsRequest , QueryPoolByIdRequest , QueryPoolRequest , QuerySimulatePlaceLimitOrderRequest , QuerySimulateMultiHopSwapRequest ,
12
12
} ;
13
13
use crate :: stargate:: aux:: proto_timestamp_from_i64;
14
14
use cosmos_sdk_proto:: cosmos:: base:: query:: v1beta1:: PageRequest as PageRequestGen ;
@@ -121,6 +121,8 @@ pub struct PlaceLimitOrderRequest {
121
121
/// Expiration time for order. Only valid for GoodTilTime limit orders.
122
122
pub expiration_time : Option < i64 > ,
123
123
pub max_amount_out : Option < String > ,
124
+ pub limit_sell_price : Option < String > ,
125
+ pub min_avg_sell_price : Option < String > ,
124
126
}
125
127
126
128
impl From < PlaceLimitOrderRequest > for MsgPlaceLimitOrder {
@@ -135,6 +137,8 @@ impl From<PlaceLimitOrderRequest> for MsgPlaceLimitOrder {
135
137
order_type : v. order_type as i32 ,
136
138
expiration_time : v. expiration_time . map ( proto_timestamp_from_i64) ,
137
139
max_amount_out : v. max_amount_out . unwrap_or_default ( ) ,
140
+ limit_sell_price : v. limit_sell_price ,
141
+ min_average_sell_price : v. min_avg_sell_price ,
138
142
}
139
143
}
140
144
}
@@ -665,6 +669,97 @@ impl From<AllPoolMetadataRequest> for QueryAllPoolMetadataRequest {
665
669
}
666
670
}
667
671
672
+ //SimulatePlaceLimitOrder
673
+
674
+ #[ derive( Serialize , Deserialize , Clone , Debug , PartialEq , Eq , JsonSchema ) ]
675
+ pub struct SimulatePlaceLimitOrderRequest {
676
+ /// Account from which token_in is debited.
677
+ pub sender : String ,
678
+ /// Account to which token_out is credited or that will be allowed to withdraw or cancel a
679
+ /// maker order.
680
+ pub receiver : String ,
681
+ /// Token being “sold”.
682
+ pub token_in : String ,
683
+ /// Token being “bought”.
684
+ pub token_out : String ,
685
+ /// Limit tick for a limit order, specified in terms of token_in to token_out.
686
+ pub tick_index_in_to_out : i64 ,
687
+ /// Amount of TokenIn to be traded.
688
+ pub amount_in : String ,
689
+ /// Type of limit order to be used.
690
+ pub order_type : LimitOrderType ,
691
+ /// Expiration time for order. Only valid for GoodTilTime limit orders.
692
+ pub expiration_time : Option < i64 > ,
693
+ pub max_amount_out : Option < String > ,
694
+ pub limit_sell_price : Option < String > ,
695
+ pub min_avg_sell_price : Option < String > ,
696
+ }
697
+
698
+ #[ derive( Serialize , Deserialize , Clone , Debug , PartialEq , Eq , JsonSchema ) ]
699
+ pub struct SimulatePlaceLimitOrderResponse {
700
+ resp : PlaceLimitOrderResponse
701
+ }
702
+
703
+ impl From < SimulatePlaceLimitOrderRequest > for QuerySimulatePlaceLimitOrderRequest {
704
+ fn from ( v : SimulatePlaceLimitOrderRequest ) -> QuerySimulatePlaceLimitOrderRequest {
705
+ QuerySimulatePlaceLimitOrderRequest {
706
+ msg : Some ( MsgPlaceLimitOrder {
707
+ creator : v. sender ,
708
+ receiver : v. receiver ,
709
+ token_in : v. token_in ,
710
+ token_out : v. token_out ,
711
+ tick_index_in_to_out : v. tick_index_in_to_out ,
712
+ amount_in : v. amount_in ,
713
+ order_type : v. order_type as i32 ,
714
+ expiration_time : v. expiration_time . map ( proto_timestamp_from_i64) ,
715
+ max_amount_out : v. max_amount_out . unwrap_or_default ( ) ,
716
+ limit_sell_price : v. limit_sell_price ,
717
+ min_average_sell_price : v. min_avg_sell_price ,
718
+ } )
719
+ }
720
+ }
721
+ }
722
+
723
+ // SimulateMultiHopSwap
724
+ #[ derive( Serialize , Deserialize , Clone , Debug , PartialEq , Eq , JsonSchema ) ]
725
+ pub struct SimulateMultiHopSwapRequest {
726
+ pub sender : String ,
727
+ /// Account to which TokenOut is credited
728
+ receiver : String ,
729
+ /// Array of possible routes
730
+ routes : Vec < Vec < String > > ,
731
+ /// Amount of TokenIn to swap
732
+ amount_in : String ,
733
+ /// Minimum price that that must be satisfied for a route to succeed
734
+ exit_limit_price : String ,
735
+ /// If true all routes are run and the route with the best price is used
736
+ pick_best_route : bool ,
737
+ }
738
+
739
+ #[ derive( Serialize , Deserialize , Clone , Debug , PartialEq , Eq , JsonSchema ) ]
740
+ pub struct SimulateMultiHopSwapResponse {
741
+ resp : MultiHopSwapResponse
742
+ }
743
+
744
+ impl From < SimulateMultiHopSwapRequest > for QuerySimulateMultiHopSwapRequest {
745
+ fn from ( v : SimulateMultiHopSwapRequest ) -> QuerySimulateMultiHopSwapRequest {
746
+ QuerySimulateMultiHopSwapRequest {
747
+ msg : Some ( MsgMultiHopSwap {
748
+ creator : v. sender ,
749
+ receiver : v. receiver ,
750
+ routes : v
751
+ . routes
752
+ . into_iter ( )
753
+ . map ( |r| MultiHopRoute { hops : r } )
754
+ . collect ( ) ,
755
+ amount_in : v. amount_in ,
756
+ exit_limit_price : v. exit_limit_price ,
757
+ pick_best_route : v. pick_best_route ,
758
+ } )
759
+ }
760
+ }
761
+ }
762
+
668
763
// Common
669
764
670
765
#[ derive( Serialize , Deserialize , Clone , Debug , PartialEq , Eq , JsonSchema ) ]
0 commit comments