pub enum Transaction {
Deploy(Deploy),
V1(TransactionV1),
}
Expand description
A versioned wrapper for a transaction or deploy.
Variants§
Implementations§
Source§impl Transaction
impl Transaction
pub fn from_deploy(deploy: Deploy) -> Self
pub fn from_v1(v1: TransactionV1) -> Self
Sourcepub fn hash(&self) -> TransactionHash
pub fn hash(&self) -> TransactionHash
Returns the TransactionHash
identifying this transaction.
Sourcepub fn size_estimate(&self) -> usize
pub fn size_estimate(&self) -> usize
Size estimate.
Sourcepub fn verify(&self) -> Result<(), InvalidTransaction>
pub fn verify(&self) -> Result<(), InvalidTransaction>
Returns Ok
if the given transaction is valid. Verification procedure is delegated to the
implementation of the particular variant of the transaction.
Sourcepub fn sign(&mut self, secret_key: &SecretKey)
pub fn sign(&mut self, secret_key: &SecretKey)
Adds a signature of this transaction’s hash to its approvals.
Sourcepub fn compute_approvals_hash(&self) -> Result<ApprovalsHash, Error>
pub fn compute_approvals_hash(&self) -> Result<ApprovalsHash, Error>
Returns the computed approvals hash identifying this transaction’s approvals.
Sourcepub fn chain_name(&self) -> String
pub fn chain_name(&self) -> String
Returns the chain name for the transaction, whether it’s a Deploy
or V1
transaction.
Sourcepub fn is_standard_payment(&self) -> bool
pub fn is_standard_payment(&self) -> bool
Checks if the transaction is a standard payment.
For Deploy
transactions, it checks if the session is a standard payment
in the payment phase. For V1
transactions, it returns the value of
standard_payment
if the pricing mode is PaymentLimited
, otherwise it returns true
.
Sourcepub fn compute_id(&self) -> TransactionId
pub fn compute_id(&self) -> TransactionId
Returns the computed TransactionId
uniquely identifying this transaction and its
approvals.
Sourcepub fn initiator_addr(&self) -> InitiatorAddr
pub fn initiator_addr(&self) -> InitiatorAddr
Returns the address of the initiator of the transaction.
Sourcepub fn expired(&self, current_instant: Timestamp) -> bool
pub fn expired(&self, current_instant: Timestamp) -> bool
Returns true
if the transaction has expired.
Sourcepub fn expires(&self) -> Timestamp
pub fn expires(&self) -> Timestamp
Returns the timestamp of when the transaction expires, i.e. self.timestamp + self.ttl
.
Sourcepub fn signers(&self) -> BTreeSet<AccountHash>
pub fn signers(&self) -> BTreeSet<AccountHash>
Returns the set of account hashes corresponding to the public keys of the approvals.
Sourcepub fn as_transaction_v1(&self) -> Option<&TransactionV1>
pub fn as_transaction_v1(&self) -> Option<&TransactionV1>
Get TransactionV1
Authorization keys.
Sourcepub fn is_legacy_transaction(&self) -> bool
pub fn is_legacy_transaction(&self) -> bool
Is the transaction the legacy deploy variant.
Sourcepub fn gas_limit(
&self,
chainspec: &Chainspec,
lane_id: u8,
) -> Result<Gas, InvalidTransaction>
Available on crate features std
and testing
only.
pub fn gas_limit( &self, chainspec: &Chainspec, lane_id: u8, ) -> Result<Gas, InvalidTransaction>
std
and testing
only.Calcualates the gas limit for the transaction.
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl DataSize for Transaction
impl DataSize for Transaction
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl Debug for Transaction
impl Debug for Transaction
Source§impl<'de> Deserialize<'de> for Transaction
Available on crate feature std
only.
impl<'de> Deserialize<'de> for Transaction
std
only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for Transaction
impl Display for Transaction
Source§impl From<Deploy> for Transaction
impl From<Deploy> for Transaction
Source§impl From<TransactionV1> for Transaction
impl From<TransactionV1> for Transaction
Source§fn from(txn: TransactionV1) -> Self
fn from(txn: TransactionV1) -> Self
Source§impl FromBytes for Transaction
impl FromBytes for Transaction
Source§impl Hash for Transaction
impl Hash for Transaction
Source§impl JsonSchema for Transaction
impl JsonSchema for Transaction
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moreSource§impl Ord for Transaction
impl Ord for Transaction
Source§fn cmp(&self, other: &Transaction) -> Ordering
fn cmp(&self, other: &Transaction) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
Source§impl PartialOrd for Transaction
impl PartialOrd for Transaction
Source§impl Serialize for Transaction
Available on crate feature std
only.
impl Serialize for Transaction
std
only.Source§impl ToBytes for Transaction
impl ToBytes for Transaction
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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