mithril_aggregator/http_server/routes/artifact_routes/
mod.rs1pub mod cardano_database;
2pub mod cardano_stake_distribution;
3pub mod cardano_transaction;
4pub mod mithril_stake_distribution;
5pub mod snapshot;
6
7#[cfg(test)]
8pub mod test_utils {
9 use chrono::{DateTime, Utc};
10 use mithril_common::entities::SignedEntityType;
11 use mithril_common::signable_builder::{Artifact, SignedEntity};
12
13 pub fn create_signed_entity<T>(
14 signed_entity_type: SignedEntityType,
15 record: T,
16 ) -> SignedEntity<T>
17 where
18 T: Artifact,
19 {
20 let mut entities = create_signed_entities(signed_entity_type, vec![record]);
21 entities.pop().unwrap()
22 }
23
24 pub fn create_signed_entities<T>(
25 signed_entity_type: SignedEntityType,
26 records: Vec<T>,
27 ) -> Vec<SignedEntity<T>>
28 where
29 T: Artifact,
30 {
31 records
32 .into_iter()
33 .enumerate()
34 .map(|(idx, record)| SignedEntity {
35 signed_entity_id: format!("{idx}"),
36 signed_entity_type: signed_entity_type.to_owned(),
37 certificate_id: format!("certificate-{idx}"),
38 artifact: record,
39 created_at: DateTime::parse_from_rfc3339("2023-01-19T13:43:05.618857482Z")
40 .unwrap()
41 .with_timezone(&Utc),
42 })
43 .collect()
44 }
45}