#[non_exhaustive]
pub enum MultiEraTx<'b> { AlonzoCompatible(Box<Cow<'b, MintedTx<'b>>>, Era), Babbage(Box<Cow<'b, MintedTx<'b>>>), Byron(Box<Cow<'b, MintedTxPayload<'b>>>), }

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

AlonzoCompatible(Box<Cow<'b, MintedTx<'b>>>, Era)

§

Babbage(Box<Cow<'b, MintedTx<'b>>>)

§

Byron(Box<Cow<'b, MintedTxPayload<'b>>>)

Implementations§

source§

impl<'b> MultiEraTx<'b>

source

pub fn from_byron(tx: &'b MintedTxPayload<'b>) -> Self

source

pub fn from_alonzo_compatible(tx: &'b MintedTx<'b>, era: Era) -> Self

source

pub fn from_babbage(tx: &'b MintedTx<'b>) -> Self

source

pub fn encode(&self) -> Vec<u8>

source

pub fn decode(era: Era, cbor: &'b [u8]) -> Result<Self, Error>

source

pub fn era(&self) -> Era

source

pub fn hash(&self) -> Hash<32>

source

pub fn outputs(&self) -> Vec<MultiEraOutput<'_>>

source

pub fn output_at(&self, index: usize) -> Option<MultiEraOutput<'_>>

source

pub fn inputs(&self) -> Vec<MultiEraInput<'_>>

source

pub fn reference_inputs(&self) -> Vec<MultiEraInput<'_>>

source

pub fn certs(&self) -> Vec<MultiEraCert<'_>>

source

pub fn mint(&self) -> MultiEraMint<'_>

source

pub fn collateral(&self) -> Vec<MultiEraInput<'_>>

source

pub fn collateral_return(&self) -> Option<MultiEraOutput<'_>>

source

pub fn consumes(&self) -> Vec<MultiEraInput<'_>>

Returns the list of inputs consumed by the Tx

Helper method to abstract the logic of which inputs are consumed depending on the validity of the Tx. If the Tx is valid, this method will return the list of inputs. If the tx is invalid, it will return the collateral.

source

pub fn produces(&self) -> Vec<(usize, MultiEraOutput<'_>)>

Returns a list of tuples of the outputs produced by the Tx with their indexes

Helper method to abstract the logic of which outputs are produced depending on the validity of the Tx. If the Tx is valid, this method will return the list of outputs. If the Tx is invalid it will return the collateral return if one is present or an empty list if not. Note that the collateral return output index is defined as the next available index after the txouts (Babbage spec, ch 4).

source

pub fn produces_at(&self, index: usize) -> Option<MultiEraOutput<'_>>

Returns the produced output at the given index if one exists

If the transaction is valid the outputs are produced, otherwise the collateral return output is produced at index |outputs.len()| if one is present. This function gets the produced output for an index if one exists. It behaves exactly as outputs_at for valid transactions, but for invalid transactions it returns None except for if the index points to the collateral-return output and one is present in the transaction, in which case it returns the collateral-return output.

source

pub fn requires(&self) -> Vec<MultiEraInput<'_>>

Returns the list of UTxO required by the Tx

Helper method to yield all of the UTxO that the Tx requires in order to be fulfilled. This includes normal inputs, reference inputs and collateral.

source

pub fn withdrawals(&self) -> MultiEraWithdrawals<'_>

source

pub fn fee(&self) -> Option<u64>

source

pub fn metadata(&self) -> MultiEraMeta<'_>

source

pub fn required_signers(&self) -> MultiEraSigners<'_>

source

pub fn is_valid(&self) -> bool

source

pub fn as_babbage(&self) -> Option<&MintedTx<'_>>

source

pub fn as_alonzo(&self) -> Option<&MintedTx<'_>>

source

pub fn as_byron(&self) -> Option<&MintedTxPayload<'_>>

source§

impl<'b> MultiEraTx<'b>

Trait Implementations§

source§

impl<'b> Clone for MultiEraTx<'b>

source§

fn clone(&self) -> MultiEraTx<'b>

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<'b> Debug for MultiEraTx<'b>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'b> RefUnwindSafe for MultiEraTx<'b>

§

impl<'b> Send for MultiEraTx<'b>

§

impl<'b> Sync for MultiEraTx<'b>

§

impl<'b> Unpin for MultiEraTx<'b>

§

impl<'b> UnwindSafe for MultiEraTx<'b>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.