use async_trait::async_trait;
use candid::{Nat, Principal};
use ex3_canister_types::{BlockHash, BlockHeight};
use ex3_blockchain_public_types::{BlockHeadResponse, BlockHeadWithHeight, CandidBlockHead};
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<BlockHeight>>;
async fn chain_length(&self) -> CanisterResult<Nat>;
async fn get_genesis_block_hash(&self) -> CanisterResult<BlockHash>;
async fn get_block_head_by_height(
&self,
height: &BlockHeight,
) -> CanisterResult<BlockHeadResponse>;
async fn get_last_block_head(&self) -> CanisterResult<Option<BlockHeadWithHeight>>;
async fn submit_block_head(
&self,
block_head: &CandidBlockHead,
) -> CanisterResult<ActorResult<()>>;
#[cfg(feature = "canister")]
async fn accept_node_provider_update(
&self,
providers: Vec<Principal>,
vote_threshold: u8,
) -> CanisterResult<ActorResult<()>>;
}