Struct algonaut_transaction::transaction::Transaction
source · [−]pub struct Transaction {
pub fee: MicroAlgos,
pub first_valid: Round,
pub genesis_hash: HashDigest,
pub last_valid: Round,
pub txn_type: TransactionType,
pub genesis_id: Option<String>,
pub group: Option<HashDigest>,
pub lease: Option<HashDigest>,
pub note: Option<Vec<u8>>,
pub rekey_to: Option<Address>,
}
Expand description
A transaction that can appear in a block
Fields
fee: MicroAlgos
Paid by the sender to the FeeSink to prevent denial-of-service. The minimum fee on Algorand is currently 1000 microAlgos.
first_valid: Round
The first round for when the transaction is valid. If the transaction is sent prior to this round it will be rejected by the network.
genesis_hash: HashDigest
The hash of the genesis block of the network for which the transaction is valid. See the genesis hash for MainNet, TestNet, and BetaNet.
last_valid: Round
The ending round for which the transaction is valid. After this round, the transaction will be rejected by the network.
txn_type: TransactionType
Specifies the type of transaction. This value is automatically generated using any of the developer tools.
genesis_id: Option<String>
The human-readable string that identifies the network for the transaction. The genesis ID is found in the genesis block. See the genesis ID for MainNet, TestNet, and BetaNet.
group: Option<HashDigest>
The group specifies that the transaction is part of a group and, if so, specifies the hash of the transaction group. Assign a group ID to a transaction through the workflow described in the Atomic Transfers Guide.
lease: Option<HashDigest>
A lease enforces mutual exclusion of transactions. If this field is nonzero, then once the transaction is confirmed, it acquires the lease identified by the (Sender, Lease) pair of the transaction until the LastValid round passes. While this transaction possesses the lease, no other transaction specifying this lease can be confirmed. A lease is often used in the context of Algorand Smart Contracts to prevent replay attacks. Read more about Algorand Smart Contracts and see the Delegate Key Registration TEAL template for an example implementation of leases. Leases can also be used to safeguard against unintended duplicate spends. For example, if I send a transaction to the network and later realize my fee was too low, I could send another transaction with a higher fee, but the same lease value. This would ensure that only one of those transactions ends up getting confirmed during the validity period.
note: Option<Vec<u8>>
Any data up to 1000 bytes.
rekey_to: Option<Address>
Specifies the authorized address. This address will be used to authorize all future transactions. Learn more about Rekeying accounts.
Implementations
sourceimpl Transaction
impl Transaction
pub fn bytes_to_sign(&self) -> Result<Vec<u8>, TransactionError>
pub fn raw_id(&self) -> Result<HashDigest, TransactionError>
pub fn id(&self) -> Result<String, TransactionError>
pub fn assign_group_id(&mut self, group_id: HashDigest)
sourcepub fn estimate_basic_sig_size(&self) -> Result<u64, TransactionError>
pub fn estimate_basic_sig_size(&self) -> Result<u64, TransactionError>
Estimates the size of the encoded transaction, used in calculating the fee.
pub fn estimate_basic_sig_fee(
&self,
fee_per_byte: MicroAlgos,
min_fee: MicroAlgos
) -> Result<MicroAlgos, TransactionError>
pub fn estimate_basic_sig_fee_with_params(
&self,
params: &SuggestedTransactionParams
) -> Result<MicroAlgos, TransactionError>
Trait Implementations
sourceimpl Clone for Transaction
impl Clone for Transaction
sourcefn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for Transaction
impl Debug for Transaction
sourceimpl<'de> Deserialize<'de> for Transaction
impl<'de> Deserialize<'de> for Transaction
Convenience to deserialize Transaction directly from msg pack
sourcefn 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>,
sourceimpl From<Transaction> for ApiTransaction
impl From<Transaction> for ApiTransaction
sourcefn from(t: Transaction) -> Self
fn from(t: Transaction) -> Self
sourceimpl PartialEq<Transaction> for Transaction
impl PartialEq<Transaction> for Transaction
sourcefn eq(&self, other: &Transaction) -> bool
fn eq(&self, other: &Transaction) -> bool
sourceimpl Serialize for Transaction
impl Serialize for Transaction
Convenience to serialize Transaction directly to msg pack
sourceimpl ToMsgPack for Transaction
impl ToMsgPack for Transaction
sourceimpl TryFrom<ApiTransaction> for Transaction
impl TryFrom<ApiTransaction> for Transaction
type Error = TransactionError
type Error = TransactionError
sourcefn try_from(api_t: ApiTransaction) -> Result<Self, Self::Error>
fn try_from(api_t: ApiTransaction) -> Result<Self, Self::Error>
impl Eq for Transaction
impl StructuralEq for Transaction
impl StructuralPartialEq for Transaction
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.