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§
Sourcefn get_account(&self) -> Result<AccountID>
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 senderErr(Error)- If the field cannot be retrieved or has an unexpected size
Sourcefn get_transaction_type(&self) -> Result<TransactionType>
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 typeErr(Error)- If the field cannot be retrieved or has an unexpected size
Sourcefn get_computation_allowance(&self) -> Result<u32>
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 unitsErr(Error)- If the field cannot be retrieved or has an unexpected size
Sourcefn get_fee(&self) -> Result<Amount>
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 dropsErr(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.
Sourcefn get_sequence(&self) -> Result<u32>
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 numberErr(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.
Sourcefn get_account_txn_id(&self) -> Result<Option<Hash256>>
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 transactionOk(None)- If no previous transaction requirement is specifiedErr(Error)- If an error occurred during field retrieval
Sourcefn get_flags(&self) -> Result<Option<u32>>
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 presentOk(None)- If no flags are specified (equivalent to flags = 0)Err(Error)- If an error occurred during field retrieval
Sourcefn get_last_ledger_sequence(&self) -> Result<Option<u32>>
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 inclusionOk(None)- If no expiration is specified (transaction never expires)Err(Error)- If an error occurred during field retrieval
Sourcefn get_network_id(&self) -> Result<Option<u32>>
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 identifierOk(None)- If no specific network is specified (uses default network)Err(Error)- If an error occurred during field retrieval
Sourcefn get_source_tag(&self) -> Result<Option<u32>>
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 identifierOk(None)- If no source tag is specifiedErr(Error)- If an error occurred during field retrieval
Sourcefn get_signing_pub_key(&self) -> Result<PublicKey>
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 signingErr(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.
Sourcefn get_ticket_sequence(&self) -> Result<Option<u32>>
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 ticketsOk(None)- If the transaction uses traditional sequence numberingErr(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.
Sourcefn get_txn_signature(&self) -> Result<Blob>
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 dataErr(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§
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.