catalyst_protocol_sdk_rust/
Account.rs1#![allow(unknown_lints)]
6#![allow(clippy::all)]
7
8#![cfg_attr(rustfmt, rustfmt_skip)]
9
10#![allow(box_pointers)]
11#![allow(dead_code)]
12#![allow(missing_docs)]
13#![allow(non_camel_case_types)]
14#![allow(non_snake_case)]
15#![allow(non_upper_case_globals)]
16#![allow(trivial_casts)]
17#![allow(unsafe_code)]
18#![allow(unused_imports)]
19#![allow(unused_results)]
20use protobuf::Message as Message_imported_for_functions;
23use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
24
25const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_10_0;
28
29#[derive(PartialEq,Clone,Default)]
30pub struct Address {
31 pub network_type: super::Network::NetworkType,
33 pub account_type: AccountType,
34 pub public_key_hash: ::std::vec::Vec<u8>,
35 pub unknown_fields: ::protobuf::UnknownFields,
37 pub cached_size: ::protobuf::CachedSize,
38}
39
40impl<'a> ::std::default::Default for &'a Address {
41 fn default() -> &'a Address {
42 <Address as ::protobuf::Message>::default_instance()
43 }
44}
45
46impl Address {
47 pub fn new() -> Address {
48 ::std::default::Default::default()
49 }
50
51 pub fn get_network_type(&self) -> super::Network::NetworkType {
55 self.network_type
56 }
57 pub fn clear_network_type(&mut self) {
58 self.network_type = super::Network::NetworkType::NETWORK_TYPE_UNKNOWN;
59 }
60
61 pub fn set_network_type(&mut self, v: super::Network::NetworkType) {
63 self.network_type = v;
64 }
65
66 pub fn get_account_type(&self) -> AccountType {
70 self.account_type
71 }
72 pub fn clear_account_type(&mut self) {
73 self.account_type = AccountType::ACCOUNT_TYPE_UNKNOWN;
74 }
75
76 pub fn set_account_type(&mut self, v: AccountType) {
78 self.account_type = v;
79 }
80
81 pub fn get_public_key_hash(&self) -> &[u8] {
85 &self.public_key_hash
86 }
87 pub fn clear_public_key_hash(&mut self) {
88 self.public_key_hash.clear();
89 }
90
91 pub fn set_public_key_hash(&mut self, v: ::std::vec::Vec<u8>) {
93 self.public_key_hash = v;
94 }
95
96 pub fn mut_public_key_hash(&mut self) -> &mut ::std::vec::Vec<u8> {
99 &mut self.public_key_hash
100 }
101
102 pub fn take_public_key_hash(&mut self) -> ::std::vec::Vec<u8> {
104 ::std::mem::replace(&mut self.public_key_hash, ::std::vec::Vec::new())
105 }
106}
107
108impl ::protobuf::Message for Address {
109 fn is_initialized(&self) -> bool {
110 true
111 }
112
113 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
114 while !is.eof()? {
115 let (field_number, wire_type) = is.read_tag_unpack()?;
116 match field_number {
117 1 => {
118 ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.network_type, 1, &mut self.unknown_fields)?
119 },
120 2 => {
121 ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.account_type, 2, &mut self.unknown_fields)?
122 },
123 3 => {
124 ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.public_key_hash)?;
125 },
126 _ => {
127 ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
128 },
129 };
130 }
131 ::std::result::Result::Ok(())
132 }
133
134 #[allow(unused_variables)]
136 fn compute_size(&self) -> u32 {
137 let mut my_size = 0;
138 if self.network_type != super::Network::NetworkType::NETWORK_TYPE_UNKNOWN {
139 my_size += ::protobuf::rt::enum_size(1, self.network_type);
140 }
141 if self.account_type != AccountType::ACCOUNT_TYPE_UNKNOWN {
142 my_size += ::protobuf::rt::enum_size(2, self.account_type);
143 }
144 if !self.public_key_hash.is_empty() {
145 my_size += ::protobuf::rt::bytes_size(3, &self.public_key_hash);
146 }
147 my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
148 self.cached_size.set(my_size);
149 my_size
150 }
151
152 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
153 if self.network_type != super::Network::NetworkType::NETWORK_TYPE_UNKNOWN {
154 os.write_enum(1, self.network_type.value())?;
155 }
156 if self.account_type != AccountType::ACCOUNT_TYPE_UNKNOWN {
157 os.write_enum(2, self.account_type.value())?;
158 }
159 if !self.public_key_hash.is_empty() {
160 os.write_bytes(3, &self.public_key_hash)?;
161 }
162 os.write_unknown_fields(self.get_unknown_fields())?;
163 ::std::result::Result::Ok(())
164 }
165
166 fn get_cached_size(&self) -> u32 {
167 self.cached_size.get()
168 }
169
170 fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
171 &self.unknown_fields
172 }
173
174 fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
175 &mut self.unknown_fields
176 }
177
178 fn as_any(&self) -> &dyn (::std::any::Any) {
179 self as &dyn (::std::any::Any)
180 }
181 fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
182 self as &mut dyn (::std::any::Any)
183 }
184 fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
185 self
186 }
187
188 fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
189 Self::descriptor_static()
190 }
191
192 fn new() -> Address {
193 Address::new()
194 }
195
196 fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
197 static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy {
198 lock: ::protobuf::lazy::ONCE_INIT,
199 ptr: 0 as *const ::protobuf::reflect::MessageDescriptor,
200 };
201 unsafe {
202 descriptor.get(|| {
203 let mut fields = ::std::vec::Vec::new();
204 fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<super::Network::NetworkType>>(
205 "network_type",
206 |m: &Address| { &m.network_type },
207 |m: &mut Address| { &mut m.network_type },
208 ));
209 fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<AccountType>>(
210 "account_type",
211 |m: &Address| { &m.account_type },
212 |m: &mut Address| { &mut m.account_type },
213 ));
214 fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>(
215 "public_key_hash",
216 |m: &Address| { &m.public_key_hash },
217 |m: &mut Address| { &mut m.public_key_hash },
218 ));
219 ::protobuf::reflect::MessageDescriptor::new::<Address>(
220 "Address",
221 fields,
222 file_descriptor_proto()
223 )
224 })
225 }
226 }
227
228 fn default_instance() -> &'static Address {
229 static mut instance: ::protobuf::lazy::Lazy<Address> = ::protobuf::lazy::Lazy {
230 lock: ::protobuf::lazy::ONCE_INIT,
231 ptr: 0 as *const Address,
232 };
233 unsafe {
234 instance.get(Address::new)
235 }
236 }
237}
238
239impl ::protobuf::Clear for Address {
240 fn clear(&mut self) {
241 self.network_type = super::Network::NetworkType::NETWORK_TYPE_UNKNOWN;
242 self.account_type = AccountType::ACCOUNT_TYPE_UNKNOWN;
243 self.public_key_hash.clear();
244 self.unknown_fields.clear();
245 }
246}
247
248impl ::std::fmt::Debug for Address {
249 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
250 ::protobuf::text_format::fmt(self, f)
251 }
252}
253
254impl ::protobuf::reflect::ProtobufValue for Address {
255 fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
256 ::protobuf::reflect::ProtobufValueRef::Message(self)
257 }
258}
259
260#[derive(Clone,PartialEq,Eq,Debug,Hash)]
261pub enum AccountType {
262 ACCOUNT_TYPE_UNKNOWN = 0,
263 PUBLIC_ACCOUNT = 8,
264 CONFIDENTIAL_ACCOUNT = 16,
265 SMART_CONTRACT_ACCOUNT = 24,
266}
267
268impl ::protobuf::ProtobufEnum for AccountType {
269 fn value(&self) -> i32 {
270 *self as i32
271 }
272
273 fn from_i32(value: i32) -> ::std::option::Option<AccountType> {
274 match value {
275 0 => ::std::option::Option::Some(AccountType::ACCOUNT_TYPE_UNKNOWN),
276 8 => ::std::option::Option::Some(AccountType::PUBLIC_ACCOUNT),
277 16 => ::std::option::Option::Some(AccountType::CONFIDENTIAL_ACCOUNT),
278 24 => ::std::option::Option::Some(AccountType::SMART_CONTRACT_ACCOUNT),
279 _ => ::std::option::Option::None
280 }
281 }
282
283 fn values() -> &'static [Self] {
284 static values: &'static [AccountType] = &[
285 AccountType::ACCOUNT_TYPE_UNKNOWN,
286 AccountType::PUBLIC_ACCOUNT,
287 AccountType::CONFIDENTIAL_ACCOUNT,
288 AccountType::SMART_CONTRACT_ACCOUNT,
289 ];
290 values
291 }
292
293 fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor {
294 static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy {
295 lock: ::protobuf::lazy::ONCE_INIT,
296 ptr: 0 as *const ::protobuf::reflect::EnumDescriptor,
297 };
298 unsafe {
299 descriptor.get(|| {
300 ::protobuf::reflect::EnumDescriptor::new("AccountType", file_descriptor_proto())
301 })
302 }
303 }
304}
305
306impl ::std::marker::Copy for AccountType {
307}
308
309impl ::std::default::Default for AccountType {
310 fn default() -> Self {
311 AccountType::ACCOUNT_TYPE_UNKNOWN
312 }
313}
314
315impl ::protobuf::reflect::ProtobufValue for AccountType {
316 fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef {
317 ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor())
318 }
319}
320
321static file_descriptor_proto_data: &'static [u8] = b"\
322 \n\rAccount.proto\x12\x19Catalyst.Protocol.Account\x1a\x12Cryptography.p\
323 roto\x1a\rNetwork.proto\"\xc7\x01\n\x07Address\x12I\n\x0cnetwork_type\
324 \x18\x01\x20\x01(\x0e2&.Catalyst.Protocol.Network.NetworkTypeR\x0bnetwor\
325 kType\x12I\n\x0caccount_type\x18\x02\x20\x01(\x0e2&.Catalyst.Protocol.Ac\
326 count.AccountTypeR\x0baccountType\x12&\n\x0fpublic_key_hash\x18\x03\x20\
327 \x01(\x0cR\rpublicKeyHash*q\n\x0bAccountType\x12\x18\n\x14ACCOUNT_TYPE_U\
328 NKNOWN\x10\0\x12\x12\n\x0ePUBLIC_ACCOUNT\x10\x08\x12\x18\n\x14CONFIDENTI\
329 AL_ACCOUNT\x10\x10\x12\x1a\n\x16SMART_CONTRACT_ACCOUNT\x10\x18B\x02P\x01\
330 J\xd0\r\n\x06\x12\x04\x13\0(\x01\n\xdf\x06\n\x01\x0c\x12\x03\x13\0\x122\
331 \xd4\x06*\n\x20Copyright\x20(c)\x202019\x20Catalyst\x20Network\n\n\x20Th\
332 is\x20file\x20is\x20part\x20of\x20Catalyst.Network.Protocol.Protobuffs\
333 \x20<https://github.com/catalyst-network/protocol-protobuffs>\n\n\x20Cat\
334 alyst.Network.Protocol.Protobuffs\x20is\x20free\x20software:\x20you\x20c\
335 an\x20redistribute\x20it\x20and/or\x20modify\n\x20it\x20under\x20the\x20\
336 terms\x20of\x20the\x20GNU\x20General\x20Public\x20License\x20as\x20publi\
337 shed\x20by\n\x20the\x20Free\x20Software\x20Foundation,\x20either\x20vers\
338 ion\x202\x20of\x20the\x20License,\x20or\n\x20(at\x20your\x20option)\x20a\
339 ny\x20later\x20version.\n\x20\n\x20Catalyst.Network.Protocol.Protobuffs\
340 \x20is\x20distributed\x20in\x20the\x20hope\x20that\x20it\x20will\x20be\
341 \x20useful,\n\x20but\x20WITHOUT\x20ANY\x20WARRANTY;\x20without\x20even\
342 \x20the\x20implied\x20warranty\x20of\n\x20MERCHANTABILITY\x20or\x20FITNE\
343 SS\x20FOR\x20A\x20PARTICULAR\x20PURPOSE.\x20See\x20the\n\x20GNU\x20Gener\
344 al\x20Public\x20License\x20for\x20more\x20details.\n\x20\n\x20You\x20sho\
345 uld\x20have\x20received\x20a\x20copy\x20of\x20the\x20GNU\x20General\x20P\
346 ublic\x20License\n\x20along\x20with\x20Catalyst.Network.Protocol.Protobu\
347 ffs\x20If\x20not,\x20see\x20<https://www.gnu.org/licenses/>.\n\n\x08\n\
348 \x01\x08\x12\x03\x15\0\"\n\x0b\n\x04\x08\xe7\x07\0\x12\x03\x15\0\"\n\x0c\
349 \n\x05\x08\xe7\x07\0\x02\x12\x03\x15\x07\x1a\n\r\n\x06\x08\xe7\x07\0\x02\
350 \0\x12\x03\x15\x07\x1a\n\x0e\n\x07\x08\xe7\x07\0\x02\0\x01\x12\x03\x15\
351 \x07\x1a\n\x0c\n\x05\x08\xe7\x07\0\x03\x12\x03\x15\x1d!\n\t\n\x02\x03\0\
352 \x12\x03\x17\x07\x1b\n\t\n\x02\x03\x01\x12\x03\x18\x07\x16\n\x08\n\x01\
353 \x02\x12\x03\x1a\x08!\n\n\n\x02\x04\0\x12\x04\x1c\0\x20\x01\n\n\n\x03\
354 \x04\0\x01\x12\x03\x1c\x08\x0f\n.\n\x04\x04\0\x02\0\x12\x03\x1d\x08-\"!\
355 \x20bit\x20signalling\x20the\x20network\x20type\n\n\r\n\x05\x04\0\x02\0\
356 \x04\x12\x04\x1d\x08\x1c\x11\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03\x1d\x08\
357 \x1b\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x1d\x1c(\n\x0c\n\x05\x04\0\x02\
358 \0\x03\x12\x03\x1d+,\n1\n\x04\x04\0\x02\x01\x12\x03\x1e\x04!\"$\x20bit\
359 \x20signalling\x20the\x20type\x20of\x20account\n\n\r\n\x05\x04\0\x02\x01\
360 \x04\x12\x04\x1e\x04\x1d-\n\x0c\n\x05\x04\0\x02\x01\x06\x12\x03\x1e\x04\
361 \x0f\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x1e\x10\x1c\n\x0c\n\x05\x04\0\
362 \x02\x01\x03\x12\x03\x1e\x1f\x20\n*\n\x04\x04\0\x02\x02\x12\x03\x1f\x08\
363 \"\"\x1d\x20multihash\x20of\x20the\x20public\x20key\n\n\r\n\x05\x04\0\
364 \x02\x02\x04\x12\x04\x1f\x08\x1e!\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\
365 \x1f\x08\r\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x1f\x0e\x1d\n\x0c\n\x05\
366 \x04\0\x02\x02\x03\x12\x03\x1f\x20!\nl\n\x02\x05\0\x12\x04#\0(\x01\x1a`\
367 \x20We\x20need\x20to\x20leave\x20the\x203\x20first\x20bits\x20for\x20the\
368 \x20NetworkType\x20and\x20can\x20use\x20the\x20rest\x20for\x20the\x20Acc\
369 ountType\n\n\n\n\x03\x05\0\x01\x12\x03#\x05\x10\n%\n\x04\x05\0\x02\0\x12\
370 \x03$\x04\x1d\"\x18\x20Un-known\x20account\x20type.\n\n\x0c\n\x05\x05\0\
371 \x02\0\x01\x12\x03$\x04\x18\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03$\x1b\x1c\
372 \n#\n\x04\x05\0\x02\x01\x12\x03%\x04\x17\"\x16\x20Public\x20account\x20t\
373 ype.\n\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03%\x04\x12\n\x0c\n\x05\x05\0\
374 \x02\x01\x02\x12\x03%\x15\x16\n)\n\x04\x05\0\x02\x02\x12\x03&\x04\x1e\"\
375 \x1c\x20Confidential\x20account\x20type.\n\n\x0c\n\x05\x05\0\x02\x02\x01\
376 \x12\x03&\x04\x18\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03&\x1b\x1d\n?\n\
377 \x04\x05\0\x02\x03\x12\x03'\x04\x20\"2\x20Smart\x20contract\x20account\
378 \x20type\x20{TO\x20BE\x20DEPRECATED}.\x20\n\n\x0c\n\x05\x05\0\x02\x03\
379 \x01\x12\x03'\x04\x1a\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03'\x1d\x1fb\
380 \x06proto3\
381";
382
383static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy {
384 lock: ::protobuf::lazy::ONCE_INIT,
385 ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto,
386};
387
388fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
389 ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
390}
391
392pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
393 unsafe {
394 file_descriptor_proto_lazy.get(|| {
395 parse_descriptor_proto()
396 })
397 }
398}