Struct themelio_structs::Transaction
source · [−]pub struct Transaction {
pub kind: TxKind,
pub inputs: Vec<CoinID>,
pub outputs: Vec<CoinData>,
pub fee: CoinValue,
pub scripts: Vec<Vec<u8>>,
pub data: Vec<u8>,
pub sigs: Vec<Vec<u8>>,
}Expand description
Transaction represents an individual, serializable Themelio transaction.
Fields
kind: TxKindinputs: Vec<CoinID>outputs: Vec<CoinData>fee: CoinValuescripts: 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 inputs of the transaction
Replaces the outputs of the transaction
Add an output
Replaces the scripts of the transaction
Add a script to 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
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations
Mutably borrows from an owned value. Read more
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.
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