use async_trait::async_trait;
use candid::Nat;
use ex3_blockchain_public_types::{
BlockHeaderResponse, CandidConsensusReport, CandidSnapshotCursor,
};
#[cfg(feature = "canister")]
use ex3_core_registry_public_types::{
NodeProviderFullSyncRequest, NodeProviderIncrementalSyncRequest,
};
use ex3_node_types::block::CandidConsensusBlockHeader;
use ex3_node_types::{BlockHash, CandidBlockHeight};
use ex3_canister_client::{ActorResult, CanisterResult};
#[cfg(feature = "canister")]
pub mod canister_impl;
#[cfg(feature = "agent")]
pub mod client_impl;
#[cfg(feature = "mock")]
pub mod mock;
#[async_trait]
pub trait Blockchain: Send + Sync {
async fn get_current_block_height(&self) -> CanisterResult<Option<CandidBlockHeight>>;
async fn chain_length(&self) -> CanisterResult<Nat>;
async fn get_genesis_block_hash(&self) -> CanisterResult<BlockHash>;
async fn get_block_header_by_height(
&self,
height: CandidBlockHeight,
) -> CanisterResult<BlockHeaderResponse>;
async fn get_last_block_header(&self) -> CanisterResult<Option<CandidConsensusBlockHeader>>;
async fn submit_consensus_report(
&self,
consensus_report: CandidConsensusReport,
) -> CanisterResult<ActorResult<()>>;
async fn get_snapshot_vault_cursor_by_height(
&self,
height: CandidBlockHeight,
) -> CanisterResult<ActorResult<CandidSnapshotCursor>>;
#[cfg(feature = "canister")]
async fn sync_node_provider(
&self,
full_sync_request: NodeProviderFullSyncRequest,
) -> CanisterResult<ActorResult<()>>;
#[cfg(feature = "canister")]
async fn accept_node_provider_update(
&self,
incremental_sync_request: NodeProviderIncrementalSyncRequest,
) -> CanisterResult<ActorResult<()>>;
}