use crate::hash::HashOf;
use crate::types::encoded_blocks::EncodedBlock;
use icrc_ledger_types::icrc::generic_value::ICRC3Value;
pub type BlockIndex = u64;
pub trait Block: Sized + Clone {
fn from_transaction(
parent_hash: Option<HashOf<EncodedBlock>>,
tx: ICRC3Value,
block_timestamp: u128,
) -> Self;
fn encode(self) -> EncodedBlock;
fn decode(encoded: EncodedBlock) -> Result<Self, String>;
fn block_hash(encoded: &EncodedBlock) -> HashOf<EncodedBlock>;
fn parent_hash(&self) -> Option<HashOf<EncodedBlock>>;
fn timestamp(&self) -> u128;
}