use moonproof_macros::async_trait;
use crate::{
Block, BlockOffset, CommitteeMember, ConnectOptions, ContractAction, ContractActionOffset,
DParameterChange, DustGenerationStatus, DustGenerations, EpochInfo, EpochPerf, FirstValidEpoch,
IndexerError, MerkleTreeCollapsedUpdate, PoolMetadata, PresenceEvent, RegisteredStat,
RegisteredTotals, Spo, SpoComposite, SpoIdentity, StakeShare, TermsAndConditionsChange,
Transaction, TransactionOffset,
};
#[async_trait]
#[allow(clippy::too_many_arguments)]
pub trait PublicDataProvider: Send + Sync {
async fn block(&self, offset: Option<BlockOffset>) -> Result<Option<Block>, IndexerError>;
async fn zswap_merkle_tree_collapsed_update(
&self,
start_index: i64,
end_index: i64,
) -> Result<MerkleTreeCollapsedUpdate, IndexerError>;
async fn transactions(
&self,
offset: TransactionOffset,
) -> Result<Vec<Transaction>, IndexerError>;
async fn contract_action(
&self,
address: &str,
offset: Option<ContractActionOffset>,
) -> Result<Option<ContractAction>, IndexerError>;
async fn dust_generation_status(
&self,
cardano_reward_addresses: Vec<String>,
) -> Result<Vec<DustGenerationStatus>, IndexerError>;
async fn dust_generations(
&self,
cardano_reward_addresses: Vec<String>,
) -> Result<Vec<DustGenerations>, IndexerError>;
async fn dust_commitment_merkle_tree_update(
&self,
start_index: i64,
end_index: i64,
) -> Result<MerkleTreeCollapsedUpdate, IndexerError>;
async fn dust_generation_merkle_tree_update(
&self,
start_index: i64,
end_index: i64,
) -> Result<MerkleTreeCollapsedUpdate, IndexerError>;
async fn d_parameter_history(&self) -> Result<Vec<DParameterChange>, IndexerError>;
async fn terms_and_conditions_history(
&self,
) -> Result<Vec<TermsAndConditionsChange>, IndexerError>;
async fn spo_identities(
&self,
limit: Option<i64>,
offset: Option<i64>,
) -> Result<Vec<SpoIdentity>, IndexerError>;
async fn spo_identity_by_pool_id(
&self,
pool_id_hex: &str,
) -> Result<Option<SpoIdentity>, IndexerError>;
async fn spo_count(&self) -> Result<Option<i64>, IndexerError>;
async fn pool_metadata(&self, pool_id_hex: &str) -> Result<Option<PoolMetadata>, IndexerError>;
async fn pool_metadata_list(
&self,
limit: Option<i64>,
offset: Option<i64>,
with_name_only: Option<bool>,
) -> Result<Vec<PoolMetadata>, IndexerError>;
async fn spo_by_pool_id(&self, pool_id_hex: &str) -> Result<Option<Spo>, IndexerError>;
async fn spo_list(
&self,
limit: Option<i64>,
offset: Option<i64>,
search: Option<String>,
) -> Result<Vec<Spo>, IndexerError>;
async fn spo_composite_by_pool_id(
&self,
pool_id_hex: &str,
) -> Result<Option<SpoComposite>, IndexerError>;
async fn stake_pool_operators(&self, limit: Option<i64>) -> Result<Vec<String>, IndexerError>;
async fn spo_performance_latest(
&self,
limit: Option<i64>,
offset: Option<i64>,
) -> Result<Vec<EpochPerf>, IndexerError>;
async fn spo_performance_by_spo_sk(
&self,
spo_sk_hex: &str,
limit: Option<i64>,
offset: Option<i64>,
) -> Result<Vec<EpochPerf>, IndexerError>;
async fn epoch_performance(
&self,
epoch: i64,
limit: Option<i64>,
offset: Option<i64>,
) -> Result<Vec<EpochPerf>, IndexerError>;
async fn current_epoch_info(&self) -> Result<Option<EpochInfo>, IndexerError>;
async fn epoch_utilization(&self, epoch: i64) -> Result<Option<f64>, IndexerError>;
async fn committee(&self, epoch: i64) -> Result<Vec<CommitteeMember>, IndexerError>;
async fn registered_totals_series(
&self,
from_epoch: i64,
to_epoch: i64,
) -> Result<Vec<RegisteredTotals>, IndexerError>;
async fn registered_spo_series(
&self,
from_epoch: i64,
to_epoch: i64,
) -> Result<Vec<RegisteredStat>, IndexerError>;
async fn registered_presence(
&self,
from_epoch: i64,
to_epoch: i64,
) -> Result<Vec<PresenceEvent>, IndexerError>;
async fn registered_first_valid_epochs(
&self,
upto_epoch: Option<i64>,
) -> Result<Vec<FirstValidEpoch>, IndexerError>;
async fn stake_distribution(
&self,
limit: Option<i64>,
offset: Option<i64>,
search: Option<String>,
order_by_stake_desc: Option<bool>,
) -> Result<Vec<StakeShare>, IndexerError>;
async fn connect(
&self,
viewing_key: &str,
options: Option<ConnectOptions>,
) -> Result<String, IndexerError>;
async fn disconnect(&self, session_id: &str) -> Result<(), IndexerError>;
}