|
1 | 1 | use anyhow::anyhow;
|
2 |
| -use std::{ |
3 |
| - collections::{BTreeSet, HashMap}, |
4 |
| - sync::Arc, |
5 |
| - time::Duration, |
6 |
| -}; |
| 2 | +use std::{collections::HashMap, sync::Arc, time::Duration}; |
7 | 3 |
|
8 | 4 | use crate::{
|
9 | 5 | HTTP_REQUEST_TIMEOUT_DURATION,
|
10 | 6 | http_client::aggregator_client::{AggregatorClient, AggregatorHTTPClient},
|
11 | 7 | interface::MithrilNetworkConfigurationProvider,
|
12 |
| - model::MithrilNetworkConfiguration, |
| 8 | + model::{MithrilNetworkConfiguration, SignedEntityTypeConfiguration}, |
13 | 9 | };
|
14 | 10 | use async_trait::async_trait;
|
15 |
| -use mithril_common::StdResult; |
16 | 11 | use mithril_common::api_version::APIVersionProvider;
|
| 12 | +use mithril_common::{StdResult, entities::SignedEntityTypeDiscriminants}; |
17 | 13 |
|
18 | 14 | struct HttpMithrilNetworkConfigurationProvider {
|
19 | 15 | aggregator_client: AggregatorHTTPClient,
|
@@ -49,8 +45,18 @@ impl MithrilNetworkConfigurationProvider for HttpMithrilNetworkConfigurationProv
|
49 | 45 | return Err(anyhow!("Failed to retrieve epoch settings"));
|
50 | 46 | };
|
51 | 47 |
|
52 |
| - let available_signed_entity_types = BTreeSet::new(); // To be implemented to be retrieve from /aggreagator-features from aggregator_client.rs |
53 |
| - let signed_entity_types_config = HashMap::new(); // To be implemented |
| 48 | + let aggregator_features = self.aggregator_client.retrieve_aggregator_features().await?; |
| 49 | + let available_signed_entity_types = aggregator_features.capabilities.signed_entity_types; |
| 50 | + |
| 51 | + let mut signed_entity_types_config = HashMap::new(); |
| 52 | + signed_entity_types_config.insert( |
| 53 | + SignedEntityTypeDiscriminants::CardanoTransactions, |
| 54 | + SignedEntityTypeConfiguration::CardanoTransactions( |
| 55 | + epoch_settings.cardano_transactions_signing_config.ok_or_else(|| { |
| 56 | + anyhow!("Cardano transactions signing config is missing in epoch settings") |
| 57 | + })?, |
| 58 | + ), |
| 59 | + ); |
54 | 60 |
|
55 | 61 | Ok(MithrilNetworkConfiguration {
|
56 | 62 | epoch: epoch_settings.epoch,
|
|
0 commit comments