pub struct TransactionV2 {
pub chain_id: ChainId,
pub from: Address,
pub fee: Balance,
pub nonce: Nonce,
pub payload: TxPayload,
}Expand description
Extended transaction with payload type
Fields§
§chain_id: ChainIdChain ID to prevent replay across networks
from: AddressSender address
fee: BalanceTransaction fee paid to validator
nonce: NonceSender’s nonce (must match account nonce)
payload: TxPayloadTransaction payload
Implementations§
Source§impl TransactionV2
impl TransactionV2
Sourcepub fn transfer(
chain_id: ChainId,
from: Address,
to: Address,
amount: Balance,
fee: Balance,
nonce: Nonce,
) -> Self
pub fn transfer( chain_id: ChainId, from: Address, to: Address, amount: Balance, fee: Balance, nonce: Nonce, ) -> Self
Create a new transfer transaction
Sourcepub fn nft(
chain_id: ChainId,
from: Address,
fee: Balance,
nonce: Nonce,
nft_data: NftTxData,
) -> Self
pub fn nft( chain_id: ChainId, from: Address, fee: Balance, nonce: Nonce, nft_data: NftTxData, ) -> Self
Create a new NFT transaction
Sourcepub fn token(
chain_id: ChainId,
from: Address,
fee: Balance,
nonce: Nonce,
token_data: TokenTxData,
) -> Self
pub fn token( chain_id: ChainId, from: Address, fee: Balance, nonce: Nonce, token_data: TokenTxData, ) -> Self
Create a new Token (SRC-20) transaction
Sourcepub fn contract_deploy(
chain_id: ChainId,
from: Address,
fee: Balance,
nonce: Nonce,
deploy_data: ContractDeployData,
) -> Self
pub fn contract_deploy( chain_id: ChainId, from: Address, fee: Balance, nonce: Nonce, deploy_data: ContractDeployData, ) -> Self
Create a new contract deployment transaction
Sourcepub fn contract_call(
chain_id: ChainId,
from: Address,
fee: Balance,
nonce: Nonce,
call_data: ContractCallData,
) -> Self
pub fn contract_call( chain_id: ChainId, from: Address, fee: Balance, nonce: Nonce, call_data: ContractCallData, ) -> Self
Create a new contract call transaction
Sourcepub fn staking(
chain_id: ChainId,
from: Address,
fee: Balance,
nonce: Nonce,
staking_data: StakingTxData,
) -> Self
pub fn staking( chain_id: ChainId, from: Address, fee: Balance, nonce: Nonce, staking_data: StakingTxData, ) -> Self
Create a new staking transaction
Sourcepub fn messaging(
chain_id: ChainId,
from: Address,
fee: Balance,
nonce: Nonce,
messaging_data: MessagingTxData,
) -> Self
pub fn messaging( chain_id: ChainId, from: Address, fee: Balance, nonce: Nonce, messaging_data: MessagingTxData, ) -> Self
Create a new messaging transaction
Sourcepub fn signing_hash(&self) -> Hash
pub fn signing_hash(&self) -> Hash
Compute the signing hash
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>
Deserialize from bytes
Sourcepub fn recipient(&self) -> Option<Address>
pub fn recipient(&self) -> Option<Address>
Get recipient address (for transfers) or contract address (for calls)
Sourcepub fn amount(&self) -> Balance
pub fn amount(&self) -> Balance
Get transfer amount (for transfers) or value (for contract calls)
Sourcepub fn to_legacy(&self) -> Option<Transaction>
pub fn to_legacy(&self) -> Option<Transaction>
Convert to legacy Transaction format (only for transfers)
Sourcepub fn deploy_data(&self) -> Option<&ContractDeployData>
pub fn deploy_data(&self) -> Option<&ContractDeployData>
Get contract deploy data if this is a deploy transaction
Sourcepub fn call_data(&self) -> Option<&ContractCallData>
pub fn call_data(&self) -> Option<&ContractCallData>
Get contract call data if this is a call transaction
Sourcepub fn is_contract(&self) -> bool
pub fn is_contract(&self) -> bool
Check if this is a contract transaction
Sourcepub fn token_data(&self) -> Option<&TokenTxData>
pub fn token_data(&self) -> Option<&TokenTxData>
Get token data if this is a Token transaction
Sourcepub fn staking_data(&self) -> Option<&StakingTxData>
pub fn staking_data(&self) -> Option<&StakingTxData>
Get staking data if this is a Staking transaction
Sourcepub fn is_staking(&self) -> bool
pub fn is_staking(&self) -> bool
Check if this is a staking transaction
Sourcepub fn messaging_data(&self) -> Option<&MessagingTxData>
pub fn messaging_data(&self) -> Option<&MessagingTxData>
Get messaging data if this is a Messaging transaction
Sourcepub fn is_messaging(&self) -> bool
pub fn is_messaging(&self) -> bool
Check if this is a messaging transaction
Sourcepub fn docclass_data(&self) -> Option<&DocClassTxData>
pub fn docclass_data(&self) -> Option<&DocClassTxData>
Get docclass data if this is a DocClass transaction
Sourcepub fn is_docclass(&self) -> bool
pub fn is_docclass(&self) -> bool
Check if this is a docclass transaction
Trait Implementations§
Source§impl Clone for TransactionV2
impl Clone for TransactionV2
Source§fn clone(&self) -> TransactionV2
fn clone(&self) -> TransactionV2
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransactionV2
impl Debug for TransactionV2
Source§impl<'de> Deserialize<'de> for TransactionV2
impl<'de> Deserialize<'de> for TransactionV2
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>,
Source§impl PartialEq for TransactionV2
impl PartialEq for TransactionV2
Source§fn eq(&self, other: &TransactionV2) -> bool
fn eq(&self, other: &TransactionV2) -> bool
self and other values to be equal, and is used by ==.