Stock

Struct Stock 

Source
pub struct Stock<S = MemStash, H = MemState, P = MemIndex>{ /* private fields */ }

Implementations§

Source§

impl Stock

Source§

impl<S, H, I> Stock<S, H, I>

Source

pub fn load<P>( provider: P, autosave: bool, ) -> Result<Stock<S, H, I>, PersistenceError>

Source

pub fn make_persistent<P>( &mut self, provider: P, autosave: bool, ) -> Result<bool, PersistenceError>

Source

pub fn store(&mut self) -> Result<(), PersistenceError>

Source§

impl<S, H, P> Stock<S, H, P>

Source

pub fn with( stash_provider: S, state_provider: H, index_provider: P, ) -> Stock<S, H, P>

Source

pub fn schemata( &self, ) -> Result<impl Iterator<Item = SchemaInfo>, StockError<S, H, P>>

Source

pub fn schema( &self, schema_id: SchemaId, ) -> Result<&Schema, StockError<S, H, P>>

Source

pub fn contracts( &self, ) -> Result<impl Iterator<Item = ContractInfo>, StockError<S, H, P>>

Source

pub fn contracts_assigning( &self, outputs: impl IntoIterator<Item = impl Into<OutPoint>>, ) -> Result<impl Iterator<Item = ContractId>, StockError<S, H, P>>

Iterates over ids of all contract assigning state to the provided set of output seals.

Source

pub fn contract_info( &self, contract_id: ContractId, ) -> Result<ContractInfo, StockError<S, H, P>>

Source

pub fn contract_state( &self, contract_id: ContractId, ) -> Result<<H as StateReadProvider>::ContractRead<'_>, StockError<S, H, P>>

Source

pub fn contract_wrapper<C>( &self, contract_id: ContractId, ) -> Result<<C as IssuerWrapper>::Wrapper<<H as StateReadProvider>::ContractRead<'_>>, StockError<S, H, P>>
where C: IssuerWrapper,

Source

pub fn contract_data( &self, contract_id: ContractId, ) -> Result<ContractData<<H as StateReadProvider>::ContractRead<'_>>, StockError<S, H, P>>

Returns the contract data for the given contract ID

Source

pub fn contract_assignments_for( &self, contract_id: ContractId, outpoints: impl IntoIterator<Item = impl Into<OutPoint>>, ) -> Result<HashMap<ExplicitSeal<Txid>, HashMap<Opout, AllocatedState>>, StockError<S, H, P>>

Source

pub fn contract_builder( &self, issuer: impl Into<Identity>, schema_id: SchemaId, chain_net: ChainNet, ) -> Result<ContractBuilder, StockError<S, H, P>>

Source

pub fn transition_builder( &self, contract_id: ContractId, transition_name: impl Into<FieldName>, ) -> Result<TransitionBuilder, StockError<S, H, P>>

Source

pub fn transition_builder_raw( &self, contract_id: ContractId, transition_type: TransitionType, ) -> Result<TransitionBuilder, StockError<S, H, P>>

Source

pub fn export_schema( &self, schema_id: SchemaId, ) -> Result<ValidKit, StockError<S, H, P>>

Source

pub fn export_contract( &self, contract_id: ContractId, ) -> Result<Consignment<false>, StockError<S, H, P, ConsignError>>

Source

pub fn transfer( &self, contract_id: ContractId, outputs: impl AsRef<[ExplicitSeal<Txid>]>, secret_seals: impl AsRef<[SecretSeal]>, opids: impl IntoIterator<Item = OpId>, witness_id: Option<Txid>, ) -> Result<Consignment<true>, StockError<S, H, P, ConsignError>>

Source

pub fn transfer_with_dag( &self, contract_id: ContractId, outputs: impl AsRef<[ExplicitSeal<Txid>]>, secret_seals: impl AsRef<[SecretSeal]>, opids: impl IntoIterator<Item = OpId>, witness_id: Option<Txid>, ) -> Result<(Consignment<true>, (Dag<Opout, ()>, HashMap<Opout, NodeIndex>)), StockError<S, H, P, ConsignError>>

Source

pub fn import_kit( &mut self, kit: ValidKit, ) -> Result<Status, StockError<S, H, P>>

Source

pub fn import_contract<R>( &mut self, contract: ValidConsignment<false>, resolver: R, ) -> Result<Status, StockError<S, H, P>>
where R: ResolveWitness,

Source

pub fn accept_transfer<R>( &mut self, contract: ValidConsignment<true>, resolver: R, ) -> Result<Status, StockError<S, H, P>>
where R: ResolveWitness,

Source

pub fn consume_fascia<WP>( &mut self, fascia: Fascia, witness_ord_provider: WP, ) -> Result<(), StockError<S, H, P, FasciaError>>

Imports fascia into the stash, index and inventory.

Part of the transfer workflow. Called once PSBT is completed and an RGB fascia containing anchor and all state transitions is exported from it.

Must be called before the consignment is created, when witness transaction is not yet mined.

Source

pub fn store_secret_seal( &mut self, seal: BlindSeal<TxPtr>, ) -> Result<bool, StockError<S, H, P>>

Source

pub fn update_witnesses( &mut self, resolver: impl ResolveWitness, after_height: u32, force_witnesses: Vec<Txid>, ) -> Result<UpdateRes, StockError<S, H, P>>

Source

pub fn upsert_witness( &mut self, witness_id: Txid, witness_ord: WitnessOrd, ) -> Result<(), StockError<S, H, P>>

Source

pub fn get_outpoint_unsafe_history( &self, outpoint: OutPoint, safe_height: NonZero<u32>, ) -> Result<HashMap<ContractId, HashMap<u32, HashSet<Txid>>>, StockError<S, H, P>>

Trait Implementations§

Source§

impl<S, H, P> CloneNoPersistence for Stock<S, H, P>

Source§

fn clone_no_persistence(&self) -> Stock<S, H, P>

Source§

impl<S, H, P> Debug for Stock<S, H, P>

Source§

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

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

impl<S, H, P> Default for Stock<S, H, P>

Source§

fn default() -> Stock<S, H, P>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<S, H, P> Freeze for Stock<S, H, P>
where S: Freeze, H: Freeze, P: Freeze,

§

impl<S, H, P> RefUnwindSafe for Stock<S, H, P>

§

impl<S, H, P> Send for Stock<S, H, P>
where S: Send, H: Send, P: Send,

§

impl<S, H, P> Sync for Stock<S, H, P>
where S: Sync, H: Sync, P: Sync,

§

impl<S, H, P> Unpin for Stock<S, H, P>
where S: Unpin, H: Unpin, P: Unpin,

§

impl<S, H, P> UnwindSafe for Stock<S, H, P>
where S: UnwindSafe, H: UnwindSafe, P: UnwindSafe,

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> 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, 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