1#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8#![allow(non_upper_case_globals)]
9#![allow(unused_imports)]
10#![allow(dead_code)]
11#![allow(unused_variables)]
12#![allow(clippy::unnecessary_cast)]
13
14use crate::*;
15use core::option::Option;
16use core::ops::{Deref, DerefMut};
17
18#[cfg(feature = "std")]
19use std::io::{Read, Write};
20#[cfg(feature = "xdrs")]
21use xdrs::*;
22
23
24#[cfg(feature = "serde")]
25use ::serde::{{Serialize, Deserialize}};
26
27
28#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
31#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
32#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
33#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
34#[repr(C)]
35pub struct uint128_xdr {
36 pub highbits: u64,
37 pub lowbits: u64,
38}
39
40#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
43#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
44#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
45#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
46#[repr(C)]
47pub struct int128_xdr {
48 pub highbits: i64,
49 pub lowbits: u64,
50}
51
52#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
55#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
56#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
57#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
58#[repr(transparent)]
59#[cfg_attr(feature = "serde", serde(transparent))]
60pub struct Protocol {
61 inner: u32,
62}
63impl From<u32> for Protocol {
64 fn from(_inner: u32) -> Self {
65 Self { inner: _inner }
66 }
67}
68impl Protocol {
69 pub fn into_inner(self) -> u32 {
70 self.inner
71 }
72 pub const fn new(_inner: u32) -> Self {
73 Self { inner: _inner }
74 }
75}
76
77impl Deref for Protocol {
78 type Target = u32;
79
80 fn deref(&self) -> &Self::Target {
81 &self.inner
82 }
83}
84impl DerefMut for Protocol {
85 fn deref_mut(&mut self) -> &mut Self::Target {
86 &mut self.inner
87 }
88}
89
90#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
94#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
95#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
96#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
97#[repr(transparent)]
98#[cfg_attr(feature = "serde", serde(transparent))]
99pub struct TimePoint {
100 inner: u64,
101}
102impl From<u64> for TimePoint {
103 fn from(_inner: u64) -> Self {
104 Self { inner: _inner }
105 }
106}
107impl TimePoint {
108 pub fn into_inner(self) -> u64 {
109 self.inner
110 }
111 pub const fn new(_inner: u64) -> Self {
112 Self { inner: _inner }
113 }
114}
115
116impl Deref for TimePoint {
117 type Target = u64;
118
119 fn deref(&self) -> &Self::Target {
120 &self.inner
121 }
122}
123impl DerefMut for TimePoint {
124 fn deref_mut(&mut self) -> &mut Self::Target {
125 &mut self.inner
126 }
127}
128
129pub type RuntimeMemoryLength = u32;
134
135pub type GasAmount = u64;
139
140#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
143#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
144#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
145#[derive(Copy)]
146#[repr(transparent)]
147#[cfg_attr(feature = "serde", serde(transparent))]
148pub struct Ed25519Signature {
149 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
150 inner: [u8; 64 as usize],
151}
152impl From<[u8; 64 as usize]> for Ed25519Signature {
153 fn from(_inner: [u8; 64 as usize]) -> Self {
154 Self { inner: _inner }
155 }
156}
157impl Ed25519Signature {
158 pub fn into_inner(self) -> [u8; 64 as usize] {
159 self.inner
160 }
161 pub const fn new(_inner: [u8; 64 as usize]) -> Self {
162 Self { inner: _inner }
163 }
164}
165
166impl Deref for Ed25519Signature {
167 type Target = [u8; 64 as usize];
168
169 fn deref(&self) -> &Self::Target {
170 &self.inner
171 }
172}
173impl DerefMut for Ed25519Signature {
174 fn deref_mut(&mut self) -> &mut Self::Target {
175 &mut self.inner
176 }
177}
178impl AsRef<[u8]> for Ed25519Signature {
179 fn as_ref(&self) -> &[u8] {
180 self.deref().as_slice()
181 }
182}
183impl<'a> From<&'a [u8; 64]> for &'a Ed25519Signature {
184 fn from(arr: &[u8; 64]) -> Self {
185 let ptr = arr as *const [u8; 64] as *const Ed25519Signature;
186 unsafe { &*ptr }
187 }
188}
189#[cfg(feature = "xdrs")]
190impl<'r: 'a, 'a> ReadXDR<'r> for &'a Ed25519Signature {
191 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
192 let arr: &[u8; 64] = xdrs::read_xdr(r)?;
193 let val = Self::from(arr);
194 Ok(val)
195 }
196}
197
198#[cfg(feature = "schema")]
199impl schemars::JsonSchema for Ed25519Signature {
200 fn schema_name() -> ::std::borrow::Cow<'static, str> {
201 "Ed25519Signature".into()
202 }
203 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
204 schemars::json_schema!({
205 "type": "string",
206 "contentEncoding": "hex",
207 "contentMediaType": "application/binary",
208 "minLength": 128,
209 "maxLength": 128
210 })
211 }
212}
213
214
215
216#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
219#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
220#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
221#[derive(Default, Copy)]
222#[repr(transparent)]
223#[cfg_attr(feature = "serde", serde(transparent))]
224pub struct Ed25519PublicKey {
225 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
226 inner: [u8; 32 as usize],
227}
228impl From<[u8; 32 as usize]> for Ed25519PublicKey {
229 fn from(_inner: [u8; 32 as usize]) -> Self {
230 Self { inner: _inner }
231 }
232}
233impl Ed25519PublicKey {
234 pub fn into_inner(self) -> [u8; 32 as usize] {
235 self.inner
236 }
237 pub const fn new(_inner: [u8; 32 as usize]) -> Self {
238 Self { inner: _inner }
239 }
240}
241
242impl Deref for Ed25519PublicKey {
243 type Target = [u8; 32 as usize];
244
245 fn deref(&self) -> &Self::Target {
246 &self.inner
247 }
248}
249impl DerefMut for Ed25519PublicKey {
250 fn deref_mut(&mut self) -> &mut Self::Target {
251 &mut self.inner
252 }
253}
254impl AsRef<[u8]> for Ed25519PublicKey {
255 fn as_ref(&self) -> &[u8] {
256 self.deref().as_slice()
257 }
258}
259impl<'a> From<&'a [u8; 32]> for &'a Ed25519PublicKey {
260 fn from(arr: &[u8; 32]) -> Self {
261 let ptr = arr as *const [u8; 32] as *const Ed25519PublicKey;
262 unsafe { &*ptr }
263 }
264}
265#[cfg(feature = "xdrs")]
266impl<'r: 'a, 'a> ReadXDR<'r> for &'a Ed25519PublicKey {
267 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
268 let arr: &[u8; 32] = xdrs::read_xdr(r)?;
269 let val = Self::from(arr);
270 Ok(val)
271 }
272}
273
274#[cfg(feature = "schema")]
275impl schemars::JsonSchema for Ed25519PublicKey {
276 fn schema_name() -> ::std::borrow::Cow<'static, str> {
277 "Ed25519PublicKey".into()
278 }
279 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
280 schemars::json_schema!({
281 "type": "string",
282 "contentEncoding": "hex",
283 "contentMediaType": "application/binary",
284 "minLength": 64,
285 "maxLength": 64
286 })
287 }
288}
289
290
291
292#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
294#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
295#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
296#[derive(Copy)]
297#[repr(transparent)]
298#[cfg_attr(feature = "serde", serde(transparent))]
299pub struct Ed25519SecretKey {
300 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
301 inner: [u8; 64 as usize],
302}
303impl From<[u8; 64 as usize]> for Ed25519SecretKey {
304 fn from(_inner: [u8; 64 as usize]) -> Self {
305 Self { inner: _inner }
306 }
307}
308impl Ed25519SecretKey {
309 pub fn into_inner(self) -> [u8; 64 as usize] {
310 self.inner
311 }
312 pub const fn new(_inner: [u8; 64 as usize]) -> Self {
313 Self { inner: _inner }
314 }
315}
316
317impl Deref for Ed25519SecretKey {
318 type Target = [u8; 64 as usize];
319
320 fn deref(&self) -> &Self::Target {
321 &self.inner
322 }
323}
324impl DerefMut for Ed25519SecretKey {
325 fn deref_mut(&mut self) -> &mut Self::Target {
326 &mut self.inner
327 }
328}
329impl AsRef<[u8]> for Ed25519SecretKey {
330 fn as_ref(&self) -> &[u8] {
331 self.deref().as_slice()
332 }
333}
334impl<'a> From<&'a [u8; 64]> for &'a Ed25519SecretKey {
335 fn from(arr: &[u8; 64]) -> Self {
336 let ptr = arr as *const [u8; 64] as *const Ed25519SecretKey;
337 unsafe { &*ptr }
338 }
339}
340#[cfg(feature = "xdrs")]
341impl<'r: 'a, 'a> ReadXDR<'r> for &'a Ed25519SecretKey {
342 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
343 let arr: &[u8; 64] = xdrs::read_xdr(r)?;
344 let val = Self::from(arr);
345 Ok(val)
346 }
347}
348
349#[cfg(feature = "schema")]
350impl schemars::JsonSchema for Ed25519SecretKey {
351 fn schema_name() -> ::std::borrow::Cow<'static, str> {
352 "Ed25519SecretKey".into()
353 }
354 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
355 schemars::json_schema!({
356 "type": "string",
357 "contentEncoding": "hex",
358 "contentMediaType": "application/binary",
359 "minLength": 128,
360 "maxLength": 128
361 })
362 }
363}
364
365
366
367#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
373#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
374#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
375#[derive(Copy)]
376#[repr(transparent)]
377#[cfg_attr(feature = "serde", serde(transparent))]
378pub struct MlDsa65Signature {
379 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
380 inner: [u8; 3309 as usize],
381}
382impl From<[u8; 3309 as usize]> for MlDsa65Signature {
383 fn from(_inner: [u8; 3309 as usize]) -> Self {
384 Self { inner: _inner }
385 }
386}
387impl MlDsa65Signature {
388 pub fn into_inner(self) -> [u8; 3309 as usize] {
389 self.inner
390 }
391 pub const fn new(_inner: [u8; 3309 as usize]) -> Self {
392 Self { inner: _inner }
393 }
394}
395
396impl Deref for MlDsa65Signature {
397 type Target = [u8; 3309 as usize];
398
399 fn deref(&self) -> &Self::Target {
400 &self.inner
401 }
402}
403impl DerefMut for MlDsa65Signature {
404 fn deref_mut(&mut self) -> &mut Self::Target {
405 &mut self.inner
406 }
407}
408impl AsRef<[u8]> for MlDsa65Signature {
409 fn as_ref(&self) -> &[u8] {
410 self.deref().as_slice()
411 }
412}
413impl<'a> From<&'a [u8; 3309]> for &'a MlDsa65Signature {
414 fn from(arr: &[u8; 3309]) -> Self {
415 let ptr = arr as *const [u8; 3309] as *const MlDsa65Signature;
416 unsafe { &*ptr }
417 }
418}
419#[cfg(feature = "xdrs")]
420impl<'r: 'a, 'a> ReadXDR<'r> for &'a MlDsa65Signature {
421 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
422 let arr: &[u8; 3309] = xdrs::read_xdr(r)?;
423 let val = Self::from(arr);
424 Ok(val)
425 }
426}
427
428#[cfg(feature = "schema")]
429impl schemars::JsonSchema for MlDsa65Signature {
430 fn schema_name() -> ::std::borrow::Cow<'static, str> {
431 "MlDsa65Signature".into()
432 }
433 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
434 schemars::json_schema!({
435 "type": "string",
436 "contentEncoding": "hex",
437 "contentMediaType": "application/binary",
438 "minLength": 6618,
439 "maxLength": 6618
440 })
441 }
442}
443
444
445
446#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
449#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
450#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
451#[derive(Copy)]
452#[repr(transparent)]
453#[cfg_attr(feature = "serde", serde(transparent))]
454pub struct MlDsa65PublicKey {
455 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
456 inner: [u8; 1952 as usize],
457}
458impl From<[u8; 1952 as usize]> for MlDsa65PublicKey {
459 fn from(_inner: [u8; 1952 as usize]) -> Self {
460 Self { inner: _inner }
461 }
462}
463impl MlDsa65PublicKey {
464 pub fn into_inner(self) -> [u8; 1952 as usize] {
465 self.inner
466 }
467 pub const fn new(_inner: [u8; 1952 as usize]) -> Self {
468 Self { inner: _inner }
469 }
470}
471
472impl Deref for MlDsa65PublicKey {
473 type Target = [u8; 1952 as usize];
474
475 fn deref(&self) -> &Self::Target {
476 &self.inner
477 }
478}
479impl DerefMut for MlDsa65PublicKey {
480 fn deref_mut(&mut self) -> &mut Self::Target {
481 &mut self.inner
482 }
483}
484impl AsRef<[u8]> for MlDsa65PublicKey {
485 fn as_ref(&self) -> &[u8] {
486 self.deref().as_slice()
487 }
488}
489impl<'a> From<&'a [u8; 1952]> for &'a MlDsa65PublicKey {
490 fn from(arr: &[u8; 1952]) -> Self {
491 let ptr = arr as *const [u8; 1952] as *const MlDsa65PublicKey;
492 unsafe { &*ptr }
493 }
494}
495#[cfg(feature = "xdrs")]
496impl<'r: 'a, 'a> ReadXDR<'r> for &'a MlDsa65PublicKey {
497 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
498 let arr: &[u8; 1952] = xdrs::read_xdr(r)?;
499 let val = Self::from(arr);
500 Ok(val)
501 }
502}
503
504#[cfg(feature = "schema")]
505impl schemars::JsonSchema for MlDsa65PublicKey {
506 fn schema_name() -> ::std::borrow::Cow<'static, str> {
507 "MlDsa65PublicKey".into()
508 }
509 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
510 schemars::json_schema!({
511 "type": "string",
512 "contentEncoding": "hex",
513 "contentMediaType": "application/binary",
514 "minLength": 3904,
515 "maxLength": 3904
516 })
517 }
518}
519
520
521
522#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
524#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
525#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
526#[derive(Copy)]
527#[repr(transparent)]
528#[cfg_attr(feature = "serde", serde(transparent))]
529pub struct MlDsa65SecretKey {
530 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
531 inner: [u8; 4032 as usize],
532}
533impl From<[u8; 4032 as usize]> for MlDsa65SecretKey {
534 fn from(_inner: [u8; 4032 as usize]) -> Self {
535 Self { inner: _inner }
536 }
537}
538impl MlDsa65SecretKey {
539 pub fn into_inner(self) -> [u8; 4032 as usize] {
540 self.inner
541 }
542 pub const fn new(_inner: [u8; 4032 as usize]) -> Self {
543 Self { inner: _inner }
544 }
545}
546
547impl Deref for MlDsa65SecretKey {
548 type Target = [u8; 4032 as usize];
549
550 fn deref(&self) -> &Self::Target {
551 &self.inner
552 }
553}
554impl DerefMut for MlDsa65SecretKey {
555 fn deref_mut(&mut self) -> &mut Self::Target {
556 &mut self.inner
557 }
558}
559impl AsRef<[u8]> for MlDsa65SecretKey {
560 fn as_ref(&self) -> &[u8] {
561 self.deref().as_slice()
562 }
563}
564impl<'a> From<&'a [u8; 4032]> for &'a MlDsa65SecretKey {
565 fn from(arr: &[u8; 4032]) -> Self {
566 let ptr = arr as *const [u8; 4032] as *const MlDsa65SecretKey;
567 unsafe { &*ptr }
568 }
569}
570#[cfg(feature = "xdrs")]
571impl<'r: 'a, 'a> ReadXDR<'r> for &'a MlDsa65SecretKey {
572 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
573 let arr: &[u8; 4032] = xdrs::read_xdr(r)?;
574 let val = Self::from(arr);
575 Ok(val)
576 }
577}
578
579#[cfg(feature = "schema")]
580impl schemars::JsonSchema for MlDsa65SecretKey {
581 fn schema_name() -> ::std::borrow::Cow<'static, str> {
582 "MlDsa65SecretKey".into()
583 }
584 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
585 schemars::json_schema!({
586 "type": "string",
587 "contentEncoding": "hex",
588 "contentMediaType": "application/binary",
589 "minLength": 8064,
590 "maxLength": 8064
591 })
592 }
593}
594
595
596
597#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
599#[cfg_attr(feature = "serde", serde(transparent))]
600#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
601#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
602#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
603#[derive(Copy)]
604#[repr(transparent)]
605pub struct CryptographicScheme(pub i32);
606
607impl CryptographicScheme {
608 pub const Ed25519: Self = Self(0);
609
610 pub const MlDsa65: Self = Self(1);
613}
614impl From<i32> for CryptographicScheme {
615 fn from(v: i32) -> Self {
616 Self(v)
617 }
618}
619#[cfg(feature = "std")]
620impl core::fmt::Display for CryptographicScheme {
621 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
622 match self.0 {
623 x if x == Self::Ed25519.0 => {
624 write!(f, "CryptographicScheme::Ed25519")
625 },
626 x if x == Self::MlDsa65.0 => {
627 write!(f, "CryptographicScheme::MlDsa65")
628 },
629 _ => {
630 write!(f, "CryptographicScheme({})", self.0)
631 }
632 }
633 }
634}
635
636
637#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
644#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
645#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
646#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
647#[repr(i32)]
648#[non_exhaustive]
649pub enum Signature {
650 Ed25519 { ed25519: Ed25519Signature } = CryptographicScheme::Ed25519.0 as i32,
653 MlDsa65 { mldsa65: Box<MlDsa65Signature> } = CryptographicScheme::MlDsa65.0 as i32,
657
658}
659
660#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
662#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
663#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
664#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
665#[repr(i32)]
666#[non_exhaustive]
667pub enum PublicKey {
668 Ed25519 { ed25519: Ed25519PublicKey } = CryptographicScheme::Ed25519.0 as i32,
671 MlDsa65 { mldsa65: Box<MlDsa65PublicKey> } = CryptographicScheme::MlDsa65.0 as i32,
675
676}
677
678#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
685#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
686#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
687#[derive(Default, Copy)]
688#[repr(transparent)]
689#[cfg_attr(feature = "serde", serde(transparent))]
690pub struct PublicKeyHash {
691 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
692 inner: [u8; 32 as usize],
693}
694impl From<[u8; 32 as usize]> for PublicKeyHash {
695 fn from(_inner: [u8; 32 as usize]) -> Self {
696 Self { inner: _inner }
697 }
698}
699impl PublicKeyHash {
700 pub fn into_inner(self) -> [u8; 32 as usize] {
701 self.inner
702 }
703 pub const fn new(_inner: [u8; 32 as usize]) -> Self {
704 Self { inner: _inner }
705 }
706}
707
708impl Deref for PublicKeyHash {
709 type Target = [u8; 32 as usize];
710
711 fn deref(&self) -> &Self::Target {
712 &self.inner
713 }
714}
715impl DerefMut for PublicKeyHash {
716 fn deref_mut(&mut self) -> &mut Self::Target {
717 &mut self.inner
718 }
719}
720impl AsRef<[u8]> for PublicKeyHash {
721 fn as_ref(&self) -> &[u8] {
722 self.deref().as_slice()
723 }
724}
725impl<'a> From<&'a [u8; 32]> for &'a PublicKeyHash {
726 fn from(arr: &[u8; 32]) -> Self {
727 let ptr = arr as *const [u8; 32] as *const PublicKeyHash;
728 unsafe { &*ptr }
729 }
730}
731#[cfg(feature = "xdrs")]
732impl<'r: 'a, 'a> ReadXDR<'r> for &'a PublicKeyHash {
733 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
734 let arr: &[u8; 32] = xdrs::read_xdr(r)?;
735 let val = Self::from(arr);
736 Ok(val)
737 }
738}
739
740#[cfg(feature = "schema")]
741impl schemars::JsonSchema for PublicKeyHash {
742 fn schema_name() -> ::std::borrow::Cow<'static, str> {
743 "PublicKeyHash".into()
744 }
745 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
746 schemars::json_schema!({
747 "type": "string",
748 "contentEncoding": "hex",
749 "contentMediaType": "application/binary",
750 "minLength": 64,
751 "maxLength": 64
752 })
753 }
754}
755
756
757
758#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
760#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
761#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
762#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
763#[repr(i32)]
764#[non_exhaustive]
765pub enum SecretKey {
766 Ed25519 { ed25519: Ed25519SecretKey } = CryptographicScheme::Ed25519.0 as i32,
769 MlDsa65 { mldsa65: Box<MlDsa65SecretKey> } = CryptographicScheme::MlDsa65.0 as i32,
773
774}
775
776#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
784#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
785#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstWriteXDR, ConstXDRSize))]
786#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
787#[repr(i32)]
788#[non_exhaustive]
789pub enum ExtensionPoint {
790 _0 = 0 as i32,
793
794}
795
796#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
798#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
799#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
800#[derive(Default, Copy)]
801#[repr(transparent)]
802#[cfg_attr(feature = "serde", serde(transparent))]
803pub struct SHA256Hash {
804 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
805 inner: [u8; 32 as usize],
806}
807impl From<[u8; 32 as usize]> for SHA256Hash {
808 fn from(_inner: [u8; 32 as usize]) -> Self {
809 Self { inner: _inner }
810 }
811}
812impl SHA256Hash {
813 pub fn into_inner(self) -> [u8; 32 as usize] {
814 self.inner
815 }
816 pub const fn new(_inner: [u8; 32 as usize]) -> Self {
817 Self { inner: _inner }
818 }
819}
820
821impl Deref for SHA256Hash {
822 type Target = [u8; 32 as usize];
823
824 fn deref(&self) -> &Self::Target {
825 &self.inner
826 }
827}
828impl DerefMut for SHA256Hash {
829 fn deref_mut(&mut self) -> &mut Self::Target {
830 &mut self.inner
831 }
832}
833impl AsRef<[u8]> for SHA256Hash {
834 fn as_ref(&self) -> &[u8] {
835 self.deref().as_slice()
836 }
837}
838impl<'a> From<&'a [u8; 32]> for &'a SHA256Hash {
839 fn from(arr: &[u8; 32]) -> Self {
840 let ptr = arr as *const [u8; 32] as *const SHA256Hash;
841 unsafe { &*ptr }
842 }
843}
844#[cfg(feature = "xdrs")]
845impl<'r: 'a, 'a> ReadXDR<'r> for &'a SHA256Hash {
846 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
847 let arr: &[u8; 32] = xdrs::read_xdr(r)?;
848 let val = Self::from(arr);
849 Ok(val)
850 }
851}
852
853#[cfg(feature = "schema")]
854impl schemars::JsonSchema for SHA256Hash {
855 fn schema_name() -> ::std::borrow::Cow<'static, str> {
856 "SHA256Hash".into()
857 }
858 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
859 schemars::json_schema!({
860 "type": "string",
861 "contentEncoding": "hex",
862 "contentMediaType": "application/binary",
863 "minLength": 64,
864 "maxLength": 64
865 })
866 }
867}
868
869
870
871#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
874#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
875#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
876#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
877#[repr(transparent)]
878#[cfg_attr(feature = "serde", serde(transparent))]
879pub struct ConsensusValueHash {
880 inner: SHA256Hash,
881}
882impl From<SHA256Hash> for ConsensusValueHash {
883 fn from(_inner: SHA256Hash) -> Self {
884 Self { inner: _inner }
885 }
886}
887impl ConsensusValueHash {
888 pub fn into_inner(self) -> SHA256Hash {
889 self.inner
890 }
891 pub const fn new(_inner: SHA256Hash) -> Self {
892 Self { inner: _inner }
893 }
894}
895
896impl Deref for ConsensusValueHash {
897 type Target = SHA256Hash;
898
899 fn deref(&self) -> &Self::Target {
900 &self.inner
901 }
902}
903impl DerefMut for ConsensusValueHash {
904 fn deref_mut(&mut self) -> &mut Self::Target {
905 &mut self.inner
906 }
907}
908
909#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
911#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
912#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
913#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
914#[repr(transparent)]
915#[cfg_attr(feature = "serde", serde(transparent))]
916pub struct NetworkHash {
917 inner: SHA256Hash,
918}
919impl From<SHA256Hash> for NetworkHash {
920 fn from(_inner: SHA256Hash) -> Self {
921 Self { inner: _inner }
922 }
923}
924impl NetworkHash {
925 pub fn into_inner(self) -> SHA256Hash {
926 self.inner
927 }
928 pub const fn new(_inner: SHA256Hash) -> Self {
929 Self { inner: _inner }
930 }
931}
932
933impl Deref for NetworkHash {
934 type Target = SHA256Hash;
935
936 fn deref(&self) -> &Self::Target {
937 &self.inner
938 }
939}
940impl DerefMut for NetworkHash {
941 fn deref_mut(&mut self) -> &mut Self::Target {
942 &mut self.inner
943 }
944}
945
946#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
949#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
950#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
951#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
952#[repr(transparent)]
953#[cfg_attr(feature = "serde", serde(transparent))]
954pub struct ConfigHash {
955 inner: SHA256Hash,
956}
957impl From<SHA256Hash> for ConfigHash {
958 fn from(_inner: SHA256Hash) -> Self {
959 Self { inner: _inner }
960 }
961}
962impl ConfigHash {
963 pub fn into_inner(self) -> SHA256Hash {
964 self.inner
965 }
966 pub const fn new(_inner: SHA256Hash) -> Self {
967 Self { inner: _inner }
968 }
969}
970
971impl Deref for ConfigHash {
972 type Target = SHA256Hash;
973
974 fn deref(&self) -> &Self::Target {
975 &self.inner
976 }
977}
978impl DerefMut for ConfigHash {
979 fn deref_mut(&mut self) -> &mut Self::Target {
980 &mut self.inner
981 }
982}
983
984#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
988#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
989#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
990#[derive(Copy)]
991#[repr(transparent)]
992#[cfg_attr(feature = "serde", serde(transparent))]
993pub struct StorageLongHash {
994 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
995 inner: [u8; 2048 as usize],
996}
997impl From<[u8; 2048 as usize]> for StorageLongHash {
998 fn from(_inner: [u8; 2048 as usize]) -> Self {
999 Self { inner: _inner }
1000 }
1001}
1002impl StorageLongHash {
1003 pub fn into_inner(self) -> [u8; 2048 as usize] {
1004 self.inner
1005 }
1006 pub const fn new(_inner: [u8; 2048 as usize]) -> Self {
1007 Self { inner: _inner }
1008 }
1009}
1010
1011impl Deref for StorageLongHash {
1012 type Target = [u8; 2048 as usize];
1013
1014 fn deref(&self) -> &Self::Target {
1015 &self.inner
1016 }
1017}
1018impl DerefMut for StorageLongHash {
1019 fn deref_mut(&mut self) -> &mut Self::Target {
1020 &mut self.inner
1021 }
1022}
1023impl AsRef<[u8]> for StorageLongHash {
1024 fn as_ref(&self) -> &[u8] {
1025 self.deref().as_slice()
1026 }
1027}
1028impl<'a> From<&'a [u8; 2048]> for &'a StorageLongHash {
1029 fn from(arr: &[u8; 2048]) -> Self {
1030 let ptr = arr as *const [u8; 2048] as *const StorageLongHash;
1031 unsafe { &*ptr }
1032 }
1033}
1034#[cfg(feature = "xdrs")]
1035impl<'r: 'a, 'a> ReadXDR<'r> for &'a StorageLongHash {
1036 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
1037 let arr: &[u8; 2048] = xdrs::read_xdr(r)?;
1038 let val = Self::from(arr);
1039 Ok(val)
1040 }
1041}
1042
1043#[cfg(feature = "schema")]
1044impl schemars::JsonSchema for StorageLongHash {
1045 fn schema_name() -> ::std::borrow::Cow<'static, str> {
1046 "StorageLongHash".into()
1047 }
1048 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
1049 schemars::json_schema!({
1050 "type": "string",
1051 "contentEncoding": "hex",
1052 "contentMediaType": "application/binary",
1053 "minLength": 4096,
1054 "maxLength": 4096
1055 })
1056 }
1057}
1058
1059
1060
1061#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1063#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1064#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1065#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1066#[repr(transparent)]
1067#[cfg_attr(feature = "serde", serde(transparent))]
1068pub struct StorageShortHash {
1069 inner: SHA256Hash,
1070}
1071impl From<SHA256Hash> for StorageShortHash {
1072 fn from(_inner: SHA256Hash) -> Self {
1073 Self { inner: _inner }
1074 }
1075}
1076impl StorageShortHash {
1077 pub fn into_inner(self) -> SHA256Hash {
1078 self.inner
1079 }
1080 pub const fn new(_inner: SHA256Hash) -> Self {
1081 Self { inner: _inner }
1082 }
1083}
1084
1085impl Deref for StorageShortHash {
1086 type Target = SHA256Hash;
1087
1088 fn deref(&self) -> &Self::Target {
1089 &self.inner
1090 }
1091}
1092impl DerefMut for StorageShortHash {
1093 fn deref_mut(&mut self) -> &mut Self::Target {
1094 &mut self.inner
1095 }
1096}
1097
1098#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1100#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1101#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1102#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1103#[repr(transparent)]
1104#[cfg_attr(feature = "serde", serde(transparent))]
1105pub struct TxsHash {
1106 inner: SHA256Hash,
1107}
1108impl From<SHA256Hash> for TxsHash {
1109 fn from(_inner: SHA256Hash) -> Self {
1110 Self { inner: _inner }
1111 }
1112}
1113impl TxsHash {
1114 pub fn into_inner(self) -> SHA256Hash {
1115 self.inner
1116 }
1117 pub const fn new(_inner: SHA256Hash) -> Self {
1118 Self { inner: _inner }
1119 }
1120}
1121
1122impl Deref for TxsHash {
1123 type Target = SHA256Hash;
1124
1125 fn deref(&self) -> &Self::Target {
1126 &self.inner
1127 }
1128}
1129impl DerefMut for TxsHash {
1130 fn deref_mut(&mut self) -> &mut Self::Target {
1131 &mut self.inner
1132 }
1133}
1134
1135#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1137#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1138#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1139#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1140#[repr(transparent)]
1141#[cfg_attr(feature = "serde", serde(transparent))]
1142pub struct EventsHash {
1143 inner: SHA256Hash,
1144}
1145impl From<SHA256Hash> for EventsHash {
1146 fn from(_inner: SHA256Hash) -> Self {
1147 Self { inner: _inner }
1148 }
1149}
1150impl EventsHash {
1151 pub fn into_inner(self) -> SHA256Hash {
1152 self.inner
1153 }
1154 pub const fn new(_inner: SHA256Hash) -> Self {
1155 Self { inner: _inner }
1156 }
1157}
1158
1159impl Deref for EventsHash {
1160 type Target = SHA256Hash;
1161
1162 fn deref(&self) -> &Self::Target {
1163 &self.inner
1164 }
1165}
1166impl DerefMut for EventsHash {
1167 fn deref_mut(&mut self) -> &mut Self::Target {
1168 &mut self.inner
1169 }
1170}
1171
1172#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1175#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1176#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1177#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1178#[repr(transparent)]
1179#[cfg_attr(feature = "serde", serde(transparent))]
1180pub struct ProposalHeaderHash {
1181 inner: SHA256Hash,
1182}
1183impl From<SHA256Hash> for ProposalHeaderHash {
1184 fn from(_inner: SHA256Hash) -> Self {
1185 Self { inner: _inner }
1186 }
1187}
1188impl ProposalHeaderHash {
1189 pub fn into_inner(self) -> SHA256Hash {
1190 self.inner
1191 }
1192 pub const fn new(_inner: SHA256Hash) -> Self {
1193 Self { inner: _inner }
1194 }
1195}
1196
1197impl Deref for ProposalHeaderHash {
1198 type Target = SHA256Hash;
1199
1200 fn deref(&self) -> &Self::Target {
1201 &self.inner
1202 }
1203}
1204impl DerefMut for ProposalHeaderHash {
1205 fn deref_mut(&mut self) -> &mut Self::Target {
1206 &mut self.inner
1207 }
1208}
1209
1210#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1214#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1215#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
1216#[derive(Default, Copy)]
1217#[repr(transparent)]
1218#[cfg_attr(feature = "serde", serde(transparent))]
1219pub struct ContractAddress {
1220 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
1221 inner: [u8; 32 as usize],
1222}
1223impl From<[u8; 32 as usize]> for ContractAddress {
1224 fn from(_inner: [u8; 32 as usize]) -> Self {
1225 Self { inner: _inner }
1226 }
1227}
1228impl ContractAddress {
1229 pub fn into_inner(self) -> [u8; 32 as usize] {
1230 self.inner
1231 }
1232 pub const fn new(_inner: [u8; 32 as usize]) -> Self {
1233 Self { inner: _inner }
1234 }
1235}
1236
1237impl Deref for ContractAddress {
1238 type Target = [u8; 32 as usize];
1239
1240 fn deref(&self) -> &Self::Target {
1241 &self.inner
1242 }
1243}
1244impl DerefMut for ContractAddress {
1245 fn deref_mut(&mut self) -> &mut Self::Target {
1246 &mut self.inner
1247 }
1248}
1249impl AsRef<[u8]> for ContractAddress {
1250 fn as_ref(&self) -> &[u8] {
1251 self.deref().as_slice()
1252 }
1253}
1254impl<'a> From<&'a [u8; 32]> for &'a ContractAddress {
1255 fn from(arr: &[u8; 32]) -> Self {
1256 let ptr = arr as *const [u8; 32] as *const ContractAddress;
1257 unsafe { &*ptr }
1258 }
1259}
1260#[cfg(feature = "xdrs")]
1261impl<'r: 'a, 'a> ReadXDR<'r> for &'a ContractAddress {
1262 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
1263 let arr: &[u8; 32] = xdrs::read_xdr(r)?;
1264 let val = Self::from(arr);
1265 Ok(val)
1266 }
1267}
1268
1269#[cfg(feature = "schema")]
1270impl schemars::JsonSchema for ContractAddress {
1271 fn schema_name() -> ::std::borrow::Cow<'static, str> {
1272 "ContractAddress".into()
1273 }
1274 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
1275 schemars::json_schema!({
1276 "type": "string",
1277 "contentEncoding": "hex",
1278 "contentMediaType": "application/binary",
1279 "minLength": 64,
1280 "maxLength": 64
1281 })
1282 }
1283}
1284
1285
1286
1287#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1297#[cfg_attr(feature = "serde", serde(transparent))]
1298#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1299#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1300#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1301#[derive(Copy)]
1302#[repr(transparent)]
1303pub struct StorageKeyType(pub i32);
1304
1305impl StorageKeyType {
1306 pub const ContractData: Self = Self(0);
1310
1311 pub const FreeNativeTokenBalance: Self = Self(1);
1315
1316 pub const AuthData: Self = Self(2);
1321
1322 pub const Metadata: Self = Self(3);
1327
1328 pub const ReplayCache: Self = Self(4);
1333}
1334impl From<i32> for StorageKeyType {
1335 fn from(v: i32) -> Self {
1336 Self(v)
1337 }
1338}
1339#[cfg(feature = "std")]
1340impl core::fmt::Display for StorageKeyType {
1341 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
1342 match self.0 {
1343 x if x == Self::ContractData.0 => {
1344 write!(f, "StorageKeyType::ContractData")
1345 },
1346 x if x == Self::FreeNativeTokenBalance.0 => {
1347 write!(f, "StorageKeyType::FreeNativeTokenBalance")
1348 },
1349 x if x == Self::AuthData.0 => {
1350 write!(f, "StorageKeyType::AuthData")
1351 },
1352 x if x == Self::Metadata.0 => {
1353 write!(f, "StorageKeyType::Metadata")
1354 },
1355 x if x == Self::ReplayCache.0 => {
1356 write!(f, "StorageKeyType::ReplayCache")
1357 },
1358 _ => {
1359 write!(f, "StorageKeyType({})", self.0)
1360 }
1361 }
1362 }
1363}
1364
1365
1366#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1370#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1371#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1372#[derive(Default, Copy)]
1373#[repr(transparent)]
1374#[cfg_attr(feature = "serde", serde(transparent))]
1375pub struct StorageKeyContractData {
1376 #[cfg_attr(feature = "serde", serde(with = "xdr_common::serde_hex"))]
1377 inner: [u8; 32 as usize],
1378}
1379impl From<[u8; 32 as usize]> for StorageKeyContractData {
1380 fn from(_inner: [u8; 32 as usize]) -> Self {
1381 Self { inner: _inner }
1382 }
1383}
1384impl StorageKeyContractData {
1385 pub fn into_inner(self) -> [u8; 32 as usize] {
1386 self.inner
1387 }
1388 pub const fn new(_inner: [u8; 32 as usize]) -> Self {
1389 Self { inner: _inner }
1390 }
1391}
1392
1393impl Deref for StorageKeyContractData {
1394 type Target = [u8; 32 as usize];
1395
1396 fn deref(&self) -> &Self::Target {
1397 &self.inner
1398 }
1399}
1400impl DerefMut for StorageKeyContractData {
1401 fn deref_mut(&mut self) -> &mut Self::Target {
1402 &mut self.inner
1403 }
1404}
1405impl AsRef<[u8]> for StorageKeyContractData {
1406 fn as_ref(&self) -> &[u8] {
1407 self.deref().as_slice()
1408 }
1409}
1410impl<'a> From<&'a [u8; 32]> for &'a StorageKeyContractData {
1411 fn from(arr: &[u8; 32]) -> Self {
1412 let ptr = arr as *const [u8; 32] as *const StorageKeyContractData;
1413 unsafe { &*ptr }
1414 }
1415}
1416#[cfg(feature = "xdrs")]
1417impl<'r: 'a, 'a> ReadXDR<'r> for &'a StorageKeyContractData {
1418 fn read_xdr<R: xdrs::Reader<'r>>(r: &mut R) -> xdrs::ReadResult<Self> {
1419 let arr: &[u8; 32] = xdrs::read_xdr(r)?;
1420 let val = Self::from(arr);
1421 Ok(val)
1422 }
1423}
1424
1425#[cfg(feature = "schema")]
1426impl schemars::JsonSchema for StorageKeyContractData {
1427 fn schema_name() -> ::std::borrow::Cow<'static, str> {
1428 "StorageKeyContractData".into()
1429 }
1430 fn json_schema(_gen: &mut schemars::SchemaGenerator) -> schemars::Schema {
1431 schemars::json_schema!({
1432 "type": "string",
1433 "contentEncoding": "hex",
1434 "contentMediaType": "application/binary",
1435 "minLength": 64,
1436 "maxLength": 64
1437 })
1438 }
1439}
1440
1441
1442
1443#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1445#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1446#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1447#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1448#[repr(i32)]
1449#[non_exhaustive]
1450pub enum StorageKey {
1451 ContractData { contract_data_key: StorageKeyContractData } = StorageKeyType::ContractData.0 as i32,
1454 FreeNativeTokenBalance = StorageKeyType::FreeNativeTokenBalance.0 as i32,
1457 AuthData = StorageKeyType::AuthData.0 as i32,
1460 Metadata = StorageKeyType::Metadata.0 as i32,
1463 ReplayCache = StorageKeyType::ReplayCache.0 as i32,
1466
1467}
1468
1469pub const kNativeTokenDivisibility : u32 = 10_000_000;
1472
1473#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1475#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1476#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1477#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1478#[repr(C)]
1479pub struct AddressAndKey {
1480 pub address: ContractAddress,
1481 pub key: StorageKey,
1482}
1483
1484#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
1490#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
1491#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
1492#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1493#[repr(transparent)]
1494#[cfg_attr(feature = "serde", serde(transparent))]
1495pub struct BlockHeight {
1496 inner: i64,
1497}
1498impl From<i64> for BlockHeight {
1499 fn from(_inner: i64) -> Self {
1500 Self { inner: _inner }
1501 }
1502}
1503impl BlockHeight {
1504 pub fn into_inner(self) -> i64 {
1505 self.inner
1506 }
1507 pub const fn new(_inner: i64) -> Self {
1508 Self { inner: _inner }
1509 }
1510}
1511
1512impl Deref for BlockHeight {
1513 type Target = i64;
1514
1515 fn deref(&self) -> &Self::Target {
1516 &self.inner
1517 }
1518}
1519impl DerefMut for BlockHeight {
1520 fn deref_mut(&mut self) -> &mut Self::Target {
1521 &mut self.inner
1522 }
1523}
1524
1525
1526impl Signature {
1531 #[allow(clippy::match_single_binding)]
1532 pub fn scheme(&self) -> CryptographicScheme {
1533 match self {
1534
1535 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
1536 }
1537 }
1538}
1539
1540impl PublicKey {
1541 #[allow(clippy::match_single_binding)]
1542 pub fn scheme(&self) -> CryptographicScheme {
1543 match self {
1544
1545 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
1546 }
1547 }
1548}
1549
1550impl SecretKey {
1551 #[allow(clippy::match_single_binding)]
1552 pub fn scheme(&self) -> CryptographicScheme {
1553 match self {
1554
1555 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
1556 }
1557 }
1558}
1559
1560impl ExtensionPoint {
1561 #[allow(clippy::match_single_binding)]
1562 pub fn v(&self) -> i32 {
1563 match self {
1564
1565 _ => unsafe { *(self as *const Self as *const i32) },
1566 }
1567 }
1568}
1569
1570impl StorageKey {
1571 #[allow(clippy::match_single_binding)]
1572 pub fn key_type(&self) -> StorageKeyType {
1573 match self {
1574
1575 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
1576 }
1577 }
1578}
1579
1580