pub struct Transaction {
    pub kind: TxKind,
    pub inputs: Vec<CoinID>,
    pub outputs: Vec<CoinData>,
    pub fee: CoinValue,
    pub covenants: Vec<Vec<u8>>,
    pub data: Vec<u8>,
    pub sigs: Vec<Vec<u8>>,
}
Expand description

Transaction represents an individual, serializable Themelio transaction.

Fields§

§kind: TxKind§inputs: Vec<CoinID>§outputs: Vec<CoinData>§fee: CoinValue§covenants: Vec<Vec<u8>>§data: Vec<u8>§sigs: Vec<Vec<u8>>

Implementations§

An empty transaction with kind Normal, no inputs, no fees, etc.

Creates a new transaction with the given kind, no inputs, no outputs, no nothing.

Replaces the kind of the transaction

Replaces the inputs of the transaction

Add an input

Replaces the outputs of the transaction

Add an output

Replaces the fee of the transaction

Replaces the scripts of the transaction

Add a script to the transaction

Replaces the scripts of the transaction

Replaces the scripts of the transaction

Checks whether or not the transaction is well formed, respecting coin size bounds and such. Does not fully validate the transaction.

hash_nosigs returns the hash of the transaction with a zeroed-out signature field. This is what signatures are computed against.

sign_ed25519 consumes the transaction, appends an ed25519 signature, and returns it.

total_outputs returns a HashMap mapping each type of coin to its total value. Fees will be included in the Mel cointype.

scripts_as_map returns a HashMap mapping the hash of each script in the transaction to the script itself.

Returns the minimum fee of the transaction at a given fee multiplier, with a given “ballast”.

Returns the weight of the transaction, given a function that maps a covenant to its weight.

Convenience function that constructs a CoinID that points to a certain output of this transaction. Panics if the index is out of bounds.

Trait Implementations§

Generate an arbitrary value of Self from the given unstructured data. Read more
Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts self into T using Into<T>. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
Should always be Self
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Attempts to convert self into T using TryInto<T>. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.