zcash_client_backend/proto/proposal.rs
1// This file is @generated by prost-build.
2/// A data structure that describes a series of transactions to be created.
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct Proposal {
5 /// The version of this serialization format.
6 #[prost(uint32, tag = "1")]
7 pub proto_version: u32,
8 /// The fee rule used in constructing this proposal
9 #[prost(enumeration = "FeeRule", tag = "2")]
10 pub fee_rule: i32,
11 /// The target height for which the proposal was constructed
12 ///
13 /// The chain must contain at least this many blocks in order for the proposal to
14 /// be executed.
15 #[prost(uint32, tag = "3")]
16 pub min_target_height: u32,
17 /// The series of transactions to be created.
18 #[prost(message, repeated, tag = "4")]
19 pub steps: ::prost::alloc::vec::Vec<ProposalStep>,
20}
21/// A data structure that describes the inputs to be consumed and outputs to
22/// be produced in a proposed transaction.
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct ProposalStep {
25 /// ZIP 321 serialized transaction request
26 #[prost(string, tag = "1")]
27 pub transaction_request: ::prost::alloc::string::String,
28 /// The vector of selected payment index / output pool mappings. Payment index
29 /// 0 corresponds to the payment with no explicit index.
30 #[prost(message, repeated, tag = "2")]
31 pub payment_output_pools: ::prost::alloc::vec::Vec<PaymentOutputPool>,
32 /// The anchor height to be used in creating the transaction, if any.
33 /// Setting the anchor height to zero will disallow the use of any shielded
34 /// inputs.
35 #[prost(uint32, tag = "3")]
36 pub anchor_height: u32,
37 /// The inputs to be used in creating the transaction.
38 #[prost(message, repeated, tag = "4")]
39 pub inputs: ::prost::alloc::vec::Vec<ProposedInput>,
40 /// The total value, fee value, and change outputs of the proposed
41 /// transaction
42 #[prost(message, optional, tag = "5")]
43 pub balance: ::core::option::Option<TransactionBalance>,
44 /// A flag indicating whether the step is for a shielding transaction,
45 /// used for determining which OVK to select for wallet-internal outputs.
46 #[prost(bool, tag = "6")]
47 pub is_shielding: bool,
48}
49/// A mapping from ZIP 321 payment index to the output pool that has been chosen
50/// for that payment, based upon the payment address and the selected inputs to
51/// the transaction.
52#[derive(Clone, Copy, PartialEq, ::prost::Message)]
53pub struct PaymentOutputPool {
54 #[prost(uint32, tag = "1")]
55 pub payment_index: u32,
56 #[prost(enumeration = "ValuePool", tag = "2")]
57 pub value_pool: i32,
58}
59/// The unique identifier and value for each proposed input that does not
60/// require a back-reference to a prior step of the proposal.
61#[derive(Clone, PartialEq, ::prost::Message)]
62pub struct ReceivedOutput {
63 #[prost(bytes = "vec", tag = "1")]
64 pub txid: ::prost::alloc::vec::Vec<u8>,
65 #[prost(enumeration = "ValuePool", tag = "2")]
66 pub value_pool: i32,
67 #[prost(uint32, tag = "3")]
68 pub index: u32,
69 #[prost(uint64, tag = "4")]
70 pub value: u64,
71}
72/// A reference to a payment in a prior step of the proposal. This payment must
73/// belong to the wallet.
74#[derive(Clone, Copy, PartialEq, ::prost::Message)]
75pub struct PriorStepOutput {
76 #[prost(uint32, tag = "1")]
77 pub step_index: u32,
78 #[prost(uint32, tag = "2")]
79 pub payment_index: u32,
80}
81/// A reference to a change or ephemeral output from a prior step of the proposal.
82#[derive(Clone, Copy, PartialEq, ::prost::Message)]
83pub struct PriorStepChange {
84 #[prost(uint32, tag = "1")]
85 pub step_index: u32,
86 #[prost(uint32, tag = "2")]
87 pub change_index: u32,
88}
89/// The unique identifier and value for an input to be used in the transaction.
90#[derive(Clone, PartialEq, ::prost::Message)]
91pub struct ProposedInput {
92 #[prost(oneof = "proposed_input::Value", tags = "1, 2, 3")]
93 pub value: ::core::option::Option<proposed_input::Value>,
94}
95/// Nested message and enum types in `ProposedInput`.
96pub mod proposed_input {
97 #[derive(Clone, PartialEq, ::prost::Oneof)]
98 pub enum Value {
99 #[prost(message, tag = "1")]
100 ReceivedOutput(super::ReceivedOutput),
101 #[prost(message, tag = "2")]
102 PriorStepOutput(super::PriorStepOutput),
103 #[prost(message, tag = "3")]
104 PriorStepChange(super::PriorStepChange),
105 }
106}
107/// The proposed change outputs and fee value.
108#[derive(Clone, PartialEq, ::prost::Message)]
109pub struct TransactionBalance {
110 /// A list of change or ephemeral output values.
111 #[prost(message, repeated, tag = "1")]
112 pub proposed_change: ::prost::alloc::vec::Vec<ChangeValue>,
113 /// The fee to be paid by the proposed transaction, in zatoshis.
114 #[prost(uint64, tag = "2")]
115 pub fee_required: u64,
116}
117/// A proposed change or ephemeral output. If the transparent value pool is
118/// selected, the `memo` field must be null.
119///
120/// When the `isEphemeral` field of a `ChangeValue` is set, it represents
121/// an ephemeral output, which must be spent by a subsequent step. This is
122/// only supported for transparent outputs. Each ephemeral output will be
123/// given a unique t-address.
124#[derive(Clone, PartialEq, ::prost::Message)]
125pub struct ChangeValue {
126 /// The value of a change or ephemeral output to be created, in zatoshis.
127 #[prost(uint64, tag = "1")]
128 pub value: u64,
129 /// The value pool in which the change or ephemeral output should be created.
130 #[prost(enumeration = "ValuePool", tag = "2")]
131 pub value_pool: i32,
132 /// The optional memo that should be associated with the newly created output.
133 /// Memos must not be present for transparent outputs.
134 #[prost(message, optional, tag = "3")]
135 pub memo: ::core::option::Option<MemoBytes>,
136 /// Whether this is to be an ephemeral output.
137 #[prost(bool, tag = "4")]
138 pub is_ephemeral: bool,
139}
140/// An object wrapper for memo bytes, to facilitate representing the
141/// `change_memo == None` case.
142#[derive(Clone, PartialEq, ::prost::Message)]
143pub struct MemoBytes {
144 #[prost(bytes = "vec", tag = "1")]
145 pub value: ::prost::alloc::vec::Vec<u8>,
146}
147#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
148#[repr(i32)]
149pub enum ValuePool {
150 /// Protobuf requires that enums have a zero discriminant as the default
151 /// value. However, we need to require that a known value pool is selected,
152 /// and we do not want to fall back to any default, so sending the
153 /// PoolNotSpecified value will be treated as an error.
154 PoolNotSpecified = 0,
155 /// The transparent value pool (P2SH is not distinguished from P2PKH)
156 Transparent = 1,
157 /// The Sapling value pool
158 Sapling = 2,
159 /// The Orchard value pool
160 Orchard = 3,
161}
162impl ValuePool {
163 /// String value of the enum field names used in the ProtoBuf definition.
164 ///
165 /// The values are not transformed in any way and thus are considered stable
166 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
167 pub fn as_str_name(&self) -> &'static str {
168 match self {
169 Self::PoolNotSpecified => "PoolNotSpecified",
170 Self::Transparent => "Transparent",
171 Self::Sapling => "Sapling",
172 Self::Orchard => "Orchard",
173 }
174 }
175 /// Creates an enum from field names used in the ProtoBuf definition.
176 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
177 match value {
178 "PoolNotSpecified" => Some(Self::PoolNotSpecified),
179 "Transparent" => Some(Self::Transparent),
180 "Sapling" => Some(Self::Sapling),
181 "Orchard" => Some(Self::Orchard),
182 _ => None,
183 }
184 }
185}
186/// The fee rule used in constructing a Proposal
187#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
188#[repr(i32)]
189pub enum FeeRule {
190 /// Protobuf requires that enums have a zero discriminant as the default
191 /// value. However, we need to require that a known fee rule is selected,
192 /// and we do not want to fall back to any default, so sending the
193 /// FeeRuleNotSpecified value will be treated as an error.
194 NotSpecified = 0,
195 /// 10000 ZAT
196 PreZip313 = 1,
197 /// 1000 ZAT
198 Zip313 = 2,
199 /// MAX(10000, 5000 * logical_actions) ZAT
200 Zip317 = 3,
201}
202impl FeeRule {
203 /// String value of the enum field names used in the ProtoBuf definition.
204 ///
205 /// The values are not transformed in any way and thus are considered stable
206 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
207 pub fn as_str_name(&self) -> &'static str {
208 match self {
209 Self::NotSpecified => "FeeRuleNotSpecified",
210 Self::PreZip313 => "PreZip313",
211 Self::Zip313 => "Zip313",
212 Self::Zip317 => "Zip317",
213 }
214 }
215 /// Creates an enum from field names used in the ProtoBuf definition.
216 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
217 match value {
218 "FeeRuleNotSpecified" => Some(Self::NotSpecified),
219 "PreZip313" => Some(Self::PreZip313),
220 "Zip313" => Some(Self::Zip313),
221 "Zip317" => Some(Self::Zip317),
222 _ => None,
223 }
224 }
225}