penumbra_sdk_proto/gen/
penumbra.core.component.dex.v1.rs

1// This file is @generated by prost-build.
2/// A Penumbra ZK swap proof.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct ZkSwapProof {
5    #[prost(bytes = "vec", tag = "1")]
6    pub inner: ::prost::alloc::vec::Vec<u8>,
7}
8impl ::prost::Name for ZkSwapProof {
9    const NAME: &'static str = "ZKSwapProof";
10    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
11    fn full_name() -> ::prost::alloc::string::String {
12        "penumbra.core.component.dex.v1.ZKSwapProof".into()
13    }
14    fn type_url() -> ::prost::alloc::string::String {
15        "/penumbra.core.component.dex.v1.ZKSwapProof".into()
16    }
17}
18/// A Penumbra ZK swap claim proof.
19#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct ZkSwapClaimProof {
21    #[prost(bytes = "vec", tag = "1")]
22    pub inner: ::prost::alloc::vec::Vec<u8>,
23}
24impl ::prost::Name for ZkSwapClaimProof {
25    const NAME: &'static str = "ZKSwapClaimProof";
26    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
27    fn full_name() -> ::prost::alloc::string::String {
28        "penumbra.core.component.dex.v1.ZKSwapClaimProof".into()
29    }
30    fn type_url() -> ::prost::alloc::string::String {
31        "/penumbra.core.component.dex.v1.ZKSwapClaimProof".into()
32    }
33}
34/// A transaction action that submits a swap to the dex.
35#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct Swap {
37    /// Contains the Swap proof.
38    #[prost(message, optional, tag = "1")]
39    pub proof: ::core::option::Option<ZkSwapProof>,
40    /// Encapsulates the authorized fields of the Swap action, used in signing.
41    #[prost(message, optional, tag = "4")]
42    pub body: ::core::option::Option<SwapBody>,
43}
44impl ::prost::Name for Swap {
45    const NAME: &'static str = "Swap";
46    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
47    fn full_name() -> ::prost::alloc::string::String {
48        "penumbra.core.component.dex.v1.Swap".into()
49    }
50    fn type_url() -> ::prost::alloc::string::String {
51        "/penumbra.core.component.dex.v1.Swap".into()
52    }
53}
54/// A transaction action that obtains assets previously confirmed
55/// via a Swap transaction. Does not include a spend authorization
56/// signature, as it is only capable of consuming the NFT from a
57/// Swap transaction.
58#[derive(Clone, PartialEq, ::prost::Message)]
59pub struct SwapClaim {
60    /// Contains the SwapClaim proof.
61    #[prost(message, optional, tag = "1")]
62    pub proof: ::core::option::Option<ZkSwapClaimProof>,
63    /// Encapsulates the authorized fields of the SwapClaim action, used in signing.
64    #[prost(message, optional, tag = "2")]
65    pub body: ::core::option::Option<SwapClaimBody>,
66    /// The epoch duration of the chain when the swap claim took place.
67    #[prost(uint64, tag = "7")]
68    pub epoch_duration: u64,
69}
70impl ::prost::Name for SwapClaim {
71    const NAME: &'static str = "SwapClaim";
72    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
73    fn full_name() -> ::prost::alloc::string::String {
74        "penumbra.core.component.dex.v1.SwapClaim".into()
75    }
76    fn type_url() -> ::prost::alloc::string::String {
77        "/penumbra.core.component.dex.v1.SwapClaim".into()
78    }
79}
80/// Encapsulates the authorized fields of the SwapClaim action, used in signing.
81#[derive(Clone, PartialEq, ::prost::Message)]
82pub struct SwapClaimBody {
83    /// The nullifier for the Swap commitment to be consumed.
84    #[prost(message, optional, tag = "1")]
85    pub nullifier: ::core::option::Option<super::super::sct::v1::Nullifier>,
86    /// The fee allows `SwapClaim` without an additional `Spend`.
87    #[prost(message, optional, tag = "2")]
88    pub fee: ::core::option::Option<super::super::fee::v1::Fee>,
89    /// Note output for asset 1.
90    #[prost(message, optional, tag = "3")]
91    pub output_1_commitment: ::core::option::Option<
92        super::super::super::super::crypto::tct::v1::StateCommitment,
93    >,
94    /// Note output for asset 2.
95    #[prost(message, optional, tag = "4")]
96    pub output_2_commitment: ::core::option::Option<
97        super::super::super::super::crypto::tct::v1::StateCommitment,
98    >,
99    /// Input and output amounts, and asset IDs for the assets in the swap.
100    #[prost(message, optional, tag = "6")]
101    pub output_data: ::core::option::Option<BatchSwapOutputData>,
102}
103impl ::prost::Name for SwapClaimBody {
104    const NAME: &'static str = "SwapClaimBody";
105    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
106    fn full_name() -> ::prost::alloc::string::String {
107        "penumbra.core.component.dex.v1.SwapClaimBody".into()
108    }
109    fn type_url() -> ::prost::alloc::string::String {
110        "/penumbra.core.component.dex.v1.SwapClaimBody".into()
111    }
112}
113/// The authorized data of a Swap transaction.
114#[derive(Clone, PartialEq, ::prost::Message)]
115pub struct SwapBody {
116    /// The trading pair to swap.
117    #[prost(message, optional, tag = "1")]
118    pub trading_pair: ::core::option::Option<TradingPair>,
119    /// The amount for asset 1.
120    #[prost(message, optional, tag = "2")]
121    pub delta_1_i: ::core::option::Option<super::super::super::num::v1::Amount>,
122    /// The amount for asset 2.
123    #[prost(message, optional, tag = "3")]
124    pub delta_2_i: ::core::option::Option<super::super::super::num::v1::Amount>,
125    /// A commitment to a prepaid fee for the future SwapClaim.
126    /// This is recorded separately from delta_j_i because it's shielded;
127    /// in the future we'll want separate commitments to each delta_j_i
128    /// anyways in order to prove consistency with flow encryption.
129    #[prost(message, optional, tag = "4")]
130    pub fee_commitment: ::core::option::Option<
131        super::super::super::asset::v1::BalanceCommitment,
132    >,
133    /// The swap commitment and encryption of the swap data.
134    #[prost(message, optional, tag = "5")]
135    pub payload: ::core::option::Option<SwapPayload>,
136}
137impl ::prost::Name for SwapBody {
138    const NAME: &'static str = "SwapBody";
139    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
140    fn full_name() -> ::prost::alloc::string::String {
141        "penumbra.core.component.dex.v1.SwapBody".into()
142    }
143    fn type_url() -> ::prost::alloc::string::String {
144        "/penumbra.core.component.dex.v1.SwapBody".into()
145    }
146}
147#[derive(Clone, PartialEq, ::prost::Message)]
148pub struct SwapPayload {
149    #[prost(message, optional, tag = "1")]
150    pub commitment: ::core::option::Option<
151        super::super::super::super::crypto::tct::v1::StateCommitment,
152    >,
153    #[prost(bytes = "vec", tag = "2")]
154    pub encrypted_swap: ::prost::alloc::vec::Vec<u8>,
155}
156impl ::prost::Name for SwapPayload {
157    const NAME: &'static str = "SwapPayload";
158    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
159    fn full_name() -> ::prost::alloc::string::String {
160        "penumbra.core.component.dex.v1.SwapPayload".into()
161    }
162    fn type_url() -> ::prost::alloc::string::String {
163        "/penumbra.core.component.dex.v1.SwapPayload".into()
164    }
165}
166#[derive(Clone, PartialEq, ::prost::Message)]
167pub struct SwapPlaintext {
168    /// The trading pair to swap.
169    #[prost(message, optional, tag = "1")]
170    pub trading_pair: ::core::option::Option<TradingPair>,
171    /// Input amount of asset 1
172    #[prost(message, optional, tag = "2")]
173    pub delta_1_i: ::core::option::Option<super::super::super::num::v1::Amount>,
174    /// Input amount of asset 2
175    #[prost(message, optional, tag = "3")]
176    pub delta_2_i: ::core::option::Option<super::super::super::num::v1::Amount>,
177    /// Pre-paid fee to claim the swap
178    #[prost(message, optional, tag = "4")]
179    pub claim_fee: ::core::option::Option<super::super::fee::v1::Fee>,
180    /// Address that will claim the swap outputs via SwapClaim.
181    #[prost(message, optional, tag = "5")]
182    pub claim_address: ::core::option::Option<super::super::super::keys::v1::Address>,
183    /// Swap rseed (blinding factors are derived from this)
184    #[prost(bytes = "vec", tag = "6")]
185    pub rseed: ::prost::alloc::vec::Vec<u8>,
186}
187impl ::prost::Name for SwapPlaintext {
188    const NAME: &'static str = "SwapPlaintext";
189    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
190    fn full_name() -> ::prost::alloc::string::String {
191        "penumbra.core.component.dex.v1.SwapPlaintext".into()
192    }
193    fn type_url() -> ::prost::alloc::string::String {
194        "/penumbra.core.component.dex.v1.SwapPlaintext".into()
195    }
196}
197#[derive(Clone, PartialEq, ::prost::Message)]
198pub struct SwapPlan {
199    /// The plaintext version of the swap to be performed.
200    #[prost(message, optional, tag = "1")]
201    pub swap_plaintext: ::core::option::Option<SwapPlaintext>,
202    /// The blinding factor for the fee commitment. The fee in the SwapPlan is private to prevent linkability with the SwapClaim.
203    #[prost(bytes = "vec", tag = "2")]
204    pub fee_blinding: ::prost::alloc::vec::Vec<u8>,
205    /// The first blinding factor to use for the ZK swap proof.
206    #[prost(bytes = "vec", tag = "3")]
207    pub proof_blinding_r: ::prost::alloc::vec::Vec<u8>,
208    /// The second blinding factor to use for the ZK swap proof.
209    #[prost(bytes = "vec", tag = "4")]
210    pub proof_blinding_s: ::prost::alloc::vec::Vec<u8>,
211}
212impl ::prost::Name for SwapPlan {
213    const NAME: &'static str = "SwapPlan";
214    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
215    fn full_name() -> ::prost::alloc::string::String {
216        "penumbra.core.component.dex.v1.SwapPlan".into()
217    }
218    fn type_url() -> ::prost::alloc::string::String {
219        "/penumbra.core.component.dex.v1.SwapPlan".into()
220    }
221}
222#[derive(Clone, PartialEq, ::prost::Message)]
223pub struct SwapClaimPlan {
224    /// The plaintext version of the swap to be performed.
225    #[prost(message, optional, tag = "1")]
226    pub swap_plaintext: ::core::option::Option<SwapPlaintext>,
227    /// The position of the swap commitment.
228    #[prost(uint64, tag = "2")]
229    pub position: u64,
230    /// Input and output amounts for the Swap.
231    #[prost(message, optional, tag = "3")]
232    pub output_data: ::core::option::Option<BatchSwapOutputData>,
233    /// The epoch duration, used in proving.
234    #[prost(uint64, tag = "4")]
235    pub epoch_duration: u64,
236    /// The first blinding factor to use for the ZK swap claim proof.
237    #[prost(bytes = "vec", tag = "5")]
238    pub proof_blinding_r: ::prost::alloc::vec::Vec<u8>,
239    /// The second blinding factor to use for the ZK swap claim proof.
240    #[prost(bytes = "vec", tag = "6")]
241    pub proof_blinding_s: ::prost::alloc::vec::Vec<u8>,
242}
243impl ::prost::Name for SwapClaimPlan {
244    const NAME: &'static str = "SwapClaimPlan";
245    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
246    fn full_name() -> ::prost::alloc::string::String {
247        "penumbra.core.component.dex.v1.SwapClaimPlan".into()
248    }
249    fn type_url() -> ::prost::alloc::string::String {
250        "/penumbra.core.component.dex.v1.SwapClaimPlan".into()
251    }
252}
253#[derive(Clone, PartialEq, ::prost::Message)]
254pub struct SwapView {
255    #[prost(oneof = "swap_view::SwapView", tags = "1, 2")]
256    pub swap_view: ::core::option::Option<swap_view::SwapView>,
257}
258/// Nested message and enum types in `SwapView`.
259pub mod swap_view {
260    #[derive(Clone, PartialEq, ::prost::Message)]
261    pub struct Visible {
262        /// The underlying Swap action being viewed.
263        #[prost(message, optional, tag = "1")]
264        pub swap: ::core::option::Option<super::Swap>,
265        /// The plaintext of the encrypted swap.
266        #[prost(message, optional, tag = "3")]
267        pub swap_plaintext: ::core::option::Option<super::SwapPlaintext>,
268        /// Optionally, a transaction hash for the transaction that claimed this
269        /// swap.
270        ///
271        /// Presence of this field signals that the swap outputs have been claimed
272        /// and that the claim transaction is known to the view server.  Absence of
273        /// this field does not indicate anything about the state of the swap.
274        ///
275        /// This field allows frontends to more easily crossreference the sequence of
276        /// Swap/SwapClaim actions.
277        #[prost(message, optional, tag = "4")]
278        pub claim_tx: ::core::option::Option<
279            super::super::super::super::txhash::v1::TransactionId,
280        >,
281        /// Optionally, if the swap has been confirmed, the batch price it received.
282        ///
283        /// As soon as the swap is detected, the view server can in principle record
284        /// the relevant BSOD and provide it as part of the view.  This allows providing
285        /// info about the execution of the swap.
286        #[prost(message, optional, tag = "20")]
287        pub batch_swap_output_data: ::core::option::Option<super::BatchSwapOutputData>,
288        /// Optionally, if the swap has been confirmed, the output note of asset 1.
289        ///
290        /// This is the note that will be minted by the SwapClaim action.
291        #[prost(message, optional, tag = "30")]
292        pub output_1: ::core::option::Option<
293            super::super::super::shielded_pool::v1::NoteView,
294        >,
295        /// Optionally, if the swap has been confirmed, the output note of asset 2.
296        ///
297        /// This is the note that will be minted by the SwapClaim action.
298        #[prost(message, optional, tag = "31")]
299        pub output_2: ::core::option::Option<
300            super::super::super::shielded_pool::v1::NoteView,
301        >,
302        /// Optionally, metadata about asset 1 in the `swap`'s trading pair.
303        #[prost(message, optional, tag = "40")]
304        pub asset_1_metadata: ::core::option::Option<
305            super::super::super::super::asset::v1::Metadata,
306        >,
307        /// Optionally, metadata about asset 2 in the `swap`'s trading pair.
308        #[prost(message, optional, tag = "41")]
309        pub asset_2_metadata: ::core::option::Option<
310            super::super::super::super::asset::v1::Metadata,
311        >,
312    }
313    impl ::prost::Name for Visible {
314        const NAME: &'static str = "Visible";
315        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
316        fn full_name() -> ::prost::alloc::string::String {
317            "penumbra.core.component.dex.v1.SwapView.Visible".into()
318        }
319        fn type_url() -> ::prost::alloc::string::String {
320            "/penumbra.core.component.dex.v1.SwapView.Visible".into()
321        }
322    }
323    #[derive(Clone, PartialEq, ::prost::Message)]
324    pub struct Opaque {
325        #[prost(message, optional, tag = "1")]
326        pub swap: ::core::option::Option<super::Swap>,
327        /// Optionally, if the swap has been confirmed, the batch price it received.
328        ///
329        /// As soon as the swap is detected, the view server can in principle record
330        /// the relevant BSOD and provide it as part of the view.  This allows providing
331        /// info about the execution of the swap.
332        #[prost(message, optional, tag = "20")]
333        pub batch_swap_output_data: ::core::option::Option<super::BatchSwapOutputData>,
334        /// Optionally, if the swap has been confirmed, the output value of asset 1.
335        ///
336        /// This is the value of the note that will be minted by the SwapClaim action.
337        /// Note that unlike the `Visible` variant, this is only a `ValueView` since
338        /// the details of the note (in particular the claim address) are not publicly known.
339        #[prost(message, optional, tag = "30")]
340        pub output_1_value: ::core::option::Option<
341            super::super::super::super::asset::v1::ValueView,
342        >,
343        /// Optionally, if the swap has been confirmed, the output value of asset 2.
344        ///
345        /// This is the note that will be minted by the SwapClaim action.
346        /// Note that unlike the `Visible` variant, this is only a `ValueView` since
347        /// the details of the note (in particular the claim address) are not publicly known.
348        #[prost(message, optional, tag = "31")]
349        pub output_2_value: ::core::option::Option<
350            super::super::super::super::asset::v1::ValueView,
351        >,
352        /// Optionally, metadata about asset 1 in the `swap`'s trading pair.
353        #[prost(message, optional, tag = "40")]
354        pub asset_1_metadata: ::core::option::Option<
355            super::super::super::super::asset::v1::Metadata,
356        >,
357        /// Optionally, metadata about asset 2 in the `swap`'s trading pair.
358        #[prost(message, optional, tag = "41")]
359        pub asset_2_metadata: ::core::option::Option<
360            super::super::super::super::asset::v1::Metadata,
361        >,
362    }
363    impl ::prost::Name for Opaque {
364        const NAME: &'static str = "Opaque";
365        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
366        fn full_name() -> ::prost::alloc::string::String {
367            "penumbra.core.component.dex.v1.SwapView.Opaque".into()
368        }
369        fn type_url() -> ::prost::alloc::string::String {
370            "/penumbra.core.component.dex.v1.SwapView.Opaque".into()
371        }
372    }
373    #[derive(Clone, PartialEq, ::prost::Oneof)]
374    pub enum SwapView {
375        #[prost(message, tag = "1")]
376        Visible(Visible),
377        #[prost(message, tag = "2")]
378        Opaque(Opaque),
379    }
380}
381impl ::prost::Name for SwapView {
382    const NAME: &'static str = "SwapView";
383    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
384    fn full_name() -> ::prost::alloc::string::String {
385        "penumbra.core.component.dex.v1.SwapView".into()
386    }
387    fn type_url() -> ::prost::alloc::string::String {
388        "/penumbra.core.component.dex.v1.SwapView".into()
389    }
390}
391#[derive(Clone, PartialEq, ::prost::Message)]
392pub struct SwapClaimView {
393    #[prost(oneof = "swap_claim_view::SwapClaimView", tags = "1, 2")]
394    pub swap_claim_view: ::core::option::Option<swap_claim_view::SwapClaimView>,
395}
396/// Nested message and enum types in `SwapClaimView`.
397pub mod swap_claim_view {
398    #[derive(Clone, PartialEq, ::prost::Message)]
399    pub struct Visible {
400        #[prost(message, optional, tag = "1")]
401        pub swap_claim: ::core::option::Option<super::SwapClaim>,
402        #[prost(message, optional, tag = "2")]
403        pub output_1: ::core::option::Option<
404            super::super::super::shielded_pool::v1::NoteView,
405        >,
406        #[prost(message, optional, tag = "3")]
407        pub output_2: ::core::option::Option<
408            super::super::super::shielded_pool::v1::NoteView,
409        >,
410        /// Optionally, a transaction hash for the transaction that created the swap
411        /// this action claims.
412        ///
413        /// This field allows frontends to more easily crossreference the sequence of
414        /// Swap/SwapClaim actions.
415        #[prost(message, optional, tag = "4")]
416        pub swap_tx: ::core::option::Option<
417            super::super::super::super::txhash::v1::TransactionId,
418        >,
419    }
420    impl ::prost::Name for Visible {
421        const NAME: &'static str = "Visible";
422        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
423        fn full_name() -> ::prost::alloc::string::String {
424            "penumbra.core.component.dex.v1.SwapClaimView.Visible".into()
425        }
426        fn type_url() -> ::prost::alloc::string::String {
427            "/penumbra.core.component.dex.v1.SwapClaimView.Visible".into()
428        }
429    }
430    #[derive(Clone, PartialEq, ::prost::Message)]
431    pub struct Opaque {
432        #[prost(message, optional, tag = "1")]
433        pub swap_claim: ::core::option::Option<super::SwapClaim>,
434    }
435    impl ::prost::Name for Opaque {
436        const NAME: &'static str = "Opaque";
437        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
438        fn full_name() -> ::prost::alloc::string::String {
439            "penumbra.core.component.dex.v1.SwapClaimView.Opaque".into()
440        }
441        fn type_url() -> ::prost::alloc::string::String {
442            "/penumbra.core.component.dex.v1.SwapClaimView.Opaque".into()
443        }
444    }
445    #[derive(Clone, PartialEq, ::prost::Oneof)]
446    pub enum SwapClaimView {
447        #[prost(message, tag = "1")]
448        Visible(Visible),
449        #[prost(message, tag = "2")]
450        Opaque(Opaque),
451    }
452}
453impl ::prost::Name for SwapClaimView {
454    const NAME: &'static str = "SwapClaimView";
455    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
456    fn full_name() -> ::prost::alloc::string::String {
457        "penumbra.core.component.dex.v1.SwapClaimView".into()
458    }
459    fn type_url() -> ::prost::alloc::string::String {
460        "/penumbra.core.component.dex.v1.SwapClaimView".into()
461    }
462}
463/// Holds two asset IDs. Ordering doesn't reflect trading direction. Instead, we
464/// require `asset_1 < asset_2` as field elements, to ensure a canonical
465/// representation of an unordered pair.
466#[derive(Clone, PartialEq, ::prost::Message)]
467pub struct TradingPair {
468    /// The first asset of the pair.
469    #[prost(message, optional, tag = "1")]
470    pub asset_1: ::core::option::Option<super::super::super::asset::v1::AssetId>,
471    /// The second asset of the pair.
472    #[prost(message, optional, tag = "2")]
473    pub asset_2: ::core::option::Option<super::super::super::asset::v1::AssetId>,
474}
475impl ::prost::Name for TradingPair {
476    const NAME: &'static str = "TradingPair";
477    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
478    fn full_name() -> ::prost::alloc::string::String {
479        "penumbra.core.component.dex.v1.TradingPair".into()
480    }
481    fn type_url() -> ::prost::alloc::string::String {
482        "/penumbra.core.component.dex.v1.TradingPair".into()
483    }
484}
485/// Encodes a trading pair starting from asset `start`
486/// and ending on asset `end`.
487#[derive(Clone, PartialEq, ::prost::Message)]
488pub struct DirectedTradingPair {
489    /// The start asset of the pair.
490    #[prost(message, optional, tag = "1")]
491    pub start: ::core::option::Option<super::super::super::asset::v1::AssetId>,
492    /// The end asset of the pair.
493    #[prost(message, optional, tag = "2")]
494    pub end: ::core::option::Option<super::super::super::asset::v1::AssetId>,
495}
496impl ::prost::Name for DirectedTradingPair {
497    const NAME: &'static str = "DirectedTradingPair";
498    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
499    fn full_name() -> ::prost::alloc::string::String {
500        "penumbra.core.component.dex.v1.DirectedTradingPair".into()
501    }
502    fn type_url() -> ::prost::alloc::string::String {
503        "/penumbra.core.component.dex.v1.DirectedTradingPair".into()
504    }
505}
506/// Records the result of a batch swap on-chain.
507///
508/// Used as a public input to a swap claim proof, as it implies the effective
509/// clearing price for the batch.
510#[derive(Clone, PartialEq, ::prost::Message)]
511pub struct BatchSwapOutputData {
512    /// The total amount of asset 1 that was input to the batch swap.
513    #[prost(message, optional, tag = "1")]
514    pub delta_1: ::core::option::Option<super::super::super::num::v1::Amount>,
515    /// The total amount of asset 2 that was input to the batch swap.
516    #[prost(message, optional, tag = "2")]
517    pub delta_2: ::core::option::Option<super::super::super::num::v1::Amount>,
518    /// The total amount of asset 1 that was output from the batch swap for 2=>1 trades.
519    #[prost(message, optional, tag = "3")]
520    pub lambda_1: ::core::option::Option<super::super::super::num::v1::Amount>,
521    /// The total amount of asset 2 that was output from the batch swap for 1=>2 trades.
522    #[prost(message, optional, tag = "4")]
523    pub lambda_2: ::core::option::Option<super::super::super::num::v1::Amount>,
524    /// The total amount of asset 1 that was returned unfilled from the batch swap for 1=>2 trades.
525    #[prost(message, optional, tag = "5")]
526    pub unfilled_1: ::core::option::Option<super::super::super::num::v1::Amount>,
527    /// The total amount of asset 2 that was returned unfilled from the batch swap for 2=>1 trades.
528    #[prost(message, optional, tag = "6")]
529    pub unfilled_2: ::core::option::Option<super::super::super::num::v1::Amount>,
530    /// The height for which the batch swap data is valid.
531    #[prost(uint64, tag = "7")]
532    pub height: u64,
533    /// The trading pair associated with the batch swap.
534    #[prost(message, optional, tag = "8")]
535    pub trading_pair: ::core::option::Option<TradingPair>,
536    /// The starting block height of the epoch for which the batch swap data is valid.
537    #[deprecated]
538    #[prost(uint64, tag = "9")]
539    pub epoch_starting_height: u64,
540    /// The prefix (epoch, block) of the position where this batch swap occurred.
541    #[prost(uint64, tag = "10")]
542    pub sct_position_prefix: u64,
543}
544impl ::prost::Name for BatchSwapOutputData {
545    const NAME: &'static str = "BatchSwapOutputData";
546    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
547    fn full_name() -> ::prost::alloc::string::String {
548        "penumbra.core.component.dex.v1.BatchSwapOutputData".into()
549    }
550    fn type_url() -> ::prost::alloc::string::String {
551        "/penumbra.core.component.dex.v1.BatchSwapOutputData".into()
552    }
553}
554/// The trading function for a specific pair.
555/// For a pair (asset_1, asset_2), a trading function is defined by:
556/// `phi(R) = p*R_1 + q*R_2` and `gamma = 1 - fee`.
557/// The trading function is frequently referred to as "phi".
558#[derive(Clone, PartialEq, ::prost::Message)]
559pub struct TradingFunction {
560    #[prost(message, optional, tag = "1")]
561    pub component: ::core::option::Option<BareTradingFunction>,
562    #[prost(message, optional, tag = "2")]
563    pub pair: ::core::option::Option<TradingPair>,
564}
565impl ::prost::Name for TradingFunction {
566    const NAME: &'static str = "TradingFunction";
567    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
568    fn full_name() -> ::prost::alloc::string::String {
569        "penumbra.core.component.dex.v1.TradingFunction".into()
570    }
571    fn type_url() -> ::prost::alloc::string::String {
572        "/penumbra.core.component.dex.v1.TradingFunction".into()
573    }
574}
575/// The minimum amount of data describing a trading function.
576///
577/// This implicitly treats the trading function as being between assets 1 and 2,
578/// without specifying what those assets are, to avoid duplicating data (each
579/// asset ID alone is twice the size of the trading function).
580#[derive(Clone, Copy, PartialEq, ::prost::Message)]
581pub struct BareTradingFunction {
582    #[prost(uint32, tag = "1")]
583    pub fee: u32,
584    /// This is not actually an amount, it's an integer the same width as an amount
585    #[prost(message, optional, tag = "2")]
586    pub p: ::core::option::Option<super::super::super::num::v1::Amount>,
587    /// This is not actually an amount, it's an integer the same width as an amount
588    #[prost(message, optional, tag = "3")]
589    pub q: ::core::option::Option<super::super::super::num::v1::Amount>,
590}
591impl ::prost::Name for BareTradingFunction {
592    const NAME: &'static str = "BareTradingFunction";
593    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
594    fn full_name() -> ::prost::alloc::string::String {
595        "penumbra.core.component.dex.v1.BareTradingFunction".into()
596    }
597    fn type_url() -> ::prost::alloc::string::String {
598        "/penumbra.core.component.dex.v1.BareTradingFunction".into()
599    }
600}
601/// The reserves of a position.
602///
603/// Like a position, this implicitly treats the trading function as being
604/// between assets 1 and 2, without specifying what those assets are, to avoid
605/// duplicating data (each asset ID alone is four times the size of the
606/// reserves).
607#[derive(Clone, Copy, PartialEq, ::prost::Message)]
608pub struct Reserves {
609    #[prost(message, optional, tag = "1")]
610    pub r1: ::core::option::Option<super::super::super::num::v1::Amount>,
611    #[prost(message, optional, tag = "2")]
612    pub r2: ::core::option::Option<super::super::super::num::v1::Amount>,
613}
614impl ::prost::Name for Reserves {
615    const NAME: &'static str = "Reserves";
616    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
617    fn full_name() -> ::prost::alloc::string::String {
618        "penumbra.core.component.dex.v1.Reserves".into()
619    }
620    fn type_url() -> ::prost::alloc::string::String {
621        "/penumbra.core.component.dex.v1.Reserves".into()
622    }
623}
624/// Data identifying a position.
625#[derive(Clone, PartialEq, ::prost::Message)]
626pub struct Position {
627    #[prost(message, optional, tag = "1")]
628    pub phi: ::core::option::Option<TradingFunction>,
629    /// A random value used to disambiguate different positions with the exact same
630    /// trading function.  The chain should reject newly created positions with the
631    /// same nonce as an existing position.  This ensures that `PositionId`s will
632    /// be unique, and allows us to track position ownership with a
633    /// sequence of stateful NFTs based on the `PositionId`.
634    #[prost(bytes = "vec", tag = "2")]
635    pub nonce: ::prost::alloc::vec::Vec<u8>,
636    #[prost(message, optional, tag = "3")]
637    pub state: ::core::option::Option<PositionState>,
638    #[prost(message, optional, tag = "4")]
639    pub reserves: ::core::option::Option<Reserves>,
640    /// / If set to true, the position is a limit-order and will be closed
641    /// / immediately after being filled.
642    #[prost(bool, tag = "5")]
643    pub close_on_fill: bool,
644}
645impl ::prost::Name for Position {
646    const NAME: &'static str = "Position";
647    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
648    fn full_name() -> ::prost::alloc::string::String {
649        "penumbra.core.component.dex.v1.Position".into()
650    }
651    fn type_url() -> ::prost::alloc::string::String {
652        "/penumbra.core.component.dex.v1.Position".into()
653    }
654}
655/// A hash of a `Position`.
656#[derive(Clone, PartialEq, ::prost::Message)]
657pub struct PositionId {
658    /// The bytes of the position ID.
659    #[prost(bytes = "vec", tag = "1")]
660    pub inner: ::prost::alloc::vec::Vec<u8>,
661    /// Alternatively, a Bech32m-encoded string representation of the `inner`
662    /// bytes.
663    ///
664    /// NOTE: implementations are not required to support parsing this field.
665    /// Implementations should prefer to encode the bytes in all messages they
666    /// produce. Implementations must not accept messages with both `inner` and
667    /// `alt_bech32m` set.
668    #[prost(string, tag = "2")]
669    pub alt_bech32m: ::prost::alloc::string::String,
670}
671impl ::prost::Name for PositionId {
672    const NAME: &'static str = "PositionId";
673    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
674    fn full_name() -> ::prost::alloc::string::String {
675        "penumbra.core.component.dex.v1.PositionId".into()
676    }
677    fn type_url() -> ::prost::alloc::string::String {
678        "/penumbra.core.component.dex.v1.PositionId".into()
679    }
680}
681/// The state of a position.
682#[derive(Clone, Copy, PartialEq, ::prost::Message)]
683pub struct PositionState {
684    #[prost(enumeration = "position_state::PositionStateEnum", tag = "1")]
685    pub state: i32,
686    /// Only meaningful if `state` is `POSITION_STATE_ENUM_WITHDRAWN`.
687    ///
688    /// The sequence number allows multiple withdrawals from the same position.
689    #[prost(uint64, tag = "2")]
690    pub sequence: u64,
691}
692/// Nested message and enum types in `PositionState`.
693pub mod position_state {
694    #[derive(
695        Clone,
696        Copy,
697        Debug,
698        PartialEq,
699        Eq,
700        Hash,
701        PartialOrd,
702        Ord,
703        ::prost::Enumeration
704    )]
705    #[repr(i32)]
706    pub enum PositionStateEnum {
707        Unspecified = 0,
708        /// The position has been opened, is active, has reserves and accumulated
709        /// fees, and can be traded against.
710        Opened = 1,
711        /// The position has been closed, is inactive and can no longer be traded
712        /// against, but still has reserves and accumulated fees.
713        Closed = 2,
714        /// The final reserves and accumulated fees have been withdrawn, leaving an
715        /// empty, inactive position awaiting (possible) retroactive rewards.
716        ///
717        /// Positions can be withdrawn from multiple times, incrementing a sequence
718        /// number each time.
719        Withdrawn = 3,
720        /// Deprecated.
721        Claimed = 4,
722    }
723    impl PositionStateEnum {
724        /// String value of the enum field names used in the ProtoBuf definition.
725        ///
726        /// The values are not transformed in any way and thus are considered stable
727        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
728        pub fn as_str_name(&self) -> &'static str {
729            match self {
730                Self::Unspecified => "POSITION_STATE_ENUM_UNSPECIFIED",
731                Self::Opened => "POSITION_STATE_ENUM_OPENED",
732                Self::Closed => "POSITION_STATE_ENUM_CLOSED",
733                Self::Withdrawn => "POSITION_STATE_ENUM_WITHDRAWN",
734                Self::Claimed => "POSITION_STATE_ENUM_CLAIMED",
735            }
736        }
737        /// Creates an enum from field names used in the ProtoBuf definition.
738        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
739            match value {
740                "POSITION_STATE_ENUM_UNSPECIFIED" => Some(Self::Unspecified),
741                "POSITION_STATE_ENUM_OPENED" => Some(Self::Opened),
742                "POSITION_STATE_ENUM_CLOSED" => Some(Self::Closed),
743                "POSITION_STATE_ENUM_WITHDRAWN" => Some(Self::Withdrawn),
744                "POSITION_STATE_ENUM_CLAIMED" => Some(Self::Claimed),
745                _ => None,
746            }
747        }
748    }
749}
750impl ::prost::Name for PositionState {
751    const NAME: &'static str = "PositionState";
752    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
753    fn full_name() -> ::prost::alloc::string::String {
754        "penumbra.core.component.dex.v1.PositionState".into()
755    }
756    fn type_url() -> ::prost::alloc::string::String {
757        "/penumbra.core.component.dex.v1.PositionState".into()
758    }
759}
760/// An LPNFT tracking both ownership and state of a position.
761///
762/// Tracking the state as part of the LPNFT means that all LP-related actions can
763/// be authorized by spending funds: a state transition (e.g., closing a
764/// position) is modeled as spending an "open position LPNFT" and minting a
765/// "closed position LPNFT" for the same (globally unique) position ID.
766///
767/// This means that the LP mechanics can be agnostic to the mechanism used to
768/// record custody and spend authorization.  For instance, they can be recorded
769/// in the shielded pool, where custody is based on off-chain keys, or they could
770/// be recorded in a programmatic on-chain account (in the future, e.g., to
771/// support interchain accounts).  This also means that LP-related actions don't
772/// require any cryptographic implementation (proofs, signatures, etc), other
773/// than hooking into the value commitment mechanism used for transaction
774/// balances.
775#[derive(Clone, PartialEq, ::prost::Message)]
776pub struct LpNft {
777    #[prost(message, optional, tag = "1")]
778    pub position_id: ::core::option::Option<PositionId>,
779    #[prost(message, optional, tag = "2")]
780    pub state: ::core::option::Option<PositionState>,
781}
782impl ::prost::Name for LpNft {
783    const NAME: &'static str = "LpNft";
784    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
785    fn full_name() -> ::prost::alloc::string::String {
786        "penumbra.core.component.dex.v1.LpNft".into()
787    }
788    fn type_url() -> ::prost::alloc::string::String {
789        "/penumbra.core.component.dex.v1.LpNft".into()
790    }
791}
792/// Metadata about a position, or bundle of positions.
793/// See UIP-9 for more details.
794#[derive(Clone, Copy, PartialEq, ::prost::Message)]
795pub struct PositionMetadata {
796    /// A strategy tag for the bundle, convention:
797    /// 0x01 >= _ \< 0x40 - Reserved
798    #[prost(fixed32, tag = "1")]
799    pub strategy: u32,
800    /// A unique identifier for the bundle this position belongs to.
801    #[prost(fixed32, tag = "2")]
802    pub identifier: u32,
803}
804impl ::prost::Name for PositionMetadata {
805    const NAME: &'static str = "PositionMetadata";
806    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
807    fn full_name() -> ::prost::alloc::string::String {
808        "penumbra.core.component.dex.v1.PositionMetadata".into()
809    }
810    fn type_url() -> ::prost::alloc::string::String {
811        "/penumbra.core.component.dex.v1.PositionMetadata".into()
812    }
813}
814/// A transaction action that opens a new position.
815///
816/// This action's contribution to the transaction's value balance is to consume
817/// the initial reserves and contribute an opened position NFT.
818#[derive(Clone, PartialEq, ::prost::Message)]
819pub struct PositionOpen {
820    /// Contains the data defining the position, sufficient to compute its `PositionId`.
821    ///
822    /// Positions are immutable, so the `PositionData` (and hence the `PositionId`)
823    /// are unchanged over the entire lifetime of the position.
824    #[prost(message, optional, tag = "1")]
825    pub position: ::core::option::Option<Position>,
826    /// Either absent, or a 50 byte ciphertext encoding position metadata.
827    #[prost(bytes = "vec", tag = "2")]
828    pub encrypted_metadata: ::prost::alloc::vec::Vec<u8>,
829}
830impl ::prost::Name for PositionOpen {
831    const NAME: &'static str = "PositionOpen";
832    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
833    fn full_name() -> ::prost::alloc::string::String {
834        "penumbra.core.component.dex.v1.PositionOpen".into()
835    }
836    fn type_url() -> ::prost::alloc::string::String {
837        "/penumbra.core.component.dex.v1.PositionOpen".into()
838    }
839}
840#[derive(Clone, PartialEq, ::prost::Message)]
841pub struct PositionOpenPlan {
842    #[prost(message, optional, tag = "1")]
843    pub position: ::core::option::Option<Position>,
844    #[prost(message, optional, tag = "2")]
845    pub metadata: ::core::option::Option<PositionMetadata>,
846}
847impl ::prost::Name for PositionOpenPlan {
848    const NAME: &'static str = "PositionOpenPlan";
849    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
850    fn full_name() -> ::prost::alloc::string::String {
851        "penumbra.core.component.dex.v1.PositionOpenPlan".into()
852    }
853    fn type_url() -> ::prost::alloc::string::String {
854        "/penumbra.core.component.dex.v1.PositionOpenPlan".into()
855    }
856}
857/// A view of the position open action.
858#[derive(Clone, PartialEq, ::prost::Message)]
859pub struct PositionOpenView {
860    #[prost(oneof = "position_open_view::PositionOpenView", tags = "1, 2")]
861    pub position_open_view: ::core::option::Option<position_open_view::PositionOpenView>,
862}
863/// Nested message and enum types in `PositionOpenView`.
864pub mod position_open_view {
865    #[derive(Clone, PartialEq, ::prost::Message)]
866    pub struct Visible {
867        #[prost(message, optional, tag = "1")]
868        pub action: ::core::option::Option<super::PositionOpen>,
869        #[prost(message, optional, tag = "2")]
870        pub metadata: ::core::option::Option<super::PositionMetadata>,
871    }
872    impl ::prost::Name for Visible {
873        const NAME: &'static str = "Visible";
874        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
875        fn full_name() -> ::prost::alloc::string::String {
876            "penumbra.core.component.dex.v1.PositionOpenView.Visible".into()
877        }
878        fn type_url() -> ::prost::alloc::string::String {
879            "/penumbra.core.component.dex.v1.PositionOpenView.Visible".into()
880        }
881    }
882    #[derive(Clone, PartialEq, ::prost::Message)]
883    pub struct Opaque {
884        #[prost(message, optional, tag = "1")]
885        pub action: ::core::option::Option<super::PositionOpen>,
886    }
887    impl ::prost::Name for Opaque {
888        const NAME: &'static str = "Opaque";
889        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
890        fn full_name() -> ::prost::alloc::string::String {
891            "penumbra.core.component.dex.v1.PositionOpenView.Opaque".into()
892        }
893        fn type_url() -> ::prost::alloc::string::String {
894            "/penumbra.core.component.dex.v1.PositionOpenView.Opaque".into()
895        }
896    }
897    #[derive(Clone, PartialEq, ::prost::Oneof)]
898    pub enum PositionOpenView {
899        #[prost(message, tag = "1")]
900        Visible(Visible),
901        #[prost(message, tag = "2")]
902        Opaque(Opaque),
903    }
904}
905impl ::prost::Name for PositionOpenView {
906    const NAME: &'static str = "PositionOpenView";
907    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
908    fn full_name() -> ::prost::alloc::string::String {
909        "penumbra.core.component.dex.v1.PositionOpenView".into()
910    }
911    fn type_url() -> ::prost::alloc::string::String {
912        "/penumbra.core.component.dex.v1.PositionOpenView".into()
913    }
914}
915/// A transaction action that closes a position.
916///
917/// This action's contribution to the transaction's value balance is to consume
918/// an opened position NFT and contribute a closed position NFT.
919///
920/// Closing a position does not immediately withdraw funds, because Penumbra
921/// transactions (like any ZK transaction model) are early-binding: the prover
922/// must know the state transition they prove knowledge of, and they cannot know
923/// the final reserves with certainty until after the position has been deactivated.
924#[derive(Clone, PartialEq, ::prost::Message)]
925pub struct PositionClose {
926    #[prost(message, optional, tag = "1")]
927    pub position_id: ::core::option::Option<PositionId>,
928}
929impl ::prost::Name for PositionClose {
930    const NAME: &'static str = "PositionClose";
931    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
932    fn full_name() -> ::prost::alloc::string::String {
933        "penumbra.core.component.dex.v1.PositionClose".into()
934    }
935    fn type_url() -> ::prost::alloc::string::String {
936        "/penumbra.core.component.dex.v1.PositionClose".into()
937    }
938}
939/// A transaction action that withdraws funds from a closed position.
940///
941/// This action's contribution to the transaction's value balance is to consume a
942/// closed position NFT and contribute a withdrawn position NFT, as well as all
943/// of the funds that were in the position at the time of closing.
944#[derive(Clone, PartialEq, ::prost::Message)]
945pub struct PositionWithdraw {
946    #[prost(message, optional, tag = "1")]
947    pub position_id: ::core::option::Option<PositionId>,
948    /// A transparent (zero blinding factor) commitment to the position's final reserves and fees.
949    ///
950    /// The chain will check this commitment by recomputing it with the on-chain state.
951    #[prost(message, optional, tag = "2")]
952    pub reserves_commitment: ::core::option::Option<
953        super::super::super::asset::v1::BalanceCommitment,
954    >,
955    /// The sequence number of the withdrawal.
956    ///
957    /// This allows multiple withdrawals from the same position, rather than a single reward claim.
958    #[prost(uint64, tag = "3")]
959    pub sequence: u64,
960}
961impl ::prost::Name for PositionWithdraw {
962    const NAME: &'static str = "PositionWithdraw";
963    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
964    fn full_name() -> ::prost::alloc::string::String {
965        "penumbra.core.component.dex.v1.PositionWithdraw".into()
966    }
967    fn type_url() -> ::prost::alloc::string::String {
968        "/penumbra.core.component.dex.v1.PositionWithdraw".into()
969    }
970}
971/// Deprecated.
972#[derive(Clone, PartialEq, ::prost::Message)]
973pub struct PositionRewardClaim {
974    #[prost(message, optional, tag = "1")]
975    pub position_id: ::core::option::Option<PositionId>,
976    #[prost(message, optional, tag = "2")]
977    pub rewards_commitment: ::core::option::Option<
978        super::super::super::asset::v1::BalanceCommitment,
979    >,
980}
981impl ::prost::Name for PositionRewardClaim {
982    const NAME: &'static str = "PositionRewardClaim";
983    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
984    fn full_name() -> ::prost::alloc::string::String {
985        "penumbra.core.component.dex.v1.PositionRewardClaim".into()
986    }
987    fn type_url() -> ::prost::alloc::string::String {
988        "/penumbra.core.component.dex.v1.PositionRewardClaim".into()
989    }
990}
991/// Contains the entire execution of a particular swap.
992#[derive(Clone, PartialEq, ::prost::Message)]
993pub struct SwapExecution {
994    #[prost(message, repeated, tag = "1")]
995    pub traces: ::prost::alloc::vec::Vec<swap_execution::Trace>,
996    /// The total input amount for this execution.
997    #[prost(message, optional, tag = "2")]
998    pub input: ::core::option::Option<super::super::super::asset::v1::Value>,
999    /// The total output amount for this execution.
1000    #[prost(message, optional, tag = "3")]
1001    pub output: ::core::option::Option<super::super::super::asset::v1::Value>,
1002}
1003/// Nested message and enum types in `SwapExecution`.
1004pub mod swap_execution {
1005    /// Contains all individual steps consisting of a trade trace.
1006    #[derive(Clone, PartialEq, ::prost::Message)]
1007    pub struct Trace {
1008        /// Each step in the trade trace.
1009        #[prost(message, repeated, tag = "1")]
1010        pub value: ::prost::alloc::vec::Vec<
1011            super::super::super::super::asset::v1::Value,
1012        >,
1013    }
1014    impl ::prost::Name for Trace {
1015        const NAME: &'static str = "Trace";
1016        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1017        fn full_name() -> ::prost::alloc::string::String {
1018            "penumbra.core.component.dex.v1.SwapExecution.Trace".into()
1019        }
1020        fn type_url() -> ::prost::alloc::string::String {
1021            "/penumbra.core.component.dex.v1.SwapExecution.Trace".into()
1022        }
1023    }
1024}
1025impl ::prost::Name for SwapExecution {
1026    const NAME: &'static str = "SwapExecution";
1027    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1028    fn full_name() -> ::prost::alloc::string::String {
1029        "penumbra.core.component.dex.v1.SwapExecution".into()
1030    }
1031    fn type_url() -> ::prost::alloc::string::String {
1032        "/penumbra.core.component.dex.v1.SwapExecution".into()
1033    }
1034}
1035/// Contains private and public data for withdrawing funds from a closed position.
1036#[derive(Clone, PartialEq, ::prost::Message)]
1037pub struct PositionWithdrawPlan {
1038    #[prost(message, optional, tag = "1")]
1039    pub reserves: ::core::option::Option<Reserves>,
1040    #[prost(message, optional, tag = "2")]
1041    pub position_id: ::core::option::Option<PositionId>,
1042    #[prost(message, optional, tag = "3")]
1043    pub pair: ::core::option::Option<TradingPair>,
1044    /// The sequence number of the withdrawal.
1045    #[prost(uint64, tag = "4")]
1046    pub sequence: u64,
1047    /// Any accumulated rewards assigned to this position.
1048    #[prost(message, repeated, tag = "5")]
1049    pub rewards: ::prost::alloc::vec::Vec<super::super::super::asset::v1::Value>,
1050}
1051impl ::prost::Name for PositionWithdrawPlan {
1052    const NAME: &'static str = "PositionWithdrawPlan";
1053    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1054    fn full_name() -> ::prost::alloc::string::String {
1055        "penumbra.core.component.dex.v1.PositionWithdrawPlan".into()
1056    }
1057    fn type_url() -> ::prost::alloc::string::String {
1058        "/penumbra.core.component.dex.v1.PositionWithdrawPlan".into()
1059    }
1060}
1061/// Deprecated.
1062#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1063pub struct PositionRewardClaimPlan {
1064    #[prost(message, optional, tag = "1")]
1065    pub reserves: ::core::option::Option<Reserves>,
1066}
1067impl ::prost::Name for PositionRewardClaimPlan {
1068    const NAME: &'static str = "PositionRewardClaimPlan";
1069    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1070    fn full_name() -> ::prost::alloc::string::String {
1071        "penumbra.core.component.dex.v1.PositionRewardClaimPlan".into()
1072    }
1073    fn type_url() -> ::prost::alloc::string::String {
1074        "/penumbra.core.component.dex.v1.PositionRewardClaimPlan".into()
1075    }
1076}
1077/// Requests batch swap data associated with a given height and trading pair from the view service.
1078#[derive(Clone, PartialEq, ::prost::Message)]
1079pub struct BatchSwapOutputDataRequest {
1080    #[prost(uint64, tag = "2")]
1081    pub height: u64,
1082    #[prost(message, optional, tag = "3")]
1083    pub trading_pair: ::core::option::Option<TradingPair>,
1084}
1085impl ::prost::Name for BatchSwapOutputDataRequest {
1086    const NAME: &'static str = "BatchSwapOutputDataRequest";
1087    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1088    fn full_name() -> ::prost::alloc::string::String {
1089        "penumbra.core.component.dex.v1.BatchSwapOutputDataRequest".into()
1090    }
1091    fn type_url() -> ::prost::alloc::string::String {
1092        "/penumbra.core.component.dex.v1.BatchSwapOutputDataRequest".into()
1093    }
1094}
1095#[derive(Clone, PartialEq, ::prost::Message)]
1096pub struct BatchSwapOutputDataResponse {
1097    #[prost(message, optional, tag = "1")]
1098    pub data: ::core::option::Option<BatchSwapOutputData>,
1099}
1100impl ::prost::Name for BatchSwapOutputDataResponse {
1101    const NAME: &'static str = "BatchSwapOutputDataResponse";
1102    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1103    fn full_name() -> ::prost::alloc::string::String {
1104        "penumbra.core.component.dex.v1.BatchSwapOutputDataResponse".into()
1105    }
1106    fn type_url() -> ::prost::alloc::string::String {
1107        "/penumbra.core.component.dex.v1.BatchSwapOutputDataResponse".into()
1108    }
1109}
1110#[derive(Clone, PartialEq, ::prost::Message)]
1111pub struct SwapExecutionRequest {
1112    #[prost(uint64, tag = "2")]
1113    pub height: u64,
1114    #[prost(message, optional, tag = "3")]
1115    pub trading_pair: ::core::option::Option<DirectedTradingPair>,
1116}
1117impl ::prost::Name for SwapExecutionRequest {
1118    const NAME: &'static str = "SwapExecutionRequest";
1119    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1120    fn full_name() -> ::prost::alloc::string::String {
1121        "penumbra.core.component.dex.v1.SwapExecutionRequest".into()
1122    }
1123    fn type_url() -> ::prost::alloc::string::String {
1124        "/penumbra.core.component.dex.v1.SwapExecutionRequest".into()
1125    }
1126}
1127#[derive(Clone, PartialEq, ::prost::Message)]
1128pub struct SwapExecutionResponse {
1129    #[prost(message, optional, tag = "1")]
1130    pub swap_execution: ::core::option::Option<SwapExecution>,
1131}
1132impl ::prost::Name for SwapExecutionResponse {
1133    const NAME: &'static str = "SwapExecutionResponse";
1134    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1135    fn full_name() -> ::prost::alloc::string::String {
1136        "penumbra.core.component.dex.v1.SwapExecutionResponse".into()
1137    }
1138    fn type_url() -> ::prost::alloc::string::String {
1139        "/penumbra.core.component.dex.v1.SwapExecutionResponse".into()
1140    }
1141}
1142#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1143pub struct ArbExecutionRequest {
1144    #[prost(uint64, tag = "2")]
1145    pub height: u64,
1146}
1147impl ::prost::Name for ArbExecutionRequest {
1148    const NAME: &'static str = "ArbExecutionRequest";
1149    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1150    fn full_name() -> ::prost::alloc::string::String {
1151        "penumbra.core.component.dex.v1.ArbExecutionRequest".into()
1152    }
1153    fn type_url() -> ::prost::alloc::string::String {
1154        "/penumbra.core.component.dex.v1.ArbExecutionRequest".into()
1155    }
1156}
1157#[derive(Clone, PartialEq, ::prost::Message)]
1158pub struct ArbExecutionResponse {
1159    #[prost(message, optional, tag = "1")]
1160    pub swap_execution: ::core::option::Option<SwapExecution>,
1161    #[prost(uint64, tag = "2")]
1162    pub height: u64,
1163}
1164impl ::prost::Name for ArbExecutionResponse {
1165    const NAME: &'static str = "ArbExecutionResponse";
1166    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1167    fn full_name() -> ::prost::alloc::string::String {
1168        "penumbra.core.component.dex.v1.ArbExecutionResponse".into()
1169    }
1170    fn type_url() -> ::prost::alloc::string::String {
1171        "/penumbra.core.component.dex.v1.ArbExecutionResponse".into()
1172    }
1173}
1174#[derive(Clone, PartialEq, ::prost::Message)]
1175pub struct SwapExecutionsRequest {
1176    /// If present, only return swap executions occurring after the given height.
1177    #[prost(uint64, tag = "2")]
1178    pub start_height: u64,
1179    /// If present, only return swap executions occurring before the given height.
1180    #[prost(uint64, tag = "3")]
1181    pub end_height: u64,
1182    /// If present, filter swap executions by the given trading pair.
1183    #[prost(message, optional, tag = "4")]
1184    pub trading_pair: ::core::option::Option<DirectedTradingPair>,
1185}
1186impl ::prost::Name for SwapExecutionsRequest {
1187    const NAME: &'static str = "SwapExecutionsRequest";
1188    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1189    fn full_name() -> ::prost::alloc::string::String {
1190        "penumbra.core.component.dex.v1.SwapExecutionsRequest".into()
1191    }
1192    fn type_url() -> ::prost::alloc::string::String {
1193        "/penumbra.core.component.dex.v1.SwapExecutionsRequest".into()
1194    }
1195}
1196#[derive(Clone, PartialEq, ::prost::Message)]
1197pub struct SwapExecutionsResponse {
1198    #[prost(message, optional, tag = "1")]
1199    pub swap_execution: ::core::option::Option<SwapExecution>,
1200    #[prost(uint64, tag = "2")]
1201    pub height: u64,
1202    #[prost(message, optional, tag = "3")]
1203    pub trading_pair: ::core::option::Option<DirectedTradingPair>,
1204}
1205impl ::prost::Name for SwapExecutionsResponse {
1206    const NAME: &'static str = "SwapExecutionsResponse";
1207    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1208    fn full_name() -> ::prost::alloc::string::String {
1209        "penumbra.core.component.dex.v1.SwapExecutionsResponse".into()
1210    }
1211    fn type_url() -> ::prost::alloc::string::String {
1212        "/penumbra.core.component.dex.v1.SwapExecutionsResponse".into()
1213    }
1214}
1215#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1216pub struct ArbExecutionsRequest {
1217    /// If present, only return arb executions occurring after the given height.
1218    #[prost(uint64, tag = "2")]
1219    pub start_height: u64,
1220    /// If present, only return arb executions occurring before the given height.
1221    #[prost(uint64, tag = "3")]
1222    pub end_height: u64,
1223}
1224impl ::prost::Name for ArbExecutionsRequest {
1225    const NAME: &'static str = "ArbExecutionsRequest";
1226    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1227    fn full_name() -> ::prost::alloc::string::String {
1228        "penumbra.core.component.dex.v1.ArbExecutionsRequest".into()
1229    }
1230    fn type_url() -> ::prost::alloc::string::String {
1231        "/penumbra.core.component.dex.v1.ArbExecutionsRequest".into()
1232    }
1233}
1234#[derive(Clone, PartialEq, ::prost::Message)]
1235pub struct ArbExecutionsResponse {
1236    #[prost(message, optional, tag = "1")]
1237    pub swap_execution: ::core::option::Option<SwapExecution>,
1238    #[prost(uint64, tag = "2")]
1239    pub height: u64,
1240}
1241impl ::prost::Name for ArbExecutionsResponse {
1242    const NAME: &'static str = "ArbExecutionsResponse";
1243    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1244    fn full_name() -> ::prost::alloc::string::String {
1245        "penumbra.core.component.dex.v1.ArbExecutionsResponse".into()
1246    }
1247    fn type_url() -> ::prost::alloc::string::String {
1248        "/penumbra.core.component.dex.v1.ArbExecutionsResponse".into()
1249    }
1250}
1251#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1252pub struct LiquidityPositionsRequest {
1253    /// If true, include closed and withdrawn positions.
1254    #[prost(bool, tag = "4")]
1255    pub include_closed: bool,
1256}
1257impl ::prost::Name for LiquidityPositionsRequest {
1258    const NAME: &'static str = "LiquidityPositionsRequest";
1259    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1260    fn full_name() -> ::prost::alloc::string::String {
1261        "penumbra.core.component.dex.v1.LiquidityPositionsRequest".into()
1262    }
1263    fn type_url() -> ::prost::alloc::string::String {
1264        "/penumbra.core.component.dex.v1.LiquidityPositionsRequest".into()
1265    }
1266}
1267#[derive(Clone, PartialEq, ::prost::Message)]
1268pub struct LiquidityPositionsResponse {
1269    #[prost(message, optional, tag = "1")]
1270    pub data: ::core::option::Option<Position>,
1271}
1272impl ::prost::Name for LiquidityPositionsResponse {
1273    const NAME: &'static str = "LiquidityPositionsResponse";
1274    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1275    fn full_name() -> ::prost::alloc::string::String {
1276        "penumbra.core.component.dex.v1.LiquidityPositionsResponse".into()
1277    }
1278    fn type_url() -> ::prost::alloc::string::String {
1279        "/penumbra.core.component.dex.v1.LiquidityPositionsResponse".into()
1280    }
1281}
1282#[derive(Clone, PartialEq, ::prost::Message)]
1283pub struct LiquidityPositionByIdRequest {
1284    #[prost(message, optional, tag = "2")]
1285    pub position_id: ::core::option::Option<PositionId>,
1286}
1287impl ::prost::Name for LiquidityPositionByIdRequest {
1288    const NAME: &'static str = "LiquidityPositionByIdRequest";
1289    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1290    fn full_name() -> ::prost::alloc::string::String {
1291        "penumbra.core.component.dex.v1.LiquidityPositionByIdRequest".into()
1292    }
1293    fn type_url() -> ::prost::alloc::string::String {
1294        "/penumbra.core.component.dex.v1.LiquidityPositionByIdRequest".into()
1295    }
1296}
1297#[derive(Clone, PartialEq, ::prost::Message)]
1298pub struct LiquidityPositionByIdResponse {
1299    #[prost(message, optional, tag = "1")]
1300    pub data: ::core::option::Option<Position>,
1301}
1302impl ::prost::Name for LiquidityPositionByIdResponse {
1303    const NAME: &'static str = "LiquidityPositionByIdResponse";
1304    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1305    fn full_name() -> ::prost::alloc::string::String {
1306        "penumbra.core.component.dex.v1.LiquidityPositionByIdResponse".into()
1307    }
1308    fn type_url() -> ::prost::alloc::string::String {
1309        "/penumbra.core.component.dex.v1.LiquidityPositionByIdResponse".into()
1310    }
1311}
1312#[derive(Clone, PartialEq, ::prost::Message)]
1313pub struct LiquidityPositionsByIdRequest {
1314    #[prost(message, repeated, tag = "2")]
1315    pub position_id: ::prost::alloc::vec::Vec<PositionId>,
1316}
1317impl ::prost::Name for LiquidityPositionsByIdRequest {
1318    const NAME: &'static str = "LiquidityPositionsByIdRequest";
1319    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1320    fn full_name() -> ::prost::alloc::string::String {
1321        "penumbra.core.component.dex.v1.LiquidityPositionsByIdRequest".into()
1322    }
1323    fn type_url() -> ::prost::alloc::string::String {
1324        "/penumbra.core.component.dex.v1.LiquidityPositionsByIdRequest".into()
1325    }
1326}
1327#[derive(Clone, PartialEq, ::prost::Message)]
1328pub struct LiquidityPositionsByIdResponse {
1329    #[prost(message, optional, tag = "1")]
1330    pub data: ::core::option::Option<Position>,
1331}
1332impl ::prost::Name for LiquidityPositionsByIdResponse {
1333    const NAME: &'static str = "LiquidityPositionsByIdResponse";
1334    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1335    fn full_name() -> ::prost::alloc::string::String {
1336        "penumbra.core.component.dex.v1.LiquidityPositionsByIdResponse".into()
1337    }
1338    fn type_url() -> ::prost::alloc::string::String {
1339        "/penumbra.core.component.dex.v1.LiquidityPositionsByIdResponse".into()
1340    }
1341}
1342#[derive(Clone, PartialEq, ::prost::Message)]
1343pub struct LiquidityPositionsByPriceRequest {
1344    /// The directed trading pair to request positions for
1345    #[prost(message, optional, tag = "2")]
1346    pub trading_pair: ::core::option::Option<DirectedTradingPair>,
1347    /// The maximum number of positions to return.
1348    #[prost(uint64, tag = "5")]
1349    pub limit: u64,
1350}
1351impl ::prost::Name for LiquidityPositionsByPriceRequest {
1352    const NAME: &'static str = "LiquidityPositionsByPriceRequest";
1353    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1354    fn full_name() -> ::prost::alloc::string::String {
1355        "penumbra.core.component.dex.v1.LiquidityPositionsByPriceRequest".into()
1356    }
1357    fn type_url() -> ::prost::alloc::string::String {
1358        "/penumbra.core.component.dex.v1.LiquidityPositionsByPriceRequest".into()
1359    }
1360}
1361#[derive(Clone, PartialEq, ::prost::Message)]
1362pub struct LiquidityPositionsByPriceResponse {
1363    #[prost(message, optional, tag = "1")]
1364    pub data: ::core::option::Option<Position>,
1365    #[prost(message, optional, tag = "2")]
1366    pub id: ::core::option::Option<PositionId>,
1367}
1368impl ::prost::Name for LiquidityPositionsByPriceResponse {
1369    const NAME: &'static str = "LiquidityPositionsByPriceResponse";
1370    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1371    fn full_name() -> ::prost::alloc::string::String {
1372        "penumbra.core.component.dex.v1.LiquidityPositionsByPriceResponse".into()
1373    }
1374    fn type_url() -> ::prost::alloc::string::String {
1375        "/penumbra.core.component.dex.v1.LiquidityPositionsByPriceResponse".into()
1376    }
1377}
1378#[derive(Clone, PartialEq, ::prost::Message)]
1379pub struct SpreadRequest {
1380    #[prost(message, optional, tag = "2")]
1381    pub trading_pair: ::core::option::Option<TradingPair>,
1382}
1383impl ::prost::Name for SpreadRequest {
1384    const NAME: &'static str = "SpreadRequest";
1385    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1386    fn full_name() -> ::prost::alloc::string::String {
1387        "penumbra.core.component.dex.v1.SpreadRequest".into()
1388    }
1389    fn type_url() -> ::prost::alloc::string::String {
1390        "/penumbra.core.component.dex.v1.SpreadRequest".into()
1391    }
1392}
1393#[derive(Clone, PartialEq, ::prost::Message)]
1394pub struct SpreadResponse {
1395    /// The best position when trading 1 => 2.
1396    #[prost(message, optional, tag = "1")]
1397    pub best_1_to_2_position: ::core::option::Option<Position>,
1398    /// The best position when trading 2 => 1.
1399    #[prost(message, optional, tag = "2")]
1400    pub best_2_to_1_position: ::core::option::Option<Position>,
1401    /// An approximation of the effective price when trading 1 => 2.
1402    #[prost(double, tag = "3")]
1403    pub approx_effective_price_1_to_2: f64,
1404    /// An approximation of the effective price when trading 2 => 1.
1405    #[prost(double, tag = "4")]
1406    pub approx_effective_price_2_to_1: f64,
1407}
1408impl ::prost::Name for SpreadResponse {
1409    const NAME: &'static str = "SpreadResponse";
1410    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1411    fn full_name() -> ::prost::alloc::string::String {
1412        "penumbra.core.component.dex.v1.SpreadResponse".into()
1413    }
1414    fn type_url() -> ::prost::alloc::string::String {
1415        "/penumbra.core.component.dex.v1.SpreadResponse".into()
1416    }
1417}
1418#[derive(Clone, PartialEq, ::prost::Message)]
1419pub struct SimulateTradeRequest {
1420    #[prost(message, optional, tag = "1")]
1421    pub input: ::core::option::Option<super::super::super::asset::v1::Value>,
1422    #[prost(message, optional, tag = "2")]
1423    pub output: ::core::option::Option<super::super::super::asset::v1::AssetId>,
1424    #[prost(message, optional, tag = "3")]
1425    pub routing: ::core::option::Option<simulate_trade_request::Routing>,
1426}
1427/// Nested message and enum types in `SimulateTradeRequest`.
1428pub mod simulate_trade_request {
1429    #[derive(Clone, Copy, PartialEq, ::prost::Message)]
1430    pub struct Routing {
1431        #[prost(oneof = "routing::Setting", tags = "1, 2")]
1432        pub setting: ::core::option::Option<routing::Setting>,
1433    }
1434    /// Nested message and enum types in `Routing`.
1435    pub mod routing {
1436        #[derive(Clone, Copy, PartialEq, ::prost::Message)]
1437        pub struct SingleHop {}
1438        impl ::prost::Name for SingleHop {
1439            const NAME: &'static str = "SingleHop";
1440            const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1441            fn full_name() -> ::prost::alloc::string::String {
1442                "penumbra.core.component.dex.v1.SimulateTradeRequest.Routing.SingleHop"
1443                    .into()
1444            }
1445            fn type_url() -> ::prost::alloc::string::String {
1446                "/penumbra.core.component.dex.v1.SimulateTradeRequest.Routing.SingleHop"
1447                    .into()
1448            }
1449        }
1450        #[derive(Clone, Copy, PartialEq, ::prost::Message)]
1451        pub struct Default {}
1452        impl ::prost::Name for Default {
1453            const NAME: &'static str = "Default";
1454            const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1455            fn full_name() -> ::prost::alloc::string::String {
1456                "penumbra.core.component.dex.v1.SimulateTradeRequest.Routing.Default"
1457                    .into()
1458            }
1459            fn type_url() -> ::prost::alloc::string::String {
1460                "/penumbra.core.component.dex.v1.SimulateTradeRequest.Routing.Default"
1461                    .into()
1462            }
1463        }
1464        #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
1465        pub enum Setting {
1466            #[prost(message, tag = "1")]
1467            Default(Default),
1468            #[prost(message, tag = "2")]
1469            SingleHop(SingleHop),
1470        }
1471    }
1472    impl ::prost::Name for Routing {
1473        const NAME: &'static str = "Routing";
1474        const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1475        fn full_name() -> ::prost::alloc::string::String {
1476            "penumbra.core.component.dex.v1.SimulateTradeRequest.Routing".into()
1477        }
1478        fn type_url() -> ::prost::alloc::string::String {
1479            "/penumbra.core.component.dex.v1.SimulateTradeRequest.Routing".into()
1480        }
1481    }
1482}
1483impl ::prost::Name for SimulateTradeRequest {
1484    const NAME: &'static str = "SimulateTradeRequest";
1485    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1486    fn full_name() -> ::prost::alloc::string::String {
1487        "penumbra.core.component.dex.v1.SimulateTradeRequest".into()
1488    }
1489    fn type_url() -> ::prost::alloc::string::String {
1490        "/penumbra.core.component.dex.v1.SimulateTradeRequest".into()
1491    }
1492}
1493#[derive(Clone, PartialEq, ::prost::Message)]
1494pub struct SimulateTradeResponse {
1495    #[prost(message, optional, tag = "1")]
1496    pub output: ::core::option::Option<SwapExecution>,
1497    /// Estimated input amount that will not be swapped due to liquidity
1498    #[prost(message, optional, tag = "2")]
1499    pub unfilled: ::core::option::Option<super::super::super::asset::v1::Value>,
1500}
1501impl ::prost::Name for SimulateTradeResponse {
1502    const NAME: &'static str = "SimulateTradeResponse";
1503    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1504    fn full_name() -> ::prost::alloc::string::String {
1505        "penumbra.core.component.dex.v1.SimulateTradeResponse".into()
1506    }
1507    fn type_url() -> ::prost::alloc::string::String {
1508        "/penumbra.core.component.dex.v1.SimulateTradeResponse".into()
1509    }
1510}
1511#[derive(Clone, PartialEq, ::prost::Message)]
1512pub struct EventSwap {
1513    /// The trading pair to swap.
1514    #[prost(message, optional, tag = "1")]
1515    pub trading_pair: ::core::option::Option<TradingPair>,
1516    /// The amount for asset 1.
1517    #[prost(message, optional, tag = "2")]
1518    pub delta_1_i: ::core::option::Option<super::super::super::num::v1::Amount>,
1519    /// The amount for asset 2.
1520    #[prost(message, optional, tag = "3")]
1521    pub delta_2_i: ::core::option::Option<super::super::super::num::v1::Amount>,
1522    /// The swap commitment.
1523    #[prost(message, optional, tag = "4")]
1524    pub swap_commitment: ::core::option::Option<
1525        super::super::super::super::crypto::tct::v1::StateCommitment,
1526    >,
1527}
1528impl ::prost::Name for EventSwap {
1529    const NAME: &'static str = "EventSwap";
1530    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1531    fn full_name() -> ::prost::alloc::string::String {
1532        "penumbra.core.component.dex.v1.EventSwap".into()
1533    }
1534    fn type_url() -> ::prost::alloc::string::String {
1535        "/penumbra.core.component.dex.v1.EventSwap".into()
1536    }
1537}
1538/// Tracks the LQT eligible volume for a position.
1539/// The volume corresponds to the outflow of staking tokens from
1540/// the position.
1541#[derive(Clone, PartialEq, ::prost::Message)]
1542pub struct EventLqtPositionVolume {
1543    /// The epoch for which the volume was recorded.
1544    #[prost(uint64, tag = "1")]
1545    pub epoch_index: u64,
1546    /// The incentivized asset.
1547    #[prost(message, optional, tag = "2")]
1548    pub asset_id: ::core::option::Option<super::super::super::asset::v1::AssetId>,
1549    /// The position ID.
1550    #[prost(message, optional, tag = "3")]
1551    pub position_id: ::core::option::Option<PositionId>,
1552    /// The volume amount.
1553    #[prost(message, optional, tag = "4")]
1554    pub volume_amount: ::core::option::Option<super::super::super::num::v1::Amount>,
1555    /// The total volume for the pair thus far.
1556    #[prost(message, optional, tag = "5")]
1557    pub total_volume: ::core::option::Option<super::super::super::num::v1::Amount>,
1558    /// The amount of staking token flowing in (possibly 0).
1559    #[prost(message, optional, tag = "6")]
1560    pub staking_token_in: ::core::option::Option<super::super::super::num::v1::Amount>,
1561    /// The amount of the other asset flowing in (possibly 0).
1562    #[prost(message, optional, tag = "7")]
1563    pub asset_in: ::core::option::Option<super::super::super::num::v1::Amount>,
1564    /// The amount of fees we've just received in the staking token.
1565    #[prost(message, optional, tag = "8")]
1566    pub staking_fees: ::core::option::Option<super::super::super::num::v1::Amount>,
1567    /// The amount of fees we've just received in the particular asset.
1568    #[prost(message, optional, tag = "9")]
1569    pub asset_fees: ::core::option::Option<super::super::super::num::v1::Amount>,
1570}
1571impl ::prost::Name for EventLqtPositionVolume {
1572    const NAME: &'static str = "EventLqtPositionVolume";
1573    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1574    fn full_name() -> ::prost::alloc::string::String {
1575        "penumbra.core.component.dex.v1.EventLqtPositionVolume".into()
1576    }
1577    fn type_url() -> ::prost::alloc::string::String {
1578        "/penumbra.core.component.dex.v1.EventLqtPositionVolume".into()
1579    }
1580}
1581#[derive(Clone, PartialEq, ::prost::Message)]
1582pub struct EventSwapClaim {
1583    /// The trading pair that is subject of the swap claim.
1584    #[prost(message, optional, tag = "1")]
1585    pub trading_pair: ::core::option::Option<TradingPair>,
1586    /// Note commitment for the first asset.
1587    #[prost(message, optional, tag = "2")]
1588    pub output_1_commitment: ::core::option::Option<
1589        super::super::super::super::crypto::tct::v1::StateCommitment,
1590    >,
1591    /// Note commitment for the second asset.
1592    #[prost(message, optional, tag = "3")]
1593    pub output_2_commitment: ::core::option::Option<
1594        super::super::super::super::crypto::tct::v1::StateCommitment,
1595    >,
1596    /// The nullifier for the swap commitment.
1597    #[prost(message, optional, tag = "4")]
1598    pub nullifier: ::core::option::Option<super::super::sct::v1::Nullifier>,
1599}
1600impl ::prost::Name for EventSwapClaim {
1601    const NAME: &'static str = "EventSwapClaim";
1602    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1603    fn full_name() -> ::prost::alloc::string::String {
1604        "penumbra.core.component.dex.v1.EventSwapClaim".into()
1605    }
1606    fn type_url() -> ::prost::alloc::string::String {
1607        "/penumbra.core.component.dex.v1.EventSwapClaim".into()
1608    }
1609}
1610#[derive(Clone, PartialEq, ::prost::Message)]
1611pub struct EventPositionOpen {
1612    /// Position ID.
1613    #[prost(message, optional, tag = "1")]
1614    pub position_id: ::core::option::Option<PositionId>,
1615    /// The trading pair to open.
1616    #[prost(message, optional, tag = "2")]
1617    pub trading_pair: ::core::option::Option<TradingPair>,
1618    /// The amount for asset 1.
1619    #[prost(message, optional, tag = "3")]
1620    pub reserves_1: ::core::option::Option<super::super::super::num::v1::Amount>,
1621    /// The amount for asset 2.
1622    #[prost(message, optional, tag = "4")]
1623    pub reserves_2: ::core::option::Option<super::super::super::num::v1::Amount>,
1624    /// The trading fee for the position, expressed in basis points.
1625    /// e.g. 2% fee is expressed as 200, 100% fee is expressed as 10000;
1626    #[prost(uint32, tag = "5")]
1627    pub trading_fee: u32,
1628    /// The full position.
1629    ///
1630    /// This is somewhat redundant, but contains any information not present above.
1631    #[prost(message, optional, tag = "6")]
1632    pub position: ::core::option::Option<Position>,
1633}
1634impl ::prost::Name for EventPositionOpen {
1635    const NAME: &'static str = "EventPositionOpen";
1636    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1637    fn full_name() -> ::prost::alloc::string::String {
1638        "penumbra.core.component.dex.v1.EventPositionOpen".into()
1639    }
1640    fn type_url() -> ::prost::alloc::string::String {
1641        "/penumbra.core.component.dex.v1.EventPositionOpen".into()
1642    }
1643}
1644#[derive(Clone, PartialEq, ::prost::Message)]
1645pub struct EventPositionClose {
1646    /// The ID of the closed position
1647    #[prost(message, optional, tag = "1")]
1648    pub position_id: ::core::option::Option<PositionId>,
1649}
1650impl ::prost::Name for EventPositionClose {
1651    const NAME: &'static str = "EventPositionClose";
1652    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1653    fn full_name() -> ::prost::alloc::string::String {
1654        "penumbra.core.component.dex.v1.EventPositionClose".into()
1655    }
1656    fn type_url() -> ::prost::alloc::string::String {
1657        "/penumbra.core.component.dex.v1.EventPositionClose".into()
1658    }
1659}
1660#[derive(Clone, PartialEq, ::prost::Message)]
1661pub struct EventQueuePositionClose {
1662    /// The ID of the position queued that is closed for closure.
1663    #[prost(message, optional, tag = "1")]
1664    pub position_id: ::core::option::Option<PositionId>,
1665}
1666impl ::prost::Name for EventQueuePositionClose {
1667    const NAME: &'static str = "EventQueuePositionClose";
1668    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1669    fn full_name() -> ::prost::alloc::string::String {
1670        "penumbra.core.component.dex.v1.EventQueuePositionClose".into()
1671    }
1672    fn type_url() -> ::prost::alloc::string::String {
1673        "/penumbra.core.component.dex.v1.EventQueuePositionClose".into()
1674    }
1675}
1676#[derive(Clone, PartialEq, ::prost::Message)]
1677pub struct EventPositionWithdraw {
1678    /// The ID of the withdrawn position.
1679    #[prost(message, optional, tag = "1")]
1680    pub position_id: ::core::option::Option<PositionId>,
1681    /// The trading pair of the withdrawn position.
1682    #[prost(message, optional, tag = "2")]
1683    pub trading_pair: ::core::option::Option<TradingPair>,
1684    /// The reserves of asset 1 of the withdrawn position.
1685    #[prost(message, optional, tag = "3")]
1686    pub reserves_1: ::core::option::Option<super::super::super::num::v1::Amount>,
1687    /// The reserves of asset 2 of the withdrawn position.
1688    #[prost(message, optional, tag = "4")]
1689    pub reserves_2: ::core::option::Option<super::super::super::num::v1::Amount>,
1690    /// The sequence number of the withdrawal.
1691    #[prost(uint64, tag = "5")]
1692    pub sequence: u64,
1693}
1694impl ::prost::Name for EventPositionWithdraw {
1695    const NAME: &'static str = "EventPositionWithdraw";
1696    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1697    fn full_name() -> ::prost::alloc::string::String {
1698        "penumbra.core.component.dex.v1.EventPositionWithdraw".into()
1699    }
1700    fn type_url() -> ::prost::alloc::string::String {
1701        "/penumbra.core.component.dex.v1.EventPositionWithdraw".into()
1702    }
1703}
1704#[derive(Clone, PartialEq, ::prost::Message)]
1705pub struct EventPositionExecution {
1706    /// The ID of the position executed against.
1707    #[prost(message, optional, tag = "1")]
1708    pub position_id: ::core::option::Option<PositionId>,
1709    /// The trading pair of the position executed against.
1710    #[prost(message, optional, tag = "2")]
1711    pub trading_pair: ::core::option::Option<TradingPair>,
1712    /// The reserves of asset 1 of the position after execution.
1713    #[prost(message, optional, tag = "3")]
1714    pub reserves_1: ::core::option::Option<super::super::super::num::v1::Amount>,
1715    /// The reserves of asset 2 of the position after execution.
1716    #[prost(message, optional, tag = "4")]
1717    pub reserves_2: ::core::option::Option<super::super::super::num::v1::Amount>,
1718    /// The reserves of asset 1 of the position before execution.
1719    #[prost(message, optional, tag = "5")]
1720    pub prev_reserves_1: ::core::option::Option<super::super::super::num::v1::Amount>,
1721    /// The reserves of asset 2 of the position before execution.
1722    #[prost(message, optional, tag = "6")]
1723    pub prev_reserves_2: ::core::option::Option<super::super::super::num::v1::Amount>,
1724    /// Context: the end-to-end route that was being traversed during execution.
1725    #[prost(message, optional, tag = "7")]
1726    pub context: ::core::option::Option<DirectedTradingPair>,
1727}
1728impl ::prost::Name for EventPositionExecution {
1729    const NAME: &'static str = "EventPositionExecution";
1730    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1731    fn full_name() -> ::prost::alloc::string::String {
1732        "penumbra.core.component.dex.v1.EventPositionExecution".into()
1733    }
1734    fn type_url() -> ::prost::alloc::string::String {
1735        "/penumbra.core.component.dex.v1.EventPositionExecution".into()
1736    }
1737}
1738#[derive(Clone, PartialEq, ::prost::Message)]
1739pub struct EventBatchSwap {
1740    /// The BatchSwapOutputData containing the results of the batch swap.
1741    #[prost(message, optional, tag = "1")]
1742    pub batch_swap_output_data: ::core::option::Option<BatchSwapOutputData>,
1743    /// The record of execution for the batch swap in the 1 -> 2 direction.
1744    #[prost(message, optional, tag = "2")]
1745    pub swap_execution_1_for_2: ::core::option::Option<SwapExecution>,
1746    /// The record of execution for the batch swap in the 2 -> 1 direction.
1747    #[prost(message, optional, tag = "3")]
1748    pub swap_execution_2_for_1: ::core::option::Option<SwapExecution>,
1749}
1750impl ::prost::Name for EventBatchSwap {
1751    const NAME: &'static str = "EventBatchSwap";
1752    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1753    fn full_name() -> ::prost::alloc::string::String {
1754        "penumbra.core.component.dex.v1.EventBatchSwap".into()
1755    }
1756    fn type_url() -> ::prost::alloc::string::String {
1757        "/penumbra.core.component.dex.v1.EventBatchSwap".into()
1758    }
1759}
1760#[derive(Clone, PartialEq, ::prost::Message)]
1761pub struct EventArbExecution {
1762    /// The height at which the arb execution occurred.
1763    #[prost(uint64, tag = "1")]
1764    pub height: u64,
1765    /// The record of execution for the arb execution.
1766    #[prost(message, optional, tag = "2")]
1767    pub swap_execution: ::core::option::Option<SwapExecution>,
1768}
1769impl ::prost::Name for EventArbExecution {
1770    const NAME: &'static str = "EventArbExecution";
1771    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1772    fn full_name() -> ::prost::alloc::string::String {
1773        "penumbra.core.component.dex.v1.EventArbExecution".into()
1774    }
1775    fn type_url() -> ::prost::alloc::string::String {
1776        "/penumbra.core.component.dex.v1.EventArbExecution".into()
1777    }
1778}
1779/// Indicates that value was added to the DEX.
1780#[derive(Clone, PartialEq, ::prost::Message)]
1781pub struct EventValueCircuitBreakerCredit {
1782    /// The asset ID being deposited into the DEX.
1783    #[prost(message, optional, tag = "1")]
1784    pub asset_id: ::core::option::Option<super::super::super::asset::v1::AssetId>,
1785    /// The previous balance of the asset in the DEX.
1786    #[prost(message, optional, tag = "2")]
1787    pub previous_balance: ::core::option::Option<super::super::super::num::v1::Amount>,
1788    /// The new balance of the asset in the DEX.
1789    #[prost(message, optional, tag = "3")]
1790    pub new_balance: ::core::option::Option<super::super::super::num::v1::Amount>,
1791}
1792impl ::prost::Name for EventValueCircuitBreakerCredit {
1793    const NAME: &'static str = "EventValueCircuitBreakerCredit";
1794    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1795    fn full_name() -> ::prost::alloc::string::String {
1796        "penumbra.core.component.dex.v1.EventValueCircuitBreakerCredit".into()
1797    }
1798    fn type_url() -> ::prost::alloc::string::String {
1799        "/penumbra.core.component.dex.v1.EventValueCircuitBreakerCredit".into()
1800    }
1801}
1802/// Indicates that value is leaving the DEX.
1803#[derive(Clone, PartialEq, ::prost::Message)]
1804pub struct EventValueCircuitBreakerDebit {
1805    /// The asset ID being deposited into the DEX.
1806    #[prost(message, optional, tag = "1")]
1807    pub asset_id: ::core::option::Option<super::super::super::asset::v1::AssetId>,
1808    /// The previous balance of the asset in the DEX.
1809    #[prost(message, optional, tag = "2")]
1810    pub previous_balance: ::core::option::Option<super::super::super::num::v1::Amount>,
1811    /// The new balance of the asset in the DEX.
1812    #[prost(message, optional, tag = "3")]
1813    pub new_balance: ::core::option::Option<super::super::super::num::v1::Amount>,
1814}
1815impl ::prost::Name for EventValueCircuitBreakerDebit {
1816    const NAME: &'static str = "EventValueCircuitBreakerDebit";
1817    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1818    fn full_name() -> ::prost::alloc::string::String {
1819        "penumbra.core.component.dex.v1.EventValueCircuitBreakerDebit".into()
1820    }
1821    fn type_url() -> ::prost::alloc::string::String {
1822        "/penumbra.core.component.dex.v1.EventValueCircuitBreakerDebit".into()
1823    }
1824}
1825/// Emitted whenever there's non-empty candlestick data for a particular pair.
1826///
1827/// Beware: if there's no activity on a given pair, there's no guarantee
1828/// that a candlestick will be emitted.
1829#[derive(Clone, PartialEq, ::prost::Message)]
1830pub struct EventCandlestickData {
1831    /// The pair the candlestick is for.
1832    #[prost(message, optional, tag = "1")]
1833    pub pair: ::core::option::Option<DirectedTradingPair>,
1834    /// The candlestick for this particular pair.
1835    #[prost(message, optional, tag = "2")]
1836    pub stick: ::core::option::Option<CandlestickData>,
1837}
1838impl ::prost::Name for EventCandlestickData {
1839    const NAME: &'static str = "EventCandlestickData";
1840    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1841    fn full_name() -> ::prost::alloc::string::String {
1842        "penumbra.core.component.dex.v1.EventCandlestickData".into()
1843    }
1844    fn type_url() -> ::prost::alloc::string::String {
1845        "/penumbra.core.component.dex.v1.EventCandlestickData".into()
1846    }
1847}
1848#[derive(Clone, PartialEq, ::prost::Message)]
1849pub struct DexParameters {
1850    /// Whether or not the DEX is enabled.
1851    #[prost(bool, tag = "1")]
1852    pub is_enabled: bool,
1853    /// The list of fixed candidates for routing.
1854    #[prost(message, repeated, tag = "2")]
1855    pub fixed_candidates: ::prost::alloc::vec::Vec<
1856        super::super::super::asset::v1::AssetId,
1857    >,
1858    /// The number of hops to traverse while routing from A to B.
1859    #[prost(uint32, tag = "3")]
1860    pub max_hops: u32,
1861    /// The maximum number of positions per trading pair.
1862    /// If this number is exceeded, positions with the least
1863    /// inventory get evicted from the DEX.
1864    #[prost(uint32, tag = "4")]
1865    pub max_positions_per_pair: u32,
1866    /// The maximum number of routing and execution steps to be performed
1867    /// for a single pair
1868    #[prost(uint32, tag = "5")]
1869    pub max_execution_budget: u32,
1870}
1871impl ::prost::Name for DexParameters {
1872    const NAME: &'static str = "DexParameters";
1873    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1874    fn full_name() -> ::prost::alloc::string::String {
1875        "penumbra.core.component.dex.v1.DexParameters".into()
1876    }
1877    fn type_url() -> ::prost::alloc::string::String {
1878        "/penumbra.core.component.dex.v1.DexParameters".into()
1879    }
1880}
1881#[derive(Clone, PartialEq, ::prost::Message)]
1882pub struct GenesisContent {
1883    /// The initial parameters for the DEX.
1884    #[prost(message, optional, tag = "1")]
1885    pub dex_params: ::core::option::Option<DexParameters>,
1886}
1887impl ::prost::Name for GenesisContent {
1888    const NAME: &'static str = "GenesisContent";
1889    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1890    fn full_name() -> ::prost::alloc::string::String {
1891        "penumbra.core.component.dex.v1.GenesisContent".into()
1892    }
1893    fn type_url() -> ::prost::alloc::string::String {
1894        "/penumbra.core.component.dex.v1.GenesisContent".into()
1895    }
1896}
1897#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1898pub struct CandlestickData {
1899    /// The height of the candlestick data.
1900    #[prost(uint64, tag = "1")]
1901    pub height: u64,
1902    /// The first observed price during the block execution.
1903    #[prost(double, tag = "2")]
1904    pub open: f64,
1905    /// The last observed price during the block execution.
1906    #[prost(double, tag = "3")]
1907    pub close: f64,
1908    /// The highest observed price during the block execution.
1909    #[prost(double, tag = "4")]
1910    pub high: f64,
1911    /// The lowest observed price during the block execution.
1912    #[prost(double, tag = "5")]
1913    pub low: f64,
1914    /// The volume that traded "directly", during individual position executions.
1915    #[prost(double, tag = "6")]
1916    pub direct_volume: f64,
1917    /// The volume that traded as part of swaps, which could have traversed multiple routes.
1918    #[prost(double, tag = "7")]
1919    pub swap_volume: f64,
1920}
1921impl ::prost::Name for CandlestickData {
1922    const NAME: &'static str = "CandlestickData";
1923    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1924    fn full_name() -> ::prost::alloc::string::String {
1925        "penumbra.core.component.dex.v1.CandlestickData".into()
1926    }
1927    fn type_url() -> ::prost::alloc::string::String {
1928        "/penumbra.core.component.dex.v1.CandlestickData".into()
1929    }
1930}
1931#[derive(Clone, PartialEq, ::prost::Message)]
1932pub struct CandlestickDataRequest {
1933    /// The directed trading pair to request candlestick data for.
1934    ///
1935    /// NOTE: the returned data will only have trades from the SOURCE asset to the
1936    /// DEST asset, not the other direction. Make another request if you want both
1937    /// sets of data.
1938    #[prost(message, optional, tag = "1")]
1939    pub pair: ::core::option::Option<DirectedTradingPair>,
1940    /// The maximum number of candlestick data points to return.
1941    ///
1942    /// The server may clamp this limit to a maximum value.
1943    #[prost(uint64, tag = "2")]
1944    pub limit: u64,
1945    /// The height to start the query from.
1946    ///
1947    /// If this is unset (= 0), the server will return the most recent data points.
1948    #[prost(uint64, tag = "3")]
1949    pub start_height: u64,
1950}
1951impl ::prost::Name for CandlestickDataRequest {
1952    const NAME: &'static str = "CandlestickDataRequest";
1953    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1954    fn full_name() -> ::prost::alloc::string::String {
1955        "penumbra.core.component.dex.v1.CandlestickDataRequest".into()
1956    }
1957    fn type_url() -> ::prost::alloc::string::String {
1958        "/penumbra.core.component.dex.v1.CandlestickDataRequest".into()
1959    }
1960}
1961#[derive(Clone, PartialEq, ::prost::Message)]
1962pub struct CandlestickDataResponse {
1963    /// The candlestick data points.
1964    #[prost(message, repeated, tag = "1")]
1965    pub data: ::prost::alloc::vec::Vec<CandlestickData>,
1966}
1967impl ::prost::Name for CandlestickDataResponse {
1968    const NAME: &'static str = "CandlestickDataResponse";
1969    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1970    fn full_name() -> ::prost::alloc::string::String {
1971        "penumbra.core.component.dex.v1.CandlestickDataResponse".into()
1972    }
1973    fn type_url() -> ::prost::alloc::string::String {
1974        "/penumbra.core.component.dex.v1.CandlestickDataResponse".into()
1975    }
1976}
1977#[derive(Clone, PartialEq, ::prost::Message)]
1978pub struct CandlestickDataStreamRequest {
1979    /// The directed trading pair to subscribe to.
1980    #[prost(message, optional, tag = "1")]
1981    pub pair: ::core::option::Option<DirectedTradingPair>,
1982}
1983impl ::prost::Name for CandlestickDataStreamRequest {
1984    const NAME: &'static str = "CandlestickDataStreamRequest";
1985    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
1986    fn full_name() -> ::prost::alloc::string::String {
1987        "penumbra.core.component.dex.v1.CandlestickDataStreamRequest".into()
1988    }
1989    fn type_url() -> ::prost::alloc::string::String {
1990        "/penumbra.core.component.dex.v1.CandlestickDataStreamRequest".into()
1991    }
1992}
1993#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1994pub struct CandlestickDataStreamResponse {
1995    /// The candlestick data point.
1996    #[prost(message, optional, tag = "1")]
1997    pub data: ::core::option::Option<CandlestickData>,
1998}
1999impl ::prost::Name for CandlestickDataStreamResponse {
2000    const NAME: &'static str = "CandlestickDataStreamResponse";
2001    const PACKAGE: &'static str = "penumbra.core.component.dex.v1";
2002    fn full_name() -> ::prost::alloc::string::String {
2003        "penumbra.core.component.dex.v1.CandlestickDataStreamResponse".into()
2004    }
2005    fn type_url() -> ::prost::alloc::string::String {
2006        "/penumbra.core.component.dex.v1.CandlestickDataStreamResponse".into()
2007    }
2008}
2009/// Generated client implementations.
2010#[cfg(feature = "rpc")]
2011pub mod query_service_client {
2012    #![allow(
2013        unused_variables,
2014        dead_code,
2015        missing_docs,
2016        clippy::wildcard_imports,
2017        clippy::let_unit_value,
2018    )]
2019    use tonic::codegen::*;
2020    use tonic::codegen::http::Uri;
2021    /// Query operations for the DEX component.
2022    #[derive(Debug, Clone)]
2023    pub struct QueryServiceClient<T> {
2024        inner: tonic::client::Grpc<T>,
2025    }
2026    impl QueryServiceClient<tonic::transport::Channel> {
2027        /// Attempt to create a new client by connecting to a given endpoint.
2028        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2029        where
2030            D: TryInto<tonic::transport::Endpoint>,
2031            D::Error: Into<StdError>,
2032        {
2033            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2034            Ok(Self::new(conn))
2035        }
2036    }
2037    impl<T> QueryServiceClient<T>
2038    where
2039        T: tonic::client::GrpcService<tonic::body::BoxBody>,
2040        T::Error: Into<StdError>,
2041        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2042        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2043    {
2044        pub fn new(inner: T) -> Self {
2045            let inner = tonic::client::Grpc::new(inner);
2046            Self { inner }
2047        }
2048        pub fn with_origin(inner: T, origin: Uri) -> Self {
2049            let inner = tonic::client::Grpc::with_origin(inner, origin);
2050            Self { inner }
2051        }
2052        pub fn with_interceptor<F>(
2053            inner: T,
2054            interceptor: F,
2055        ) -> QueryServiceClient<InterceptedService<T, F>>
2056        where
2057            F: tonic::service::Interceptor,
2058            T::ResponseBody: Default,
2059            T: tonic::codegen::Service<
2060                http::Request<tonic::body::BoxBody>,
2061                Response = http::Response<
2062                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
2063                >,
2064            >,
2065            <T as tonic::codegen::Service<
2066                http::Request<tonic::body::BoxBody>,
2067            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2068        {
2069            QueryServiceClient::new(InterceptedService::new(inner, interceptor))
2070        }
2071        /// Compress requests with the given encoding.
2072        ///
2073        /// This requires the server to support it otherwise it might respond with an
2074        /// error.
2075        #[must_use]
2076        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2077            self.inner = self.inner.send_compressed(encoding);
2078            self
2079        }
2080        /// Enable decompressing responses.
2081        #[must_use]
2082        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2083            self.inner = self.inner.accept_compressed(encoding);
2084            self
2085        }
2086        /// Limits the maximum size of a decoded message.
2087        ///
2088        /// Default: `4MB`
2089        #[must_use]
2090        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2091            self.inner = self.inner.max_decoding_message_size(limit);
2092            self
2093        }
2094        /// Limits the maximum size of an encoded message.
2095        ///
2096        /// Default: `usize::MAX`
2097        #[must_use]
2098        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2099            self.inner = self.inner.max_encoding_message_size(limit);
2100            self
2101        }
2102        /// Get the batch clearing prices for a specific block height and trading pair.
2103        pub async fn batch_swap_output_data(
2104            &mut self,
2105            request: impl tonic::IntoRequest<super::BatchSwapOutputDataRequest>,
2106        ) -> std::result::Result<
2107            tonic::Response<super::BatchSwapOutputDataResponse>,
2108            tonic::Status,
2109        > {
2110            self.inner
2111                .ready()
2112                .await
2113                .map_err(|e| {
2114                    tonic::Status::unknown(
2115                        format!("Service was not ready: {}", e.into()),
2116                    )
2117                })?;
2118            let codec = tonic::codec::ProstCodec::default();
2119            let path = http::uri::PathAndQuery::from_static(
2120                "/penumbra.core.component.dex.v1.QueryService/BatchSwapOutputData",
2121            );
2122            let mut req = request.into_request();
2123            req.extensions_mut()
2124                .insert(
2125                    GrpcMethod::new(
2126                        "penumbra.core.component.dex.v1.QueryService",
2127                        "BatchSwapOutputData",
2128                    ),
2129                );
2130            self.inner.unary(req, path, codec).await
2131        }
2132        /// Get the precise swap execution used for a specific batch swap.
2133        pub async fn swap_execution(
2134            &mut self,
2135            request: impl tonic::IntoRequest<super::SwapExecutionRequest>,
2136        ) -> std::result::Result<
2137            tonic::Response<super::SwapExecutionResponse>,
2138            tonic::Status,
2139        > {
2140            self.inner
2141                .ready()
2142                .await
2143                .map_err(|e| {
2144                    tonic::Status::unknown(
2145                        format!("Service was not ready: {}", e.into()),
2146                    )
2147                })?;
2148            let codec = tonic::codec::ProstCodec::default();
2149            let path = http::uri::PathAndQuery::from_static(
2150                "/penumbra.core.component.dex.v1.QueryService/SwapExecution",
2151            );
2152            let mut req = request.into_request();
2153            req.extensions_mut()
2154                .insert(
2155                    GrpcMethod::new(
2156                        "penumbra.core.component.dex.v1.QueryService",
2157                        "SwapExecution",
2158                    ),
2159                );
2160            self.inner.unary(req, path, codec).await
2161        }
2162        /// Get the precise execution used to perform on-chain arbitrage.
2163        pub async fn arb_execution(
2164            &mut self,
2165            request: impl tonic::IntoRequest<super::ArbExecutionRequest>,
2166        ) -> std::result::Result<
2167            tonic::Response<super::ArbExecutionResponse>,
2168            tonic::Status,
2169        > {
2170            self.inner
2171                .ready()
2172                .await
2173                .map_err(|e| {
2174                    tonic::Status::unknown(
2175                        format!("Service was not ready: {}", e.into()),
2176                    )
2177                })?;
2178            let codec = tonic::codec::ProstCodec::default();
2179            let path = http::uri::PathAndQuery::from_static(
2180                "/penumbra.core.component.dex.v1.QueryService/ArbExecution",
2181            );
2182            let mut req = request.into_request();
2183            req.extensions_mut()
2184                .insert(
2185                    GrpcMethod::new(
2186                        "penumbra.core.component.dex.v1.QueryService",
2187                        "ArbExecution",
2188                    ),
2189                );
2190            self.inner.unary(req, path, codec).await
2191        }
2192        /// Stream all swap executions over a range of heights, optionally subscribing to future executions.
2193        pub async fn swap_executions(
2194            &mut self,
2195            request: impl tonic::IntoRequest<super::SwapExecutionsRequest>,
2196        ) -> std::result::Result<
2197            tonic::Response<tonic::codec::Streaming<super::SwapExecutionsResponse>>,
2198            tonic::Status,
2199        > {
2200            self.inner
2201                .ready()
2202                .await
2203                .map_err(|e| {
2204                    tonic::Status::unknown(
2205                        format!("Service was not ready: {}", e.into()),
2206                    )
2207                })?;
2208            let codec = tonic::codec::ProstCodec::default();
2209            let path = http::uri::PathAndQuery::from_static(
2210                "/penumbra.core.component.dex.v1.QueryService/SwapExecutions",
2211            );
2212            let mut req = request.into_request();
2213            req.extensions_mut()
2214                .insert(
2215                    GrpcMethod::new(
2216                        "penumbra.core.component.dex.v1.QueryService",
2217                        "SwapExecutions",
2218                    ),
2219                );
2220            self.inner.server_streaming(req, path, codec).await
2221        }
2222        /// Stream all arbitrage executions over a range of heights, optionally subscribing to future executions.
2223        pub async fn arb_executions(
2224            &mut self,
2225            request: impl tonic::IntoRequest<super::ArbExecutionsRequest>,
2226        ) -> std::result::Result<
2227            tonic::Response<tonic::codec::Streaming<super::ArbExecutionsResponse>>,
2228            tonic::Status,
2229        > {
2230            self.inner
2231                .ready()
2232                .await
2233                .map_err(|e| {
2234                    tonic::Status::unknown(
2235                        format!("Service was not ready: {}", e.into()),
2236                    )
2237                })?;
2238            let codec = tonic::codec::ProstCodec::default();
2239            let path = http::uri::PathAndQuery::from_static(
2240                "/penumbra.core.component.dex.v1.QueryService/ArbExecutions",
2241            );
2242            let mut req = request.into_request();
2243            req.extensions_mut()
2244                .insert(
2245                    GrpcMethod::new(
2246                        "penumbra.core.component.dex.v1.QueryService",
2247                        "ArbExecutions",
2248                    ),
2249                );
2250            self.inner.server_streaming(req, path, codec).await
2251        }
2252        /// Query all liquidity positions on the DEX.
2253        pub async fn liquidity_positions(
2254            &mut self,
2255            request: impl tonic::IntoRequest<super::LiquidityPositionsRequest>,
2256        ) -> std::result::Result<
2257            tonic::Response<tonic::codec::Streaming<super::LiquidityPositionsResponse>>,
2258            tonic::Status,
2259        > {
2260            self.inner
2261                .ready()
2262                .await
2263                .map_err(|e| {
2264                    tonic::Status::unknown(
2265                        format!("Service was not ready: {}", e.into()),
2266                    )
2267                })?;
2268            let codec = tonic::codec::ProstCodec::default();
2269            let path = http::uri::PathAndQuery::from_static(
2270                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositions",
2271            );
2272            let mut req = request.into_request();
2273            req.extensions_mut()
2274                .insert(
2275                    GrpcMethod::new(
2276                        "penumbra.core.component.dex.v1.QueryService",
2277                        "LiquidityPositions",
2278                    ),
2279                );
2280            self.inner.server_streaming(req, path, codec).await
2281        }
2282        /// Query liquidity positions by ID.
2283        ///
2284        /// To get multiple positions, use `LiquidityPositionsById`.
2285        pub async fn liquidity_position_by_id(
2286            &mut self,
2287            request: impl tonic::IntoRequest<super::LiquidityPositionByIdRequest>,
2288        ) -> std::result::Result<
2289            tonic::Response<super::LiquidityPositionByIdResponse>,
2290            tonic::Status,
2291        > {
2292            self.inner
2293                .ready()
2294                .await
2295                .map_err(|e| {
2296                    tonic::Status::unknown(
2297                        format!("Service was not ready: {}", e.into()),
2298                    )
2299                })?;
2300            let codec = tonic::codec::ProstCodec::default();
2301            let path = http::uri::PathAndQuery::from_static(
2302                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositionById",
2303            );
2304            let mut req = request.into_request();
2305            req.extensions_mut()
2306                .insert(
2307                    GrpcMethod::new(
2308                        "penumbra.core.component.dex.v1.QueryService",
2309                        "LiquidityPositionById",
2310                    ),
2311                );
2312            self.inner.unary(req, path, codec).await
2313        }
2314        /// Query multiple liquidity positions by ID.
2315        pub async fn liquidity_positions_by_id(
2316            &mut self,
2317            request: impl tonic::IntoRequest<super::LiquidityPositionsByIdRequest>,
2318        ) -> std::result::Result<
2319            tonic::Response<
2320                tonic::codec::Streaming<super::LiquidityPositionsByIdResponse>,
2321            >,
2322            tonic::Status,
2323        > {
2324            self.inner
2325                .ready()
2326                .await
2327                .map_err(|e| {
2328                    tonic::Status::unknown(
2329                        format!("Service was not ready: {}", e.into()),
2330                    )
2331                })?;
2332            let codec = tonic::codec::ProstCodec::default();
2333            let path = http::uri::PathAndQuery::from_static(
2334                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositionsById",
2335            );
2336            let mut req = request.into_request();
2337            req.extensions_mut()
2338                .insert(
2339                    GrpcMethod::new(
2340                        "penumbra.core.component.dex.v1.QueryService",
2341                        "LiquidityPositionsById",
2342                    ),
2343                );
2344            self.inner.server_streaming(req, path, codec).await
2345        }
2346        /// Query liquidity positions on a specific pair, sorted by effective price.
2347        pub async fn liquidity_positions_by_price(
2348            &mut self,
2349            request: impl tonic::IntoRequest<super::LiquidityPositionsByPriceRequest>,
2350        ) -> std::result::Result<
2351            tonic::Response<
2352                tonic::codec::Streaming<super::LiquidityPositionsByPriceResponse>,
2353            >,
2354            tonic::Status,
2355        > {
2356            self.inner
2357                .ready()
2358                .await
2359                .map_err(|e| {
2360                    tonic::Status::unknown(
2361                        format!("Service was not ready: {}", e.into()),
2362                    )
2363                })?;
2364            let codec = tonic::codec::ProstCodec::default();
2365            let path = http::uri::PathAndQuery::from_static(
2366                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositionsByPrice",
2367            );
2368            let mut req = request.into_request();
2369            req.extensions_mut()
2370                .insert(
2371                    GrpcMethod::new(
2372                        "penumbra.core.component.dex.v1.QueryService",
2373                        "LiquidityPositionsByPrice",
2374                    ),
2375                );
2376            self.inner.server_streaming(req, path, codec).await
2377        }
2378        /// Get the current (direct) spread on a trading pair.
2379        ///
2380        /// This method doesn't do simulation, so actually executing might result in a
2381        /// better price (if the chain takes a different route to the target asset).
2382        pub async fn spread(
2383            &mut self,
2384            request: impl tonic::IntoRequest<super::SpreadRequest>,
2385        ) -> std::result::Result<tonic::Response<super::SpreadResponse>, tonic::Status> {
2386            self.inner
2387                .ready()
2388                .await
2389                .map_err(|e| {
2390                    tonic::Status::unknown(
2391                        format!("Service was not ready: {}", e.into()),
2392                    )
2393                })?;
2394            let codec = tonic::codec::ProstCodec::default();
2395            let path = http::uri::PathAndQuery::from_static(
2396                "/penumbra.core.component.dex.v1.QueryService/Spread",
2397            );
2398            let mut req = request.into_request();
2399            req.extensions_mut()
2400                .insert(
2401                    GrpcMethod::new(
2402                        "penumbra.core.component.dex.v1.QueryService",
2403                        "Spread",
2404                    ),
2405                );
2406            self.inner.unary(req, path, codec).await
2407        }
2408        /// Get historical candlestick data for a given trading pair.
2409        ///
2410        /// Note that this RPC is directional, to get data for both directions, make a second request.
2411        pub async fn candlestick_data(
2412            &mut self,
2413            request: impl tonic::IntoRequest<super::CandlestickDataRequest>,
2414        ) -> std::result::Result<
2415            tonic::Response<super::CandlestickDataResponse>,
2416            tonic::Status,
2417        > {
2418            self.inner
2419                .ready()
2420                .await
2421                .map_err(|e| {
2422                    tonic::Status::unknown(
2423                        format!("Service was not ready: {}", e.into()),
2424                    )
2425                })?;
2426            let codec = tonic::codec::ProstCodec::default();
2427            let path = http::uri::PathAndQuery::from_static(
2428                "/penumbra.core.component.dex.v1.QueryService/CandlestickData",
2429            );
2430            let mut req = request.into_request();
2431            req.extensions_mut()
2432                .insert(
2433                    GrpcMethod::new(
2434                        "penumbra.core.component.dex.v1.QueryService",
2435                        "CandlestickData",
2436                    ),
2437                );
2438            self.inner.unary(req, path, codec).await
2439        }
2440        /// Subscribe to candlestick data updates.
2441        pub async fn candlestick_data_stream(
2442            &mut self,
2443            request: impl tonic::IntoRequest<super::CandlestickDataStreamRequest>,
2444        ) -> std::result::Result<
2445            tonic::Response<
2446                tonic::codec::Streaming<super::CandlestickDataStreamResponse>,
2447            >,
2448            tonic::Status,
2449        > {
2450            self.inner
2451                .ready()
2452                .await
2453                .map_err(|e| {
2454                    tonic::Status::unknown(
2455                        format!("Service was not ready: {}", e.into()),
2456                    )
2457                })?;
2458            let codec = tonic::codec::ProstCodec::default();
2459            let path = http::uri::PathAndQuery::from_static(
2460                "/penumbra.core.component.dex.v1.QueryService/CandlestickDataStream",
2461            );
2462            let mut req = request.into_request();
2463            req.extensions_mut()
2464                .insert(
2465                    GrpcMethod::new(
2466                        "penumbra.core.component.dex.v1.QueryService",
2467                        "CandlestickDataStream",
2468                    ),
2469                );
2470            self.inner.server_streaming(req, path, codec).await
2471        }
2472    }
2473}
2474/// Generated client implementations.
2475#[cfg(feature = "rpc")]
2476pub mod simulation_service_client {
2477    #![allow(
2478        unused_variables,
2479        dead_code,
2480        missing_docs,
2481        clippy::wildcard_imports,
2482        clippy::let_unit_value,
2483    )]
2484    use tonic::codegen::*;
2485    use tonic::codegen::http::Uri;
2486    /// Simulation for the DEX component.
2487    ///
2488    /// This is a separate service from the QueryService because it's not just a
2489    /// simple read query from the state. Thus it poses greater DoS risks, and node
2490    /// operators may want to enable it separately.
2491    #[derive(Debug, Clone)]
2492    pub struct SimulationServiceClient<T> {
2493        inner: tonic::client::Grpc<T>,
2494    }
2495    impl SimulationServiceClient<tonic::transport::Channel> {
2496        /// Attempt to create a new client by connecting to a given endpoint.
2497        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
2498        where
2499            D: TryInto<tonic::transport::Endpoint>,
2500            D::Error: Into<StdError>,
2501        {
2502            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
2503            Ok(Self::new(conn))
2504        }
2505    }
2506    impl<T> SimulationServiceClient<T>
2507    where
2508        T: tonic::client::GrpcService<tonic::body::BoxBody>,
2509        T::Error: Into<StdError>,
2510        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
2511        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
2512    {
2513        pub fn new(inner: T) -> Self {
2514            let inner = tonic::client::Grpc::new(inner);
2515            Self { inner }
2516        }
2517        pub fn with_origin(inner: T, origin: Uri) -> Self {
2518            let inner = tonic::client::Grpc::with_origin(inner, origin);
2519            Self { inner }
2520        }
2521        pub fn with_interceptor<F>(
2522            inner: T,
2523            interceptor: F,
2524        ) -> SimulationServiceClient<InterceptedService<T, F>>
2525        where
2526            F: tonic::service::Interceptor,
2527            T::ResponseBody: Default,
2528            T: tonic::codegen::Service<
2529                http::Request<tonic::body::BoxBody>,
2530                Response = http::Response<
2531                    <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
2532                >,
2533            >,
2534            <T as tonic::codegen::Service<
2535                http::Request<tonic::body::BoxBody>,
2536            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
2537        {
2538            SimulationServiceClient::new(InterceptedService::new(inner, interceptor))
2539        }
2540        /// Compress requests with the given encoding.
2541        ///
2542        /// This requires the server to support it otherwise it might respond with an
2543        /// error.
2544        #[must_use]
2545        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2546            self.inner = self.inner.send_compressed(encoding);
2547            self
2548        }
2549        /// Enable decompressing responses.
2550        #[must_use]
2551        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2552            self.inner = self.inner.accept_compressed(encoding);
2553            self
2554        }
2555        /// Limits the maximum size of a decoded message.
2556        ///
2557        /// Default: `4MB`
2558        #[must_use]
2559        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2560            self.inner = self.inner.max_decoding_message_size(limit);
2561            self
2562        }
2563        /// Limits the maximum size of an encoded message.
2564        ///
2565        /// Default: `usize::MAX`
2566        #[must_use]
2567        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2568            self.inner = self.inner.max_encoding_message_size(limit);
2569            self
2570        }
2571        /// Simulate routing and trade execution.
2572        pub async fn simulate_trade(
2573            &mut self,
2574            request: impl tonic::IntoRequest<super::SimulateTradeRequest>,
2575        ) -> std::result::Result<
2576            tonic::Response<super::SimulateTradeResponse>,
2577            tonic::Status,
2578        > {
2579            self.inner
2580                .ready()
2581                .await
2582                .map_err(|e| {
2583                    tonic::Status::unknown(
2584                        format!("Service was not ready: {}", e.into()),
2585                    )
2586                })?;
2587            let codec = tonic::codec::ProstCodec::default();
2588            let path = http::uri::PathAndQuery::from_static(
2589                "/penumbra.core.component.dex.v1.SimulationService/SimulateTrade",
2590            );
2591            let mut req = request.into_request();
2592            req.extensions_mut()
2593                .insert(
2594                    GrpcMethod::new(
2595                        "penumbra.core.component.dex.v1.SimulationService",
2596                        "SimulateTrade",
2597                    ),
2598                );
2599            self.inner.unary(req, path, codec).await
2600        }
2601    }
2602}
2603/// Generated server implementations.
2604#[cfg(feature = "rpc")]
2605pub mod query_service_server {
2606    #![allow(
2607        unused_variables,
2608        dead_code,
2609        missing_docs,
2610        clippy::wildcard_imports,
2611        clippy::let_unit_value,
2612    )]
2613    use tonic::codegen::*;
2614    /// Generated trait containing gRPC methods that should be implemented for use with QueryServiceServer.
2615    #[async_trait]
2616    pub trait QueryService: std::marker::Send + std::marker::Sync + 'static {
2617        /// Get the batch clearing prices for a specific block height and trading pair.
2618        async fn batch_swap_output_data(
2619            &self,
2620            request: tonic::Request<super::BatchSwapOutputDataRequest>,
2621        ) -> std::result::Result<
2622            tonic::Response<super::BatchSwapOutputDataResponse>,
2623            tonic::Status,
2624        >;
2625        /// Get the precise swap execution used for a specific batch swap.
2626        async fn swap_execution(
2627            &self,
2628            request: tonic::Request<super::SwapExecutionRequest>,
2629        ) -> std::result::Result<
2630            tonic::Response<super::SwapExecutionResponse>,
2631            tonic::Status,
2632        >;
2633        /// Get the precise execution used to perform on-chain arbitrage.
2634        async fn arb_execution(
2635            &self,
2636            request: tonic::Request<super::ArbExecutionRequest>,
2637        ) -> std::result::Result<
2638            tonic::Response<super::ArbExecutionResponse>,
2639            tonic::Status,
2640        >;
2641        /// Server streaming response type for the SwapExecutions method.
2642        type SwapExecutionsStream: tonic::codegen::tokio_stream::Stream<
2643                Item = std::result::Result<super::SwapExecutionsResponse, tonic::Status>,
2644            >
2645            + std::marker::Send
2646            + 'static;
2647        /// Stream all swap executions over a range of heights, optionally subscribing to future executions.
2648        async fn swap_executions(
2649            &self,
2650            request: tonic::Request<super::SwapExecutionsRequest>,
2651        ) -> std::result::Result<
2652            tonic::Response<Self::SwapExecutionsStream>,
2653            tonic::Status,
2654        >;
2655        /// Server streaming response type for the ArbExecutions method.
2656        type ArbExecutionsStream: tonic::codegen::tokio_stream::Stream<
2657                Item = std::result::Result<super::ArbExecutionsResponse, tonic::Status>,
2658            >
2659            + std::marker::Send
2660            + 'static;
2661        /// Stream all arbitrage executions over a range of heights, optionally subscribing to future executions.
2662        async fn arb_executions(
2663            &self,
2664            request: tonic::Request<super::ArbExecutionsRequest>,
2665        ) -> std::result::Result<
2666            tonic::Response<Self::ArbExecutionsStream>,
2667            tonic::Status,
2668        >;
2669        /// Server streaming response type for the LiquidityPositions method.
2670        type LiquidityPositionsStream: tonic::codegen::tokio_stream::Stream<
2671                Item = std::result::Result<
2672                    super::LiquidityPositionsResponse,
2673                    tonic::Status,
2674                >,
2675            >
2676            + std::marker::Send
2677            + 'static;
2678        /// Query all liquidity positions on the DEX.
2679        async fn liquidity_positions(
2680            &self,
2681            request: tonic::Request<super::LiquidityPositionsRequest>,
2682        ) -> std::result::Result<
2683            tonic::Response<Self::LiquidityPositionsStream>,
2684            tonic::Status,
2685        >;
2686        /// Query liquidity positions by ID.
2687        ///
2688        /// To get multiple positions, use `LiquidityPositionsById`.
2689        async fn liquidity_position_by_id(
2690            &self,
2691            request: tonic::Request<super::LiquidityPositionByIdRequest>,
2692        ) -> std::result::Result<
2693            tonic::Response<super::LiquidityPositionByIdResponse>,
2694            tonic::Status,
2695        >;
2696        /// Server streaming response type for the LiquidityPositionsById method.
2697        type LiquidityPositionsByIdStream: tonic::codegen::tokio_stream::Stream<
2698                Item = std::result::Result<
2699                    super::LiquidityPositionsByIdResponse,
2700                    tonic::Status,
2701                >,
2702            >
2703            + std::marker::Send
2704            + 'static;
2705        /// Query multiple liquidity positions by ID.
2706        async fn liquidity_positions_by_id(
2707            &self,
2708            request: tonic::Request<super::LiquidityPositionsByIdRequest>,
2709        ) -> std::result::Result<
2710            tonic::Response<Self::LiquidityPositionsByIdStream>,
2711            tonic::Status,
2712        >;
2713        /// Server streaming response type for the LiquidityPositionsByPrice method.
2714        type LiquidityPositionsByPriceStream: tonic::codegen::tokio_stream::Stream<
2715                Item = std::result::Result<
2716                    super::LiquidityPositionsByPriceResponse,
2717                    tonic::Status,
2718                >,
2719            >
2720            + std::marker::Send
2721            + 'static;
2722        /// Query liquidity positions on a specific pair, sorted by effective price.
2723        async fn liquidity_positions_by_price(
2724            &self,
2725            request: tonic::Request<super::LiquidityPositionsByPriceRequest>,
2726        ) -> std::result::Result<
2727            tonic::Response<Self::LiquidityPositionsByPriceStream>,
2728            tonic::Status,
2729        >;
2730        /// Get the current (direct) spread on a trading pair.
2731        ///
2732        /// This method doesn't do simulation, so actually executing might result in a
2733        /// better price (if the chain takes a different route to the target asset).
2734        async fn spread(
2735            &self,
2736            request: tonic::Request<super::SpreadRequest>,
2737        ) -> std::result::Result<tonic::Response<super::SpreadResponse>, tonic::Status>;
2738        /// Get historical candlestick data for a given trading pair.
2739        ///
2740        /// Note that this RPC is directional, to get data for both directions, make a second request.
2741        async fn candlestick_data(
2742            &self,
2743            request: tonic::Request<super::CandlestickDataRequest>,
2744        ) -> std::result::Result<
2745            tonic::Response<super::CandlestickDataResponse>,
2746            tonic::Status,
2747        >;
2748        /// Server streaming response type for the CandlestickDataStream method.
2749        type CandlestickDataStreamStream: tonic::codegen::tokio_stream::Stream<
2750                Item = std::result::Result<
2751                    super::CandlestickDataStreamResponse,
2752                    tonic::Status,
2753                >,
2754            >
2755            + std::marker::Send
2756            + 'static;
2757        /// Subscribe to candlestick data updates.
2758        async fn candlestick_data_stream(
2759            &self,
2760            request: tonic::Request<super::CandlestickDataStreamRequest>,
2761        ) -> std::result::Result<
2762            tonic::Response<Self::CandlestickDataStreamStream>,
2763            tonic::Status,
2764        >;
2765    }
2766    /// Query operations for the DEX component.
2767    #[derive(Debug)]
2768    pub struct QueryServiceServer<T> {
2769        inner: Arc<T>,
2770        accept_compression_encodings: EnabledCompressionEncodings,
2771        send_compression_encodings: EnabledCompressionEncodings,
2772        max_decoding_message_size: Option<usize>,
2773        max_encoding_message_size: Option<usize>,
2774    }
2775    impl<T> QueryServiceServer<T> {
2776        pub fn new(inner: T) -> Self {
2777            Self::from_arc(Arc::new(inner))
2778        }
2779        pub fn from_arc(inner: Arc<T>) -> Self {
2780            Self {
2781                inner,
2782                accept_compression_encodings: Default::default(),
2783                send_compression_encodings: Default::default(),
2784                max_decoding_message_size: None,
2785                max_encoding_message_size: None,
2786            }
2787        }
2788        pub fn with_interceptor<F>(
2789            inner: T,
2790            interceptor: F,
2791        ) -> InterceptedService<Self, F>
2792        where
2793            F: tonic::service::Interceptor,
2794        {
2795            InterceptedService::new(Self::new(inner), interceptor)
2796        }
2797        /// Enable decompressing requests with the given encoding.
2798        #[must_use]
2799        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2800            self.accept_compression_encodings.enable(encoding);
2801            self
2802        }
2803        /// Compress responses with the given encoding, if the client supports it.
2804        #[must_use]
2805        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2806            self.send_compression_encodings.enable(encoding);
2807            self
2808        }
2809        /// Limits the maximum size of a decoded message.
2810        ///
2811        /// Default: `4MB`
2812        #[must_use]
2813        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2814            self.max_decoding_message_size = Some(limit);
2815            self
2816        }
2817        /// Limits the maximum size of an encoded message.
2818        ///
2819        /// Default: `usize::MAX`
2820        #[must_use]
2821        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2822            self.max_encoding_message_size = Some(limit);
2823            self
2824        }
2825    }
2826    impl<T, B> tonic::codegen::Service<http::Request<B>> for QueryServiceServer<T>
2827    where
2828        T: QueryService,
2829        B: Body + std::marker::Send + 'static,
2830        B::Error: Into<StdError> + std::marker::Send + 'static,
2831    {
2832        type Response = http::Response<tonic::body::BoxBody>;
2833        type Error = std::convert::Infallible;
2834        type Future = BoxFuture<Self::Response, Self::Error>;
2835        fn poll_ready(
2836            &mut self,
2837            _cx: &mut Context<'_>,
2838        ) -> Poll<std::result::Result<(), Self::Error>> {
2839            Poll::Ready(Ok(()))
2840        }
2841        fn call(&mut self, req: http::Request<B>) -> Self::Future {
2842            match req.uri().path() {
2843                "/penumbra.core.component.dex.v1.QueryService/BatchSwapOutputData" => {
2844                    #[allow(non_camel_case_types)]
2845                    struct BatchSwapOutputDataSvc<T: QueryService>(pub Arc<T>);
2846                    impl<
2847                        T: QueryService,
2848                    > tonic::server::UnaryService<super::BatchSwapOutputDataRequest>
2849                    for BatchSwapOutputDataSvc<T> {
2850                        type Response = super::BatchSwapOutputDataResponse;
2851                        type Future = BoxFuture<
2852                            tonic::Response<Self::Response>,
2853                            tonic::Status,
2854                        >;
2855                        fn call(
2856                            &mut self,
2857                            request: tonic::Request<super::BatchSwapOutputDataRequest>,
2858                        ) -> Self::Future {
2859                            let inner = Arc::clone(&self.0);
2860                            let fut = async move {
2861                                <T as QueryService>::batch_swap_output_data(&inner, request)
2862                                    .await
2863                            };
2864                            Box::pin(fut)
2865                        }
2866                    }
2867                    let accept_compression_encodings = self.accept_compression_encodings;
2868                    let send_compression_encodings = self.send_compression_encodings;
2869                    let max_decoding_message_size = self.max_decoding_message_size;
2870                    let max_encoding_message_size = self.max_encoding_message_size;
2871                    let inner = self.inner.clone();
2872                    let fut = async move {
2873                        let method = BatchSwapOutputDataSvc(inner);
2874                        let codec = tonic::codec::ProstCodec::default();
2875                        let mut grpc = tonic::server::Grpc::new(codec)
2876                            .apply_compression_config(
2877                                accept_compression_encodings,
2878                                send_compression_encodings,
2879                            )
2880                            .apply_max_message_size_config(
2881                                max_decoding_message_size,
2882                                max_encoding_message_size,
2883                            );
2884                        let res = grpc.unary(method, req).await;
2885                        Ok(res)
2886                    };
2887                    Box::pin(fut)
2888                }
2889                "/penumbra.core.component.dex.v1.QueryService/SwapExecution" => {
2890                    #[allow(non_camel_case_types)]
2891                    struct SwapExecutionSvc<T: QueryService>(pub Arc<T>);
2892                    impl<
2893                        T: QueryService,
2894                    > tonic::server::UnaryService<super::SwapExecutionRequest>
2895                    for SwapExecutionSvc<T> {
2896                        type Response = super::SwapExecutionResponse;
2897                        type Future = BoxFuture<
2898                            tonic::Response<Self::Response>,
2899                            tonic::Status,
2900                        >;
2901                        fn call(
2902                            &mut self,
2903                            request: tonic::Request<super::SwapExecutionRequest>,
2904                        ) -> Self::Future {
2905                            let inner = Arc::clone(&self.0);
2906                            let fut = async move {
2907                                <T as QueryService>::swap_execution(&inner, request).await
2908                            };
2909                            Box::pin(fut)
2910                        }
2911                    }
2912                    let accept_compression_encodings = self.accept_compression_encodings;
2913                    let send_compression_encodings = self.send_compression_encodings;
2914                    let max_decoding_message_size = self.max_decoding_message_size;
2915                    let max_encoding_message_size = self.max_encoding_message_size;
2916                    let inner = self.inner.clone();
2917                    let fut = async move {
2918                        let method = SwapExecutionSvc(inner);
2919                        let codec = tonic::codec::ProstCodec::default();
2920                        let mut grpc = tonic::server::Grpc::new(codec)
2921                            .apply_compression_config(
2922                                accept_compression_encodings,
2923                                send_compression_encodings,
2924                            )
2925                            .apply_max_message_size_config(
2926                                max_decoding_message_size,
2927                                max_encoding_message_size,
2928                            );
2929                        let res = grpc.unary(method, req).await;
2930                        Ok(res)
2931                    };
2932                    Box::pin(fut)
2933                }
2934                "/penumbra.core.component.dex.v1.QueryService/ArbExecution" => {
2935                    #[allow(non_camel_case_types)]
2936                    struct ArbExecutionSvc<T: QueryService>(pub Arc<T>);
2937                    impl<
2938                        T: QueryService,
2939                    > tonic::server::UnaryService<super::ArbExecutionRequest>
2940                    for ArbExecutionSvc<T> {
2941                        type Response = super::ArbExecutionResponse;
2942                        type Future = BoxFuture<
2943                            tonic::Response<Self::Response>,
2944                            tonic::Status,
2945                        >;
2946                        fn call(
2947                            &mut self,
2948                            request: tonic::Request<super::ArbExecutionRequest>,
2949                        ) -> Self::Future {
2950                            let inner = Arc::clone(&self.0);
2951                            let fut = async move {
2952                                <T as QueryService>::arb_execution(&inner, request).await
2953                            };
2954                            Box::pin(fut)
2955                        }
2956                    }
2957                    let accept_compression_encodings = self.accept_compression_encodings;
2958                    let send_compression_encodings = self.send_compression_encodings;
2959                    let max_decoding_message_size = self.max_decoding_message_size;
2960                    let max_encoding_message_size = self.max_encoding_message_size;
2961                    let inner = self.inner.clone();
2962                    let fut = async move {
2963                        let method = ArbExecutionSvc(inner);
2964                        let codec = tonic::codec::ProstCodec::default();
2965                        let mut grpc = tonic::server::Grpc::new(codec)
2966                            .apply_compression_config(
2967                                accept_compression_encodings,
2968                                send_compression_encodings,
2969                            )
2970                            .apply_max_message_size_config(
2971                                max_decoding_message_size,
2972                                max_encoding_message_size,
2973                            );
2974                        let res = grpc.unary(method, req).await;
2975                        Ok(res)
2976                    };
2977                    Box::pin(fut)
2978                }
2979                "/penumbra.core.component.dex.v1.QueryService/SwapExecutions" => {
2980                    #[allow(non_camel_case_types)]
2981                    struct SwapExecutionsSvc<T: QueryService>(pub Arc<T>);
2982                    impl<
2983                        T: QueryService,
2984                    > tonic::server::ServerStreamingService<super::SwapExecutionsRequest>
2985                    for SwapExecutionsSvc<T> {
2986                        type Response = super::SwapExecutionsResponse;
2987                        type ResponseStream = T::SwapExecutionsStream;
2988                        type Future = BoxFuture<
2989                            tonic::Response<Self::ResponseStream>,
2990                            tonic::Status,
2991                        >;
2992                        fn call(
2993                            &mut self,
2994                            request: tonic::Request<super::SwapExecutionsRequest>,
2995                        ) -> Self::Future {
2996                            let inner = Arc::clone(&self.0);
2997                            let fut = async move {
2998                                <T as QueryService>::swap_executions(&inner, request).await
2999                            };
3000                            Box::pin(fut)
3001                        }
3002                    }
3003                    let accept_compression_encodings = self.accept_compression_encodings;
3004                    let send_compression_encodings = self.send_compression_encodings;
3005                    let max_decoding_message_size = self.max_decoding_message_size;
3006                    let max_encoding_message_size = self.max_encoding_message_size;
3007                    let inner = self.inner.clone();
3008                    let fut = async move {
3009                        let method = SwapExecutionsSvc(inner);
3010                        let codec = tonic::codec::ProstCodec::default();
3011                        let mut grpc = tonic::server::Grpc::new(codec)
3012                            .apply_compression_config(
3013                                accept_compression_encodings,
3014                                send_compression_encodings,
3015                            )
3016                            .apply_max_message_size_config(
3017                                max_decoding_message_size,
3018                                max_encoding_message_size,
3019                            );
3020                        let res = grpc.server_streaming(method, req).await;
3021                        Ok(res)
3022                    };
3023                    Box::pin(fut)
3024                }
3025                "/penumbra.core.component.dex.v1.QueryService/ArbExecutions" => {
3026                    #[allow(non_camel_case_types)]
3027                    struct ArbExecutionsSvc<T: QueryService>(pub Arc<T>);
3028                    impl<
3029                        T: QueryService,
3030                    > tonic::server::ServerStreamingService<super::ArbExecutionsRequest>
3031                    for ArbExecutionsSvc<T> {
3032                        type Response = super::ArbExecutionsResponse;
3033                        type ResponseStream = T::ArbExecutionsStream;
3034                        type Future = BoxFuture<
3035                            tonic::Response<Self::ResponseStream>,
3036                            tonic::Status,
3037                        >;
3038                        fn call(
3039                            &mut self,
3040                            request: tonic::Request<super::ArbExecutionsRequest>,
3041                        ) -> Self::Future {
3042                            let inner = Arc::clone(&self.0);
3043                            let fut = async move {
3044                                <T as QueryService>::arb_executions(&inner, request).await
3045                            };
3046                            Box::pin(fut)
3047                        }
3048                    }
3049                    let accept_compression_encodings = self.accept_compression_encodings;
3050                    let send_compression_encodings = self.send_compression_encodings;
3051                    let max_decoding_message_size = self.max_decoding_message_size;
3052                    let max_encoding_message_size = self.max_encoding_message_size;
3053                    let inner = self.inner.clone();
3054                    let fut = async move {
3055                        let method = ArbExecutionsSvc(inner);
3056                        let codec = tonic::codec::ProstCodec::default();
3057                        let mut grpc = tonic::server::Grpc::new(codec)
3058                            .apply_compression_config(
3059                                accept_compression_encodings,
3060                                send_compression_encodings,
3061                            )
3062                            .apply_max_message_size_config(
3063                                max_decoding_message_size,
3064                                max_encoding_message_size,
3065                            );
3066                        let res = grpc.server_streaming(method, req).await;
3067                        Ok(res)
3068                    };
3069                    Box::pin(fut)
3070                }
3071                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositions" => {
3072                    #[allow(non_camel_case_types)]
3073                    struct LiquidityPositionsSvc<T: QueryService>(pub Arc<T>);
3074                    impl<
3075                        T: QueryService,
3076                    > tonic::server::ServerStreamingService<
3077                        super::LiquidityPositionsRequest,
3078                    > for LiquidityPositionsSvc<T> {
3079                        type Response = super::LiquidityPositionsResponse;
3080                        type ResponseStream = T::LiquidityPositionsStream;
3081                        type Future = BoxFuture<
3082                            tonic::Response<Self::ResponseStream>,
3083                            tonic::Status,
3084                        >;
3085                        fn call(
3086                            &mut self,
3087                            request: tonic::Request<super::LiquidityPositionsRequest>,
3088                        ) -> Self::Future {
3089                            let inner = Arc::clone(&self.0);
3090                            let fut = async move {
3091                                <T as QueryService>::liquidity_positions(&inner, request)
3092                                    .await
3093                            };
3094                            Box::pin(fut)
3095                        }
3096                    }
3097                    let accept_compression_encodings = self.accept_compression_encodings;
3098                    let send_compression_encodings = self.send_compression_encodings;
3099                    let max_decoding_message_size = self.max_decoding_message_size;
3100                    let max_encoding_message_size = self.max_encoding_message_size;
3101                    let inner = self.inner.clone();
3102                    let fut = async move {
3103                        let method = LiquidityPositionsSvc(inner);
3104                        let codec = tonic::codec::ProstCodec::default();
3105                        let mut grpc = tonic::server::Grpc::new(codec)
3106                            .apply_compression_config(
3107                                accept_compression_encodings,
3108                                send_compression_encodings,
3109                            )
3110                            .apply_max_message_size_config(
3111                                max_decoding_message_size,
3112                                max_encoding_message_size,
3113                            );
3114                        let res = grpc.server_streaming(method, req).await;
3115                        Ok(res)
3116                    };
3117                    Box::pin(fut)
3118                }
3119                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositionById" => {
3120                    #[allow(non_camel_case_types)]
3121                    struct LiquidityPositionByIdSvc<T: QueryService>(pub Arc<T>);
3122                    impl<
3123                        T: QueryService,
3124                    > tonic::server::UnaryService<super::LiquidityPositionByIdRequest>
3125                    for LiquidityPositionByIdSvc<T> {
3126                        type Response = super::LiquidityPositionByIdResponse;
3127                        type Future = BoxFuture<
3128                            tonic::Response<Self::Response>,
3129                            tonic::Status,
3130                        >;
3131                        fn call(
3132                            &mut self,
3133                            request: tonic::Request<super::LiquidityPositionByIdRequest>,
3134                        ) -> Self::Future {
3135                            let inner = Arc::clone(&self.0);
3136                            let fut = async move {
3137                                <T as QueryService>::liquidity_position_by_id(
3138                                        &inner,
3139                                        request,
3140                                    )
3141                                    .await
3142                            };
3143                            Box::pin(fut)
3144                        }
3145                    }
3146                    let accept_compression_encodings = self.accept_compression_encodings;
3147                    let send_compression_encodings = self.send_compression_encodings;
3148                    let max_decoding_message_size = self.max_decoding_message_size;
3149                    let max_encoding_message_size = self.max_encoding_message_size;
3150                    let inner = self.inner.clone();
3151                    let fut = async move {
3152                        let method = LiquidityPositionByIdSvc(inner);
3153                        let codec = tonic::codec::ProstCodec::default();
3154                        let mut grpc = tonic::server::Grpc::new(codec)
3155                            .apply_compression_config(
3156                                accept_compression_encodings,
3157                                send_compression_encodings,
3158                            )
3159                            .apply_max_message_size_config(
3160                                max_decoding_message_size,
3161                                max_encoding_message_size,
3162                            );
3163                        let res = grpc.unary(method, req).await;
3164                        Ok(res)
3165                    };
3166                    Box::pin(fut)
3167                }
3168                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositionsById" => {
3169                    #[allow(non_camel_case_types)]
3170                    struct LiquidityPositionsByIdSvc<T: QueryService>(pub Arc<T>);
3171                    impl<
3172                        T: QueryService,
3173                    > tonic::server::ServerStreamingService<
3174                        super::LiquidityPositionsByIdRequest,
3175                    > for LiquidityPositionsByIdSvc<T> {
3176                        type Response = super::LiquidityPositionsByIdResponse;
3177                        type ResponseStream = T::LiquidityPositionsByIdStream;
3178                        type Future = BoxFuture<
3179                            tonic::Response<Self::ResponseStream>,
3180                            tonic::Status,
3181                        >;
3182                        fn call(
3183                            &mut self,
3184                            request: tonic::Request<super::LiquidityPositionsByIdRequest>,
3185                        ) -> Self::Future {
3186                            let inner = Arc::clone(&self.0);
3187                            let fut = async move {
3188                                <T as QueryService>::liquidity_positions_by_id(
3189                                        &inner,
3190                                        request,
3191                                    )
3192                                    .await
3193                            };
3194                            Box::pin(fut)
3195                        }
3196                    }
3197                    let accept_compression_encodings = self.accept_compression_encodings;
3198                    let send_compression_encodings = self.send_compression_encodings;
3199                    let max_decoding_message_size = self.max_decoding_message_size;
3200                    let max_encoding_message_size = self.max_encoding_message_size;
3201                    let inner = self.inner.clone();
3202                    let fut = async move {
3203                        let method = LiquidityPositionsByIdSvc(inner);
3204                        let codec = tonic::codec::ProstCodec::default();
3205                        let mut grpc = tonic::server::Grpc::new(codec)
3206                            .apply_compression_config(
3207                                accept_compression_encodings,
3208                                send_compression_encodings,
3209                            )
3210                            .apply_max_message_size_config(
3211                                max_decoding_message_size,
3212                                max_encoding_message_size,
3213                            );
3214                        let res = grpc.server_streaming(method, req).await;
3215                        Ok(res)
3216                    };
3217                    Box::pin(fut)
3218                }
3219                "/penumbra.core.component.dex.v1.QueryService/LiquidityPositionsByPrice" => {
3220                    #[allow(non_camel_case_types)]
3221                    struct LiquidityPositionsByPriceSvc<T: QueryService>(pub Arc<T>);
3222                    impl<
3223                        T: QueryService,
3224                    > tonic::server::ServerStreamingService<
3225                        super::LiquidityPositionsByPriceRequest,
3226                    > for LiquidityPositionsByPriceSvc<T> {
3227                        type Response = super::LiquidityPositionsByPriceResponse;
3228                        type ResponseStream = T::LiquidityPositionsByPriceStream;
3229                        type Future = BoxFuture<
3230                            tonic::Response<Self::ResponseStream>,
3231                            tonic::Status,
3232                        >;
3233                        fn call(
3234                            &mut self,
3235                            request: tonic::Request<
3236                                super::LiquidityPositionsByPriceRequest,
3237                            >,
3238                        ) -> Self::Future {
3239                            let inner = Arc::clone(&self.0);
3240                            let fut = async move {
3241                                <T as QueryService>::liquidity_positions_by_price(
3242                                        &inner,
3243                                        request,
3244                                    )
3245                                    .await
3246                            };
3247                            Box::pin(fut)
3248                        }
3249                    }
3250                    let accept_compression_encodings = self.accept_compression_encodings;
3251                    let send_compression_encodings = self.send_compression_encodings;
3252                    let max_decoding_message_size = self.max_decoding_message_size;
3253                    let max_encoding_message_size = self.max_encoding_message_size;
3254                    let inner = self.inner.clone();
3255                    let fut = async move {
3256                        let method = LiquidityPositionsByPriceSvc(inner);
3257                        let codec = tonic::codec::ProstCodec::default();
3258                        let mut grpc = tonic::server::Grpc::new(codec)
3259                            .apply_compression_config(
3260                                accept_compression_encodings,
3261                                send_compression_encodings,
3262                            )
3263                            .apply_max_message_size_config(
3264                                max_decoding_message_size,
3265                                max_encoding_message_size,
3266                            );
3267                        let res = grpc.server_streaming(method, req).await;
3268                        Ok(res)
3269                    };
3270                    Box::pin(fut)
3271                }
3272                "/penumbra.core.component.dex.v1.QueryService/Spread" => {
3273                    #[allow(non_camel_case_types)]
3274                    struct SpreadSvc<T: QueryService>(pub Arc<T>);
3275                    impl<
3276                        T: QueryService,
3277                    > tonic::server::UnaryService<super::SpreadRequest>
3278                    for SpreadSvc<T> {
3279                        type Response = super::SpreadResponse;
3280                        type Future = BoxFuture<
3281                            tonic::Response<Self::Response>,
3282                            tonic::Status,
3283                        >;
3284                        fn call(
3285                            &mut self,
3286                            request: tonic::Request<super::SpreadRequest>,
3287                        ) -> Self::Future {
3288                            let inner = Arc::clone(&self.0);
3289                            let fut = async move {
3290                                <T as QueryService>::spread(&inner, request).await
3291                            };
3292                            Box::pin(fut)
3293                        }
3294                    }
3295                    let accept_compression_encodings = self.accept_compression_encodings;
3296                    let send_compression_encodings = self.send_compression_encodings;
3297                    let max_decoding_message_size = self.max_decoding_message_size;
3298                    let max_encoding_message_size = self.max_encoding_message_size;
3299                    let inner = self.inner.clone();
3300                    let fut = async move {
3301                        let method = SpreadSvc(inner);
3302                        let codec = tonic::codec::ProstCodec::default();
3303                        let mut grpc = tonic::server::Grpc::new(codec)
3304                            .apply_compression_config(
3305                                accept_compression_encodings,
3306                                send_compression_encodings,
3307                            )
3308                            .apply_max_message_size_config(
3309                                max_decoding_message_size,
3310                                max_encoding_message_size,
3311                            );
3312                        let res = grpc.unary(method, req).await;
3313                        Ok(res)
3314                    };
3315                    Box::pin(fut)
3316                }
3317                "/penumbra.core.component.dex.v1.QueryService/CandlestickData" => {
3318                    #[allow(non_camel_case_types)]
3319                    struct CandlestickDataSvc<T: QueryService>(pub Arc<T>);
3320                    impl<
3321                        T: QueryService,
3322                    > tonic::server::UnaryService<super::CandlestickDataRequest>
3323                    for CandlestickDataSvc<T> {
3324                        type Response = super::CandlestickDataResponse;
3325                        type Future = BoxFuture<
3326                            tonic::Response<Self::Response>,
3327                            tonic::Status,
3328                        >;
3329                        fn call(
3330                            &mut self,
3331                            request: tonic::Request<super::CandlestickDataRequest>,
3332                        ) -> Self::Future {
3333                            let inner = Arc::clone(&self.0);
3334                            let fut = async move {
3335                                <T as QueryService>::candlestick_data(&inner, request).await
3336                            };
3337                            Box::pin(fut)
3338                        }
3339                    }
3340                    let accept_compression_encodings = self.accept_compression_encodings;
3341                    let send_compression_encodings = self.send_compression_encodings;
3342                    let max_decoding_message_size = self.max_decoding_message_size;
3343                    let max_encoding_message_size = self.max_encoding_message_size;
3344                    let inner = self.inner.clone();
3345                    let fut = async move {
3346                        let method = CandlestickDataSvc(inner);
3347                        let codec = tonic::codec::ProstCodec::default();
3348                        let mut grpc = tonic::server::Grpc::new(codec)
3349                            .apply_compression_config(
3350                                accept_compression_encodings,
3351                                send_compression_encodings,
3352                            )
3353                            .apply_max_message_size_config(
3354                                max_decoding_message_size,
3355                                max_encoding_message_size,
3356                            );
3357                        let res = grpc.unary(method, req).await;
3358                        Ok(res)
3359                    };
3360                    Box::pin(fut)
3361                }
3362                "/penumbra.core.component.dex.v1.QueryService/CandlestickDataStream" => {
3363                    #[allow(non_camel_case_types)]
3364                    struct CandlestickDataStreamSvc<T: QueryService>(pub Arc<T>);
3365                    impl<
3366                        T: QueryService,
3367                    > tonic::server::ServerStreamingService<
3368                        super::CandlestickDataStreamRequest,
3369                    > for CandlestickDataStreamSvc<T> {
3370                        type Response = super::CandlestickDataStreamResponse;
3371                        type ResponseStream = T::CandlestickDataStreamStream;
3372                        type Future = BoxFuture<
3373                            tonic::Response<Self::ResponseStream>,
3374                            tonic::Status,
3375                        >;
3376                        fn call(
3377                            &mut self,
3378                            request: tonic::Request<super::CandlestickDataStreamRequest>,
3379                        ) -> Self::Future {
3380                            let inner = Arc::clone(&self.0);
3381                            let fut = async move {
3382                                <T as QueryService>::candlestick_data_stream(
3383                                        &inner,
3384                                        request,
3385                                    )
3386                                    .await
3387                            };
3388                            Box::pin(fut)
3389                        }
3390                    }
3391                    let accept_compression_encodings = self.accept_compression_encodings;
3392                    let send_compression_encodings = self.send_compression_encodings;
3393                    let max_decoding_message_size = self.max_decoding_message_size;
3394                    let max_encoding_message_size = self.max_encoding_message_size;
3395                    let inner = self.inner.clone();
3396                    let fut = async move {
3397                        let method = CandlestickDataStreamSvc(inner);
3398                        let codec = tonic::codec::ProstCodec::default();
3399                        let mut grpc = tonic::server::Grpc::new(codec)
3400                            .apply_compression_config(
3401                                accept_compression_encodings,
3402                                send_compression_encodings,
3403                            )
3404                            .apply_max_message_size_config(
3405                                max_decoding_message_size,
3406                                max_encoding_message_size,
3407                            );
3408                        let res = grpc.server_streaming(method, req).await;
3409                        Ok(res)
3410                    };
3411                    Box::pin(fut)
3412                }
3413                _ => {
3414                    Box::pin(async move {
3415                        let mut response = http::Response::new(empty_body());
3416                        let headers = response.headers_mut();
3417                        headers
3418                            .insert(
3419                                tonic::Status::GRPC_STATUS,
3420                                (tonic::Code::Unimplemented as i32).into(),
3421                            );
3422                        headers
3423                            .insert(
3424                                http::header::CONTENT_TYPE,
3425                                tonic::metadata::GRPC_CONTENT_TYPE,
3426                            );
3427                        Ok(response)
3428                    })
3429                }
3430            }
3431        }
3432    }
3433    impl<T> Clone for QueryServiceServer<T> {
3434        fn clone(&self) -> Self {
3435            let inner = self.inner.clone();
3436            Self {
3437                inner,
3438                accept_compression_encodings: self.accept_compression_encodings,
3439                send_compression_encodings: self.send_compression_encodings,
3440                max_decoding_message_size: self.max_decoding_message_size,
3441                max_encoding_message_size: self.max_encoding_message_size,
3442            }
3443        }
3444    }
3445    /// Generated gRPC service name
3446    pub const SERVICE_NAME: &str = "penumbra.core.component.dex.v1.QueryService";
3447    impl<T> tonic::server::NamedService for QueryServiceServer<T> {
3448        const NAME: &'static str = SERVICE_NAME;
3449    }
3450}
3451/// Generated server implementations.
3452#[cfg(feature = "rpc")]
3453pub mod simulation_service_server {
3454    #![allow(
3455        unused_variables,
3456        dead_code,
3457        missing_docs,
3458        clippy::wildcard_imports,
3459        clippy::let_unit_value,
3460    )]
3461    use tonic::codegen::*;
3462    /// Generated trait containing gRPC methods that should be implemented for use with SimulationServiceServer.
3463    #[async_trait]
3464    pub trait SimulationService: std::marker::Send + std::marker::Sync + 'static {
3465        /// Simulate routing and trade execution.
3466        async fn simulate_trade(
3467            &self,
3468            request: tonic::Request<super::SimulateTradeRequest>,
3469        ) -> std::result::Result<
3470            tonic::Response<super::SimulateTradeResponse>,
3471            tonic::Status,
3472        >;
3473    }
3474    /// Simulation for the DEX component.
3475    ///
3476    /// This is a separate service from the QueryService because it's not just a
3477    /// simple read query from the state. Thus it poses greater DoS risks, and node
3478    /// operators may want to enable it separately.
3479    #[derive(Debug)]
3480    pub struct SimulationServiceServer<T> {
3481        inner: Arc<T>,
3482        accept_compression_encodings: EnabledCompressionEncodings,
3483        send_compression_encodings: EnabledCompressionEncodings,
3484        max_decoding_message_size: Option<usize>,
3485        max_encoding_message_size: Option<usize>,
3486    }
3487    impl<T> SimulationServiceServer<T> {
3488        pub fn new(inner: T) -> Self {
3489            Self::from_arc(Arc::new(inner))
3490        }
3491        pub fn from_arc(inner: Arc<T>) -> Self {
3492            Self {
3493                inner,
3494                accept_compression_encodings: Default::default(),
3495                send_compression_encodings: Default::default(),
3496                max_decoding_message_size: None,
3497                max_encoding_message_size: None,
3498            }
3499        }
3500        pub fn with_interceptor<F>(
3501            inner: T,
3502            interceptor: F,
3503        ) -> InterceptedService<Self, F>
3504        where
3505            F: tonic::service::Interceptor,
3506        {
3507            InterceptedService::new(Self::new(inner), interceptor)
3508        }
3509        /// Enable decompressing requests with the given encoding.
3510        #[must_use]
3511        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
3512            self.accept_compression_encodings.enable(encoding);
3513            self
3514        }
3515        /// Compress responses with the given encoding, if the client supports it.
3516        #[must_use]
3517        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
3518            self.send_compression_encodings.enable(encoding);
3519            self
3520        }
3521        /// Limits the maximum size of a decoded message.
3522        ///
3523        /// Default: `4MB`
3524        #[must_use]
3525        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
3526            self.max_decoding_message_size = Some(limit);
3527            self
3528        }
3529        /// Limits the maximum size of an encoded message.
3530        ///
3531        /// Default: `usize::MAX`
3532        #[must_use]
3533        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
3534            self.max_encoding_message_size = Some(limit);
3535            self
3536        }
3537    }
3538    impl<T, B> tonic::codegen::Service<http::Request<B>> for SimulationServiceServer<T>
3539    where
3540        T: SimulationService,
3541        B: Body + std::marker::Send + 'static,
3542        B::Error: Into<StdError> + std::marker::Send + 'static,
3543    {
3544        type Response = http::Response<tonic::body::BoxBody>;
3545        type Error = std::convert::Infallible;
3546        type Future = BoxFuture<Self::Response, Self::Error>;
3547        fn poll_ready(
3548            &mut self,
3549            _cx: &mut Context<'_>,
3550        ) -> Poll<std::result::Result<(), Self::Error>> {
3551            Poll::Ready(Ok(()))
3552        }
3553        fn call(&mut self, req: http::Request<B>) -> Self::Future {
3554            match req.uri().path() {
3555                "/penumbra.core.component.dex.v1.SimulationService/SimulateTrade" => {
3556                    #[allow(non_camel_case_types)]
3557                    struct SimulateTradeSvc<T: SimulationService>(pub Arc<T>);
3558                    impl<
3559                        T: SimulationService,
3560                    > tonic::server::UnaryService<super::SimulateTradeRequest>
3561                    for SimulateTradeSvc<T> {
3562                        type Response = super::SimulateTradeResponse;
3563                        type Future = BoxFuture<
3564                            tonic::Response<Self::Response>,
3565                            tonic::Status,
3566                        >;
3567                        fn call(
3568                            &mut self,
3569                            request: tonic::Request<super::SimulateTradeRequest>,
3570                        ) -> Self::Future {
3571                            let inner = Arc::clone(&self.0);
3572                            let fut = async move {
3573                                <T as SimulationService>::simulate_trade(&inner, request)
3574                                    .await
3575                            };
3576                            Box::pin(fut)
3577                        }
3578                    }
3579                    let accept_compression_encodings = self.accept_compression_encodings;
3580                    let send_compression_encodings = self.send_compression_encodings;
3581                    let max_decoding_message_size = self.max_decoding_message_size;
3582                    let max_encoding_message_size = self.max_encoding_message_size;
3583                    let inner = self.inner.clone();
3584                    let fut = async move {
3585                        let method = SimulateTradeSvc(inner);
3586                        let codec = tonic::codec::ProstCodec::default();
3587                        let mut grpc = tonic::server::Grpc::new(codec)
3588                            .apply_compression_config(
3589                                accept_compression_encodings,
3590                                send_compression_encodings,
3591                            )
3592                            .apply_max_message_size_config(
3593                                max_decoding_message_size,
3594                                max_encoding_message_size,
3595                            );
3596                        let res = grpc.unary(method, req).await;
3597                        Ok(res)
3598                    };
3599                    Box::pin(fut)
3600                }
3601                _ => {
3602                    Box::pin(async move {
3603                        let mut response = http::Response::new(empty_body());
3604                        let headers = response.headers_mut();
3605                        headers
3606                            .insert(
3607                                tonic::Status::GRPC_STATUS,
3608                                (tonic::Code::Unimplemented as i32).into(),
3609                            );
3610                        headers
3611                            .insert(
3612                                http::header::CONTENT_TYPE,
3613                                tonic::metadata::GRPC_CONTENT_TYPE,
3614                            );
3615                        Ok(response)
3616                    })
3617                }
3618            }
3619        }
3620    }
3621    impl<T> Clone for SimulationServiceServer<T> {
3622        fn clone(&self) -> Self {
3623            let inner = self.inner.clone();
3624            Self {
3625                inner,
3626                accept_compression_encodings: self.accept_compression_encodings,
3627                send_compression_encodings: self.send_compression_encodings,
3628                max_decoding_message_size: self.max_decoding_message_size,
3629                max_encoding_message_size: self.max_encoding_message_size,
3630            }
3631        }
3632    }
3633    /// Generated gRPC service name
3634    pub const SERVICE_NAME: &str = "penumbra.core.component.dex.v1.SimulationService";
3635    impl<T> tonic::server::NamedService for SimulationServiceServer<T> {
3636        const NAME: &'static str = SERVICE_NAME;
3637    }
3638}