Struct Consignment

Source
pub struct Consignment<const TYPE: bool> {
    pub version: ContainerVer,
    pub transfer: bool,
    pub schema: SubSchema,
    pub ifaces: TinyOrdMap<IfaceId, IfacePair>,
    pub supplements: TinyOrdSet<ContractSuppl>,
    pub genesis: Genesis,
    pub terminals: SmallOrdMap<BundleId, Terminal>,
    pub bundles: LargeVec<AnchoredBundle>,
    pub extensions: LargeVec<Extension>,
    pub attachments: SmallOrdMap<AttachId, MediumBlob>,
    pub signatures: TinyOrdMap<ContentId, ContentSigs>,
    /* private fields */
}
Expand description

Consignment represents contract-specific data, always starting with genesis, which must be valid under client-side-validation rules (i.e. internally consistent and properly committed into the commitment layer, like bitcoin blockchain or current state of the lightning channel).

All consignments-related procedures, including validation or merging consignments data into stash or schema-specific data storage, must start with endpoints and process up to the genesis. If any of the nodes within the consignments are not part of the paths connecting endpoints with the genesis, consignments validation will return [validation::Warning::ExcessiveNode] warning.

Fields§

§version: ContainerVer

Version.

§transfer: bool

Specifies whether the consignment contains information about state transfer (true), or it is just a consignment with an information about a contract.

§schema: SubSchema

Schema (plus root schema, if any) under which contract is issued.

§ifaces: TinyOrdMap<IfaceId, IfacePair>

Interfaces supported by the contract.

§supplements: TinyOrdSet<ContractSuppl>

Known supplements.

§genesis: Genesis

Genesis data.

§terminals: SmallOrdMap<BundleId, Terminal>

Set of seals which are history terminals.

§bundles: LargeVec<AnchoredBundle>

Data on all anchored state transitions contained in the consignments.

§extensions: LargeVec<Extension>

Data on all state extensions contained in the consignments.

§attachments: SmallOrdMap<AttachId, MediumBlob>

Data containers coming with this consignment. For the purposes of in-memory consignments we are restricting the size of the containers to 24 bit value (RGB allows containers up to 32-bit values in size).

§signatures: TinyOrdMap<ContentId, ContentSigs>

Signatures on the pieces of content which are the part of the consignment.

Implementations§

Source§

impl<const TYPE: bool> Consignment<TYPE>

Source

pub fn new(schema: SubSchema, genesis: Genesis) -> Self

§Panics

If the provided schema is not the one which is used by genesis.

Source

pub fn schema_id(&self) -> SchemaId

Source

pub fn root_schema_id(&self) -> Option<SchemaId>

Source

pub fn contract_id(&self) -> ContractId

Source

pub fn anchored_bundle(&self, bundle_id: BundleId) -> Option<&AnchoredBundle>

Source

pub fn validation_status(&self) -> Option<&Status>

Source

pub fn into_validation_status(self) -> Option<Status>

Source

pub fn update_history<R: ResolveHeight>( &self, history: Option<&ContractHistory>, resolver: &mut R, ) -> Result<ContractHistory, R::Error>

Source

pub fn reveal_bundle_seal(&mut self, bundle_id: BundleId, revealed: GraphSeal)

Source

pub fn into_contract(self) -> Contract

Source§

impl Consignment<true>

Source

pub fn transfer_id(&self) -> TransferId

Source§

impl<const TYPE: bool> Consignment<TYPE>

Source

pub fn validate<R: ResolveTx>( self, resolver: &mut R, ) -> Result<Consignment<TYPE>, Consignment<TYPE>>

Trait Implementations§

Source§

impl<const TYPE: bool> Clone for Consignment<TYPE>

Source§

fn clone(&self) -> Consignment<TYPE>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const TYPE: bool> ConsignmentApi for Consignment<TYPE>

Source§

type BundleIter<'container> = Iter<'container, AnchoredBundle> where Self: 'container

Source§

fn schema(&self) -> &SubSchema

Source§

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

Retrieves reference to a operation (genesis, state transition or state extension) matching the provided id, or None otherwise
Source§

fn genesis(&self) -> &Genesis

Contract genesis.
Source§

fn transition(&self, opid: OpId) -> Option<&Transition>

Returns reference to a state transition, if known, matching the provided id. If id is unknown, or corresponds to other type of the operation (genesis or state extensions) a error is returned. Read more
Source§

fn extension(&self, opid: OpId) -> Option<&Extension>

Returns reference to a state extension, if known, matching the provided id. If id is unknown, or corresponds to other type of the operation (genesis or state transition) a error is returned. Read more
Source§

fn terminals(&self) -> BTreeSet<(BundleId, SecretSeal)>

The final state (“endpoints”) provided by this consignment. Read more
Source§

fn anchored_bundles(&self) -> Self::BundleIter<'_>

Data on all anchored state transitions contained in the consignment
Source§

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

Source§

fn op_ids_except(&self, ids: &BTreeSet<OpId>) -> BTreeSet<OpId>

Source§

fn has_operation(&self, opid: OpId) -> bool

Source§

fn known_transitions_by_bundle_id( &self, bundle_id: BundleId, ) -> Option<Vec<&Transition>>

Source§

impl<const TYPE: bool> Debug for Consignment<TYPE>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, const TYPE: bool> Deserialize<'de> for Consignment<TYPE>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<const TYPE: bool> Serialize for Consignment<TYPE>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<const TYPE: bool> StrictDecode for Consignment<TYPE>

Source§

fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>

Source§

fn strict_read(lim: usize, reader: impl Read) -> Result<Self, DecodeError>

Source§

impl<const TYPE: bool> StrictDeserialize for Consignment<TYPE>

Source§

fn from_strict_serialized<const MAX: usize>( ast_data: Confined<Vec<u8>, 0, MAX>, ) -> Result<Self, DeserializeError>

Source§

fn strict_deserialize_from_file<const MAX: usize>( path: impl AsRef<Path>, ) -> Result<Self, DeserializeError>

Source§

impl<const TYPE: bool> StrictDumb for Consignment<TYPE>

Source§

fn strict_dumb() -> Self

Source§

impl<const TYPE: bool> StrictEncode for Consignment<TYPE>

Source§

fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>

Source§

fn strict_write(&self, lim: usize, writer: impl Write) -> Result<usize, Error>

Source§

impl<const TYPE: bool> StrictSerialize for Consignment<TYPE>

Source§

impl<const TYPE: bool> StrictStruct for Consignment<TYPE>

Source§

impl<const TYPE: bool> StrictType for Consignment<TYPE>

Source§

const STRICT_LIB_NAME: &'static str = LIB_NAME_RGB_STD

Source§

fn strict_name() -> Option<TypeName>

Source§

impl<const TYPE: bool> StrictProduct for Consignment<TYPE>

Auto Trait Implementations§

§

impl<const TYPE: bool> Freeze for Consignment<TYPE>

§

impl<const TYPE: bool> RefUnwindSafe for Consignment<TYPE>

§

impl<const TYPE: bool> Send for Consignment<TYPE>

§

impl<const TYPE: bool> Sync for Consignment<TYPE>

§

impl<const TYPE: bool> Unpin for Consignment<TYPE>

§

impl<const TYPE: bool> UnwindSafe for Consignment<TYPE>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,