pragma_common/
lib.rs

1// Web3 types
2pub mod web3;
3
4// Entries retrieved through different markets.
5// This is the data that we'll push in our internal Kafka.
6pub mod entries;
7
8#[cfg(feature = "starknet")]
9pub mod starknet;
10
11// Telemetry init through OTEL
12#[cfg(feature = "telemetry")]
13pub mod telemetry;
14
15// Trading types
16pub mod trading;
17
18// Pair
19pub mod pair;
20pub use pair::Pair;
21
22// Types of instrument supported, i.e spot, perp etc.
23pub mod instrument_type;
24pub use instrument_type::{InstrumentType, InstrumentTypeError};
25
26// Pragma Aggregations
27pub mod aggregation;
28pub use aggregation::AggregationMode;
29
30// An util to manage multiple tasks gracefully
31#[cfg(feature = "services")]
32pub mod services;
33
34// A structure allowing us to have multiple handles dependent on each others.
35#[cfg(feature = "task-group")]
36pub mod task_group;
37
38// Pragma Time Intervals
39pub mod interval;
40pub use interval::Interval;
41
42// Protobuf generated schema. Only related to `entries`.
43#[cfg(feature = "proto")]
44pub mod schema {
45    include!(concat!(env!("OUT_DIR"), "/pragma_common.rs"));
46}
47
48// Used to serialize a struct into a payload with protobuf.
49#[cfg(feature = "proto")]
50pub trait ProtoSerialize {
51    fn to_proto_bytes(&self) -> Vec<u8>;
52}
53
54// Used to deserialize a protobuf payload into a struct.
55#[cfg(feature = "proto")]
56pub trait ProtoDeserialize {
57    fn from_proto_bytes(bytes: &[u8]) -> Result<Self, prost::DecodeError>
58    where
59        Self: Sized;
60}