pub struct ContractState {
pub schema: Schema<Schema<()>>,
pub history: ContractHistory,
}
Expand description
Contract state provides API to read consensus-valid data from the
ContractHistory
.
Fields§
§schema: Schema<Schema<()>>
§history: ContractHistory
Implementations§
Source§impl ContractState
impl ContractState
Sourcepub unsafe fn global_unchecked(
&self,
state_type: u16,
) -> Confined<Vec<&RevealedData>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>
pub unsafe fn global_unchecked( &self, state_type: u16, ) -> Confined<Vec<&RevealedData>, amplify::::collection::confinement::SmallVec::{constant#0}, amplify::::collection::confinement::SmallVec::{constant#1}>
§Safety
If the specified state type is not part of the schema.
Methods from Deref<Target = ContractHistory>§
Sourcepub fn schema_id(&self) -> SchemaId
pub fn schema_id(&self) -> SchemaId
Method returning copy of ContractHistory::schema_id
field.
Sourcepub fn root_schema_id(&self) -> Option<SchemaId>
pub fn root_schema_id(&self) -> Option<SchemaId>
Method returning copy of ContractHistory::root_schema_id
field.
Sourcepub fn contract_id(&self) -> ContractId
pub fn contract_id(&self) -> ContractId
Method returning copy of ContractHistory::contract_id
field.
Sourcepub fn rights(
&self,
) -> &Confined<BTreeSet<OutputAssignment<VoidState>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
pub fn rights( &self, ) -> &Confined<BTreeSet<OutputAssignment<VoidState>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
Method borrowing ContractHistory::rights
field.
Sourcepub fn fungibles(
&self,
) -> &Confined<BTreeSet<OutputAssignment<RevealedValue>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
pub fn fungibles( &self, ) -> &Confined<BTreeSet<OutputAssignment<RevealedValue>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
Method borrowing ContractHistory::fungibles
field.
Sourcepub fn data(
&self,
) -> &Confined<BTreeSet<OutputAssignment<RevealedData>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
pub fn data( &self, ) -> &Confined<BTreeSet<OutputAssignment<RevealedData>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
Method borrowing ContractHistory::data
field.
Sourcepub fn attach(
&self,
) -> &Confined<BTreeSet<OutputAssignment<RevealedAttach>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
pub fn attach( &self, ) -> &Confined<BTreeSet<OutputAssignment<RevealedAttach>>, amplify::::collection::confinement::LargeOrdSet::{constant#0}, amplify::::collection::confinement::LargeOrdSet::{constant#1}>
Method borrowing ContractHistory::attach
field.
Sourcepub fn update_genesis(&mut self, genesis: &Genesis)
pub fn update_genesis(&mut self, genesis: &Genesis)
§Panics
If genesis violates RGB consensus rules and wasn’t checked against the schema before adding to the history.
Sourcepub fn add_transition(
&mut self,
transition: &Transition,
ord_txid: WitnessAnchor,
)
pub fn add_transition( &mut self, transition: &Transition, ord_txid: WitnessAnchor, )
§Panics
If state transition violates RGB consensus rules and wasn’t checked against the schema before adding to the history.
Sourcepub fn add_extension(&mut self, extension: &Extension, ord_txid: WitnessAnchor)
pub fn add_extension(&mut self, extension: &Extension, ord_txid: WitnessAnchor)
§Panics
If state extension violates RGB consensus rules and wasn’t checked against the schema before adding to the history.
Trait Implementations§
Source§impl Clone for ContractState
impl Clone for ContractState
Source§fn clone(&self) -> ContractState
fn clone(&self) -> ContractState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ContractState
impl Debug for ContractState
Source§impl Deref for ContractState
impl Deref for ContractState
Source§type Target = ContractHistory
type Target = ContractHistory
Source§impl DerefMut for ContractState
impl DerefMut for ContractState
Source§impl<'de> Deserialize<'de> for ContractState
impl<'de> Deserialize<'de> for ContractState
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContractState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContractState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ContractState
impl PartialEq for ContractState
Source§impl Serialize for ContractState
impl Serialize for ContractState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl StrictDecode for ContractState
impl StrictDecode for ContractState
fn strict_decode( reader: &mut impl TypedRead, ) -> Result<ContractState, DecodeError>
fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>
Source§impl StrictDumb for ContractState
impl StrictDumb for ContractState
fn strict_dumb() -> ContractState
Source§impl StrictEncode for ContractState
impl StrictEncode for ContractState
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>
Source§impl StrictStruct for ContractState
impl StrictStruct for ContractState
const ALL_FIELDS: &'static [&'static str]
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for ContractState
impl StrictType for ContractState
const STRICT_LIB_NAME: &'static str = LIB_NAME_RGB
fn strict_name() -> Option<TypeName>
impl Eq for ContractState
impl StrictProduct for ContractState
impl StructuralPartialEq for ContractState
Auto Trait Implementations§
impl Freeze for ContractState
impl RefUnwindSafe for ContractState
impl Send for ContractState
impl Sync for ContractState
impl Unpin for ContractState
impl UnwindSafe for ContractState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.