Skip to main content

SignedTransaction

Struct SignedTransaction 

Source
pub struct SignedTransaction {
    pub inner: TxInner,
    pub signature: [u8; 64],
    pub public_key: [u8; 32],
}
Expand description

Signed transaction (transaction + signature) Supports both legacy transfers and V2 transactions (NFT operations)

Fields§

§inner: TxInner

The unsigned transaction (legacy or V2)

§signature: [u8; 64]

Ed25519 signature (64 bytes)

§public_key: [u8; 32]

Signer’s public key (for verification)

Implementations§

Source§

impl SignedTransaction

Source

pub fn new(tx: Transaction, signature: [u8; 64], public_key: [u8; 32]) -> Self

Create a new signed legacy transaction (backwards compatible)

Source

pub fn new_v2( tx: TransactionV2, signature: [u8; 64], public_key: [u8; 32], ) -> Self

Create a new signed V2 transaction (for NFT and extended operations)

Source

pub fn tx_type(&self) -> TxType

Get the transaction type

Source

pub fn is_nft(&self) -> bool

Check if this is an NFT transaction

Source

pub fn is_token(&self) -> bool

Check if this is a Token (SRC-20) transaction

Source

pub fn nft_data(&self) -> Option<&NftTxData>

Get NFT data if this is an NFT transaction

Source

pub fn token_data(&self) -> Option<&TokenTxData>

Get Token data if this is a Token transaction

Source

pub fn staking_data(&self) -> Option<&StakingTxData>

Get Staking data if this is a Staking transaction

Source

pub fn is_staking(&self) -> bool

Check if this is a Staking transaction

Source

pub fn messaging_data(&self) -> Option<&MessagingTxData>

Get Messaging data if this is a Messaging transaction

Source

pub fn is_messaging(&self) -> bool

Check if this is a Messaging transaction

Source

pub fn hash(&self) -> Hash

Compute the transaction hash (unique identifier)

Source

pub fn signing_hash(&self) -> Hash

Get the transaction signing hash

Source

pub fn to_bytes(&self) -> Vec<u8>

Serialize to bytes

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Deserialize from bytes

Source

pub fn to_hex(&self) -> String

Serialize to hex string

Source

pub fn from_hex(s: &str) -> Result<Self, String>

Deserialize from hex string

Source

pub fn sender(&self) -> Address

Get sender address

Source

pub fn chain_id(&self) -> ChainId

Get chain ID

Source

pub fn fee(&self) -> Balance

Get transaction fee

Source

pub fn nonce(&self) -> Nonce

Get transaction nonce

Source

pub fn amount(&self) -> Balance

Get transfer amount (0 for NFT transactions)

Source

pub fn recipient(&self) -> Option<Address>

Get recipient address (None for NFT transactions)

Source

pub fn signer_address(&self) -> Address

Get the expected address from the public key

Source

pub fn verify_signer(&self) -> bool

Verify that the signer matches the from address

Source

pub fn legacy_tx(&self) -> Option<&Transaction>

Get legacy transaction reference (for backwards compatibility) Returns None if this is a V2 NFT transaction

Source

pub fn inner(&self) -> &TxInner

Access the inner transaction data Use tx_type() to determine which variant is active

Source§

impl SignedTransaction

Source

pub fn tx(&self) -> &Transaction

👎Deprecated:

Use sender(), fee(), nonce() etc. or inner() instead

Get legacy transaction (DEPRECATED: use sender(), fee(), nonce() etc. or inner() instead) Panics if this is a V2 NFT transaction

Trait Implementations§

Source§

impl Clone for SignedTransaction

Source§

fn clone(&self) -> SignedTransaction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SignedTransaction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SignedTransaction

Source§

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 PartialEq for SignedTransaction

Source§

fn eq(&self, other: &SignedTransaction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SignedTransaction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for SignedTransaction

Source§

impl StructuralPartialEq for SignedTransaction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,