TransactionCommonFields

Trait TransactionCommonFields 

Source
pub trait TransactionCommonFields {
Show 13 methods // Provided methods fn get_account(&self) -> Result<AccountID> { ... } fn get_transaction_type(&self) -> Result<TransactionType> { ... } fn get_computation_allowance(&self) -> Result<u32> { ... } fn get_fee(&self) -> Result<Amount> { ... } fn get_sequence(&self) -> Result<u32> { ... } fn get_account_txn_id(&self) -> Result<Option<Hash256>> { ... } fn get_flags(&self) -> Result<Option<u32>> { ... } fn get_last_ledger_sequence(&self) -> Result<Option<u32>> { ... } fn get_network_id(&self) -> Result<Option<u32>> { ... } fn get_source_tag(&self) -> Result<Option<u32>> { ... } fn get_signing_pub_key(&self) -> Result<PublicKey> { ... } fn get_ticket_sequence(&self) -> Result<Option<u32>> { ... } fn get_txn_signature(&self) -> Result<Blob> { ... }
}
Expand description

Trait providing access to common fields present in all XRPL transactions.

§Implementation Requirements

Types implementing this trait should ensure they are used only in the context of a valid XRPL transaction. The trait methods assume the current transaction context is properly established by the XRPL Programmability environment.

Provided Methods§

Source

fn get_account(&self) -> Result<AccountID>

Retrieves the account field from the current transaction.

This field identifies (Required) The unique address of the account that initiated the transaction.

§Returns

Returns a Result<AccountID> where:

  • Ok(AccountID) - The 20-byte account identifier of the transaction sender
  • Err(Error) - If the field cannot be retrieved or has an unexpected size
Source

fn get_transaction_type(&self) -> Result<TransactionType>

Retrieves the transaction type from the current transaction.

This field specifies the type of transaction. Valid transaction types include: Payment, OfferCreate, TrustSet, and many others.

§Returns

Returns a Result<TransactionType> where:

  • Ok(TransactionType) - An enumerated value representing the transaction type
  • Err(Error) - If the field cannot be retrieved or has an unexpected size
Source

fn get_computation_allowance(&self) -> Result<u32>

Retrieves the computation allowance from the current transaction.

This field specifies the maximum computational resources that the transaction is allowed to consume during execution in the XRPL Programmability environment. It helps prevent runaway computations and ensures network stability.

§Returns

Returns a Result<u32> where:

  • Ok(u32) - The computation allowance value in platform-defined units
  • Err(Error) - If the field cannot be retrieved or has an unexpected size
Source

fn get_fee(&self) -> Result<Amount>

Retrieves the fee amount from the current transaction.

This field specifies the amount of XRP (in drops) that the sender is willing to pay as a transaction fee. The fee is consumed regardless of whether the transaction succeeds or fails, and higher fees can improve transaction priority during network congestion.

§Returns

Returns a Result<Amount> where:

  • Ok(Amount) - The fee amount as an XRP amount in drops
  • Err(Error) - If the field cannot be retrieved or has an unexpected size
§Note

Returns XRP amounts only (for now). Future versions may support other token types when the underlying amount handling is enhanced.

Source

fn get_sequence(&self) -> Result<u32>

Retrieves the sequence number from the current transaction.

This field represents the sequence number of the account sending the transaction. A transaction is only valid if the Sequence number is exactly 1 greater than the previous transaction from the same account. The special case 0 means the transaction is using a Ticket instead (Added by the TicketBatch amendment).

§Returns

Returns a Result<u32> where:

  • Ok(u32) - The transaction sequence number
  • Err(Error) - If the field cannot be retrieved or has an unexpected size
§Note

If the transaction uses tickets instead of sequence numbers, this field may not be present. In such cases, use get_ticket_sequence() instead.

Source

fn get_account_txn_id(&self) -> Result<Option<Hash256>>

Retrieves the account transaction ID from the current transaction.

This optional field contains the hash value identifying another transaction. If provided, this transaction is only valid if the sending account’s previously sent transaction matches the provided hash.

§Returns

Returns a Result<Option<Hash256>> where:

  • Ok(Some(Hash256)) - The hash of the required previous transaction
  • Ok(None) - If no previous transaction requirement is specified
  • Err(Error) - If an error occurred during field retrieval
