Struct sapio::contract::object::Object[][src]

pub struct Object {
    pub ctv_to_tx: HashMap<Hash, Template>,
    pub suggested_txs: HashMap<Hash, Template>,
    pub policy: Option<Clause>,
    pub address: Address,
    pub descriptor: Option<Descriptor<PublicKey>>,
    pub amount_range: AmountRange,
}

Object holds a contract’s complete context required post-compilation There is no guarantee that Object is properly constructed presently.

Fields

ctv_to_tx: HashMap<Hash, Template>

a map of template hashes to the corresponding template, that in the policy are a CTV protected

suggested_txs: HashMap<Hash, Template>

a map of template hashes to the corresponding template, that in the policy are not necessarily CTV protected but we might want to know about anyways.

policy: Option<Clause>

The Object’s Policy – if known

address: Address

The Object’s address

descriptor: Option<Descriptor<PublicKey>>

The Object’s descriptor – if there is one known/available

amount_range: AmountRange

The amount_range safe to send this object

Implementations

impl Object[src]

pub fn from_address(address: Address, a: Option<AmountRange>) -> Object[src]

Creates an object from a given address. The optional AmountRange argument determines the safe bounds the contract can receive, otherwise it is set to any.

pub fn from_script(
    script: Script,
    a: Option<AmountRange>,
    net: Network
) -> Result<Object, ObjectError>
[src]

Creates an object from a given script. The optional AmountRange argument determines the safe bounds the contract can receive, otherwise it is set to any.

pub fn bind(&self, out_in: OutPoint) -> (Vec<Transaction>, Vec<Value>)[src]

bind attaches an Object to a specific UTXO and returns a vec of transactions and transaction metadata.

pub fn bind_psbt(
    &self,
    out_in: OutPoint,
    output_map: HashMap<Sha256, Vec<Option<OutPoint>>>,
    blockdata: Rc<dyn TxIndex>,
    emulator: &dyn CTVEmulator
) -> Result<(Vec<PartiallySignedTransaction>, Vec<Value>), ObjectError>
[src]

bind_psbt attaches and Object to a specific UTXO, returning a Vector of PSBTs and transaction metadata.

bind_psbt accepts a CTVEmulator, a txindex, and a map of outputs to be bound to specific template hashes.

Trait Implementations

impl Clone for Object[src]

impl Compilable for Compiled[src]

Implements a basic identity

impl Debug for Object[src]

impl<'de> Deserialize<'de> for Object[src]

impl JsonSchema for Object[src]

impl Serialize for Object[src]

Auto Trait Implementations

impl RefUnwindSafe for Object

impl Send for Object

impl Sync for Object

impl Unpin for Object

impl UnwindSafe for Object

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.