Struct TxEnv

Source
pub struct TxEnv<'tx, 'ptx> { /* private fields */ }
Expand description

A satisfier for Covenant descriptors that can do transaction introspection ’tx denotes the lifetime of the transaction being satisfied and ’ptx denotes the lifetime of the previous transaction inputs

Implementations§

Source§

impl<'tx, 'ptx> TxEnv<'tx, 'ptx>

Source

pub fn new( tx: &'tx Transaction, spent_utxos: &'ptx [TxOut], idx: usize, ) -> Option<Self>

Returns None when spent_utos.len() != tx.input.len()

Source

pub fn tx(&self) -> &Transaction

Obtains the tx

Source

pub fn spent_utxos(&self) -> &[TxOut]

Obtains the spend utxos

Source

pub fn idx(&self) -> usize

Obtains the current input index

Trait Implementations§

Source§

impl<'tx, 'ptx> Clone for TxEnv<'tx, 'ptx>

Source§

fn clone(&self) -> TxEnv<'tx, 'ptx>

Returns a duplicate 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<'tx, 'ptx> Debug for TxEnv<'tx, 'ptx>

Source§

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

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

impl<'tx, 'ptx> PartialEq for TxEnv<'tx, 'ptx>

Source§

fn eq(&self, other: &TxEnv<'tx, 'ptx>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'tx, 'ptx, Pk: ToPublicKey> Satisfier<Pk> for TxEnv<'tx, 'ptx>

Source§

fn lookup_tx(&self) -> Option<&Transaction>

Lookup spending transaction. Required for introspection
Source§

fn lookup_spent_utxos(&self) -> Option<&[TxOut]>

Lookup spent txouts. Required for introspection
Source§

fn lookup_curr_inp(&self) -> Option<usize>

Lookup spent txouts. Required for introspection
Source§

fn lookup_ecdsa_sig(&self, _: &Pk) -> Option<ElementsSig>

Given a public key, look up an ECDSA signature with that key
Source§

fn lookup_tap_key_spend_sig(&self) -> Option<SchnorrSig>

Lookup the tap key spend sig
Source§

fn lookup_tap_leaf_script_sig( &self, _: &Pk, _: &TapLeafHash, ) -> Option<SchnorrSig>

Given a public key and a associated leaf hash, look up an schnorr signature with that key
Source§

fn lookup_tap_control_block_map( &self, ) -> Option<&BTreeMap<ControlBlock, (Script, LeafVersion)>>

Obtain a reference to the control block for a ver and script
Source§

fn lookup_raw_pkh_pk(&self, _: &Hash) -> Option<PublicKey>

Given a raw Pkh, lookup corresponding bitcoin::PublicKey
Source§

fn lookup_raw_pkh_x_only_pk(&self, _: &Hash) -> Option<XOnlyPublicKey>

Given a raw Pkh, lookup corresponding bitcoin::key::XOnlyPublicKey
Source§

fn lookup_raw_pkh_ecdsa_sig(&self, _: &Hash) -> Option<(PublicKey, ElementsSig)>

Given a keyhash, look up the EC signature and the associated key Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
Source§

fn lookup_raw_pkh_tap_leaf_script_sig( &self, _: &(Hash, TapLeafHash), ) -> Option<(XOnlyPublicKey, SchnorrSig)>

Given a keyhash, look up the schnorr signature and the associated key Even if signatures for public key Hashes are not available, the users can use this map to provide pkh -> pk mapping which can be useful for dissatisfying pkh.
Source§

fn lookup_sha256(&self, _: &Pk::Sha256) -> Option<Preimage32>

Given a SHA256 hash, look up its preimage
Source§

fn lookup_hash256(&self, _: &Pk::Hash256) -> Option<Preimage32>

Given a HASH256 hash, look up its preimage
Source§

fn lookup_ripemd160(&self, _: &Pk::Ripemd160) -> Option<Preimage32>

Given a RIPEMD160 hash, look up its preimage
Source§

fn lookup_hash160(&self, _: &Pk::Hash160) -> Option<Preimage32>

Given a HASH160 hash, look up its preimage
Source§

fn check_older(&self, _: Sequence) -> bool

Assert whether an relative locktime is satisfied
Source§

fn check_after(&self, _: LockTime) -> bool

Assert whether a absolute locktime is satisfied
Source§

fn lookup_nversion(&self) -> Option<u32>

Introspection Data for Covenant support #1 Version
Source§

fn lookup_hashprevouts(&self) -> Option<Hash>

Item 2: hashprevouts
Source§

fn lookup_hashsequence(&self) -> Option<Hash>

Item 3: hashsequence
Source§

fn lookup_hashissuances(&self) -> Option<Hash>

ELEMENTS EXTRA: Item 3b: hashsequence
Source§

fn lookup_outpoint(&self) -> Option<OutPoint>

Item 4: outpoint
Source§

fn lookup_scriptcode(&self) -> Option<&Script>

Item 5: scriptcode
Source§

fn lookup_value(&self) -> Option<Value>

Item 6: value
Source§

fn lookup_nsequence(&self) -> Option<u32>

Item 7: sequence
Source§

fn lookup_outputs(&self) -> Option<&[TxOut]>

Item 8: hashoutputs
Source§

fn lookup_nlocktime(&self) -> Option<u32>

Item 9: nlocktime
Source§

fn lookup_sighashu32(&self) -> Option<u32>

Item 10: sighash type as u32
Source§

fn lookup_csfs_sig( &self, _pk: &XOnlyPublicKey, _msg: &CsfsMsg, ) -> Option<Signature>

Lookup (msg, sig) for CSFS fragment
Source§

fn lookup_price_oracle_sig( &self, _pk: &XOnlyPublicKey, _time: u64, ) -> Option<(Signature, i64, u64)>

Lookup price oracle signature
Source§

impl<'tx, 'ptx> Eq for TxEnv<'tx, 'ptx>

Source§

impl<'tx, 'ptx> StructuralPartialEq for TxEnv<'tx, 'ptx>

Auto Trait Implementations§

§

impl<'tx, 'ptx> Freeze for TxEnv<'tx, 'ptx>

§

impl<'tx, 'ptx> RefUnwindSafe for TxEnv<'tx, 'ptx>

§

impl<'tx, 'ptx> Send for TxEnv<'tx, 'ptx>

§

impl<'tx, 'ptx> Sync for TxEnv<'tx, 'ptx>

§

impl<'tx, 'ptx> Unpin for TxEnv<'tx, 'ptx>

§

impl<'tx, 'ptx> UnwindSafe for TxEnv<'tx, 'ptx>

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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