pub struct ContractHistory {
pub contract_id: Hash,
pub transitions: Vec<StateTransitionRecord>,
pub active_rights: BTreeMap<Hash, Right>,
pub consumed_seals: BTreeMap<Vec<u8>, SealRef>,
pub latest_commitment_hash: Hash,
}Expand description
A contract’s full state history from genesis to present.
Fields§
§contract_id: HashThe contract’s unique identifier
transitions: Vec<StateTransitionRecord>All state transitions in chronological order
active_rights: BTreeMap<Hash, Right>Current active Rights (not yet consumed)
consumed_seals: BTreeMap<Vec<u8>, SealRef>All consumed seals indexed by seal ID
latest_commitment_hash: HashThe latest commitment hash in the chain
Implementations§
Source§impl ContractHistory
impl ContractHistory
Sourcepub fn from_genesis(genesis_commitment: Commitment) -> Self
pub fn from_genesis(genesis_commitment: Commitment) -> Self
Create a new contract history from genesis.
Sourcepub fn add_transition(
&mut self,
transition: StateTransitionRecord,
) -> Result<(), StoreError>
pub fn add_transition( &mut self, transition: StateTransitionRecord, ) -> Result<(), StoreError>
Add a state transition to the history.
Sourcepub fn consume_right(&mut self, right_id: &Hash) -> Option<Right>
pub fn consume_right(&mut self, right_id: &Hash) -> Option<Right>
Mark a Right as consumed.
Sourcepub fn is_seal_consumed(&self, seal_ref: &SealRef) -> bool
pub fn is_seal_consumed(&self, seal_ref: &SealRef) -> bool
Check if a seal has been consumed.
Sourcepub fn mark_seal_consumed(&mut self, seal_ref: SealRef)
pub fn mark_seal_consumed(&mut self, seal_ref: SealRef)
Mark a seal as consumed.
Sourcepub fn transition_count(&self) -> usize
pub fn transition_count(&self) -> usize
Get the number of transitions in this contract’s history.
Sourcepub fn get_active_rights(&self) -> Vec<&Right>
pub fn get_active_rights(&self) -> Vec<&Right>
Get all active Rights.
Trait Implementations§
Source§impl Clone for ContractHistory
impl Clone for ContractHistory
Source§fn clone(&self) -> ContractHistory
fn clone(&self) -> ContractHistory
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContractHistory
impl Debug for ContractHistory
Source§impl<'de> Deserialize<'de> for ContractHistory
impl<'de> Deserialize<'de> for ContractHistory
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ContractHistory
impl RefUnwindSafe for ContractHistory
impl Send for ContractHistory
impl Sync for ContractHistory
impl Unpin for ContractHistory
impl UnsafeUnpin for ContractHistory
impl UnwindSafe for ContractHistory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more