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// Pair
16pub mod pair;
17pub use pair::Pair;
18
19// Types of instrument supported, i.e spot, perp etc.
20pub mod instrument_type;
21pub use instrument_type::{InstrumentType, InstrumentTypeError};
22
23// Pragma Aggregations
24pub mod aggregation;
25pub use aggregation::AggregationMode;
26
27// An util to manage multiple tasks gracefully
28#[cfg(feature = "services")]
29pub mod services;
30
31// A structure allowing us to have multiple handles dependent on each others.
32#[cfg(feature = "task-group")]
33pub mod task_group;
34
35// Pragma Time Intervals
36pub mod interval;
37pub use interval::Interval;
38
39// Protobuf generated schema. Only related to `entries`.
40#[cfg(feature = "proto")]
41pub mod schema {
42    include!(concat!(env!("OUT_DIR"), "/pragma_common.rs"));
43}
44
45// Used to serialize a struct into a payload with protobuf.
46#[cfg(feature = "proto")]
47pub trait ProtoSerialize {
48    fn to_proto_bytes(&self) -> Vec<u8>;
49}
50
51// Used to deserialize a protobuf payload into a struct.
52#[cfg(feature = "proto")]
53pub trait ProtoDeserialize {
54    fn from_proto_bytes(bytes: &[u8]) -> Result<Self, prost::DecodeError>
55    where
56        Self: Sized;
57}