Trait ConsignmentApi

Source
pub trait ConsignmentApi {
    // Required methods
    fn schema(&self) -> &Schema;
    fn types(&self) -> &TypeSystem;
    fn scripts(&self) -> &Scripts;
    fn operation(&self, opid: OpId) -> Option<OpRef<'_>>;
    fn genesis(&self) -> &Genesis;
    fn bundles<'iter>(&self) -> impl Iterator<Item = TransitionBundle> + 'iter;
    fn bundle_ids<'iter>(&self) -> impl Iterator<Item = BundleId> + 'iter;
    fn bundle(&self, bundle_id: BundleId) -> Option<&TransitionBundle>;
    fn anchor(&self, bundle_id: BundleId) -> Option<(Txid, &EAnchor)>;
    fn op_witness_id(&self, opid: OpId) -> Option<Txid>;
}
Expand description

Trait defining common data access API for all storage-related RGB structures

The API provided for the consignment should not verify the internal consistency, schema conformance or validation status of the RGB contract data within the storage or container. If the methods are called on an invalid or absent data, the API must always return None or empty collections/iterators.

Required Methods§

Source

fn schema(&self) -> &Schema

Returns reference to the schema object used by the consignment.

Source

fn types(&self) -> &TypeSystem

Returns reference to the type system.

Source

fn scripts(&self) -> &Scripts

Returns reference to a collection of AluVM libraries used for the validation.

Source

fn operation(&self, opid: OpId) -> Option<OpRef<'_>>

Retrieves reference to an operation (genesis or state transition) matching the provided id, or None otherwise

Source

fn genesis(&self) -> &Genesis

Contract genesis.

Source

fn bundles<'iter>(&self) -> impl Iterator<Item = TransitionBundle> + 'iter

Returns iterator over all bundles present in the consignment.

Source

fn bundle_ids<'iter>(&self) -> impl Iterator<Item = BundleId> + 'iter

Returns iterator over all bundle ids present in the consignment.

Source

fn bundle(&self, bundle_id: BundleId) -> Option<&TransitionBundle>

Returns reference to a bundle given a bundle id.

Source

fn anchor(&self, bundle_id: BundleId) -> Option<(Txid, &EAnchor)>

Returns a grip given a bundle id.

Source

fn op_witness_id(&self, opid: OpId) -> Option<Txid>

Returns witness id for a given operation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§