Struct SignedTransaction
pub struct SignedTransaction<T>where
T: TransactionType,{
pub transaction: Transaction<T>,
/* private fields */
}Expand description
A transaction that has been signed by its sender.
This structure wraps a transaction with its cryptographic signature, providing proof that the transaction was authorized by the sender.
Fields§
§transaction: Transaction<T>The transaction that has been signed
Implementations§
§impl<T> SignedTransaction<T>where
T: TransactionType,
impl<T> SignedTransaction<T>where
T: TransactionType,
pub fn new(
transaction: Transaction<T>,
signature: Signature,
) -> Result<SignedTransaction<T>, TransactionValidationError>
pub fn new( transaction: Transaction<T>, signature: Signature, ) -> Result<SignedTransaction<T>, TransactionValidationError>
Creates a new signed transaction and validates it.
This constructor ensures that the signature is valid for the transaction before creating the signed transaction instance.
§Parameters
transaction- transaction to be signedsignature- cryptographic signature for the transaction
§Errors
Returns a TransactionValidationError if:
- The signature cannot be verified; or
- The transaction itself is invalid.
pub fn tx_id(&self) -> HashDigest
pub fn tx_id(&self) -> HashDigest
Returns a unique identifier for this transaction.
pub fn validate_signed_tx(&self) -> Result<(), TransactionValidationError>
pub fn validate_signed_tx(&self) -> Result<(), TransactionValidationError>
Validates both the signature and the transaction.
This method performs a complete validation by:
- First verifying that the signature matches the transaction and signer; then
- Validating the transaction itself according to its type-specific rules
§Errors
Returns a TransactionValidationError if:
- The signature verification fails
- The transaction type-specific validation fails
Trait Implementations§
§impl<T> Clone for SignedTransaction<T>where
T: Clone + TransactionType,
impl<T> Clone for SignedTransaction<T>where
T: Clone + TransactionType,
§fn clone(&self) -> SignedTransaction<T>
fn clone(&self) -> SignedTransaction<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl<T> Debug for SignedTransaction<T>where
T: Debug + TransactionType,
impl<T> Debug for SignedTransaction<T>where
T: Debug + TransactionType,
§impl<'de, T> Deserialize<'de> for SignedTransaction<T>where
T: TransactionType + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for SignedTransaction<T>where
T: TransactionType + Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SignedTransaction<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SignedTransaction<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<T> FromIterator<SignedTransaction<T>> for TransactionBundle<T>where
T: TransactionType,
impl<T> FromIterator<SignedTransaction<T>> for TransactionBundle<T>where
T: TransactionType,
§fn from_iter<I>(iter: I) -> TransactionBundle<T>where
I: IntoIterator<Item = SignedTransaction<T>>,
fn from_iter<I>(iter: I) -> TransactionBundle<T>where
I: IntoIterator<Item = SignedTransaction<T>>,
Creates a value from an iterator. Read more
§impl<T> PartialEq for SignedTransaction<T>where
T: PartialEq + TransactionType,
impl<T> PartialEq for SignedTransaction<T>where
T: PartialEq + TransactionType,
§impl<T> Serialize for SignedTransaction<T>where
T: TransactionType + Serialize,
impl<T> Serialize for SignedTransaction<T>where
T: TransactionType + Serialize,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl<T> TryFrom<SignedTransaction> for SignedTransaction<T>where
T: TransactionType + TryFrom<Transaction, Error = ProtoError>,
impl<T> TryFrom<SignedTransaction> for SignedTransaction<T>where
T: TransactionType + TryFrom<Transaction, Error = ProtoError>,
§fn try_from(
wire_tx: SignedTransaction,
) -> Result<SignedTransaction<T>, <SignedTransaction<T> as TryFrom<SignedTransaction>>::Error>
fn try_from( wire_tx: SignedTransaction, ) -> Result<SignedTransaction<T>, <SignedTransaction<T> as TryFrom<SignedTransaction>>::Error>
Performs the conversion.
§impl<T> TryHash256 for SignedTransaction<T>where
T: TransactionType,
impl<T> TryHash256 for SignedTransaction<T>where
T: TransactionType,
§fn try_hash_sha256(&self) -> Result<HashDigest, SerializationError>
fn try_hash_sha256(&self) -> Result<HashDigest, SerializationError>
Try to hash the type
impl<T> Eq for SignedTransaction<T>where
T: Eq + TransactionType,
impl<T> StructuralPartialEq for SignedTransaction<T>where
T: TransactionType,
Auto Trait Implementations§
impl<T> Freeze for SignedTransaction<T>where
T: Freeze,
impl<T> RefUnwindSafe for SignedTransaction<T>where
T: RefUnwindSafe,
impl<T> Send for SignedTransaction<T>where
T: Send,
impl<T> Sync for SignedTransaction<T>where
T: Sync,
impl<T> Unpin for SignedTransaction<T>where
T: Unpin,
impl<T> UnwindSafe for SignedTransaction<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request