Trait Operation

Source
pub trait Operation {
    // Required methods
    fn op_type(&self) -> OpType;
    fn full_type(&self) -> OpFullType;
    fn id(&self) -> OpId;
    fn contract_id(&self) -> ContractId;
    fn transition_type(&self) -> Option<u16>;
    fn extension_type(&self) -> Option<u16>;
    fn metadata(
        &self,
    ) -> &Confined<Vec<u8>, amplify::::collection::confinement::SmallBlob::{constant#0}, amplify::::collection::confinement::SmallBlob::{constant#1}> ;
    fn globals(&self) -> &GlobalState;
    fn valencies(&self) -> &Valencies;
    fn assignments(&self) -> AssignmentsRef<'_>;
    fn assignments_by_type(
        &self,
        t: u16,
    ) -> Option<TypedAssigns<BlindSeal<TxPtr>>>;
    fn inputs(&self) -> Inputs;
}
Expand description

RGB contract operation API, defined as trait

Implemented by all contract operation types (see OpType):

  • Genesis (Genesis)
  • State transitions ([Transitions])
  • Public state extensions ([Extensions])

Required Methods§

Source

fn op_type(&self) -> OpType

Returns type of the operation (see OpType). Unfortunately, this can’t be just a const, since it will break our ability to convert concrete Node types into &dyn Node (entities implementing traits with const definitions can’t be made into objects)

Source

fn full_type(&self) -> OpFullType

Returns full contract operation type information

Source

fn id(&self) -> OpId

Returns OpId, which is a hash of this operation commitment serialization

Source

fn contract_id(&self) -> ContractId

Returns ContractId this operation belongs to.

Source

fn transition_type(&self) -> Option<u16>

Returns Option::Some(TransitionType) for transitions or Option::None for genesis and extension operation types

Source

fn extension_type(&self) -> Option<u16>

Returns Option::Some(ExtensionType) for extension nodes or Option::None for genesis and state transitions

Source

fn metadata( &self, ) -> &Confined<Vec<u8>, amplify::::collection::confinement::SmallBlob::{constant#0}, amplify::::collection::confinement::SmallBlob::{constant#1}>

Returns metadata associated with the operation, if any.

Source

fn globals(&self) -> &GlobalState

Returns reference to a full set of metadata (in form of GlobalState wrapper structure) for the contract operation.

Source

fn valencies(&self) -> &Valencies

Source

fn assignments(&self) -> AssignmentsRef<'_>

Source

fn assignments_by_type(&self, t: u16) -> Option<TypedAssigns<BlindSeal<TxPtr>>>

Source

fn inputs(&self) -> Inputs

For genesis and public state extensions always returns an empty list. While public state extension do have parent nodes, they do not contain indexed rights.

Implementors§