pub struct Transaction {
pub version: u16,
pub inputs: Vec<TransactionInput>,
pub outputs: Vec<TransactionOutput>,
pub lock_time: u64,
pub subnetwork_id: SubnetworkId,
pub gas: u64,
pub payload: Vec<u8>,
/* private fields */
}Expand description
Represents a Kaspa transaction
Fields§
§version: u16§inputs: Vec<TransactionInput>§outputs: Vec<TransactionOutput>§lock_time: u64§subnetwork_id: SubnetworkId§gas: u64§payload: Vec<u8>Implementations§
Source§impl Transaction
impl Transaction
pub fn new( version: u16, inputs: Vec<TransactionInput>, outputs: Vec<TransactionOutput>, lock_time: u64, subnetwork_id: SubnetworkId, gas: u64, payload: Vec<u8>, ) -> Self
pub fn new_non_finalized( version: u16, inputs: Vec<TransactionInput>, outputs: Vec<TransactionOutput>, lock_time: u64, subnetwork_id: SubnetworkId, gas: u64, payload: Vec<u8>, ) -> Self
Source§impl Transaction
impl Transaction
Sourcepub fn is_coinbase(&self) -> bool
pub fn is_coinbase(&self) -> bool
Determines whether or not a transaction is a coinbase transaction. A coinbase transaction is a special transaction created by miners that distributes fees and block subsidy to the previous blocks’ miners, and specifies the script_pub_key that will be used to pay the current miner in future blocks.
Sourcepub fn id(&self) -> TransactionId
pub fn id(&self) -> TransactionId
Returns the transaction ID
Sourcepub fn set_mass(&self, mass: u64)
pub fn set_mass(&self, mass: u64)
Set the mass field of this transaction. The mass field is expected depending on hard-forks which are currently activated only on some testnets. The field has no effect on tx ID so no need to finalize following this call.
pub fn mass(&self) -> u64
pub fn with_mass(self, mass: u64) -> Self
Trait Implementations§
Source§impl<T: AsRef<Transaction>> AsRef<Transaction> for MutableTransaction<T>
impl<T: AsRef<Transaction>> AsRef<Transaction> for MutableTransaction<T>
Source§fn as_ref(&self) -> &Transaction
fn as_ref(&self) -> &Transaction
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<Transaction> for Transaction
impl AsRef<Transaction> for Transaction
Source§fn as_ref(&self) -> &Transaction
fn as_ref(&self) -> &Transaction
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl BorshDeserialize for Transaction
impl BorshDeserialize for Transaction
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Transaction
impl BorshSerialize for Transaction
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transaction
impl Debug for Transaction
Source§impl Default for Transaction
impl Default for Transaction
Source§fn default() -> Transaction
fn default() -> Transaction
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Transaction
impl<'de> Deserialize<'de> for Transaction
Source§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
Source§impl MemSizeEstimator for Transaction
impl MemSizeEstimator for Transaction
Source§fn estimate_mem_bytes(&self) -> usize
fn estimate_mem_bytes(&self) -> usize
Estimates the (deep) size of this object in bytes (including heap owned inner data)
Source§fn estimate_size(&self, mem_mode: MemMode) -> usize
fn estimate_size(&self, mem_mode: MemMode) -> usize
Estimates the size of this object depending on the passed mem mode
Source§fn estimate_mem_units(&self) -> usize
fn estimate_mem_units(&self) -> usize
Estimates the number of units this object holds in memory where the unit byte size is usually
a constant known to the caller as well (and hence we avoid computing it over and over)
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
Source§impl Serialize for Transaction
impl Serialize for Transaction
impl Eq for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations§
impl !Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more