Source

fn get_flags(&self) -> Result<Option<u32>>

Retrieves the flags field from the current transaction.

This optional field contains a bitfield of transaction-specific flags that modify the transaction’s behavior.

§Returns

Returns a Result<Option<u32>> where:

  • Ok(Some(u32)) - The flags bitfield if present
  • Ok(None) - If no flags are specified (equivalent to flags = 0)
  • Err(Error) - If an error occurred during field retrieval
Source

fn get_last_ledger_sequence(&self) -> Result<Option<u32>>

Retrieves the last ledger sequence from the current transaction.

This optional field specifies the highest ledger index this transaction can appear in. Specifying this field places a strict upper limit on how long the transaction can wait to be validated or rejected. See Reliable Transaction Submission for more details.

§Returns

Returns a Result<Option<u32>> where:

  • Ok(Some(u32)) - The maximum ledger index for transaction inclusion
  • Ok(None) - If no expiration is specified (transaction never expires)
  • Err(Error) - If an error occurred during field retrieval
Source

fn get_network_id(&self) -> Result<Option<u32>>

Retrieves the network ID from the current transaction.

This optional field identifies the network ID of the chain this transaction is intended for. MUST BE OMITTED for Mainnet and some test networks. REQUIRED on chains whose network ID is 1025 or higher.

§Returns

Returns a Result<Option<u32>> where:

  • Ok(Some(u32)) - The network identifier
  • Ok(None) - If no specific network is specified (uses default network)
  • Err(Error) - If an error occurred during field retrieval
Source

fn get_source_tag(&self) -> Result<Option<u32>>

Retrieves the source tag from the current transaction.

This optional field is an arbitrary integer used to identify the reason for this payment, or a sender on whose behalf this transaction is made. Conventionally, a refund should specify the initial payment’s SourceTag as the refund payment’s DestinationTag.

§Returns

Returns a Result<Option<u32>> where:

  • Ok(Some(u32)) - The source tag identifier
  • Ok(None) - If no source tag is specified
  • Err(Error) - If an error occurred during field retrieval
Source

fn get_signing_pub_key(&self) -> Result<PublicKey>

Retrieves the signing public key from the current transaction.

This field contains the hex representation of the public key that corresponds to the private key used to sign this transaction. If an empty string, this field indicates that a multi-signature is present in the Signers field instead.

§Returns

Returns a Result<PublicKey> where:

  • Ok(PublicKey) - The 33-byte compressed public key used for signing
  • Err(Error) - If the field cannot be retrieved or has an unexpected size
§Security Note

The presence of this field doesn’t guarantee the signature is valid. Instead, this field only provides the key claimed to be used for signing. The XRPL network performs signature validation before transaction execution.

Source

fn get_ticket_sequence(&self) -> Result<Option<u32>>

Retrieves the ticket sequence from the current transaction.

This optional field provides the sequence number of the ticket to use in place of a Sequence number. If this is provided, Sequence must be 0. Cannot be used with AccountTxnID.

§Returns

Returns a Result<Option<u32>> where:

  • Ok(Some(u32)) - The ticket sequence number if the transaction uses tickets
  • Ok(None) - If the transaction uses traditional sequence numbering
  • Err(Error) - If an error occurred during field retrieval
§Note

Transactions use either Sequence or TicketSequence, but not both. Check this field when get_sequence() fails or when implementing ticket-aware logic.

Source

fn get_txn_signature(&self) -> Result<Blob>

Retrieves the transaction signature from the current transaction.

This mandatory field contains the signature that verifies this transaction as originating from the account it says it is from.

§Returns

Returns a Result<Blob> where:

  • Ok(Blob) - The transaction signature as variable-length binary data
  • Err(Error) - If the field cannot be retrieved
§Security Note

The signature is validated by the XRPL network before transaction execution. In the programmability context, you can access the signature for logging or analysis purposes, but signature validation has already been performed.

Implementors§

Source§

impl TransactionCommonFields for EscrowFinish

Implementation of common transaction fields for EscrowFinish transactions.

This implementation provides access to standard XRPL transaction fields that are present in all transaction types, such as Account, Fee, Sequence, and others. The methods are provided by the TransactionCommonFields trait.